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);
 }
示例#2
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);
  }