/** Draw the foreground layer for the GuiContainer (everything in front of the items) */
  protected void drawGuiContainerForegroundLayer(int par1, int par2) {

    this.fontRenderer.drawString(
        StatCollector.translateToLocal("container.crafting"), 28, 6, 4210752);
    this.fontRenderer.drawString(
        StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
  }
Exemplo n.º 2
0
  public boolean checkLaunchValidity() {
    this.statusMessageCooldown = 40;

    if (this.hasValidFuel()) {
      if (this.launchPhase == EnumLaunchPhase.UNIGNITED.ordinal() && !this.worldObj.isRemote) {
        if (!this.setFrequency()) {
          this.destinationFrequency = -1;
          this.statusMessage =
              StatCollector.translateToLocal("gui.message.frequency.name")
                  + "#"
                  + StatCollector.translateToLocal("gui.message.not_set.name");
          this.statusColour = "\u00a7c";
          return false;
        } else {
          this.statusMessage = StatCollector.translateToLocal("gui.message.success.name");
          this.statusColour = "\u00a7a";
          return true;
        }
      }
    } else {
      this.destinationFrequency = -1;
      this.statusMessage =
          StatCollector.translateToLocal("gui.message.not_enough.name")
              + "#"
              + StatCollector.translateToLocal("gui.message.fuel.name");
      this.statusColour = "\u00a7c";
      return false;
    }

    this.destinationFrequency = -1;
    return false;
  }
Exemplo n.º 3
0
  @Override
  public String getItemStackDisplayName(ItemStack stack) {
    int type = stack.getItemDamage();
    ItemData data = new ItemData(stack);
    String s = StatCollector.translateToLocal("cc.item.needle.name");

    if (type == 0) {
      if (data.isDirty()) {
        s = StatCollector.translateToLocal("cc.dirty") + " " + s;
      } else {
        s = StatCollector.translateToLocal("cc.empty") + " " + s;
      }
    } else if (type == 1) {
      if (data.id != -1) {
        return data.getCurrentEntityNameTrans() + " " + StatCollector.translateToLocal("cc.blood");
      }
    } else if (type == 2) {
      if (data.id != -1) {
        return data.getCurrentEntityNameTrans() + " " + StatCollector.translateToLocal("cc.dna");
      }
    } else if (type == 3) {
      return "Human Stem Cells";
    }
    return s;
  }
Exemplo n.º 4
0
  @Override
  public void render(boolean isTranslatable) {
    if (text != null) {
      if (isTranslatable) text = StatCollector.translateToLocal(text);
      drawCenteredString("\u00a7n" + text, 4);
      // manual.fonts.drawString("\u00a7n" + text, localWidth + 70, localHeight + 4, 0);
    }

    ItemStack ingred;
    if (icons[2] != null
        && icons[2].getItemDamage() == OreDictionary.WILDCARD_VALUE
        && icons[2].getItem() instanceof ArmorCore) {
      ArrayList<Integer> materials =
          new ArrayList<Integer>(TConstructRegistry.toolMaterials.keySet());
      int mat = materials.get(curTime() % materials.size());
      ingred = ((ArmorCore) icons[2].getItem()).createDefaultStack(mat);
    } else ingred = icons[2];

    startRenderingItem();

    renderStack(icons[0], 138, 110, 2);
    renderStack(icons[1], 70, 74, 2);
    renderStack(ingred, 70, 110, 2);

    stopRenderingItem();

    String ingr = StatCollector.translateToLocal("manual.page.casting1");
    if (isTranslatable) ingr = StatCollector.translateToLocal(ingr);
    int y = 32;
    y += drawTextBlock(ingr + ":", 110, y);
    y += drawTextBlock("- " + icons[1].getDisplayName(), 110, y);
    if (ingred != null) drawTextBlock("- " + ingred.getDisplayName(), 110, y);
  }
Exemplo n.º 5
0
  @Override
  public void setPersonality(Personality newPersonality) {
    // Check if there is an existing one
    if (this.getPersonality() != null) {
      Personality oldPersonality = this.getPersonality();
      String stat = "";
      // Loop through the new personalities
      for (Map.Entry<String, MoodVariable> entry : newPersonality.moodVariables.entrySet()) {
        int newValue = entry.getValue().getCurrentValue();
        int oldValue = oldPersonality.getMoodVariableValue(entry.getKey());
        // If greater, show that's increased
        if (newValue > oldValue) {
          stat +=
              EnumChatFormatting.DARK_GREEN
                  + StatCollector.translateToLocal("mood.variable." + entry.getKey() + ".name")
                  + "+;";
        }
        // If less, show that's decreased
        else if (newValue < oldValue) {
          stat +=
              EnumChatFormatting.DARK_RED
                  + StatCollector.translateToLocal("mood.variable." + entry.getKey() + ".name")
                  + "-;";
        }
      }
      // If any stats have changed, show them
      if (!stat.isEmpty()) {
        this.statMessage = stat;
        this.statMessageTime = 0;
      }
    }

    this.personality = newPersonality;
  }
 public static void checkInventory(EntityPlayer player, int dim, int fromDim) {
   ArrayList<String> disabledItems = new ArrayList<String>();
   ArrayList<String> enabledItems = new ArrayList<String>();
   for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
     ItemStack stack = player.inventory.getStackInSlot(i);
     if (stack == null || stack.getItem() == null) continue;
     boolean disabled = DisabledHandler.isDisabledStack(stack, dim);
     boolean wasDisabled =
         fromDim > Integer.MIN_VALUE && DisabledHandler.isDisabledStack(stack, fromDim);
     if (disabled != wasDisabled) {
       String name = stack.getDisplayName();
       if (disabled && !disabledItems.contains(name)) disabledItems.add(name);
       else if (!disabled && !enabledItems.contains(name)) enabledItems.add(name);
     }
   }
   try {
     if (disabledItems.size() > 0)
       player.addChatComponentMessage(
           new ChatComponentText(
               StatCollector.translateToLocal(Names.disabled)
                   + ": "
                   + StackUtils.getConcatString(disabledItems)));
     if (enabledItems.size() > 0)
       player.addChatComponentMessage(
           new ChatComponentText(
               StatCollector.translateToLocal(Names.enabled)
                   + ": "
                   + StackUtils.getConcatString(enabledItems)));
   } catch (Exception ignore) {
   }
   disableArmour(player, dim);
 }
  public GuiUserFilter(
      IGuiParent parent, int x, int y, int w, int h, boolean drawLabel, IFilterTile tile) {
    super(parent, x, y, w, h);
    this.drawLabel = drawLabel;
    this.tile = tile;

    userFilterLabel =
        new GuiLabel(this, x, y, StatCollector.translateToLocal(Strings.CUSTOM_FILTER));
    userFilterLabel.drawCentered = false;

    userFilterHelp =
        new GuiRefinedRelocationButton(
            this,
            userFilterLabel.x + userFilterLabel.w + 5,
            userFilterLabel.y - 1,
            10,
            10,
            0,
            128,
            null);
    userFilterHelp.setTooltipString(
        StatCollector.translateToLocal(Strings.NAME_MATCHING)
            + "\n\u00A77"
            + StatCollector.translateToLocal(Strings.WILDCARD_CHARACTER)
            + ": \u00A73*\n\u00A77"
            + StatCollector.translateToLocal(Strings.OREDICT_CHARACTER)
            + ": \u00A72!\n\u00A77"
            + StatCollector.translateToLocal(Strings.COMMA_SEPARATION));

    userFilter = new GuiTextInputUserFilter(this, x, y + h - inputHeight, w, inputHeight, tile);
  }
  @SideOnly(Side.CLIENT)
  private static Pair<String, KnowledgeObject<?>> getObject(char type, String identifier) {
    KnowledgeObject<?> obj = null;
    String text = null;

    boolean isHEE = identifier.charAt(0) == '~' && identifier.length() > 1;
    if (isHEE) identifier = identifier.substring(1);

    switch (type) {
      case 'b':
      case 'i':
        int metaIndex = identifier.indexOf('/'), meta = 0;

        if (metaIndex != -1 && metaIndex + 1 < identifier.length()) {
          meta = DragonUtil.tryParse(identifier.substring(metaIndex + 1), 0);
          identifier = identifier.substring(0, metaIndex);
        }

        Item item =
            GameRegistry.findItem(isHEE ? "HardcoreEnderExpansion" : "minecraft", identifier);

        if (item != null) {
          text =
              StatCollector.translateToLocal(
                  item.getUnlocalizedName(new ItemStack(item, 1, meta)) + ".name");
          obj =
              KnowledgeObject.fromObject(
                  type == 'b'
                      ? (item instanceof ItemBlock
                          ? new BlockInfo(((ItemBlock) item).field_150939_a, meta)
                          : null)
                      : item);
        }

        break;

      case 'e':
        if (isHEE)
          text =
              ItemSpawnEggs.getMobName(
                  (Class<?>)
                      EntityList.stringToClassMapping.get(
                          identifier = ("HardcoreEnderExpansion." + identifier)));
        else text = StatCollector.translateToLocal("entity." + identifier + ".name");

        Class<?> cls = (Class<?>) EntityList.stringToClassMapping.get(identifier);
        if (cls != null) obj = KnowledgeObject.fromObject(cls);
        break;

      case 'd':
        obj = KnowledgeObject.fromObject(identifier);
        if (obj != null) text = obj.getTranslatedTooltip();
        break;
    }

    if (text == null || obj == null) {
      Log.warn("Invalid object type or identifier: $0:$1", type, identifier);
      return Pair.<String, KnowledgeObject<?>>of(text == null ? identifier : text, obj);
    } else return Pair.<String, KnowledgeObject<?>>of(text, obj);
  }
 @Override
 public String getItemStackDisplayName(ItemStack stack) {
   String flowerName = getUnlocalizedName(stack) + ".name";
   return String.format(
       StatCollector.translateToLocal("botaniamisc.floatingPrefix"),
       StatCollector.translateToLocal(flowerName));
 }
