private final void drawGraphics() {
    int posX = (width - xSize) / 2 - 2;
    int posY = (height - ySize) / 2 - 8;

    ReikaRenderHelper.disableLighting();
    int msx = ReikaGuiAPI.instance.getMouseRealX();
    int msy = ReikaGuiAPI.instance.getMouseRealY();

    this.drawAuxGraphics(posX, posY);
  }
 private void renderLiquid(TileEntity tile, double par2, double par4, double par6) {
   GL11.glTranslated(par2, par4, par6);
   TileEntityFillingStation tr = (TileEntityFillingStation) tile;
   double dx = 0;
   double dz = 0;
   double ddx = 0;
   double ddz = 0;
   switch (tr.getBlockMetadata()) {
     case 0:
       dx = 0.25;
       break;
     case 1:
       ddx = 0.25;
       break;
     case 2:
       dz = 0.25;
       break;
     case 3:
       ddz = 0.25;
       break;
   }
   if (!tr.isEmpty() && tr.isInWorld()) {
     Fluid f = tr.getFluid();
     if (!f.equals(FluidRegistry.LAVA)) {
       GL11.glEnable(GL11.GL_BLEND);
     }
     ReikaLiquidRenderer.bindFluidTexture(f);
     IIcon ico = f.getIcon();
     float u = ico.getMinU();
     float v = ico.getMinV();
     float du = ico.getMaxU();
     float dv = ico.getMaxV();
     double h = 0.0625 + 14D / 16D * tr.getLevel() / tr.CAPACITY;
     Tessellator v5 = Tessellator.instance;
     if (f.getLuminosity() > 0) ReikaRenderHelper.disableLighting();
     v5.startDrawingQuads();
     v5.setNormal(0, 1, 0);
     v5.addVertexWithUV(dx + 0, h, -ddz + 1, u, dv);
     v5.addVertexWithUV(-ddx + 1, h, -ddz + 1, du, dv);
     v5.addVertexWithUV(-ddx + 1, h, dz + 0, du, v);
     v5.addVertexWithUV(dx + 0, h, dz + 0, u, v);
     v5.draw();
     ReikaRenderHelper.enableLighting();
   }
   GL11.glTranslated(-par2, -par4, -par6);
   GL11.glDisable(GL11.GL_BLEND);
 }
