I fixed my problem, old code...
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
System.out.println("test");
return itemStack;
}
new code...
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
if (!world.isRemote) {
System.out.println("test");
// more code here
}
return itemStack;
}
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;
}
the name says it all, and some code ...
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
System.out.println("test");
return itemStack;
}
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.