This commit is contained in:
oitsjustjose 2016-06-01 07:00:49 -05:00
commit c2379d7df0
2 changed files with 6 additions and 4 deletions

View file

@ -1,3 +1,5 @@
1.0.1:
-Fixed: Auto-Repair Working on Multiple Tools Simultaneously
1.0:
Initial Release:
-Added: Auto-Repair Modifier

View file

@ -48,13 +48,14 @@ public class ModAutoRepair extends Modifier
EntityPlayer player = event.entityPlayer;
ArrayList<ItemStack> tinkersTools = new ArrayList<ItemStack>();
int autoRepairLevel = 0;
int autoRepairLevel;
for (ItemStack iterStack : player.inventory.mainInventory)
if (iterStack != null && iterStack.getItem() instanceof ToolCore)
tinkersTools.add(iterStack);
for (ItemStack iterStack : tinkersTools)
{
autoRepairLevel = 0;
NBTTagCompound tag = TagUtil.getToolTag(iterStack.getTagCompound());
NBTTagList tagList = TagUtil.getModifiersTagList(iterStack);
for (int i = 0; i < tagList.tagCount(); i++)
@ -68,10 +69,9 @@ public class ModAutoRepair extends Modifier
}
}
}
long lastRepairTime = tag.getLong(Lib.TAG_AUTO_REPAIR_COOLDOWN);
// Calculates that the last repair time stored minus the current time is less than or equal to 30 seconds divided by auto-repair level
if ((System.currentTimeMillis() - lastRepairTime) >= (getRepairCooldown(player)) && autoRepairLevel > 0)
if (autoRepairLevel > 0 && (System.currentTimeMillis() - lastRepairTime) >= (getRepairCooldown(player)))
{
ToolHelper.healTool(iterStack, autoRepairLevel, event.entityPlayer);
tag.setLong(Lib.TAG_AUTO_REPAIR_COOLDOWN, System.currentTimeMillis());