Ejemplo n.º 3
0
  private void renderLiquid(
      TileEntityPiping tile, double par2, double par4, double par6, ForgeDirection dir) {
    if (!tile.hasLiquid()) return;
    float size = 0.75F / 2F;
    float window = 0.5F / 2F;
    float dl = size - window;
    float dd = 0.5F - size;
    double in = 0.5 + size - 0.01;
    double in2 = 0.5 - size + 0.01;
    double dd2 = in - in2;

    Fluid f = tile.getLiquidType();
    if (f == null) return;
    Icon ico = tile.getLiquidType().getIcon();
    ReikaLiquidRenderer.bindFluidTexture(f);
    if (f.getLuminosity() > 0) ReikaRenderHelper.disableLighting();
    float u = ico.getMinU();
    float v = ico.getMinV();
    float u2 = ico.getMaxU();
    float v2 = ico.getMaxV();
    double du = dd2 * (u2 - u) / 4D;

    GL11.glTranslated(par2, par4, par6);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor3f(1, 1, 1);

    Tessellator v5 = new Tessellator();
    v5.startDrawingQuads();
    v5.setNormal(dir.offsetX, dir.offsetY, dir.offsetZ);
    // this.faceBrightness(ForgeDirection.DOWN, v5);
    if (!tile.isConnectionValidForSide(dir)) {
      switch (dir) {
        case UP:
          v5.addVertexWithUV(in2, in, in, u, v2);
          v5.addVertexWithUV(in, in, in, u2, v2);
          v5.addVertexWithUV(in, in, in2, u2, v);
          v5.addVertexWithUV(in2, in, in2, u, v);
          break;
        case DOWN:
          v5.addVertexWithUV(in2, in2, in2, u, v);
          v5.addVertexWithUV(in, in2, in2, u2, v);
          v5.addVertexWithUV(in, in2, in, u2, v2);
          v5.addVertexWithUV(in2, in2, in, u, v2);
          break;
        case SOUTH:
          v5.addVertexWithUV(in, in, in, u, v);
          v5.addVertexWithUV(in2, in, in, u2, v);
          v5.addVertexWithUV(in2, in2, in, u2, v2);
          v5.addVertexWithUV(in, in2, in, u, v2);
          break;
        case NORTH:
          v5.addVertexWithUV(in, in2, in2, u, v2);
          v5.addVertexWithUV(in2, in2, in2, u2, v2);
          v5.addVertexWithUV(in2, in, in2, u2, v);
          v5.addVertexWithUV(in, in, in2, u, v);
          break;
        case EAST:
          v5.addVertexWithUV(in, in2, in, u, v2);
          v5.addVertexWithUV(in, in2, in2, u2, v2);
          v5.addVertexWithUV(in, in, in2, u2, v);
          v5.addVertexWithUV(in, in, in, u, v);
          break;
        case WEST:
          v5.addVertexWithUV(in2, in, in, u, v);
          v5.addVertexWithUV(in2, in, in2, u2, v);
          v5.addVertexWithUV(in2, in2, in2, u2, v2);
          v5.addVertexWithUV(in2, in2, in, u, v2);
        default:
          break;
      }
    } else { // is connected on side
      switch (dir) {
        case DOWN:
          v5.setNormal(-1, 0, 0);
          v5.addVertexWithUV(in2, in2, in, u, v);
          v5.addVertexWithUV(in2, in2, in2, u2, v);
          v5.addVertexWithUV(in2, 0, in2, u2, v + du);
          v5.addVertexWithUV(in2, 0, in, u, v + du);

          v5.setNormal(1, 0, 0);
          v5.addVertexWithUV(in, 0, in, u, v + du);
          v5.addVertexWithUV(in, 0, in2, u2, v + du);
          v5.addVertexWithUV(in, in2, in2, u2, v);
          v5.addVertexWithUV(in, in2, in, u, v);

          v5.setNormal(0, 0, -1);
          v5.addVertexWithUV(in, 0, in2, u, v + du);
          v5.addVertexWithUV(in2, 0, in2, u2, v + du);
          v5.addVertexWithUV(in2, in2, in2, u2, v);
          v5.addVertexWithUV(in, in2, in2, u, v);

          v5.setNormal(0, 0, 1);
          v5.addVertexWithUV(in, in2, in, u, v);
          v5.addVertexWithUV(in2, in2, in, u2, v);
          v5.addVertexWithUV(in2, 0, in, u2, v + du);
          v5.addVertexWithUV(in, 0, in, u, v + du);
          break;
        case UP:
          v5.setNormal(-1, 0, 0);
          v5.addVertexWithUV(in2, 1, in, u, v + du);
          v5.addVertexWithUV(in2, 1, in2, u2, v + du);
          v5.addVertexWithUV(in2, in, in2, u2, v);
          v5.addVertexWithUV(in2, in, in, u, v);

          v5.setNormal(1, 0, 0);
          v5.addVertexWithUV(in, in, in, u, v);
          v5.addVertexWithUV(in, in, in2, u2, v);
          v5.addVertexWithUV(in, 1, in2, u2, v + du);
          v5.addVertexWithUV(in, 1, in, u, v + du);

          v5.setNormal(0, 0, -1);
          v5.addVertexWithUV(in, in, in2, u, v);
          v5.addVertexWithUV(in2, in, in2, u2, v);
          v5.addVertexWithUV(in2, 1, in2, u2, v + du);
          v5.addVertexWithUV(in, 1, in2, u, v + du);

          v5.setNormal(0, 0, 1);
          v5.addVertexWithUV(in, 1, in, u, v + du);
          v5.addVertexWithUV(in2, 1, in, u2, v + du);
          v5.addVertexWithUV(in2, in, in, u2, v);
          v5.addVertexWithUV(in, in, in, u, v);
          break;
        case NORTH:
          v5.setNormal(-1, 0, 0);
          v5.addVertexWithUV(in2, in2, 0, u, v2);
          v5.addVertexWithUV(in2, in2, in2, u + du, v2);
          v5.addVertexWithUV(in2, in, in2, u + du, v);
          v5.addVertexWithUV(in2, in, 0, u, v);

          v5.setNormal(1, 0, 0);
          v5.addVertexWithUV(in, in, 0, u, v);
          v5.addVertexWithUV(in, in, in2, u + du, v);
          v5.addVertexWithUV(in, in2, in2, u + du, v2);
          v5.addVertexWithUV(in, in2, 0, u, v2);

          v5.setNormal(0, 1, 0);
          v5.addVertexWithUV(in2, in, 0, u, v2);
          v5.addVertexWithUV(in2, in, in2, u + du, v2);
          v5.addVertexWithUV(in, in, in2, u + du, v);
          v5.addVertexWithUV(in, in, 0, u, v);

          v5.setNormal(0, -1, 0);
          v5.addVertexWithUV(in, in2, 0, u, v);
          v5.addVertexWithUV(in, in2, in2, u + du, v);
          v5.addVertexWithUV(in2, in2, in2, u + du, v2);
          v5.addVertexWithUV(in2, in2, 0, u, v2);
          break;
        case SOUTH:
          v5.setNormal(-1, 0, 0);
          v5.addVertexWithUV(in2, in, 1, u, v);
          v5.addVertexWithUV(in2, in, in, u + du, v);
          v5.addVertexWithUV(in2, in2, in, u + du, v2);
          v5.addVertexWithUV(in2, in2, 1, u, v2);

          v5.setNormal(1, 0, 0);
          v5.addVertexWithUV(in, in2, 1, u, v2);
          v5.addVertexWithUV(in, in2, in, u + du, v2);
          v5.addVertexWithUV(in, in, in, u + du, v);
          v5.addVertexWithUV(in, in, 1, u, v);

          v5.setNormal(0, 1, 0);
          v5.addVertexWithUV(in, in, 1, u, v);
          v5.addVertexWithUV(in, in, in, u + du, v);
          v5.addVertexWithUV(in2, in, in, u + du, v2);
          v5.addVertexWithUV(in2, in, 1, u, v2);

          v5.setNormal(0, -1, 0);
          v5.addVertexWithUV(in2, in2, 1, u, v2);
          v5.addVertexWithUV(in2, in2, in, u + du, v2);
          v5.addVertexWithUV(in, in2, in, u + du, v);
          v5.addVertexWithUV(in, in2, 1, u, v);
          break;
        case EAST:
          v5.setNormal(0, 0, 1);
          v5.addVertexWithUV(1, in, in, u, v);
          v5.addVertexWithUV(in, in, in, u + du, v);
          v5.addVertexWithUV(in, in2, in, u + du, v2);
          v5.addVertexWithUV(1, in2, in, u, v2);

          v5.setNormal(0, 0, -1);
          v5.addVertexWithUV(1, in2, in2, u, v2);
          v5.addVertexWithUV(in, in2, in2, u + du, v2);
          v5.addVertexWithUV(in, in, in2, u + du, v);
          v5.addVertexWithUV(1, in, in2, u, v);

          v5.setNormal(0, 1, 0);
          v5.addVertexWithUV(1, in, in2, u, v2);
          v5.addVertexWithUV(in, in, in2, u + du, v2);
          v5.addVertexWithUV(in, in, in, u + du, v);
          v5.addVertexWithUV(1, in, in, u, v);

          v5.setNormal(0, -1, 0);
          v5.addVertexWithUV(1, in2, in, u, v);
          v5.addVertexWithUV(in, in2, in, u + du, v);
          v5.addVertexWithUV(in, in2, in2, u + du, v2);
          v5.addVertexWithUV(1, in2, in2, u, v2);
          break;
        case WEST:
          v5.setNormal(0, 0, 1);
          v5.addVertexWithUV(0, in2, in, u, v2);
          v5.addVertexWithUV(in2, in2, in, u + du, v2);
          v5.addVertexWithUV(in2, in, in, u + du, v);
          v5.addVertexWithUV(0, in, in, u, v);

          v5.setNormal(0, 0, -1);
          v5.addVertexWithUV(0, in, in2, u, v);
          v5.addVertexWithUV(in2, in, in2, u + du, v);
          v5.addVertexWithUV(in2, in2, in2, u + du, v2);
          v5.addVertexWithUV(0, in2, in2, u, v2);

          v5.setNormal(0, 1, 0);
          v5.addVertexWithUV(0, in, in, u, v);
          v5.addVertexWithUV(in2, in, in, u + du, v);
          v5.addVertexWithUV(in2, in, in2, u + du, v2);
          v5.addVertexWithUV(0, in, in2, u, v2);

          v5.setNormal(0, -1, 0);
          v5.addVertexWithUV(0, in2, in2, u, v2);
          v5.addVertexWithUV(in2, in2, in2, u + du, v2);
          v5.addVertexWithUV(in2, in2, in, u + du, v);
          v5.addVertexWithUV(0, in2, in, u, v);
          break;
        default:
          break;
      }
    }
    if (tile.isConnectedToNonSelf(dir)) {
      v5.setNormal(dir.offsetX, dir.offsetY, dir.offsetZ);
      switch (dir) {
        case UP:
          v5.addVertexWithUV(in2, 0.99, in, u, v2);
          v5.addVertexWithUV(in, 0.99, in, u2, v2);
          v5.addVertexWithUV(in, 0.99, in2, u2, v);
          v5.addVertexWithUV(in2, 0.99, in2, u, v);
          break;
        case DOWN:
          v5.addVertexWithUV(in2, 0.01, in2, u, v);
          v5.addVertexWithUV(in, 0.01, in2, u2, v);
          v5.addVertexWithUV(in, 0.01, in, u2, v2);
          v5.addVertexWithUV(in2, 0.01, in, u, v2);
          break;
        case SOUTH:
          v5.addVertexWithUV(in, in, 0.99, u, v);
          v5.addVertexWithUV(in2, in, 0.99, u2, v);
          v5.addVertexWithUV(in2, in2, 0.99, u2, v2);
          v5.addVertexWithUV(in, in2, 0.99, u, v2);
          break;
        case NORTH:
          v5.addVertexWithUV(in, in2, 0.01, u, v2);
          v5.addVertexWithUV(in2, in2, 0.01, u2, v2);
          v5.addVertexWithUV(in2, in, 0.01, u2, v);
          v5.addVertexWithUV(in, in, 0.01, u, v);
          break;
        case EAST:
          v5.addVertexWithUV(0.99, in2, in, u, v2);
          v5.addVertexWithUV(0.99, in2, in2, u2, v2);
          v5.addVertexWithUV(0.99, in, in2, u2, v);
          v5.addVertexWithUV(0.99, in, in, u, v);
          break;
        case WEST:
          v5.addVertexWithUV(0.01, in, in, u, v);
          v5.addVertexWithUV(0.01, in, in2, u2, v);
          v5.addVertexWithUV(0.01, in2, in2, u2, v2);
          v5.addVertexWithUV(0.01, in2, in, u, v2);
        default:
          break;
      }
    }
    v5.draw();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    ReikaRenderHelper.enableLighting();
    GL11.glTranslated(-par2, -par4, -par6);
    GL11.glDisable(GL11.GL_BLEND);
  }