Exemplo n.º 10
0
  @SuppressWarnings({"rawtypes", "unchecked"})
  @Override
  @SideOnly(Side.CLIENT)
  public void addInformation(ItemStack var1, EntityPlayer var2, List var3, boolean var4) {
    if (var1.getItem().equals(RioVItems.axeOfAunTun)) {
      var3.add("The most valuable and powerful weapon.");
      var3.add("Fully fused. Fully usable.");
      var3.add("Fusion: 100%");
    }

    if (var1.getItem().equals(RioVItems.unfusedAxeOfAunTun)) {
      var3.add(StatCollector.translateToLocal("Unfused. Not usable."));
      var3.add(StatCollector.translateToLocal("Fusion: 0%"));
    }

    if (var1.getItem().equals(RioVItems.halfFusedAxeOfAunTun)) {
      var3.add(StatCollector.translateToLocal("Half fused. Still not usable."));
      var3.add(StatCollector.translateToLocal("Fusion: 50%"));
    }

    if (Config.showToolInfo) {
      var3.add(Color.GOLD + (var1.getMaxDamage() - var1.getItemDamage()) + " Uses");
      var3.add(Color.DARK_PURPLE + "Damage: " + toolMaterial.getDamageVsEntity());
    }
  }
Exemplo n.º 11
0
  private void func_77248_b(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) {
    LanServer lanserver =
        (LanServer)
            GuiMultiplayer.getListOfLanServers(this.parentGui)
                .get(par1 - GuiMultiplayer.getInternetServerList(this.parentGui).countServers());
    this.parentGui.drawString(
        this.parentGui.fontRenderer,
        StatCollector.translateToLocal("lanServer.title"),
        par2 + 2,
        par3 + 1,
        16777215);
    this.parentGui.drawString(
        this.parentGui.fontRenderer, lanserver.getServerMotd(), par2 + 2, par3 + 12, 8421504);

    if (this.parentGui.mc.gameSettings.hideServerAddress) {
      this.parentGui.drawString(
          this.parentGui.fontRenderer,
          StatCollector.translateToLocal("selectServer.hiddenAddress"),
          par2 + 2,
          par3 + 12 + 11,
          3158064);
    } else {
      this.parentGui.drawString(
          this.parentGui.fontRenderer,
          lanserver.getServerIpPort(),
          par2 + 2,
          par3 + 12 + 11,
          3158064);
    }
  }
