Skip to content

Commit

Permalink
Prevent hotbar-energy-sucking for unchargeable (potato) batteries
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Aug 8, 2014
1 parent 02de829 commit 3a377b6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/tconstruct/library/tools/AbilityHelper.java
Expand Up @@ -453,6 +453,12 @@ protected static void chargeEnergyFromHotbar (ItemStack stack, EntityPlayer play
return;

ToolCore tool = (ToolCore)stack.getItem();

// check if the tool can actually receive energy
if(tool.receiveEnergy(stack, 1, true) != 1)
// no you're not going to charge that potato battery on your tool
return;

int buffer = tool.getEnergyStored(stack);
int max = tool.getMaxEnergyStored(stack);
int missing = max - buffer;
Expand Down

0 comments on commit 3a377b6

Please sign in to comment.