/**
   * Adds the contents of the cell to the description tooltip.
   *
   * @param cellHandler
   * @param displayList
   * @param player
   */
  private void addContentsToCellDescription(
      final HandlerItemEssentiaCell cellHandler,
      final List displayList,
      final EntityPlayer player) {
    // Get the list of stored aspects
    List<IAspectStack> cellAspects = cellHandler.getStoredEssentia();

    // Sort the list
    Collections.sort(cellAspects, new AspectStackComparator());

    for (IAspectStack currentStack : cellAspects) {
      if (currentStack != null) {
        // Get the chat color
        String aspectChatColor = currentStack.getChatColor();

        // Does this aspect have color?
        if (aspectChatColor == null) {
          // It does not, set to white
          aspectChatColor = EnumChatFormatting.WHITE.toString();
        }

        // Build the display string
        String aspectInfo =
            String.format(
                "%s%s%s x %d",
                aspectChatColor,
                currentStack.getAspectName(player),
                EnumChatFormatting.WHITE.toString(),
                currentStack.getStackSize());

        // Add to the list
        displayList.add(aspectInfo);
      }
    }
  }
  /** Creates the cell tooltip. */
  @Override
  public void addInformation(
      final ItemStack essentiaCell,
      final EntityPlayer player,
      final List displayList,
      final boolean advancedItemTooltips) {
    // Get the contents of the cell
    IMEInventoryHandler<IAEFluidStack> handler =
        AEApi.instance()
            .registries()
            .cell()
            .getCellInventory(essentiaCell, null, StorageChannel.FLUIDS);

    // Ensure we have a cell inventory handler
    if (!(handler instanceof HandlerItemEssentiaCell)) {
      return;
    }

    // Cast to cell inventory handler
    HandlerItemEssentiaCell cellHandler = (HandlerItemEssentiaCell) handler;

    // Create the bytes tooltip
    String bytesTip =
        String.format(
            ThEStrings.Tooltip_CellBytes.getLocalized(),
            cellHandler.getUsedBytes(),
            cellHandler.getTotalBytes());

    // Create the types tooltip
    String typesTip =
        String.format(
            ThEStrings.Tooltip_CellTypes.getLocalized(),
            cellHandler.getUsedTypes(),
            cellHandler.getTotalTypes());

    // Add the tooltips
    displayList.add(bytesTip);
    displayList.add(typesTip);

    // Is the cell pre-formated?
    if (cellHandler.isPartitioned()) {
      displayList.add(GuiText.Partitioned.getLocal());
    }

    // Does the cell have anything stored?
    if (cellHandler.getUsedTypes() > 0) {
      // Is shift being held?
      if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))) {
        // Add information about the essentia types in the cell
        this.addContentsToCellDescription(cellHandler, displayList, player);
      } else {
        // Let the user know they can hold shift
        displayList.add(
            EnumChatFormatting.WHITE.toString()
                + EnumChatFormatting.ITALIC.toString()
                + ThEStrings.Tooltip_ItemStackDetails.getLocalized());
      }
    }
  }
Ejemplo n.º 3
0
  /** Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks */
  @Override
  public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    super.drawScreen(mouseX, mouseY, partialTicks);
    boolean var4 = mc.thePlayer.capabilities.isCreativeMode;
    int var5 = field_147075_G.func_178147_e();

    for (int var6 = 0; var6 < 3; ++var6) {
      int var7 = field_147075_G.enchantLevels[var6];
      int var8 = field_147075_G.field_178151_h[var6];
      int var9 = var6 + 1;

      if (func_146978_c(60, 14 + 19 * var6, 108, 17, mouseX, mouseY) && var7 > 0 && var8 >= 0) {
        ArrayList<Object> var10 = Lists.newArrayList();
        String var11;
        if (var8 >= 0 && Enchantment.enchantmentsList[var8 & 255] != null) {
          var11 = Enchantment.enchantmentsList[var8 & 255].getTranslatedName((var8 & 65280) >> 8);
          var10.add(
              EnumChatFormatting.WHITE.toString()
                  + EnumChatFormatting.ITALIC.toString()
                  + I18n.format("container.enchant.clue", new Object[] {var11}));
        }

        if (!var4) {
          if (var8 >= 0) var10.add("");

          if (mc.thePlayer.experienceLevel < var7)
            var10.add(
                EnumChatFormatting.RED.toString()
                    + "Level Requirement: "
                    + field_147075_G.enchantLevels[var6]);
          else {
            var11 = "";

            if (var9 == 1) var11 = I18n.format("container.enchant.lapis.one", new Object[0]);
            else
              var11 =
                  I18n.format("container.enchant.lapis.many", new Object[] {Integer.valueOf(var9)});

            if (var5 >= var9) var10.add(EnumChatFormatting.GRAY.toString() + "" + var11);
            else var10.add(EnumChatFormatting.RED.toString() + "" + var11);

            if (var9 == 1) var11 = I18n.format("container.enchant.level.one", new Object[0]);
            else
              var11 =
                  I18n.format("container.enchant.level.many", new Object[] {Integer.valueOf(var9)});

            var10.add(EnumChatFormatting.GRAY.toString() + "" + var11);
          }
        }

        drawHoveringText(var10, mouseX, mouseY, fontRendererObj);
        break;
      }
    }
  }
Ejemplo n.º 4
0
 @SuppressWarnings({"unchecked", "rawtypes"})
 @Override
 public void addInformation(ItemStack items, EntityPlayer player, List l, boolean moreInfo) {
   if (items == null) return;
   try {
     if (items.stackTagCompound == null) {
       initializeNBT(items);
     }
     if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
       ((BlockContainerAdvanced) field_150939_a)
           .getNBTInfo(items.stackTagCompound, (ArrayList<String>) l, items.getItemDamage());
     } else {
       l.add(
           EnumChatFormatting.WHITE.toString()
               + EnumChatFormatting.ITALIC
               + StatCollector.translateToLocal("info.techno:shift"));
     }
   } catch (Exception e) {
     Conf.ex(e);
   }
 }