Okay. That actually was the problem. It works now.
One more question. Do I update/set the block state with regular
world.setBlockState(pos, world.getBlockState(pos).withProperty(VALUE, Integer.valueOf(4)), 2);
Or do I do it somehow different? because this is happening (values should be the same as Val in the console)
Image
Hello again!
I've been messing around with block properties.
I wanted to create a block with multiple properties so I've created a TileEntity for that block.
Code \/
Everything compiles and runs ok, Even placing the block works, but whenever I F3 or destroy the block it crashes by throwing and IllegalArgumentException that It cannot set property.
What am I doing wrong here? I am new with tile entities so I am probably making some mistakes
Hello forum members!
I am creating an event that triggers when you right click on a donkey.
The code works for every mob but horses, mules and donkeys because you "feed" them by right clicking.
How do I cancel that?
Code
@SubscribeEvent
public void itemEvent(PlayerInteractEvent.RightClickItem event) {
if(event.getEntityPlayer() != null) {
if(event.getEntityPlayer().getActiveItemStack() != null) {
try {
EntityPlayer player = event.getEntityPlayer();
World world = event.getEntity().world;
Entity entity = Minecraft.getMinecraft().objectMouseOver.entityHit;
ItemStack itemstack = player.getHeldItem(event.getHand());
Item item = itemstack.getItem();
if (item == Items.STICK && entity instanceof EntityDonkey) {
System.out.println("works")
}
}
catch(NullPointerException | IllegalArgumentException ex) {
System.out.println("Exception: "+ex.getMessage());
}
}
}
}