@Override public void decreaseCharge(ItemStack stack) { if (NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) > 0) { NBTHelper.setShort( stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY, (short) (NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) - 1)); } }
@Override public void increaseCharge(ItemStack stack) { if (NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) < maxChargeLevel) { NBTHelper.setShort( stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY, (short) (NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) + 1)); } }
public void onGuiClosed() { super.onGuiClosed(); if (this.mc.thePlayer != null) { for (ItemStack itemStack : this.mc.thePlayer.inventory.mainInventory) { if (itemStack != null) { if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANS_GUI_OPEN)) { NBTHelper.removeTag(itemStack, Strings.NBT_ITEM_TRANS_GUI_OPEN); } } } } }
@Override public void setCharge(ItemStack stack, short charge) { if (charge <= maxChargeLevel) { NBTHelper.setShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY, charge); } }
@Override public void openPortableCrafting(EntityPlayer thePlayer, ItemStack itemStack) { NBTHelper.setBoolean(itemStack, Strings.NBT_ITEM_TRANS_GUI_OPEN, true); thePlayer.openGui( EquivalentExchange3.instance, GuiIds.PORTABLE_CRAFTING, thePlayer.worldObj, (int) thePlayer.posX, (int) thePlayer.posY, (int) thePlayer.posZ); }
@Override public short getCharge(ItemStack stack) { return NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY); }