Ejemplo n.º 1
0
  @Override
  public int getEnergyStored(ItemStack container) {

    if (container.stackTagCompound == null) {
      EnergyHelper.setDefaultEnergyTag(container, 0);
    }
    return container.stackTagCompound.getInteger("Energy");
  }
Ejemplo n.º 2
0
  @Override
  public int getDisplayDamage(ItemStack stack) {

    if (stack.stackTagCompound == null) {
      EnergyHelper.setDefaultEnergyTag(stack, 0);
    }
    return 1 + maxEnergy - stack.stackTagCompound.getInteger("Energy");
  }
Ejemplo n.º 3
0
  public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
    if (container.stackTagCompound == null) {
      EnergyHelper.setDefaultEnergyTag(container, 0);
    }
    int stored = container.stackTagCompound.getInteger("Energy");
    int receive = Math.min(maxReceive, Math.min(10000000 - stored, 100000));

    if (!simulate) {
      stored += receive;
      container.stackTagCompound.setInteger("Energy", stored);
    }
    return receive;
  }
Ejemplo n.º 4
0
  public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
    if (container.stackTagCompound == null) {
      EnergyHelper.setDefaultEnergyTag(container, 0);
    }
    int stored = container.stackTagCompound.getInteger("Energy");
    int extract = Math.min(maxExtract, stored);

    if (!simulate) {
      stored -= extract;
      container.stackTagCompound.setInteger("Energy", stored);
    }
    return extract;
  }
Ejemplo n.º 5
0
  @Override
  public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean check) {

    if (StringHelper.displayShiftForDetail && !StringHelper.isShiftKeyDown()) {
      list.add(StringHelper.shiftForDetails());
    }
    if (!StringHelper.isShiftKeyDown()) {
      return;
    }
    if (stack.stackTagCompound == null) {
      EnergyHelper.setDefaultEnergyTag(stack, 0);
    }
    list.add(
        StringHelper.localize("info.cofh.charge")
            + ": "
            + stack.stackTagCompound.getInteger("Energy")
            + " / "
            + maxEnergy
            + " RF");

    list.add(
        StringHelper.ORANGE
            + getEnergyPerUse(stack)
            + " "
            + StringHelper.localize("info.redstonearsenal.tool.energyPerUse")
            + StringHelper.END);
    if (isEmpowered(stack)) {
      list.add(
          StringHelper.YELLOW
              + StringHelper.ITALIC
              + StringHelper.localize("info.cofh.press")
              + " "
              + Keyboard.getKeyName(KeyBindingEmpower.instance.getKey())
              + " "
              + StringHelper.localize("info.redstonearsenal.tool.chargeOff")
              + StringHelper.END);
    } else {
      list.add(
          StringHelper.BRIGHT_BLUE
              + StringHelper.ITALIC
              + StringHelper.localize("info.cofh.press")
              + " "
              + Keyboard.getKeyName(KeyBindingEmpower.instance.getKey())
              + " "
              + StringHelper.localize("info.redstonearsenal.tool.chargeOn")
              + StringHelper.END);
    }
  }
Ejemplo n.º 6
0
  @Override
  public void getSubItems(Item item, CreativeTabs tab, List list) {

    list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
    list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), maxEnergy));
  }