Exemplo n.º 12
0
  @SubscribeEvent
  public void drawDislocationFocusHUD(RenderGameOverlayEvent.Post event) {
    if (event.type == ElementType.HOTBAR && ClientHelper.minecraft().currentScreen == null) {
      boolean up = !Config.dialBottom;
      int xpos = 4;
      int ypos = up ? 50 : event.resolution.getScaledHeight() - 70;

      ItemStack item = ClientHelper.clientPlayer().getCurrentEquippedItem();
      if (item != null && item.getItem() instanceof ItemWandCasting) {
        ItemWandCasting wand = (ItemWandCasting) item.getItem();
        wand.getFocusItem(item);
        ItemFocusBasic focus = wand.getFocus(item);

        if (focus != null && focus instanceof ItemFocusDislocation) {
          ItemStack pickedBlock = ((ItemFocusDislocation) focus).getPickedBlock(item);
          if (pickedBlock != null) {
            Gui.drawRect(xpos - 1, ypos - 1, xpos + 18, ypos + 18, 0x66000000);

            FontRenderer font = ClientHelper.fontRenderer();
            boolean unicode = font.getUnicodeFlag();
            font.setUnicodeFlag(true);
            String name = StatCollector.translateToLocal("ttmisc.focusDislocation.tooltip");
            int strLength = font.getStringWidth(name);

            Gui.drawRect(xpos + 18, ypos, xpos + 18 + strLength + 4, ypos + 9, 0x66000000);
            font.drawStringWithShadow(name, xpos + 20, ypos, 0xFFAA00);

            NBTTagCompound cmp = ((ItemFocusDislocation) focus).getStackTileEntity(item);
            if (cmp != null && !cmp.hasNoTags()) {
              String content =
                  StatCollector.translateToLocal("ttmisc.focusDislocation.tooltipExtra");
              font.getStringWidth(content);

              Gui.drawRect(xpos + 18, ypos + 9, xpos + 18 + strLength + 4, ypos + 18, 0x66000000);
              font.drawStringWithShadow(content, xpos + 20, ypos + 9, 0xFFAA00);
            }

            if (new ItemStack(((ItemBlock) pickedBlock.getItem()).field_150939_a).getItem() != null)
              renderItem.renderItemIntoGUI(
                  font,
                  ClientHelper.minecraft().renderEngine,
                  new ItemStack(((ItemBlock) pickedBlock.getItem()).field_150939_a),
                  xpos,
                  ypos);
            else {
              if (((ItemBlock) pickedBlock.getItem()).field_150939_a == Blocks.reeds)
                renderItem.renderItemIntoGUI(
                    font,
                    ClientHelper.minecraft().renderEngine,
                    new ItemStack(Items.reeds),
                    xpos,
                    ypos);
            }
            font.setUnicodeFlag(unicode);
          }
        }
      }
    }
  }
 public ModButtertouch(ItemStack[] items, int effect) {
   super(
       items,
       effect,
       StatCollector.translateToLocal("gui.modifier.silk"),
       "\u00a7e",
       StatCollector.translateToLocal("modifier.tool.silk"));
 }
