private void drawQuad(int x, int y, int h, int w, float color[], float alpha) {
    GL11.glColor4f(color[0], color[1], color[2], alpha);

    // draw quad
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2f(x, y);
    GL11.glVertex2f(x + w, y);
    GL11.glVertex2f(x + w, y + h);
    GL11.glVertex2f(x, y + h);
    GL11.glEnd();
  }
  @Override
  protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glPushMatrix();
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

    if (inverted) {
      this.mc.renderEngine.bindTexture(
          new ResourceLocation(
              "uncraftingTable:textures/gui/container/uncrafting_gui_redstoned.png"));
    } else
      this.mc.renderEngine.bindTexture(
          new ResourceLocation("uncraftingTable:textures/gui/container/uncrafting_gui.png"));

    int k = width / 2 - xSize / 2;
    int l = height / 2 - ySize / 2;
    this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
    GL11.glPopMatrix();
  }
  private void drawCircle(double x, double y, int radius, float color[], float alpha) {
    GL11.glColor4f(color[0], color[1], color[2], alpha);

    float incr = (float) (2 * Math.PI / slices);
    /*xCoord = xCoord + radius;
    yCoord = yCoord + radius;*/

    GL11.glBegin(GL11.GL_TRIANGLE_FAN);
    for (int i = 0; i < slices; i++) {
      float angle = incr * i;

      float Xc = (float) (x + Math.cos(angle) * radius);
      float Yc = (float) (y + Math.sin(angle) * radius);

      GL11.glVertex2f(Xc, Yc);
    }
    GL11.glEnd();
  }
Beispiel #4
0
 private void loadScreen() throws LWJGLException {
   ScaledResolution scaledresolution =
       new ScaledResolution(gameSettings, displayWidth, displayHeight);
   GL11.glClear(16640);
   GL11.glMatrixMode(5889 /*GL_PROJECTION*/);
   GL11.glLoadIdentity();
   GL11.glOrtho(
       0.0D, scaledresolution.field_25121_a, scaledresolution.field_25120_b, 0.0D, 1000D, 3000D);
   GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/);
   GL11.glLoadIdentity();
   GL11.glTranslatef(0.0F, 0.0F, -2000F);
   GL11.glViewport(0, 0, displayWidth, displayHeight);
   GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F);
   Tessellator tessellator = Tessellator.instance;
   GL11.glDisable(2896 /*GL_LIGHTING*/);
   GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
   GL11.glDisable(2912 /*GL_FOG*/);
   GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, renderEngine.getTexture("/title/mojang.png"));
   tessellator.startDrawingQuads();
   tessellator.setColorOpaque_I(0xffffff);
   tessellator.addVertexWithUV(0.0D, displayHeight, 0.0D, 0.0D, 0.0D);
   tessellator.addVertexWithUV(displayWidth, displayHeight, 0.0D, 0.0D, 0.0D);
   tessellator.addVertexWithUV(displayWidth, 0.0D, 0.0D, 0.0D, 0.0D);
   tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
   tessellator.draw();
   char c = '\u0100';
   char c1 = '\u0100';
   GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
   tessellator.setColorOpaque_I(0xffffff);
   func_6274_a(
       (scaledresolution.getScaledWidth() - c) / 2,
       (scaledresolution.getScaledHeight() - c1) / 2,
       0,
       0,
       c,
       c1);
   GL11.glDisable(2896 /*GL_LIGHTING*/);
   GL11.glDisable(2912 /*GL_FOG*/);
   GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
   GL11.glAlphaFunc(516, 0.1F);
   Display.swapBuffers();
 }
  @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);
      }
    }
  }