Exemple #1
0
  public OCSettings(GuiExternalConnection gui, IConduit con) {
    super(IconEIO.WRENCH_OVERLAY_OC, EnderIO.lang.localize("itemOCConduit.name"), gui, con);
    occon = (IOCConduit) con;

    int x = 0;
    int y = customTop;

    x += gap + gap + 2 + gui.getFontRenderer().getStringWidth(signalColorStr);
    cb = new ColorButton(gui, ID_COLOR_BUTTON, x, y);
    cb.setToolTipHeading(EnderIO.lang.localize("gui.conduit.redstone.signalColor"));
    DyeColor sigCol = occon.getSignalColor(gui.getDir());
    cb.setColorIndex(sigCol.ordinal());
    x += cb.getButtonWidth();
  }
Exemple #2
0
 @Override
 public void actionPerformed(GuiButton guiButton) {
   super.actionPerformed(guiButton);
   if (guiButton.id == ID_COLOR_BUTTON && cb != null) {
     occon.setSignalColor(gui.getDir(), DyeColor.values()[cb.getColorIndex()]);
     PacketHandler.INSTANCE.sendToServer(new PacketOCConduitSignalColor(occon, gui.getDir()));
   }
 }
Exemple #3
0
  @Override
  @SideOnly(Side.CLIENT)
  public void addInformation(
      ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
    if (par1ItemStack != null) {
      String mobName = getMobTypeFromStack(par1ItemStack);
      if (mobName != null) {
        par3List.add(EntityUtil.getDisplayNameForEntity(mobName));
      } else {
        par3List.add(EnderIO.lang.localize("item.itemSoulVessel.tooltip.empty"));
      }

      float health = getHealthFromStack(par1ItemStack);
      if (health >= 0) {
        float maxHealth = getMaxHealthFromStack(par1ItemStack);
        String msg = EnderIO.lang.localize("item.itemSoulVessel.tooltip.health");
        if (maxHealth >= 0) {
          par3List.add(String.format("%s %3.1f/%3.1f", msg, health, maxHealth));
        } else {
          par3List.add(String.format("%s %3.1f", msg, health));
        }
      }

      String fluidName = getFluidNameFromStack(par1ItemStack);
      if (fluidName != null) {
        Fluid fluid = FluidRegistry.getFluid(fluidName);
        if (fluid != null) {
          par3List.add(
              EnderIO.lang.localize("item.itemSoulVessel.tooltip.fluidname")
                  + " "
                  + fluid.getLocalizedName());
        }
      }

      DyeColor color = getColorFromStack(par1ItemStack);
      if (color != null) {
        par3List.add(
            EnderIO.lang.localize("item.itemSoulVessel.tooltip.color")
                + " "
                + color.getLocalisedName());
      }
    }
  }
Exemple #4
0
 private DyeColor getColorFromStack(ItemStack item) {
   if (!containsSoul(item)) {
     return null;
   }
   if (!item.stackTagCompound.hasKey("Color")) {
     return null;
   }
   int colorIdx = item.stackTagCompound.getInteger("Color");
   if (colorIdx < 0 || colorIdx > 15) {
     return null;
   }
   return DyeColor.values()[15 - colorIdx];
 }