Exemplo n.º 14
0
 /** Draw the foreground layer for the GuiContainer (everything in front of the items) */
 @Override
 protected void drawGuiContainerForegroundLayer(int par1, int par2) {
   // Shows the name "Villager" and "Inventory"
   this.fontRenderer.drawString(
       StatCollector.translateToLocal("entity.Villager.name"), 56, 6, 4210752);
   this.fontRenderer.drawString(
       StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
 }
Exemplo n.º 15
0
 /**
  * Returns a translated description of the skill's duration, in ticks or seconds, using the value
  * provided
  */
 public String getDurationDisplay(int duration, boolean inTicks) {
   return StatCollector.translateToLocalFormatted(
       "skill.zss.desc.duration",
       (inTicks ? duration : duration / 20),
       (inTicks
           ? StatCollector.translateToLocal("skill.zss.ticks")
           : StatCollector.translateToLocal("skill.zss.seconds")));
 }
  /**
   * Returns the unlocalized name of this item. This version accepts an ItemStack so different
   * stacks can have different names based on their damage or NBT.
   */
  public String getUnlocalizedName(ItemStack item) {
    int type = item.getItemDamage();

    if (type == 1 || type == 2) {
      return StatCollector.translateToLocal("tile.oreMythic.deepIron");
    }

    return StatCollector.translateToLocal("tile.oreMythic.mithril");
  }
Exemplo n.º 17
0
  public GuiAutoMerchant(
      InventoryPlayer playerInventory, TileEntityVillager _villager, World world) {
    super(new ContainerAutoMerchant(playerInventory, _villager, world));

    this.currentRecipeIndex = _villager.getTradeIndex();
    this.villager = _villager;
    this.guiCaption = StatCollector.translateToLocal("container.villager_block");
    this.inventoryCaption = StatCollector.translateToLocal("container.inventory");
  }
Exemplo n.º 18
0
  @Override
  public void processCommand(final ICommandSender sender, final String[] parms) {

    try {
      final EntityPlayerMP player = getCommandSenderAsPlayer(sender);
      final World world = player.worldObj;
      final DimensionEffectData data = DimensionEffectData.get(world);

      if (parms.length == 1) {
        if ("status".compareToIgnoreCase(parms[0]) == 0) {
          // Dump out some diagnostics for the currentAurora dimension
          player.addChatMessage(new ChatComponentText(statusOutput(world, data)));
        } else if ("reset".compareToIgnoreCase(parms[0]) == 0) {
          world.provider.resetRainAndThunder();
          player.addChatMessage(
              new ChatComponentText(StatCollector.translateToLocal("msg.RainReset")));
        } else if ("reload".compareToIgnoreCase(parms[0]) == 0) {
          BiomeRegistry.initialize();
          BlockRegistry.initialize();
          player.addChatMessage(
              new ChatComponentText(StatCollector.translateToLocal("msg.BiomeReload")));
        } else {
          final double d = parseDouble(parms[0], 0.0D, 100.0D) / 100.0D;
          data.setRainIntensity((float) d);
          player.addChatMessage(
              new ChatComponentText(
                  StatCollector.translateToLocalFormatted(
                      "msg.RainIntensitySet", FORMATTER.format(data.getRainIntensity() * 100))));
        }
      } else if (parms.length == 2) {
        if ("setmin".compareToIgnoreCase(parms[0]) == 0) {
          final double d = parseDouble(parms[1], 0.0D, 100.0D) / 100.0D;
          data.setMinRainIntensity((float) d);
          player.addChatMessage(
              new ChatComponentText(
                  StatCollector.translateToLocalFormatted(
                      "msg.MinRainIntensitySet",
                      FORMATTER.format(data.getMinRainIntensity() * 100))));
        } else if ("setmax".compareToIgnoreCase(parms[0]) == 0) {
          final double d = parseDouble(parms[1], 0.0D, 100.0D) / 100.0D;
          data.setMaxRainIntensity((float) d);
          player.addChatMessage(
              new ChatComponentText(
                  StatCollector.translateToLocalFormatted(
                      "msg.MaxRainIntensitySet",
                      FORMATTER.format(data.getMaxRainIntensity() * 100))));
        } else {
          throw new CommandException(getCommandUsage(sender));
        }
      } else {
        player.addChatMessage(new ChatComponentText(getCommandUsage(sender)));
      }
    } catch (final Exception ex) {
      ex.printStackTrace();
    }
  }
Exemplo n.º 19
0
 @Override
 protected void drawGuiContainerForegroundLayer(int i, int j) {
   if (container.te != null) {
     fontRendererObj.drawString(container.te.getInventoryName(), 8, 5, 4210752);
   } else {
     fontRendererObj.drawString(StatCollector.translateToLocal("gui.landmine"), 8, 5, 4210752);
   }
   fontRendererObj.drawString(
       StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 3, 4210752);
 }
Exemplo n.º 20
0
 @Override
 protected void drawGuiContainerForegroundLayer(int par1, int par2) {
   String s =
       tileEntity.hasCustomInventoryName()
           ? tileEntity.getInventoryName()
           : StatCollector.translateToLocal(tileEntity.getInventoryName());
   fontRendererObj.drawString(s, xSize / 2 - fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
   fontRendererObj.drawString(
       StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 4210752);
 }
Exemplo n.º 21
0
  @Override
  @SideOnly(Side.CLIENT)
  public void renderScreen(IGuiLexiconEntry gui, int mx, int my) {
    relativeMouseX = mx;
    relativeMouseY = my;

    renderRecipe(gui, mx, my);

    int width = gui.getWidth() - 30;
    int height = gui.getHeight();
    int x = gui.getLeft() + 16;
    int y = gui.getTop() + height - 40;
    PageText.renderText(x, y, width, height, getUnlocalizedName());

    if (tooltipStack != null) {
      List<String> tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
      List<String> parsedTooltip = new ArrayList();
      boolean first = true;

      for (String s : tooltipData) {
        String s_ = s;
        if (!first) s_ = EnumChatFormatting.GRAY + s;
        parsedTooltip.add(s_);
        first = false;
      }

      vazkii.botania.client.core.helper.RenderHelper.renderTooltip(mx, my, parsedTooltip);

      int tooltipY = 8 + tooltipData.size() * 11;

      if (tooltipEntry) {
        vazkii.botania.client.core.helper.RenderHelper.renderTooltipOrange(
            mx,
            my + tooltipY,
            Arrays.asList(
                EnumChatFormatting.GRAY
                    + StatCollector.translateToLocal("botaniamisc.clickToRecipe")));
        tooltipY += 18;
      }

      if (tooltipContainerStack != null)
        vazkii.botania.client.core.helper.RenderHelper.renderTooltipGreen(
            mx,
            my + tooltipY,
            Arrays.asList(
                EnumChatFormatting.AQUA
                    + StatCollector.translateToLocal("botaniamisc.craftingContainer"),
                tooltipContainerStack.getDisplayName()));
    }

    tooltipStack = tooltipContainerStack = null;
    tooltipEntry = false;
    GL11.glDisable(GL11.GL_BLEND);
    mouseDownLastTick = Mouse.isButtonDown(0);
  }
  @Override
  protected void drawGuiContainerForegroundLayer(int par1, int par2) {
    String invtName = StatCollector.translateToLocal(hopper.getInventoryName());
    fontRendererObj.drawString(
        invtName, xSize / 2 - fontRendererObj.getStringWidth(invtName) / 2, 6, 4210752);
    fontRendererObj.drawString(
        StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 4210752);

    fontRendererObj.drawString(
        hopper.getLine(), 76 - fontRendererObj.getStringWidth(hopper.getLine()), 57, 4210752);
  }
  public String[] getGolemCoreImplementation() throws Exception {
    if (golem == null) return new String[] {};
    if (golem.getCore() == -1)
      return new String[] {StatCollector.translateToLocal("item.ItemGolemCore.100.name")};
    String[] decorations = new String[1];
    EnumGolemCores golemCore = EnumGolemCores.getFromByte(golem.getCore());
    if (golemCore == null) throw new Exception("Golem has Unknown core: " + golem.getCore());
    decorations[0] = StatCollector.translateToLocal(golemCore.getName());

    return decorations;
  }
 @Override
 public void addInformation(
     ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
   p_77624_3_.add("");
   p_77624_3_.add(EnumChatFormatting.RED + StatCollector.translateToLocal("turret.addon.label"));
   p_77624_3_.add("");
   p_77624_3_.add(StatCollector.translateToLocal("turret.addon.amp.a.label"));
   p_77624_3_.add("");
   p_77624_3_.add(
       EnumChatFormatting.DARK_GRAY + StatCollector.translateToLocal("turret.addon.amp.flavour"));
 }
  @Override
  public void addInformation(
      ItemStack essentiaCell, EntityPlayer player, List displayList, boolean advancedItemTooltips) {
    // TODO: Save provider??
    // 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(
            StatCollector.translateToLocal(
                ThaumicEnergistics.MOD_ID + ".tooltip.essentia.cell.bytes"),
            new Object[] {
              cellHandler.usedBytes() / ItemEssentiaCell.CONVERSION_SIZE,
              cellHandler.totalBytes() / ItemEssentiaCell.CONVERSION_SIZE
            });

    // Create the types tooltip
    String typesTip =
        String.format(
            StatCollector.translateToLocal(
                ThaumicEnergistics.MOD_ID + ".tooltip.essentia.cell.types"),
            new Object[] {cellHandler.usedTypes(), cellHandler.totalTypes()});

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

    // Is the cell pre-formated?
    if (cellHandler.isPreformatted()) {
      displayList.add(
          StatCollector.translateToLocal("Appeng.GuiITooltip.Partitioned")
              + " - "
              + StatCollector.translateToLocal("Appeng.GuiITooltip.Precise"));
    }

    // 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);
    }
  }
  @Override
  public void setupElements() {
    typeLabel.setText(
        StatCollector.translateToLocal("guistrings.validation_type")
            + ": "
            + parent.validationType.getName());

    int totalHeight = 0;
    area.clearElements();
    for (Button b : typeButtons) {
      area.addGuiElement(b);
    }
    totalHeight += 16 * 3 + 4 + 8; // type buttons height+buffer

    Label label = null;
    String propName;
    Checkbox box;
    NumberInput input;
    for (StructureValidationProperty property : parent.validator.getProperties()) {
      propName = property.getRegName();
      if (propName.equals(StructureValidator.PROP_BIOME_LIST)
          || propName.equals(StructureValidator.PROP_BIOME_WHITE_LIST)
          || propName.equals(StructureValidator.PROP_DIMENSION_LIST)
          || propName.equals(StructureValidator.PROP_DIMENSION_WHITE_LIST)
          || propName.equals(StructureValidator.PROP_BLOCK_LIST)) {
        continue; // skip the properties handled by blocks, biome, or dimensions setup guis
      }
      label =
          new Label(
              8,
              totalHeight,
              StatCollector.translateToLocal("structure.validation." + property.getRegName()));
      area.addGuiElement(label);

      switch (property.getDataType()) {
        case StructureValidationProperty.DATA_TYPE_INT:
          {
            input = new PropertyNumberInputInteger(200, totalHeight - 1, 32, property, this);
            area.addGuiElement(input);
          }
          break;
        case StructureValidationProperty.DATA_TYPE_BOOLEAN:
          {
            box = new PropertyCheckbox(200, totalHeight - 3, 16, 16, property);
            area.addGuiElement(box);
          }
          break;
      }

      totalHeight += 16;
    }
    area.setAreaSize(totalHeight);
  }