Ejemplo n.º 4
0
  private final void drawGraphics(float ptick) {
    int posX = (width - xSize) / 2 - 2;
    int posY = (height - ySize) / 2 - 8;

    if (!this.isLimitedView()) {
      ReikaRenderHelper.disableLighting();
      int msx = ReikaGuiAPI.instance.getMouseRealX();
      int msy = ReikaGuiAPI.instance.getMouseRealY();
      String s = String.format("Page %d/%d", screen, this.getMaxScreen());
      // ReikaGuiAPI.instance.drawCenteredStringNoShadow(fontRendererObj, s, posX+xSize+23, posY+5,
      // 0xffffff);
      ReikaGuiAPI.instance.drawTooltipAt(
          fontRendererObj, s, posX + 24 + xSize + fontRendererObj.getStringWidth(s), posY + 20);
      if (ReikaGuiAPI.instance.isMouseInBox(posX - 18, posX + 2, posY + 0, posY + 220)) {
        String sg = "";
        List<HandbookEntry> li = this.getAllTabsOnScreen();
        int idx = (msy - posY) / 20;
        if (idx >= PAGES_PER_SCREEN) {
          int diff = idx - PAGES_PER_SCREEN;
          switch (diff) {
            case 0:
              sg = "Next";
              break;
            case 1:
              sg = "Back";
              break;
            case 2:
              sg = "Return";
              break;
          }
        } else if (idx < li.size()) {
          HandbookEntry h = li.get(idx);
          sg = h.getTitle();
        }
        if (!sg.isEmpty())
          ReikaGuiAPI.instance.drawTooltipAt(
              fontRendererObj, sg, msx + fontRendererObj.getStringWidth(sg) + 30, msy);
      }
    }

    if (HandbookNotifications.instance.newAlerts()
        || PackModificationTracker.instance.modificationsExist(RotaryCraft.instance)) {
      ReikaTextureHelper.bindFinalTexture(DragonAPICore.class, "Resources/warning.png");
      GL11.glEnable(GL11.GL_BLEND);
      Tessellator v5 = Tessellator.instance;
      int x = posX + 257;
      int y = posY + 18;
      int alpha =
          (int) (155 + 100 * Math.sin(Math.toRadians(System.currentTimeMillis() / 8 % 360)));
      v5.startDrawingQuads();
      v5.setColorRGBA_I(0xffffff, alpha);
      v5.addVertexWithUV(x, y + 24, 0, 0, 1);
      v5.addVertexWithUV(x + 24, y + 24, 0, 1, 1);
      v5.addVertexWithUV(x + 24, y, 0, 1, 0);
      v5.addVertexWithUV(x, y, 0, 0, 0);
      v5.draw();
      GL11.glDisable(GL11.GL_BLEND);

      int i = Mouse.getX() * width / mc.displayWidth;
      int j = height - Mouse.getY() * height / mc.displayHeight - 1;
      int dx = i - posX;
      int dy = j - posY;
      if (ReikaMathLibrary.isValueInsideBoundsIncl(261, 377, dx)
          && ReikaMathLibrary.isValueInsideBoundsIncl(22, 36, dy)) {
        if (HandbookNotifications.instance.newAlerts())
          ReikaGuiAPI.instance.drawTooltip(
              fontRendererObj, "Some config settings have been changed.");
        if (PackModificationTracker.instance.modificationsExist(RotaryCraft.instance))
          ReikaGuiAPI.instance.drawTooltip(
              fontRendererObj, "The modpack has made some changes to the mod.", 0, 10);
      }
    }

    this.drawAuxGraphics(posX, posY, ptick);
  }