mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-13 17:04:24 +00:00
Flux modified tools now charge properly with the charge rate if CoFHCore is present. WITHOUT breaking blockbreak process. This also fixes moss-repair resetting.
This commit is contained in:
1 parent
78167ba7ac
commit
edf30d3a5c
3 files changed
+49
-7
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package tconstruct.library.tools;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import java.util.*;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -406,23 +407,24 @@ public class AbilityHelper
|
||||
trueSpeed *= 6;
|
||||
if (energy != -1)
|
||||
{
|
||||
ToolCore tool = (ToolCore) stack.getItem();
|
||||
// first try charging from the hotbar
|
||||
if (entity instanceof EntityPlayer)
|
||||
int usage = (int)(trueSpeed * 3.3f);
|
||||
// first try charging from the hotbar if we don't have CoFHs override
|
||||
if (equalityOverrideLoaded && entity instanceof EntityPlayer)
|
||||
{
|
||||
ToolCore tool = (ToolCore) stack.getItem();
|
||||
// workaround for charging flux-capacitors making tools unusable
|
||||
chargeEnergyFromHotbar(stack, (EntityPlayer) entity, tags);
|
||||
energy = tool.getEnergyStored(stack);
|
||||
}
|
||||
|
||||
if (energy < trueSpeed * 2)
|
||||
if (energy < usage)
|
||||
{
|
||||
if (energy > 0)
|
||||
tags.setInteger("Energy", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
energy -= trueSpeed * 2;
|
||||
energy -= usage*50;
|
||||
tags.setInteger("Energy", energy);
|
||||
|
||||
//stack.setItemDamage(1 + (tool.getMaxEnergyStored(stack) - energy) * (stack.getMaxDamage() - 1) / tool.getMaxEnergyStored(stack));
|
||||
@@ -475,6 +477,8 @@ public class AbilityHelper
|
||||
tags.setInteger("Energy", max - missing);
|
||||
}
|
||||
|
||||
private static boolean equalityOverrideLoaded = Loader.isModLoaded("CoFHCore"); // Mods should be loaded far enough before this is ever initialized
|
||||
|
||||
public static void breakTool (ItemStack stack, NBTTagCompound tags, Entity entity)
|
||||
{
|
||||
tags.getCompoundTag("InfiTool").setBoolean("Broken", true);
|
||||
|
||||
Reference in new issue
Block a user