Exemplo n.º 27
0
 public RedSword() {
   super(
       "rm_sword",
       (byte) 3,
       new String[] {
         StatCollector.translateToLocal("pe.redsword.mode1"),
         StatCollector.translateToLocal("pe.redsword.mode2")
       });
   this.setNoRepair();
   this.peToolMaterial = "rm_tools";
   this.pePrimaryToolClass = "sword";
 }
 public void drawGuiContainerForegroundLayer(int par1, int par2) {
   String name1 =
       (this.entity.D - 2)
           + "x"
           + (this.entity.D - 2)
           + "x"
           + (this.entity.D - 2)
           + " "
           + StatCollector.translateToLocal("gui.reactor");
   String name2 = this.entity.problem;
   this.fontRendererObj.drawString(
       (this.entity.multiblockstring() ? name1 : name2),
       67,
       5,
       (this.entity.multiblockstring() ? -1 : 15597568));
   String power = this.entity.energy + " RF";
   this.fontRendererObj.drawString(
       power, 67, 16, (this.entity.multiblockstring() ? -1 : 15597568));
   String fueltime =
       ((int) this.entity.fueltime * 100 / 72) + " " + StatCollector.translateToLocal("gui.fuel");
   this.fontRendererObj.drawString(
       fueltime, 67, 27, (this.entity.multiblockstring() ? -1 : 15597568));
   String heat = (this.entity.heat) + " " + StatCollector.translateToLocal("gui.heat");
   this.fontRendererObj.drawString(heat, 67, 38, (this.entity.multiblockstring() ? -1 : 15597568));
   String fueltype =
       (this.entity.fueltime == 0
               ? StatCollector.translateToLocal("gui.noFuel")
               : this.entity.typeoffuel)
           + "";
   this.fontRendererObj.drawString(
       fueltype, 67, 49, (this.entity.multiblockstring() ? -1 : 15597568));
   String egen =
       this.entity.fueltime == 0
           ? 0 + " RF/t"
           : (this.entity.E < 100000
               ? (this.entity.E) + " RF/t"
               : ((int) (Math.round(this.entity.E / 1000))) + " kRF/t");
   this.fontRendererObj.drawString(
       egen,
       7,
       63,
       (!this.entity.multiblockstring() ? 15597568 : (this.entity.off == 1 ? 15641088 : -1)));
   String hgen =
       this.entity.H < 100000
           ? (this.entity.H) + " H/t"
           : ((int) (Math.round(this.entity.H / 1000))) + " kH/t";
   this.fontRendererObj.drawString(
       hgen,
       7,
       74,
       (!this.entity.multiblockstring() ? 15597568 : (this.entity.off == 1 ? 15641088 : -1)));
 }
