コード例 #1
0
  @Override
  protected void drawGuiContainerForegroundLayer(int par1, int par2) {
    super.drawGuiContainerForegroundLayer(par1, par2);

    int j = (width - xSize) / 2;
    int k = (height - ySize) / 2;
    int minx = 120;
    int miny = 24;
    int w = 36;
    int maxx = minx + w;
    int maxy = miny + w;

    if (mode == AspectMode.DEMAND) {
      // api.drawRectFrame(minx, miny, w, w, ReikaColorAPI.mixColors(this.getActive().getColor(),
      // 0x1e1e1e, clickDelay/90F));
      // Color.HSBtoRGB(hsb[0], Math.min(clickDelay/90F, hsb[1]), Math.min(bright/255F, hsb[2]))
      int color = ReikaColorAPI.mixColors(0x010101, 0xffffff, 1 - bright / 255F - clickDelay / 90F);
      color = ReikaColorAPI.mixColors(color, this.getActive().getColor(), 1 - clickDelay / 90F);
      api.drawRectFrame(minx, miny, w, w, color);
      if (api.isMouseInBox(j + minx, j + maxx, k + miny, k + maxy)) {
        bright = Math.min(bright + 12, 255);
      } else {
        bright = Math.max(bright - 4, 30);
      }
      if (clickDelay > 0) {
        clickDelay = Math.max(clickDelay - 4, 0);
      }

      ElementTagCompound tag = TileEntityAspectFormer.getAspectCost(this.getActive());
      int dx = 18;
      int dy = 21;
      boolean text =
          GuiScreen.isCtrlKeyDown()
              && api.isMouseInBox(
                  j + dx + 32 - 20, j + dx + 32 + 20, k + dy + 20 - 20, k + dy + 20 + 20);
      Proportionality<CrystalElement> p = text ? null : new Proportionality();
      HashMap<CrystalElement, Integer> colors = text ? null : new HashMap();
      for (CrystalElement e : tag.elementSet()) {
        if (text) {
          String s = e.displayName + ": " + tag.getValue(e) + " L/Vis";
          fontRendererObj.drawString(
              s, dx, dy, ReikaColorAPI.mixColors(e.getColor(), 0xffffff, 0.75F));
          dy += fontRendererObj.FONT_HEIGHT;
        } else {
          p.addValue(e, tag.getValue(e));
          colors.put(e, e.getColor());
        }
      }
      if (!text) {
        p.renderAsPie(dx + 32, dy + 20, 20, 0, colors);
        api.drawCircle(dx + 32, dy + 20, 20.25, 0x000000);
      }
    }
  }
コード例 #2
0
  private void renderGlow(
      TileEntityChromaLamp te, double par2, double par4, double par6, float par8) {
    ElementTagCompound tag = te.getColors();
    Tessellator v5 = Tessellator.instance;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LIGHTING);
    BlendMode.ADDITIVEDARK.apply();
    ReikaTextureHelper.bindTexture(ChromatiCraft.class, "Textures/clouds/bubble.png");
    int tick = te.getTicksExisted();
    double s = 0.3875;
    double h = 0.875;

    for (CrystalElement e : tag.elementSet()) {
      GL11.glPushMatrix();
      double ang = Math.toRadians(map[e.ordinal()]);
      double ang2 = e.ordinal() * 22.5;
      double vu = Math.cos(ang);
      double vv = Math.sin(ang);
      int alpha = Math.max(0, (int) (255 * Math.sin(Math.toRadians(ang2 + tick + par8))));
      double u = (vu * (tick) % 32) / 32D;
      double v = (vv * (tick) % 32) / 32D;
      double du = 1 + u;
      double dv = 1 + v;
      int color = ReikaColorAPI.mixColors(e.getColor(), 0, alpha / 255F);
      v5.startDrawingQuads();
      v5.setColorOpaque_I(color);
      v5.setBrightness(240);
      v5.addVertexWithUV(0.5 - s, h, 0.5 - s, u, dv);
      v5.addVertexWithUV(0.5 + s, h, 0.5 - s, du, dv);
      v5.addVertexWithUV(0.5 + s, 0, 0.5 - s, du, v);
      v5.addVertexWithUV(0.5 - s, 0, 0.5 - s, u, v);

      v5.addVertexWithUV(0.5 - s, 0, 0.5 + s, du, v);
      v5.addVertexWithUV(0.5 + s, 0, 0.5 + s, u, v);
      v5.addVertexWithUV(0.5 + s, h, 0.5 + s, u, dv);
      v5.addVertexWithUV(0.5 - s, h, 0.5 + s, du, dv);

      v5.addVertexWithUV(0.5 + s, h, 0.5 - s, u, dv);
      v5.addVertexWithUV(0.5 + s, h, 0.5 + s, du, dv);
      v5.addVertexWithUV(0.5 + s, 0, 0.5 + s, du, v);
      v5.addVertexWithUV(0.5 + s, 0, 0.5 - s, u, v);

      v5.addVertexWithUV(0.5 - s, 0, 0.5 - s, du, v);
      v5.addVertexWithUV(0.5 - s, 0, 0.5 + s, u, v);
      v5.addVertexWithUV(0.5 - s, h, 0.5 + s, u, dv);
      v5.addVertexWithUV(0.5 - s, h, 0.5 - s, du, dv);
      v5.draw();
      GL11.glPopMatrix();
    }
    BlendMode.DEFAULT.apply();
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
  }