コード例 #1
0
  protected void drawToolTip(List par1List, int par2, int par3) {
    if (!par1List.isEmpty()) {
      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
      RenderHelper.disableStandardItemLighting();
      GL11.glDisable(GL11.GL_LIGHTING);
      GL11.glDisable(GL11.GL_DEPTH_TEST);
      int k = 0;
      Iterator iterator = par1List.iterator();

      while (iterator.hasNext()) {
        String s = (String) iterator.next();
        int l = this.fontRenderer.getStringWidth(s);

        if (l > k) {
          k = l;
        }
      }

      int i1 = par2 + 12;
      int j1 = par3 - 12;
      int k1 = 8;

      if (par1List.size() > 1) {
        k1 += 2 + (par1List.size() - 1) * 10;
      }

      if (i1 + k > this.width) {
        i1 -= 28 + k;
      }

      if (j1 + k1 + 6 > this.height) {
        j1 = this.height - k1 - 6;
      }

      this.zLevel = 300.0F;
      itemRenderer.zLevel = 300.0F;
      int l1 = -267386864;
      this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1);
      this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1);
      this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1);
      this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1);
      this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1);
      int i2 = 1347420415;
      int j2 = (i2 & 16711422) >> 1 | i2 & -16777216;
      this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2);
      this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2);
      this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2);
      this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2);

      for (int k2 = 0; k2 < par1List.size(); ++k2) {
        String s1 = (String) par1List.get(k2);
        this.fontRenderer.drawStringWithShadow(s1, i1, j1, -1);

        if (k2 == 0) {
          j1 += 2;
        }

        j1 += 10;
      }

      this.zLevel = 0.0F;
      itemRenderer.zLevel = 0.0F;
    }
  }
コード例 #2
0
  @Override
  protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(background);
    int cornerX = (width - xSize) / 2 + 36;
    int cornerY = (height - ySize) / 2;
    drawTexturedModalRect(cornerX + 46, cornerY, 0, 0, 176, ySize);

    // Fuel - Lava
    this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
    if (scomp.fuelGague > 0) {
      Icon lavaIcon = Block.lavaStill.getIcon(0, 0);
      int fuel = scomp.getScaledFuelGague(52);
      int count = 0;
      while (fuel > 0) {
        int size = fuel >= 16 ? 16 : fuel;
        fuel -= size;
        drawLiquidRect(cornerX + 117, (cornerY + 68) - size - 16 * count, lavaIcon, 12, size);
        count++;
      }
    }

    FluidTankInfo[] info = logic.getTankInfo(ForgeDirection.UNKNOWN);
    int capacity = 0;

    for (int i = 0; i < info.length - 1; i++) {
      FluidStack liquid = info[i].fluid;
      if (liquid != null) capacity += info[i].capacity;
    }

    // Liquids - molten metal
    int base = 0;
    for (int i = 0; i < info.length - 1; i++) {
      FluidStack liquid = info[i].fluid;
      Icon renderIndex = liquid.getFluid().getStillIcon();
      int basePos = 54;
      if (capacity > 0) {
        int liquidSize = liquid.amount * 52 / capacity;
        if (liquidSize == 0) liquidSize = 1;
        while (liquidSize > 0) {
          int size = liquidSize >= 16 ? 16 : liquidSize;
          drawLiquidRect(cornerX + basePos, (cornerY + 68) - size - base, renderIndex, 16, size);
          drawLiquidRect(
              cornerX + basePos + 16, (cornerY + 68) - size - base, renderIndex, 16, size);
          drawLiquidRect(
              cornerX + basePos + 32, (cornerY + 68) - size - base, renderIndex, 16, size);
          drawLiquidRect(
              cornerX + basePos + 48, (cornerY + 68) - size - base, renderIndex, 4, size);
          liquidSize -= size;
          base += size;
        }
      }
    }

    // Liquid gague
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    this.mc.getTextureManager().bindTexture(background);
    drawTexturedModalRect(cornerX + 54, cornerY + 16, 176, 76, 52, 52);

    // Side inventory
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(backgroundSide);
    // if (logic.layers > 0)
    {
      /*if (logic.layers == 1)
      {
          drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, 43);
          drawTexturedModalRect(cornerX - 46, cornerY + 43, 0, 133, 98, 25);
      }
      else if (logic.layers == 2)
      {
          drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, 61);
          drawTexturedModalRect(cornerX - 46, cornerY + 61, 0, 97, 98, 61);
      }
      else*/
      {
        drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, ySize - 8);
      }
      drawTexturedModalRect(cornerX + 32, (int) (cornerY + 8 + 127 * currentScroll), 98, 0, 12, 15);
    }

    // Temperature
    int slotSize = logic.getSizeInventory();
    if (slotSize > 24) slotSize = 24;
    for (int iter = 0; iter < slotSize; iter++) {
      int slotTemp = logic.getTempForSlot(iter + slotPos * 3) - 20;
      int maxTemp = logic.getMeltingPointForSlot(iter + slotPos * 3) - 20;
      if (slotTemp > 0 && maxTemp > 0) {
        int size = 16 * slotTemp / maxTemp + 1;
        drawTexturedModalRect(
            cornerX - 38 + (iter % 3 * 22),
            cornerY + 8 + (iter / 3 * 18) + 16 - size,
            98,
            15 + 16 - size,
            5,
            size);
      }
    }
  }