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,9 +43,12 @@ 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){
if(item.isDead || !ItemStack.areItemStacksEqual(item.getEntityItem(), oldItem)){
this.extractEnergy(stack, energyForItem, false); this.extractEnergy(stack, energyForItem, false);
} }
} }
@ -55,6 +58,7 @@ public class ItemMagnetRing extends ItemEnergy{
} }
} }
} }
}
@Override @Override