Fix nanosaber

This commit is contained in:
modmuss50 2016-06-05 20:37:22 +01:00
parent 895319ed67
commit d84bffce46
2 changed files with 6 additions and 3 deletions

View file

@ -273,7 +273,7 @@ public class ModItems
wrench = new ItemWrench();
registerItem(wrench, "wrench");
nanosaber = new ItemNanosaber();
nanosaber = PoweredItem.createItem(ItemNanosaber.class);
registerItem(nanosaber, "nanosaber");
scrapBox = new ItemScrapBox();

View file

@ -97,7 +97,6 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo
ItemStack inactiveUncharged = new ItemStack(ModItems.nanosaber);
inactiveUncharged.setTagCompound(new NBTTagCompound());
inactiveUncharged.getTagCompound().setBoolean("isActive", false);
PoweredItem.setEnergy(0, inactiveUncharged);
ItemStack inactiveCharged = new ItemStack(ModItems.nanosaber);
inactiveCharged.setTagCompound(new NBTTagCompound());
@ -107,7 +106,6 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo
ItemStack activeUncharged = new ItemStack(ModItems.nanosaber);
activeUncharged.setTagCompound(new NBTTagCompound());
activeUncharged.getTagCompound().setBoolean("isActive", true);
PoweredItem.setEnergy(0, activeUncharged);
ItemStack activeCharged = new ItemStack(ModItems.nanosaber);
activeCharged.setTagCompound(new NBTTagCompound());
@ -169,9 +167,14 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo
@Override public double getDurabilityForDisplay(ItemStack stack)
{
if (PoweredItem.getEnergy(stack) > getMaxPower(stack))
{
return 0;
}
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge;
}
@Override public boolean isRepairable()