From cb584b6e9309251d80ab11fc617ead8a1d23b910 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 16 Jul 2015 17:42:19 +0200 Subject: [PATCH] Fixed Drill Charging with Items before --- .../java/ellpeck/actuallyadditions/items/ItemDrill.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java index 95b5ed155..8732ecdc9 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java @@ -76,9 +76,6 @@ public class ItemDrill extends ItemEnergy implements INameableItem{ } public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){ - NBTTagCompound compound = stack.getTagCompound(); - if(compound == null) return; - ItemStack[] slots = this.getSlotsFromNBT(stack); if(slots != null && slots.length > 0){ for(ItemStack slotStack : slots){ @@ -86,8 +83,10 @@ public class ItemDrill extends ItemEnergy implements INameableItem{ if(this.getEnergyStored(stack) < this.getMaxEnergyStored(stack)){ int energy = ((IEnergyContainerItem)slotStack.getItem()).getEnergyStored(slotStack); if(energy > 0){ - int received = ((IEnergyContainerItem)stack.getItem()).receiveEnergy(stack, energy, false); - ((IEnergyContainerItem)slotStack.getItem()).extractEnergy(slotStack, received, false); + int toReceive = ((IEnergyContainerItem)stack.getItem()).receiveEnergy(stack, energy, true); + int actualReceive = ((IEnergyContainerItem)slotStack.getItem()).extractEnergy(slotStack, toReceive, false); + ((IEnergyContainerItem)stack.getItem()).receiveEnergy(stack, actualReceive, false); + } } }