コード例 #1
0
  @Override
  public void drawScreen(int x, int y, float par3) {
    if (!isActive) {
      super.drawScreen(x, y, par3);

      if (isPointInRegion(7, 46, 162, 18, x, y)) {
        List<String> str = new ArrayList<String>();
        str.add(
            portalModifier.upgradeHandler.hasUpgrade(new UpgradeDialDevice())
                ? Strings.UniqueIdentifier.toString()
                : Strings.Network.toString());
        str.add(
            EnumChatFormatting.GRAY
                + (portalModifier.upgradeHandler.hasUpgrade(new UpgradeDialDevice())
                    ? Strings.ClickToSetIdentifier.toString()
                    : Strings.ClickToSetNetwork.toString()));
        drawText(str, x, y);
      }
    } else {
      drawDefaultBackground();
      fontRenderer.drawString(
          Strings.ModifierActive.toString(),
          width / 2 - fontRenderer.getStringWidth(Strings.ModifierActive.toString()) / 2,
          guiTop,
          0xFFFFFF);
      okayButton.drawButton(mc, 0, 0);
    }
  }
コード例 #2
0
  @Override
  protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    super.drawGuiContainerBackgroundLayer(f, i, j);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.func_110577_a(
        new ResourceLocation(
            Reference.RESOURCE_NAME, Reference.GUI_LOCATION + "portalModifier.png"));
    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2 - 3;
    drawTexturedModalRect(x, y, 0, 0, xSize, ySize);

    fontRenderer.drawString(
        Localization.localizeString("tile.portalModifier.name"),
        guiLeft
            + xSize / 2
            - fontRenderer.getStringWidth(Localization.localizeString("tile.portalModifier.name"))
                / 2,
        guiTop + -15,
        0xFFFFFF);
    fontRenderer.drawString(Strings.Upgrades.toString(), guiLeft + 8, guiTop + 3, 0xFF444444);
    fontRenderer.drawString(
        Strings.Modifications.toString(),
        guiLeft + xSize - 8 - fontRenderer.getStringWidth(Strings.Modifications.toString()),
        guiTop + 3,
        0xFF444444);
    fontRenderer.drawString(
        portalModifier.upgradeHandler.hasUpgrade(new UpgradeDialDevice())
            ? Strings.UniqueIdentifier.toString()
            : Strings.Network.toString(),
        guiLeft + 8,
        guiTop + 35,
        0xFF444444);

    boolean draw =
        portalModifier.isRemotelyControlled()
            ? portalModifier.dialDeviceNetwork.equals("")
            : portalModifier.modifierNetwork.equals("");

    if (draw) {
      String str =
          portalModifier.isRemotelyControlled()
              ? Strings.ClickToSetIdentifier.toString()
              : Strings.ClickToSetNetwork.toString();

      drawRect(guiLeft + 7, guiTop + 46, guiLeft + xSize - 7, guiTop + 64, 0x55000000);

      if (!EnhancedPortals_deprecated.proxy.isIdentifierTaken) {
        fontRenderer.drawStringWithShadow(
            str,
            guiLeft + xSize / 2 - fontRenderer.getStringWidth(str) / 2,
            guiTop + 51,
            0xFF00FF00);
      } else {
        fontRenderer.drawStringWithShadow(
            Strings.IdentifierInUse.toString(),
            guiLeft
                + xSize / 2
                - fontRenderer.getStringWidth(Strings.IdentifierInUse.toString()) / 2,
            guiTop + 51,
            0xEE0000);
      }
    }

    String network =
        portalModifier.isRemotelyControlled()
            ? portalModifier.dialDeviceNetwork
            : portalModifier.modifierNetwork;

    if (!network.equals("")) {
      String[] split = network.split(Reference.glyphSeperator);

      for (int i1 = 0; i1 < split.length; i1++) {
        for (int j1 = 0; j1 < Reference.glyphItems.size(); j1++) {
          if (Reference.glyphItems
              .get(j1)
              .getItemName()
              .replace("item.", "")
              .equalsIgnoreCase(split[i1])) {
            itemRenderer.renderItemIntoGUI(
                fontRenderer,
                mc.renderEngine,
                Reference.glyphItems.get(j1),
                guiLeft + 8 + i1 * 18,
                guiTop + 47);
          }
        }
      }
    }
  }