Пример #1
0
 @Override
 public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean inUse) {
   if (stack.getItem() == this) {
     stack.stackSize = 0;
     if (entity instanceof EntityPlayer) {
       ((EntityPlayer) entity).inventory.setInventorySlotContents(slot, null);
       ((EntityPlayer) entity).inventoryContainer.detectAndSendChanges();
     }
   }
 }
 @Override
 public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean b) {
   // TODO maybe blow up engine if player is on fire?
   if (!world.isRemote) {
     // Remove creative module from non-creative mode player's
     if (entity instanceof EntityPlayer && !((EntityPlayer) entity).capabilities.isCreativeMode) {
       if (stack.getItemDamage() == Engines.CREATIVE_ENGINE.ordinal()) {
         ((EntityPlayer) entity).inventory.setInventorySlotContents(slot, null);
         ((EntityPlayer) entity).inventoryContainer.detectAndSendChanges();
       }
     }
   }
 }