Posted December 28, 201410 yr I'm trying to make my code check, if EntityItemPickupEvent item equals to dirt for example. My code : public class ItemPickupHandler { @SubscribeEvent public void itemPickup(EntityItemPickupEvent event) { if (event.entity instanceof EntityPlayer){ if (event.item == /*What now?*/){ LogHelper.info("stuff happens"); } } } } It does fire without the IF for special block/On any pickup. Thanks in advance TheCreepySheep
December 28, 201410 yr Add an if statemant with: !event.item.worldObj.isRemote And change your line to: if (event.item.getEntityItem().getItem() == Item.getItemFromBlock(Blocks.dirt)){ If you want to check if its an item use Items.ITEM for Blocks use Item.getItemFromBlock(Blocks.BLOCK)
December 28, 201410 yr Author Add an if statemant with: !event.item.worldObj.isRemote And change your line to: if (event.item.getEntityItem().getItem() == Item.getItemFromBlock(Blocks.dirt)){ If you want to check if its an item use Items.ITEM for Blocks use Item.getItemFromBlock(Blocks.BLOCK) Thank you good sir! It does exactly what I want.
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.