Merge branch 'v9' into 1.8.9

This commit is contained in:
Ben Spiers committed 2016-02-20 22:19:34 +00:00
commit b08bca67d4
42 files changed
+302 -212

No files matched your search

@@ -36,8 +36,6 @@ public class ItemJetpack extends ItemArmor implements IGasItem, ISpecialArmor
{
super(EnumHelper.addArmorMaterial("JETPACK", "jetpack", 0, new int[] {0, 0, 0, 0}, 0), 0, 1);
setCreativeTab(Mekanism.tabMekanism);
setMaxDamage(100);
setNoRepair();
}
/*
@@ -45,6 +43,18 @@ public class ItemJetpack extends ItemArmor implements IGasItem, ISpecialArmor
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister register) {}
*/
@Override
public boolean showDurabilityBar(ItemStack stack)
{
return true;
}
@Override
public double getDurabilityForDisplay(ItemStack stack)
{
return 1D-((getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack));
}
@Override
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
@@ -164,17 +174,7 @@ public class ItemJetpack extends ItemArmor implements IGasItem, ISpecialArmor
return null;
}
GasStack stored = GasStack.readFromNBT(itemstack.getTagCompound().getCompoundTag("stored"));
if(stored == null)
{
itemstack.setItemDamage(100);
}
else {
itemstack.setItemDamage((int)Math.max(1, (Math.abs((((float)stored.amount/getMaxGas(itemstack))*100)-100))));
}
return stored;
return GasStack.readFromNBT(itemstack.stackTagCompound.getCompoundTag("stored"));
}
@Override
@@ -213,14 +213,12 @@ public class ItemJetpack extends ItemArmor implements IGasItem, ISpecialArmor
if(stack == null || stack.amount == 0)
{
itemstack.setItemDamage(100);
itemstack.getTagCompound().removeTag("stored");
}
else {
int amount = Math.max(0, Math.min(stack.amount, getMaxGas(itemstack)));
GasStack gasStack = new GasStack(stack.getGas(), amount);
itemstack.setItemDamage((int)Math.max(1, (Math.abs((((float)amount/getMaxGas(itemstack))*100)-100))));
itemstack.getTagCompound().setTag("stored", gasStack.write(new NBTTagCompound()));
}
}