Posted November 28, 201410 yr when I use setBlock the block appears then disappears. this is my code ... public boolean onCast(EntityPlayer player, int x, int y, int z) { y += 1; World world = player.worldObj; if (world.getBlock(x, y, z) == Blocks.water) { world.setBlock(x, y, z, Blocks.ice); return true; } return false; } the x, y, z is the block the player right clicks.
November 28, 201410 yr Author it Is called in the "onItemUse()" method of a item. p.s. I am new to minecraft modding.
November 28, 201410 yr Author like this? @Override public boolean onCast(EntityPlayer player, int x, int y, int z) { y += 1; World world = player.worldObj; if (!world.isRemote) { if (world.getBlock(x, y, z) == Blocks.water) { world.setBlock(x, y, z, Blocks.ice); } return true; } return false; }
November 28, 201410 yr Author I have tried it as if (!world.isRemote) and if (world.isRemote) and it still will not work.
November 28, 201410 yr Author I got it to work by add "!world.isremote" tests to where "onCast()" is called.
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.