@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)); } }
@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 short getCharge(ItemStack stack) { return NBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY); }