Posted April 5, 20169 yr This problem may be found in many released mods. The function world.setBlock is called by updateEntity function of a TileEntity. I have tried the three set of codes below: world.setBlock(x,y,z,Blocks.packed_ice); world.setBlock(x,y,z,Blocks.packed_ice,0,2); world.setBlock(x,y,z,Blocks.packed_ice,0,3); However, sometimes world.setBlock is not successful. When it is not successful, only the texture of the block changes, but the block is not changed; the player can right click the block to change the texture back. I also have tried repeating setting block until the block is indeed changed, but it does not solve the problem. What is the real solution on earth?
April 5, 20169 yr Sounds like you are setting the block on the client side - only ever call setBlock on the server side, i.e. when the world is not remote. if (!worldObj.isRemote) { // logical server - okay to set block worldObj.setBlock(...); } http://i.imgur.com/NdrFdld.png[/img]
April 30, 20169 yr Author Sounds like you are setting the block on the client side - only ever call setBlock on the server side, i.e. when the world is not remote. if (!worldObj.isRemote) { // logical server - okay to set block worldObj.setBlock(...); } I have tested the case setting a single block; it works fine. However, the case swapping two blocks failed; neither blocks are changed. zbt=zb[i]; zmt=zm[i]; if(!world.isRemote){ world.setBlock(zx[i],zy[i],zz[i],zb[j],zm[j],2); world.setBlock(zx[j],zy[j],zz[j],zbt,zmt,2); } Is it solvable?
April 30, 20169 yr Your block of code doesn't show how you determine what each of those variables' values are, so I can't say for sure, but if neither block changed, then chances are the coordinates are not what you think they are - possibly you just got them backwards, i.e. setting each block to itself. http://i.imgur.com/NdrFdld.png[/img]
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.