Fix the magnet ring using energy when not picking anything up

Closes #589
This commit is contained in:
Ellpeck 2017-01-30 18:44:29 +01:00
parent 2d4c7db2aa
commit 1b27148792

View file

@ -52,9 +52,12 @@ public class ItemMagnetRing extends ItemEnergy{
int energyForItem = 50*StackUtil.getStackSize(item.getEntityItem()); int energyForItem = 50*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.extractEnergyInternal(stack, energyForItem, false); this.extractEnergyInternal(stack, energyForItem, false);
} }
} }
@ -64,6 +67,7 @@ public class ItemMagnetRing extends ItemEnergy{
} }
} }
} }
}
@Override @Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer player, EnumHand hand){ public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer player, EnumHand hand){