Posted December 13, 201212 yr Hey guys, I'm having a problem with for(int x = firstCorner[0]; x <= secondCorner[0]; x++){ for(int y = firstCorner[1]; y <= secondCorner[1]; y++) { for(int z = firstCorner[2]; z <= secondCorner[2]; z++) { //world.setBlock(x, y, z, blockID); //world.setBlockWithNotify(x, y, z, blockID); //world.setBlockAndMetadataWithNotify(x, y, z, blockID, 0); world.setBlock(x, y, z, blockID) } } } It works just fine, but when ever the block gets updated like from water or placing a block above it, the block disappears. It's just the same with the other methods which are commented out. Does anyone have a idea where the problem is? Sorry for my bad english...
December 14, 201212 yr you might want to make sure that this code is being run on the server side, because if it is running on the client side it will be a client only block, which is probably why it is disappearing when it gets updated
December 14, 201212 yr Author Thanks for the answer! But actually I have no clue how to do it. I have an item where I get two corners and then I wanna call the method above where i get the worldObj from EntityPlayer. Do I need an Entity or PacketHandling to send it to the server or what? Sorry for my bad english...
December 14, 201212 yr You could either use packets, or in some cases you could make the calling code run server side when possible, but that is not always possible
December 15, 201212 yr Thanks for the answer! But actually I have no clue how to do it. I have an item where I get two corners and then I wanna call the method above where i get the worldObj from EntityPlayer. Do I need an Entity or PacketHandling to send it to the server or what? First rule of minecraft multiplayer modding: When in doubt, add an if(!world.isRemote) [And if you don't know what that means, I suggest you find the isRemote field in World.class]. Most methods in Block.class and Item.class get called both clientside and serverside, so packets shouldn't be necessary depending on how you arrived at the posted code, but beware of Item.class's onItemUseFirst method -- when it returns true clientside, it never gets called serverside. I know how badly that tripped me up. I also suggest you read the Forge Wiki's page on SMP coding guidelines -- its helpful, if somewhat terse.
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.