made the magnet ring not use energy when not picking something up

This commit is contained in:
Ellpeck 2017-03-10 23:07:59 +01:00
parent 723da24eb7
commit 770e02c65a

View file

@ -43,10 +43,14 @@ public class ItemMagnetRing extends ItemEnergy{
int energyForItem = 350*StackUtil.getStackSize(item.getEntityItem()); int energyForItem = 350*StackUtil.getStackSize(item.getEntityItem());
if(this.getEnergyStored(stack) >= energyForItem){ if(this.getEnergyStored(stack) >= energyForItem){
ItemStack oldItem = StackUtil.validateCopy(item.getEntityItem());
item.onCollideWithPlayer(player); item.onCollideWithPlayer(player);
if(!player.capabilities.isCreativeMode){ if(!player.capabilities.isCreativeMode){
this.extractEnergy(stack, energyForItem, false); if(item.isDead || !ItemStack.areItemStacksEqual(item.getEntityItem(), oldItem)){
this.extractEnergy(stack, energyForItem, false);
}
} }
} }
} }