Exemplo n.º 29
0
 @Override
 public List<String> getPedestalDescription() {
   List<String> list = Lists.newArrayList();
   if (ProjectEConfig.ignitePedCooldown != -1) {
     list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("pe.ignition.pedestal1"));
     list.add(
         EnumChatFormatting.BLUE
             + String.format(
                 StatCollector.translateToLocal("pe.ignition.pedestal2"),
                 MathUtils.tickToSecFormatted(ProjectEConfig.ignitePedCooldown)));
   }
   return list;
 }
Exemplo n.º 30
0
  @EventHandler
  public void postInit(FMLPostInitializationEvent event) {
    RegistrationManager.INSTANCE.registerAll(this, "PostInit");

    try {
      Class.forName("ic2.core.IC2");
      try {
        Class.forName("cn.academy.support.ic2.IC2Support").getMethod("init").invoke(this);
        ic2SupportPresent = true;
      } catch (Throwable e) {
        log.error("Failed to initialize IC2 support", e);
      }
    } catch (Throwable e) {
    }

    try {
      Class.forName("cofh.thermalexpansion.ThermalExpansion");
      try {
        Class.forName("cn.academy.support.te.TESupport").getMethod("init").invoke(this);
        teSupportPresent = true;
      } catch (Throwable e) {
        log.error("Failed to initialize TE support", e);
      }
    } catch (Throwable e) {
    }

    recipes.addRecipeFromResourceLocation(new ResourceLocation("academy:recipes/default.recipe"));

    if (DEBUG_MODE) {
      System.out.printf("|-------------------------------------------------------\n");
      System.out.printf("| AC Recipe Name Mappings\n");
      System.out.printf("|--------------------------|----------------------------\n");
      System.out.printf(String.format("| %-25s| Object Name\n", "Recipe Name"));
      System.out.printf("|--------------------------|----------------------------\n");
      for (Entry<String, Object> entry : recipes.nameMapping.entrySet()) {
        Object obj = entry.getValue();
        String str1 = entry.getKey(), str2;
        if (obj instanceof Item) {
          str2 = StatCollector.translateToLocal(((Item) obj).getUnlocalizedName() + ".name");
        } else if (obj instanceof Block) {
          str2 = StatCollector.translateToLocal(((Block) obj).getUnlocalizedName() + ".name");
        } else {
          str2 = obj.toString();
        }
        System.out.printf(String.format("| %-25s| %s\n", str1, str2));
      }
      System.out.printf("|-------------------------------------------------------\n");
    }

    recipes = null; // Doesn't need it after loading
  }