ColdFox Posted June 8, 2013 Share Posted June 8, 2013 There's anyways to control what happens to a block when is placed by the player in a custom dimension without, of course, having to change the Block.java file? Quote Link to comment Share on other sites More sharing options...
Moritz Posted June 8, 2013 Share Posted June 8, 2013 Your own blocks or vannila blocks? If your own blocks detect at the placing part the dimension id and when the id is not the overworldID (0) then you can tell that the block sets to 0 (equals as not there) Quote Link to comment Share on other sites More sharing options...
ColdFox Posted June 8, 2013 Author Share Posted June 8, 2013 Your own blocks or vannila blocks? If your own blocks detect at the placing part the dimension id and when the id is not the overworldID (0) then you can tell that the block sets to 0 (equals as not there) All blocks. If it was with my blocks it would be easy Quote Link to comment Share on other sites More sharing options...
Moritz Posted June 8, 2013 Share Posted June 8, 2013 I never had think about that^^" Hmmm thats hard. But i got an idea. Why dont you make an block which is in your dimemsion and search for all blocks from top to the bottom after special blockids. like this: public class TileEntityYourBlock extends TileEntity { public void updateEntity() { for(int i = 0; i<=255; i++) { if(!getValidBlockID(i)) { world.setBlockWithNotify(xCoord, i, zCoord, 0); } } } public boolean getValidBlockID(int i) { int blockId = worldObj.getBlockID(xCoord, i, zCoord); if(blockId = Block.planks.blockID) { return true; } return false; } } So what this code does it checks (in a tileEntity) the world from the bottom to the hight. And if there is a not valid BlockID then he set the blockID to 0. That the way i would do it when i have my own dimension^^ i hope that is what you want. Quote Link to comment Share on other sites More sharing options...
ColdFox Posted June 8, 2013 Author Share Posted June 8, 2013 I never had think about that^^" Hmmm thats hard. But i got an idea. Why dont you make an block which is in your dimemsion and search for all blocks from top to the bottom after special blockids. like this: public class TileEntityYourBlock extends TileEntity { public void updateEntity() { for(int i = 0; i<=255; i++) { if(!getValidBlockID(i)) { world.setBlockWithNotify(xCoord, i, zCoord, 0); } } } public boolean getValidBlockID(int i) { int blockId = worldObj.getBlockID(xCoord, i, zCoord); if(blockId = Block.planks.blockID) { return true; } return false; } } So what this code does it checks (in a tileEntity) the world from the bottom to the hight. And if there is a not valid BlockID then he set the blockID to 0. That the way i would do it when i have my own dimension^^ i hope that is what you want. That's sounds like a solution but I don't think that's the best one. But thanks anyway, I'm gonna try that out. Btw,aren't those xCoord and zCoord always the same? That way it would only check the blocks above and below. And do a layer of only the blocks with this tile entity would be kinda stupid Quote Link to comment Share on other sites More sharing options...
CJCutrone9 Posted June 8, 2013 Share Posted June 8, 2013 The aether team did it, I would use the same method used for the end/nether, maybe have the item blown up when it is clicked on, or maybe have it so that when the player tries to place down the block, that the games checks the block ID and if it is a vanilla block, then they can't place it (I think that is what you are saying, right?) Quote Link to comment Share on other sites More sharing options...
endershadow Posted June 8, 2013 Share Posted June 8, 2013 you could always use a block placed event (if it exists) and if it's the wrong block and the wrong dimension, then you can cancel it. Quote Link to comment Share on other sites More sharing options...
ColdFox Posted June 8, 2013 Author Share Posted June 8, 2013 The aether team did it, I would use the same method used for the end/nether, maybe have the item blown up when it is clicked on, or maybe have it so that when the player tries to place down the block, that the games checks the block ID and if it is a vanilla block, then they can't place it (I think that is what you are saying, right?) To do that I think that I've to change the Block.java Quote Link to comment Share on other sites More sharing options...
ColdFox Posted June 8, 2013 Author Share Posted June 8, 2013 you could always use a block placed event (if it exists) and if it's the wrong block and the wrong dimension, then you can cancel it. there's is one but only for the interaction with a block, I don't think that it works for the placement Quote Link to comment Share on other sites More sharing options...
Moritz Posted June 8, 2013 Share Posted June 8, 2013 I never had think about that^^" Hmmm thats hard. But i got an idea. Why dont you make an block which is in your dimemsion and search for all blocks from top to the bottom after special blockids. like this: public class TileEntityYourBlock extends TileEntity { public void updateEntity() { for(int i = 0; i<=255; i++) { if(!getValidBlockID(i)) { world.setBlockWithNotify(xCoord, i, zCoord, 0); } } } public boolean getValidBlockID(int i) { int blockId = worldObj.getBlockID(xCoord, i, zCoord); if(blockId = Block.planks.blockID) { return true; } return false; } } So what this code does it checks (in a tileEntity) the world from the bottom to the hight. And if there is a not valid BlockID then he set the blockID to 0. That the way i would do it when i have my own dimension^^ i hope that is what you want. That's sounds like a solution but I don't think that's the best one. But thanks anyway, I'm gonna try that out. Btw,aren't those xCoord and zCoord always the same? That way it would only check the blocks above and below. And do a layer of only the blocks with this tile entity would be kinda stupid Why x and z coord are the same because badrock is the lowest Level and every block on the bottom are badrock^^ With that you can make a check it easy^^. The other ways are good to but what is when a player find a way to jump over the place function? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.