Ejemplo n.º 1
0
public class OpenGLUtils {

  private static IntBuffer viewport = GLAllocation.createDirectIntBuffer(16);

  private static FloatBuffer modelview = GLAllocation.createDirectFloatBuffer(16);

  private static FloatBuffer projection = GLAllocation.createDirectFloatBuffer(16);

  private static FloatBuffer objectCoords = GLAllocation.createDirectFloatBuffer(3);

  public static void updateMatrices() {
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
    GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
    GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);
  }

  public static Vec3 unproject(float winX, float winY, float winZ) {
    GLU.gluUnProject(winX, winY, winZ, modelview, projection, viewport, objectCoords);

    float objectX = objectCoords.get(0);
    float objectY = objectCoords.get(1);
    float objectZ = objectCoords.get(2);

    return Vec3.createVectorHelper(objectX, objectY, objectZ);
  }
}
Ejemplo n.º 2
0
  @SubscribeEvent
  @SideOnly(Side.CLIENT)
  public void renderLast(RenderWorldLastEvent evt) {
    // TODO: while the urbanist is deactivated, this code can be dormant.
    // it happens to be very expensive at run time, so we need some way
    // to operate it only when relevant (e.g. in the cycle following a
    // click request).
    if (NONRELEASED_BLOCKS) {
      return;
    }

    /**
     * Note (SpaceToad): Why on earth this thing eventually worked out is a mystery to me. In
     * particular, all the examples I got computed y in a different way. Anyone with further OpenGL
     * understanding would be welcome to explain.
     *
     * <p>Anyway, the purpose of this code is to store the block position pointed by the mouse at
     * each frame, relative to the entity that has the camera.
     *
     * <p>It got heavily inspire from the two following sources:
     * http://nehe.gamedev.net/article/using_gluunproject/16013/ #ActiveRenderInfo.updateRenderInfo.
     *
     * <p>See EntityUrbanist#rayTraceMouse for a usage example.
     */
    if (modelviewF == null) {
      modelviewF = GLAllocation.createDirectFloatBuffer(16);
      projectionF = GLAllocation.createDirectFloatBuffer(16);
      viewport = GLAllocation.createDirectIntBuffer(16);
    }

    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelviewF);
    GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projectionF);
    GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);
    float f = (viewport.get(0) + viewport.get(2)) / 2;
    float f1 = (viewport.get(1) + viewport.get(3)) / 2;

    float x = Mouse.getX();
    float y = Mouse.getY();

    // TODO: Minecraft seems to instist to have this winZ re-created at
    // each frame - looks like a memory leak to me but I couldn't use a
    // static variable instead, as for the rest.
    FloatBuffer winZ = GLAllocation.createDirectFloatBuffer(1);
    GL11.glReadPixels((int) x, (int) y, 1, 1, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, winZ);

    GLU.gluUnProject(x, y, winZ.get(), modelviewF, projectionF, viewport, pos);

    diffX = pos.get(0);
    diffY = pos.get(1);
    diffZ = pos.get(2);
  }
Ejemplo n.º 3
0
  private void compileDisplayList(float f) {
    displayList = GLAllocation.generateDisplayLists(1);
    GL11.glNewList(displayList, 4864 /*GL_COMPILE*/);
    Tessellator tessellator = Tessellator.getInstance(); // Tessellator.instance;
    for (int i = 0; i < faces.length; i++) {
      faces[i].func_808_a(tessellator, f);
    }

    GL11.glEndList();
    compiled = true;
  }
Ejemplo n.º 4
0
  private static void initialize() {
    if (!initialized) {
      initialized = true;

      starGLCallList = GLAllocation.generateDisplayLists(3);
      GL11.glPushMatrix();
      GL11.glNewList(starGLCallList, GL11.GL_COMPILE);
      renderStars();
      GL11.glEndList();
      GL11.glPopMatrix();
      Tessellator tessellator = Tessellator.instance;
      glSkyList = starGLCallList + 1;
      GL11.glNewList(glSkyList, GL11.GL_COMPILE);
      byte b2 = 64;
      int i = 256 / b2 + 2;
      float f = 16.0F;
      int j;
      int k;

      for (j = -b2 * i; j <= b2 * i; j += b2) {
        for (k = -b2 * i; k <= b2 * i; k += b2) {
          tessellator.startDrawingQuads();
          tessellator.addVertex((j + 0), f, (k + 0));
          tessellator.addVertex((j + b2), f, (k + 0));
          tessellator.addVertex((j + b2), f, (k + b2));
          tessellator.addVertex((j + 0), f, (k + b2));
          tessellator.draw();
        }
      }

      GL11.glEndList();
      glSkyList2 = starGLCallList + 2;
      GL11.glNewList(glSkyList2, GL11.GL_COMPILE);
      f = -16.0F;
      tessellator.startDrawingQuads();

      for (j = -b2 * i; j <= b2 * i; j += b2) {
        for (k = -b2 * i; k <= b2 * i; k += b2) {
          tessellator.addVertex((j + b2), f, (k + 0));
          tessellator.addVertex((j + 0), f, (k + 0));
          tessellator.addVertex((j + 0), f, (k + b2));
          tessellator.addVertex((j + b2), f, (k + b2));
        }
      }

      tessellator.draw();
      GL11.glEndList();
    }
  }
public class GCPlutoSkyProvider extends IRenderHandler {
  private static final ResourceLocation neptuneTexture =
      new ResourceLocation(GCPluto.TEXTURE_DOMAIN, "textures/gui/planets/neptune.png");
  private static final ResourceLocation sunTexture =
      new ResourceLocation(GCPluto.TEXTURE_DOMAIN, "textures/gui/planets/sun.png");

  public int starGLCallList = GLAllocation.generateDisplayLists(3);
  public int glSkyList;
  public int glSkyList2;

  public GCPlutoSkyProvider() {
    GL11.glPushMatrix();
    GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE);
    this.renderStars();
    GL11.glEndList();
    GL11.glPopMatrix();
    final Tessellator tessellator = Tessellator.instance;
    this.glSkyList = this.starGLCallList + 1;
    GL11.glNewList(this.glSkyList, GL11.GL_COMPILE);
    final byte byte2 = 64;
    final int i = 256 / byte2 + 2;
    float f = 16F;

    for (int j = -byte2 * i; j <= byte2 * i; j += byte2) {
      for (int l = -byte2 * i; l <= byte2 * i; l += byte2) {
        tessellator.startDrawingQuads();
        tessellator.addVertex(j + 0, f, l + 0);
        tessellator.addVertex(j + byte2, f, l + 0);
        tessellator.addVertex(j + byte2, f, l + byte2);
        tessellator.addVertex(j + 0, f, l + byte2);
        tessellator.draw();
      }
    }

    GL11.glEndList();
    this.glSkyList2 = this.starGLCallList + 2;
    GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE);
    f = -16F;
    tessellator.startDrawingQuads();

    for (int k = -byte2 * i; k <= byte2 * i; k += byte2) {
      for (int i1 = -byte2 * i; i1 <= byte2 * i; i1 += byte2) {
        tessellator.addVertex(k + byte2, f, i1 + 0);
        tessellator.addVertex(k + 0, f, i1 + 0);
        tessellator.addVertex(k + 0, f, i1 + byte2);
        tessellator.addVertex(k + byte2, f, i1 + byte2);
      }
    }

    tessellator.draw();
    GL11.glEndList();
  }

  @Override
  public void render(float partialTicks, WorldClient world, Minecraft mc) {
    GCPlutoWorldProvider gcProvider = null;

    if (world.provider instanceof GCPlutoWorldProvider) {
      gcProvider = (GCPlutoWorldProvider) world.provider;
    }

    float var10;
    float var11;
    float var12;
    final Tessellator var23 = Tessellator.instance;

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    final Vec3 var2 = this.getCustomSkyColor();
    float var3 = (float) var2.xCoord * (1 - world.getStarBrightness(partialTicks) * 2);
    float var4 = (float) var2.yCoord * (1 - world.getStarBrightness(partialTicks) * 2);
    float var5 = (float) var2.zCoord * (1 - world.getStarBrightness(partialTicks) * 2);
    float var8;

    if (mc.gameSettings.anaglyph) {
      final float var6 = (var3 * 30.0F + var4 * 59.0F + var5 * 11.0F) / 100.0F;
      final float var7 = (var3 * 30.0F + var4 * 70.0F) / 100.0F;
      var8 = (var3 * 30.0F + var5 * 70.0F) / 100.0F;
      var3 = var6;
      var4 = var7;
      var5 = var8;
    }

    GL11.glColor3f(1, 1, 1);
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(0, 0, 0);
    GL11.glCallList(this.glSkyList);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.disableStandardItemLighting();

    float var20 = 0;

    if (gcProvider != null) {
      var20 = gcProvider.getStarBrightness(partialTicks);
    }

    GL11.glPushMatrix();

    GL11.glDisable(GL11.GL_BLEND);

    GL11.glEnable(GL11.GL_TEXTURE_2D);

    // STARS:
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();

    if (var20 > 0.0F) {
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, var20);
      GL11.glCallList(this.starGLCallList);
      GL11.glEnable(GL11.GL_TEXTURE_2D);
    }

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);

    GL11.glPushMatrix();

    // Sun:
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
    var12 = 30.0F;
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(GCPlutoSkyProvider.sunTexture);
    var23.startDrawingQuads();
    var23.addVertexWithUV(-var12, 150.0D, -var12, 0.0D, 0.0D);
    var23.addVertexWithUV(var12, 150.0D, -var12, 1.0D, 0.0D);
    var23.addVertexWithUV(var12, 150.0D, var12, 1.0D, 1.0D);
    var23.addVertexWithUV(-var12, 150.0D, var12, 0.0D, 1.0D);
    var23.draw();

    GL11.glPopMatrix();

    GL11.glPushMatrix();

    GL11.glDisable(GL11.GL_BLEND);

    // NEPTUNE:
    var12 = 0.5F;
    GL11.glScalef(0.6F, 0.6F, 0.6F);
    GL11.glRotatef(40.0F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(200F, 1.0F, 0.0F, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F);
    FMLClientHandler.instance()
        .getClient()
        .renderEngine
        .bindTexture(GCPlutoSkyProvider.neptuneTexture);
    var23.startDrawingQuads();
    var23.addVertexWithUV(-var12, -100.0D, var12, 0, 1);
    var23.addVertexWithUV(var12, -100.0D, var12, 1, 1);
    var23.addVertexWithUV(var12, -100.0D, -var12, 1, 0);
    var23.addVertexWithUV(-var12, -100.0D, -var12, 0, 0);
    var23.draw();

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor3f(0.0F, 0.0F, 0.0F);
    final double var25 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon();

    if (var25 < 0.0D) {
      GL11.glPushMatrix();
      GL11.glTranslatef(0.0F, 12.0F, 0.0F);
      GL11.glCallList(this.glSkyList2);
      GL11.glPopMatrix();
      var10 = 1.0F;
      var11 = -((float) (var25 + 65.0D));
      var12 = -var10;
      var23.startDrawingQuads();
      var23.setColorRGBA_I(0, 255);
      var23.addVertex(-var10, var11, var10);
      var23.addVertex(var10, var11, var10);
      var23.addVertex(var10, var12, var10);
      var23.addVertex(-var10, var12, var10);
      var23.addVertex(-var10, var12, -var10);
      var23.addVertex(var10, var12, -var10);
      var23.addVertex(var10, var11, -var10);
      var23.addVertex(-var10, var11, -var10);
      var23.addVertex(var10, var12, -var10);
      var23.addVertex(var10, var12, var10);
      var23.addVertex(var10, var11, var10);
      var23.addVertex(var10, var11, -var10);
      var23.addVertex(-var10, var11, -var10);
      var23.addVertex(-var10, var11, var10);
      var23.addVertex(-var10, var12, var10);
      var23.addVertex(-var10, var12, -var10);
      var23.addVertex(-var10, var12, -var10);
      var23.addVertex(-var10, var12, var10);
      var23.addVertex(var10, var12, var10);
      var23.addVertex(var10, var12, -var10);
      var23.draw();
    }

    GL11.glColor3f(70F / 256F, 70F / 256F, 70F / 256F);

    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, -((float) (var25 - 16.0D)), 0.0F);
    GL11.glCallList(this.glSkyList2);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
  }

  private void renderStars() {
    final Random var1 = new Random(10842L);
    final Tessellator var2 = Tessellator.instance;
    var2.startDrawingQuads();

    for (int var3 = 0; var3 < (GCCoreConfigManager.moreStars ? 35000 : 6000); ++var3) {
      double var4 = var1.nextFloat() * 2.0F - 1.0F;
      double var6 = var1.nextFloat() * 2.0F - 1.0F;
      double var8 = var1.nextFloat() * 2.0F - 1.0F;
      final double var10 = 0.15F + var1.nextFloat() * 0.1F;
      double var12 = var4 * var4 + var6 * var6 + var8 * var8;

      if (var12 < 1.0D && var12 > 0.01D) {
        var12 = 1.0D / Math.sqrt(var12);
        var4 *= var12;
        var6 *= var12;
        var8 *= var12;
        final double var14 =
            var4 * (GCCoreConfigManager.moreStars ? var1.nextDouble() * 150D + 130D : 100.0D);
        final double var16 =
            var6 * (GCCoreConfigManager.moreStars ? var1.nextDouble() * 150D + 130D : 100.0D);
        final double var18 =
            var8 * (GCCoreConfigManager.moreStars ? var1.nextDouble() * 150D + 130D : 100.0D);
        final double var20 = Math.atan2(var4, var8);
        final double var22 = Math.sin(var20);
        final double var24 = Math.cos(var20);
        final double var26 = Math.atan2(Math.sqrt(var4 * var4 + var8 * var8), var6);
        final double var28 = Math.sin(var26);
        final double var30 = Math.cos(var26);
        final double var32 = var1.nextDouble() * Math.PI * 2.0D;
        final double var34 = Math.sin(var32);
        final double var36 = Math.cos(var32);

        for (int var38 = 0; var38 < 4; ++var38) {
          final double var39 = 0.0D;
          final double var41 = ((var38 & 2) - 1) * var10;
          final double var43 = ((var38 + 1 & 2) - 1) * var10;
          final double var47 = var41 * var36 - var43 * var34;
          final double var49 = var43 * var36 + var41 * var34;
          final double var53 = var47 * var28 + var39 * var30;
          final double var55 = var39 * var28 - var47 * var30;
          final double var57 = var55 * var22 - var49 * var24;
          final double var61 = var49 * var22 + var55 * var24;
          var2.addVertex(var14 + var57, var16 + var53, var18 + var61);
        }
      }
    }

    var2.draw();
  }

  private Vec3 getCustomSkyColor() {
    return Vec3.fakePool.getVecFromPool(0.26796875D, 0.1796875D, 0.0D);
  }

  public float getSkyBrightness(float par1) {
    final float var2 = FMLClientHandler.instance().getClient().theWorld.getCelestialAngle(par1);
    float var3 = 1.0F - (MathHelper.sin(var2 * (float) Math.PI * 2.0F) * 2.0F + 0.25F);

    if (var3 < 0.0F) {
      var3 = 0.0F;
    }

    if (var3 > 1.0F) {
      var3 = 1.0F;
    }

    return var3 * var3 * 1F;
  }
}
Ejemplo n.º 6
0
@SideOnly(Side.CLIENT)
public class RenderDimDoor extends TileEntitySpecialRenderer {
  FloatBuffer field_76908_a = GLAllocation.createDirectFloatBuffer(16);

  public RenderDimDoor() {
    if (properties == null) properties = DDProperties.instance();
  }

  private static DDProperties properties = null;

  /** Renders the dimdoor. */
  public void renderDimDoorTileEntity(
      TileEntityDimDoor tile, double x, double y, double z, float par8) {
    try {
      dimDoor
          .class
          .cast(Block.blocksList[properties.DimensionalDoorID])
          .updateAttatchedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord)
          .getFullMetadata(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord);

    } catch (Exception e) {

      e.printStackTrace();
    }

    // float playerX = (float)this.tileEntityRenderer.playerX;
    // float playerY = (float)this.tileEntityRenderer.playerY;
    // float playerZ = (float)this.tileEntityRenderer.playerZ;

    // float distance = (float) tile.getDistanceFrom(playerX, playerY, playerZ);
    GL11.glDisable(GL11.GL_LIGHTING);
    Random rand = new Random(31100L);
    float var13 = 0.75F;

    for (int count = 0; count < 16; ++count) {
      GL11.glPushMatrix();
      float var15 = (float) (16 - count);
      float var16 = 0.2625F;
      float var17 = 1.0F / (var15 + 1.0F);

      if (count == 0) {
        this.bindTextureByName("/RIFT.png");
        var17 = 0.1F;
        var15 = 25.0F;
        var16 = 0.125F;
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
      }

      if (count == 1) {
        this.bindTextureByName("/WARP.png");
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
        var16 = .5F;
      }

      float startY = (float) (+(y + (double) var13));
      float ratioY = startY + ActiveRenderInfo.objectY;
      float ratioY2 = startY + var15 + ActiveRenderInfo.objectY;
      float yConverted = ratioY / ratioY2;

      float startZ = (float) (+(z + (double) var13));
      float ratioZ = startZ + ActiveRenderInfo.objectZ;
      float ratioZ2 = startZ + var15 + ActiveRenderInfo.objectZ;
      float zConverted = ratioZ / ratioZ2;

      float startX = (float) (+(x + (double) var13));
      float ratioX = startX + ActiveRenderInfo.objectX;
      float ratioX2 = startX + var15 + ActiveRenderInfo.objectX;
      float xConverted = ratioX / ratioX2;

      yConverted += (float) (y + (double) var13);
      xConverted += (float) (x + (double) var13);
      zConverted += (float) (z + (double) var13);

      GL11.glTranslatef((float) (Minecraft.getSystemTime() % 200000L) / 200000.0F, 0, 0.0F);
      GL11.glTranslatef(0, (float) (Minecraft.getSystemTime() % 200000L) / 200000.0F, 0.0F);

      GL11.glTranslatef(0, 0, (float) (Minecraft.getSystemTime() % 200000L) / 200000.0F);

      GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
      GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
      GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
      GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
      switch ((tile.orientation % 4) + 4) {
        case 4:
          GL11.glTexGen(
              GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
          GL11.glTexGen(
              GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));

          break;
        case 5:
          GL11.glTexGen(
              GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
          GL11.glTexGen(
              GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
          break;
        case 6:
          GL11.glTexGen(
              GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
          GL11.glTexGen(
              GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));

          break;
        case 7:
          GL11.glTexGen(
              GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
          GL11.glTexGen(
              GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
          break;
      }

      GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
      GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
      GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
      GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
      GL11.glPopMatrix();
      GL11.glMatrixMode(GL11.GL_TEXTURE);
      GL11.glPushMatrix();
      GL11.glLoadIdentity();
      GL11.glTranslatef(
          0.0F, (float) (Minecraft.getSystemTime() % 200000L) / 200000.0F * var15, 0.0F);
      GL11.glScalef(var16, var16, var16);
      GL11.glTranslatef(0.5F, 0.5F, 0.5F);
      GL11.glRotatef((float) (count * count * 4321 + count * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(0.5F, 0.5F, 0.5F);

      Tessellator var24 = Tessellator.instance;
      var24.startDrawingQuads();

      float var21 = rand.nextFloat() * 0.5F + 0.1F;
      float var22 = rand.nextFloat() * 0.4F + 0.4F;
      float var23 = rand.nextFloat() * 0.6F + 0.5F;

      if (count == 0) {
        var23 = 1.0F;
        var22 = 1.0F;
        yConverted = 1.0F;
      }
      var24.setColorRGBA_F(var21 * var17, var22 * var17, var23 * var17, 1.0F);
      if (tile.openOrClosed) {

        switch (tile.orientation) {
          case 0:
            var24.addVertex(x + .01F, y - 1, z);
            var24.addVertex(x + .01, y - 1, z + 1.0D);
            var24.addVertex(x + .01, y + 1, z + 1.0D);
            var24.addVertex(x + .01, y + 1, z);
            break;
          case 1:
            var24.addVertex(x, y + 1, z + .01);
            var24.addVertex(x + 1, y + 1, z + .01);
            var24.addVertex(x + 1, y - 1, z + .01);
            var24.addVertex(x, y - 1, z + .01);

            break;
          case 2: //
            var24.addVertex(x + .99, y + 1, z);
            var24.addVertex(x + .99, y + 1, z + 1.0D);
            var24.addVertex(x + .99, y - 1, z + 1.0D);
            var24.addVertex(x + .99, y - 1, z);
            break;
          case 3:
            var24.addVertex(x, y - 1, z + .99);
            var24.addVertex(x + 1, y - 1, z + .99);
            var24.addVertex(x + 1, y + 1, z + .99);
            var24.addVertex(x, y + 1, z + .99);
            break;
          case 4: //
            //   GL11.glTranslatef();

            var24.addVertex(x + .15F, y - 1, z);
            var24.addVertex(x + .15, y - 1, z + 1.0D);
            var24.addVertex(x + .15, y + 1, z + 1.0D);
            var24.addVertex(x + .15, y + 1, z);
            break;
          case 5:
            var24.addVertex(x, y + 1, z + .15);
            var24.addVertex(x + 1, y + 1, z + .15);
            var24.addVertex(x + 1, y - 1, z + .15);
            var24.addVertex(x, y - 1, z + .15);

            break;
          case 6: //
            var24.addVertex(x + .85, y + 1, z);
            var24.addVertex(x + .85, y + 1, z + 1.0D);
            var24.addVertex(x + .85, y - 1, z + 1.0D);
            var24.addVertex(x + .85, y - 1, z);
            break;
          case 7:
            var24.addVertex(x, y - 1, z + .85);
            var24.addVertex(x + 1, y - 1, z + .85);
            var24.addVertex(x + 1, y + 1, z + .85);
            var24.addVertex(x, y + 1, z + .85);
            break;
          default:
            break;
        }
      }

      var24.draw();

      GL11.glPopMatrix();
      GL11.glMatrixMode(GL11.GL_MODELVIEW);
    }

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_R);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_Q);
    GL11.glEnable(GL11.GL_LIGHTING);
  }

  private FloatBuffer getFloatBuffer(float par1, float par2, float par3, float par4) {
    this.field_76908_a.clear();
    this.field_76908_a.put(par1).put(par2).put(par3).put(par4);
    this.field_76908_a.flip();
    return this.field_76908_a;
  }

  public void renderTileEntityAt(
      TileEntity par1TileEntity, double par2, double par4, double par6, float par8) {
    if (properties.DoorRenderingEnabled) {
      this.renderDimDoorTileEntity((TileEntityDimDoor) par1TileEntity, par2, par4, par6, par8);
    }
  }
}
Ejemplo n.º 7
0
public class ClippingHelperImpl extends ClippingHelper {
  private static ClippingHelperImpl instance = new ClippingHelperImpl();
  private FloatBuffer projectionMatrixBuffer = GLAllocation.createDirectFloatBuffer(16);
  private FloatBuffer modelviewMatrixBuffer = GLAllocation.createDirectFloatBuffer(16);
  private FloatBuffer field_78564_h = GLAllocation.createDirectFloatBuffer(16);
  private static final String __OBFID = "CL_00000975";

  /** Initialises the ClippingHelper object then returns an instance of it. */
  public static ClippingHelper getInstance() {
    instance.init();
    return instance;
  }

  /** Normalize the frustum. */
  private void normalize(float[][] p_78559_1_, int p_78559_2_) {
    float var3 =
        MathHelper.sqrt_float(
            p_78559_1_[p_78559_2_][0] * p_78559_1_[p_78559_2_][0]
                + p_78559_1_[p_78559_2_][1] * p_78559_1_[p_78559_2_][1]
                + p_78559_1_[p_78559_2_][2] * p_78559_1_[p_78559_2_][2]);
    p_78559_1_[p_78559_2_][0] /= var3;
    p_78559_1_[p_78559_2_][1] /= var3;
    p_78559_1_[p_78559_2_][2] /= var3;
    p_78559_1_[p_78559_2_][3] /= var3;
  }

  private void init() {
    this.projectionMatrixBuffer.clear();
    this.modelviewMatrixBuffer.clear();
    this.field_78564_h.clear();
    GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, this.projectionMatrixBuffer);
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, this.modelviewMatrixBuffer);
    this.projectionMatrixBuffer.flip().limit(16);
    this.projectionMatrixBuffer.get(this.projectionMatrix);
    this.modelviewMatrixBuffer.flip().limit(16);
    this.modelviewMatrixBuffer.get(this.modelviewMatrix);
    this.clippingMatrix[0] =
        this.modelviewMatrix[0] * this.projectionMatrix[0]
            + this.modelviewMatrix[1] * this.projectionMatrix[4]
            + this.modelviewMatrix[2] * this.projectionMatrix[8]
            + this.modelviewMatrix[3] * this.projectionMatrix[12];
    this.clippingMatrix[1] =
        this.modelviewMatrix[0] * this.projectionMatrix[1]
            + this.modelviewMatrix[1] * this.projectionMatrix[5]
            + this.modelviewMatrix[2] * this.projectionMatrix[9]
            + this.modelviewMatrix[3] * this.projectionMatrix[13];
    this.clippingMatrix[2] =
        this.modelviewMatrix[0] * this.projectionMatrix[2]
            + this.modelviewMatrix[1] * this.projectionMatrix[6]
            + this.modelviewMatrix[2] * this.projectionMatrix[10]
            + this.modelviewMatrix[3] * this.projectionMatrix[14];
    this.clippingMatrix[3] =
        this.modelviewMatrix[0] * this.projectionMatrix[3]
            + this.modelviewMatrix[1] * this.projectionMatrix[7]
            + this.modelviewMatrix[2] * this.projectionMatrix[11]
            + this.modelviewMatrix[3] * this.projectionMatrix[15];
    this.clippingMatrix[4] =
        this.modelviewMatrix[4] * this.projectionMatrix[0]
            + this.modelviewMatrix[5] * this.projectionMatrix[4]
            + this.modelviewMatrix[6] * this.projectionMatrix[8]
            + this.modelviewMatrix[7] * this.projectionMatrix[12];
    this.clippingMatrix[5] =
        this.modelviewMatrix[4] * this.projectionMatrix[1]
            + this.modelviewMatrix[5] * this.projectionMatrix[5]
            + this.modelviewMatrix[6] * this.projectionMatrix[9]
            + this.modelviewMatrix[7] * this.projectionMatrix[13];
    this.clippingMatrix[6] =
        this.modelviewMatrix[4] * this.projectionMatrix[2]
            + this.modelviewMatrix[5] * this.projectionMatrix[6]
            + this.modelviewMatrix[6] * this.projectionMatrix[10]
            + this.modelviewMatrix[7] * this.projectionMatrix[14];
    this.clippingMatrix[7] =
        this.modelviewMatrix[4] * this.projectionMatrix[3]
            + this.modelviewMatrix[5] * this.projectionMatrix[7]
            + this.modelviewMatrix[6] * this.projectionMatrix[11]
            + this.modelviewMatrix[7] * this.projectionMatrix[15];
    this.clippingMatrix[8] =
        this.modelviewMatrix[8] * this.projectionMatrix[0]
            + this.modelviewMatrix[9] * this.projectionMatrix[4]
            + this.modelviewMatrix[10] * this.projectionMatrix[8]
            + this.modelviewMatrix[11] * this.projectionMatrix[12];
    this.clippingMatrix[9] =
        this.modelviewMatrix[8] * this.projectionMatrix[1]
            + this.modelviewMatrix[9] * this.projectionMatrix[5]
            + this.modelviewMatrix[10] * this.projectionMatrix[9]
            + this.modelviewMatrix[11] * this.projectionMatrix[13];
    this.clippingMatrix[10] =
        this.modelviewMatrix[8] * this.projectionMatrix[2]
            + this.modelviewMatrix[9] * this.projectionMatrix[6]
            + this.modelviewMatrix[10] * this.projectionMatrix[10]
            + this.modelviewMatrix[11] * this.projectionMatrix[14];
    this.clippingMatrix[11] =
        this.modelviewMatrix[8] * this.projectionMatrix[3]
            + this.modelviewMatrix[9] * this.projectionMatrix[7]
            + this.modelviewMatrix[10] * this.projectionMatrix[11]
            + this.modelviewMatrix[11] * this.projectionMatrix[15];
    this.clippingMatrix[12] =
        this.modelviewMatrix[12] * this.projectionMatrix[0]
            + this.modelviewMatrix[13] * this.projectionMatrix[4]
            + this.modelviewMatrix[14] * this.projectionMatrix[8]
            + this.modelviewMatrix[15] * this.projectionMatrix[12];
    this.clippingMatrix[13] =
        this.modelviewMatrix[12] * this.projectionMatrix[1]
            + this.modelviewMatrix[13] * this.projectionMatrix[5]
            + this.modelviewMatrix[14] * this.projectionMatrix[9]
            + this.modelviewMatrix[15] * this.projectionMatrix[13];
    this.clippingMatrix[14] =
        this.modelviewMatrix[12] * this.projectionMatrix[2]
            + this.modelviewMatrix[13] * this.projectionMatrix[6]
            + this.modelviewMatrix[14] * this.projectionMatrix[10]
            + this.modelviewMatrix[15] * this.projectionMatrix[14];
    this.clippingMatrix[15] =
        this.modelviewMatrix[12] * this.projectionMatrix[3]
            + this.modelviewMatrix[13] * this.projectionMatrix[7]
            + this.modelviewMatrix[14] * this.projectionMatrix[11]
            + this.modelviewMatrix[15] * this.projectionMatrix[15];
    this.frustum[0][0] = this.clippingMatrix[3] - this.clippingMatrix[0];
    this.frustum[0][1] = this.clippingMatrix[7] - this.clippingMatrix[4];
    this.frustum[0][2] = this.clippingMatrix[11] - this.clippingMatrix[8];
    this.frustum[0][3] = this.clippingMatrix[15] - this.clippingMatrix[12];
    this.normalize(this.frustum, 0);
    this.frustum[1][0] = this.clippingMatrix[3] + this.clippingMatrix[0];
    this.frustum[1][1] = this.clippingMatrix[7] + this.clippingMatrix[4];
    this.frustum[1][2] = this.clippingMatrix[11] + this.clippingMatrix[8];
    this.frustum[1][3] = this.clippingMatrix[15] + this.clippingMatrix[12];
    this.normalize(this.frustum, 1);
    this.frustum[2][0] = this.clippingMatrix[3] + this.clippingMatrix[1];
    this.frustum[2][1] = this.clippingMatrix[7] + this.clippingMatrix[5];
    this.frustum[2][2] = this.clippingMatrix[11] + this.clippingMatrix[9];
    this.frustum[2][3] = this.clippingMatrix[15] + this.clippingMatrix[13];
    this.normalize(this.frustum, 2);
    this.frustum[3][0] = this.clippingMatrix[3] - this.clippingMatrix[1];
    this.frustum[3][1] = this.clippingMatrix[7] - this.clippingMatrix[5];
    this.frustum[3][2] = this.clippingMatrix[11] - this.clippingMatrix[9];
    this.frustum[3][3] = this.clippingMatrix[15] - this.clippingMatrix[13];
    this.normalize(this.frustum, 3);
    this.frustum[4][0] = this.clippingMatrix[3] - this.clippingMatrix[2];
    this.frustum[4][1] = this.clippingMatrix[7] - this.clippingMatrix[6];
    this.frustum[4][2] = this.clippingMatrix[11] - this.clippingMatrix[10];
    this.frustum[4][3] = this.clippingMatrix[15] - this.clippingMatrix[14];
    this.normalize(this.frustum, 4);
    this.frustum[5][0] = this.clippingMatrix[3] + this.clippingMatrix[2];
    this.frustum[5][1] = this.clippingMatrix[7] + this.clippingMatrix[6];
    this.frustum[5][2] = this.clippingMatrix[11] + this.clippingMatrix[10];
    this.frustum[5][3] = this.clippingMatrix[15] + this.clippingMatrix[14];
    this.normalize(this.frustum, 5);
  }
}
Ejemplo n.º 8
0
  private DisplayFluidList getDisplayFluidLists(int liquidId, World world) {
    if (displayFluidLists.containsKey(liquidId)) {
      return displayFluidLists.get(liquidId);
    }

    DisplayFluidList d = new DisplayFluidList();
    displayFluidLists.put(liquidId, d);

    BlockInterface block = new BlockInterface();

    Fluid fluid = FluidRegistry.getFluid(liquidId);
    if (fluid.getBlockID() > 0) {
      block.baseBlock = Block.blocksList[fluid.getBlockID()];
    } else {
      block.baseBlock = Block.waterStill;
    }
    block.texture = fluid.getStillIcon();

    float size = Utils.pipeMaxPos - Utils.pipeMinPos;

    // render size

    for (int s = 0; s < LIQUID_STAGES; ++s) {
      float ratio = (float) s / (float) LIQUID_STAGES;

      // SIDE HORIZONTAL

      d.sideHorizontal[s] = GLAllocation.generateDisplayLists(1);
      GL11.glNewList(d.sideHorizontal[s], 4864 /* GL_COMPILE */);

      block.minX = 0.0F;
      block.minZ = Utils.pipeMinPos + 0.01F;

      block.maxX = block.minX + size / 2F + 0.01F;
      block.maxZ = block.minZ + size - 0.02F;

      block.minY = Utils.pipeMinPos + 0.01F;
      block.maxY = block.minY + (size - 0.02F) * ratio;

      RenderEntityBlock.INSTANCE.renderBlock(block, world, 0, 0, 0, false, true);

      GL11.glEndList();

      // SIDE VERTICAL

      d.sideVertical[s] = GLAllocation.generateDisplayLists(1);
      GL11.glNewList(d.sideVertical[s], 4864 /* GL_COMPILE */);

      block.minY = Utils.pipeMaxPos - 0.01;
      block.maxY = 1;

      block.minX = 0.5 - (size / 2 - 0.01) * ratio;
      block.maxX = 0.5 + (size / 2 - 0.01) * ratio;

      block.minZ = 0.5 - (size / 2 - 0.01) * ratio;
      block.maxZ = 0.5 + (size / 2 - 0.01) * ratio;

      RenderEntityBlock.INSTANCE.renderBlock(block, world, 0, 0, 0, false, true);

      GL11.glEndList();

      // CENTER HORIZONTAL

      d.centerHorizontal[s] = GLAllocation.generateDisplayLists(1);
      GL11.glNewList(d.centerHorizontal[s], 4864 /* GL_COMPILE */);

      block.minX = Utils.pipeMinPos + 0.01;
      block.minZ = Utils.pipeMinPos + 0.01;

      block.maxX = block.minX + size - 0.02;
      block.maxZ = block.minZ + size - 0.02;

      block.minY = Utils.pipeMinPos + 0.01;
      block.maxY = block.minY + (size - 0.02F) * ratio;

      RenderEntityBlock.INSTANCE.renderBlock(block, world, 0, 0, 0, false, true);

      GL11.glEndList();

      // CENTER VERTICAL

      d.centerVertical[s] = GLAllocation.generateDisplayLists(1);
      GL11.glNewList(d.centerVertical[s], 4864 /* GL_COMPILE */);

      block.minY = Utils.pipeMinPos + 0.01;
      block.maxY = Utils.pipeMaxPos - 0.01;

      block.minX = 0.5 - (size / 2 - 0.02) * ratio;
      block.maxX = 0.5 + (size / 2 - 0.02) * ratio;

      block.minZ = 0.5 - (size / 2 - 0.02) * ratio;
      block.maxZ = 0.5 + (size / 2 - 0.02) * ratio;

      RenderEntityBlock.INSTANCE.renderBlock(block, world, 0, 0, 0, false, true);

      GL11.glEndList();
    }

    return d;
  }
Ejemplo n.º 9
0
  private void initializeDisplayPowerList(World world) {
    if (initialized) return;

    initialized = true;

    BlockInterface block = new BlockInterface();
    block.texture =
        BuildCraftTransport.instance.pipeIconProvider.getIcon(
            PipeIconProvider.TYPE.Power_Normal.ordinal());

    float size = Utils.pipeMaxPos - Utils.pipeMinPos;

    for (int s = 0; s < POWER_STAGES; ++s) {
      displayPowerList[s] = GLAllocation.generateDisplayLists(1);
      GL11.glNewList(displayPowerList[s], 4864 /* GL_COMPILE */);

      float minSize = 0.005F;

      float unit = (size - minSize) / 2F / POWER_STAGES;

      block.minY = 0.5 - (minSize / 2F) - unit * s;
      block.maxY = 0.5 + (minSize / 2F) + unit * s;

      block.minZ = 0.5 - (minSize / 2F) - unit * s;
      block.maxZ = 0.5 + (minSize / 2F) + unit * s;

      block.minX = 0;
      block.maxX = 0.5 + (minSize / 2F) + unit * s;

      RenderEntityBlock.INSTANCE.renderBlock(block, world, 0, 0, 0, false, true);

      GL11.glEndList();
    }

    block.texture =
        BuildCraftTransport.instance.pipeIconProvider.getIcon(
            PipeIconProvider.TYPE.Power_Overload.ordinal());

    size = Utils.pipeMaxPos - Utils.pipeMinPos;

    for (int s = 0; s < POWER_STAGES; ++s) {
      displayPowerListOverload[s] = GLAllocation.generateDisplayLists(1);
      GL11.glNewList(displayPowerListOverload[s], 4864 /* GL_COMPILE */);

      float minSize = 0.005F;

      float unit = (size - minSize) / 2F / POWER_STAGES;

      block.minY = 0.5 - (minSize / 2F) - unit * s;
      block.maxY = 0.5 + (minSize / 2F) + unit * s;

      block.minZ = 0.5 - (minSize / 2F) - unit * s;
      block.maxZ = 0.5 + (minSize / 2F) + unit * s;

      block.minX = 0;
      block.maxX = 0.5 + (minSize / 2F) + unit * s;

      RenderEntityBlock.INSTANCE.renderBlock(block, world, 0, 0, 0, false, true);

      GL11.glEndList();
    }
  }
Ejemplo n.º 10
0
public class ClippingHelperImpl extends ClippingHelper {
  private static ClippingHelperImpl instance = new ClippingHelperImpl();
  private FloatBuffer projectionMatrixBuffer = GLAllocation.createDirectFloatBuffer(16);
  private FloatBuffer modelviewMatrixBuffer = GLAllocation.createDirectFloatBuffer(16);
  private FloatBuffer field_78564_h = GLAllocation.createDirectFloatBuffer(16);
  private static final String __OBFID = "CL_00000975";

  /** Initialises the ClippingHelper object then returns an instance of it. */
  public static ClippingHelper getInstance() {
    instance.init();
    return instance;
  }

  private void func_180547_a(float[] p_180547_1_) {
    float var2 =
        MathHelper.sqrt_float(
            p_180547_1_[0] * p_180547_1_[0]
                + p_180547_1_[1] * p_180547_1_[1]
                + p_180547_1_[2] * p_180547_1_[2]);
    p_180547_1_[0] /= var2;
    p_180547_1_[1] /= var2;
    p_180547_1_[2] /= var2;
    p_180547_1_[3] /= var2;
  }

  public void init() {
    this.projectionMatrixBuffer.clear();
    this.modelviewMatrixBuffer.clear();
    this.field_78564_h.clear();
    GlStateManager.getFloat(2983, this.projectionMatrixBuffer);
    GlStateManager.getFloat(2982, this.modelviewMatrixBuffer);
    float[] var1 = this.field_178625_b;
    float[] var2 = this.field_178626_c;
    this.projectionMatrixBuffer.flip().limit(16);
    this.projectionMatrixBuffer.get(var1);
    this.modelviewMatrixBuffer.flip().limit(16);
    this.modelviewMatrixBuffer.get(var2);
    this.clippingMatrix[0] =
        var2[0] * var1[0] + var2[1] * var1[4] + var2[2] * var1[8] + var2[3] * var1[12];
    this.clippingMatrix[1] =
        var2[0] * var1[1] + var2[1] * var1[5] + var2[2] * var1[9] + var2[3] * var1[13];
    this.clippingMatrix[2] =
        var2[0] * var1[2] + var2[1] * var1[6] + var2[2] * var1[10] + var2[3] * var1[14];
    this.clippingMatrix[3] =
        var2[0] * var1[3] + var2[1] * var1[7] + var2[2] * var1[11] + var2[3] * var1[15];
    this.clippingMatrix[4] =
        var2[4] * var1[0] + var2[5] * var1[4] + var2[6] * var1[8] + var2[7] * var1[12];
    this.clippingMatrix[5] =
        var2[4] * var1[1] + var2[5] * var1[5] + var2[6] * var1[9] + var2[7] * var1[13];
    this.clippingMatrix[6] =
        var2[4] * var1[2] + var2[5] * var1[6] + var2[6] * var1[10] + var2[7] * var1[14];
    this.clippingMatrix[7] =
        var2[4] * var1[3] + var2[5] * var1[7] + var2[6] * var1[11] + var2[7] * var1[15];
    this.clippingMatrix[8] =
        var2[8] * var1[0] + var2[9] * var1[4] + var2[10] * var1[8] + var2[11] * var1[12];
    this.clippingMatrix[9] =
        var2[8] * var1[1] + var2[9] * var1[5] + var2[10] * var1[9] + var2[11] * var1[13];
    this.clippingMatrix[10] =
        var2[8] * var1[2] + var2[9] * var1[6] + var2[10] * var1[10] + var2[11] * var1[14];
    this.clippingMatrix[11] =
        var2[8] * var1[3] + var2[9] * var1[7] + var2[10] * var1[11] + var2[11] * var1[15];
    this.clippingMatrix[12] =
        var2[12] * var1[0] + var2[13] * var1[4] + var2[14] * var1[8] + var2[15] * var1[12];
    this.clippingMatrix[13] =
        var2[12] * var1[1] + var2[13] * var1[5] + var2[14] * var1[9] + var2[15] * var1[13];
    this.clippingMatrix[14] =
        var2[12] * var1[2] + var2[13] * var1[6] + var2[14] * var1[10] + var2[15] * var1[14];
    this.clippingMatrix[15] =
        var2[12] * var1[3] + var2[13] * var1[7] + var2[14] * var1[11] + var2[15] * var1[15];
    float[] var3 = this.frustum[0];
    var3[0] = this.clippingMatrix[3] - this.clippingMatrix[0];
    var3[1] = this.clippingMatrix[7] - this.clippingMatrix[4];
    var3[2] = this.clippingMatrix[11] - this.clippingMatrix[8];
    var3[3] = this.clippingMatrix[15] - this.clippingMatrix[12];
    this.func_180547_a(var3);
    float[] var4 = this.frustum[1];
    var4[0] = this.clippingMatrix[3] + this.clippingMatrix[0];
    var4[1] = this.clippingMatrix[7] + this.clippingMatrix[4];
    var4[2] = this.clippingMatrix[11] + this.clippingMatrix[8];
    var4[3] = this.clippingMatrix[15] + this.clippingMatrix[12];
    this.func_180547_a(var4);
    float[] var5 = this.frustum[2];
    var5[0] = this.clippingMatrix[3] + this.clippingMatrix[1];
    var5[1] = this.clippingMatrix[7] + this.clippingMatrix[5];
    var5[2] = this.clippingMatrix[11] + this.clippingMatrix[9];
    var5[3] = this.clippingMatrix[15] + this.clippingMatrix[13];
    this.func_180547_a(var5);
    float[] var6 = this.frustum[3];
    var6[0] = this.clippingMatrix[3] - this.clippingMatrix[1];
    var6[1] = this.clippingMatrix[7] - this.clippingMatrix[5];
    var6[2] = this.clippingMatrix[11] - this.clippingMatrix[9];
    var6[3] = this.clippingMatrix[15] - this.clippingMatrix[13];
    this.func_180547_a(var6);
    float[] var7 = this.frustum[4];
    var7[0] = this.clippingMatrix[3] - this.clippingMatrix[2];
    var7[1] = this.clippingMatrix[7] - this.clippingMatrix[6];
    var7[2] = this.clippingMatrix[11] - this.clippingMatrix[10];
    var7[3] = this.clippingMatrix[15] - this.clippingMatrix[14];
    this.func_180547_a(var7);
    float[] var8 = this.frustum[5];
    var8[0] = this.clippingMatrix[3] + this.clippingMatrix[2];
    var8[1] = this.clippingMatrix[7] + this.clippingMatrix[6];
    var8[2] = this.clippingMatrix[11] + this.clippingMatrix[10];
    var8[3] = this.clippingMatrix[15] + this.clippingMatrix[14];
    this.func_180547_a(var8);
  }
}
Ejemplo n.º 11
0
 @Override
 public void clearDisplayList(int displayList) {
   GLAllocation.deleteDisplayLists(displayList);
 }
public class GCCoreSkyProviderOverworld extends IRenderHandler {
  public int starGLCallList = GLAllocation.generateDisplayLists(3);
  public int glSkyList;
  public int glSkyList2;

  public GCCoreSkyProviderOverworld() {
    GL11.glPushMatrix();
    GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE);
    this.renderStars();
    GL11.glEndList();
    GL11.glPopMatrix();
    final Tessellator tessellator = Tessellator.instance;
    this.glSkyList = this.starGLCallList + 1;
    GL11.glNewList(this.glSkyList, GL11.GL_COMPILE);
    final byte byte2 = 64;
    final int i = 256 / byte2 + 2;
    float f = 16F;

    for (int j = -byte2 * i; j <= byte2 * i; j += byte2) {
      for (int l = -byte2 * i; l <= byte2 * i; l += byte2) {
        tessellator.startDrawingQuads();
        tessellator.addVertex(j + 0, f, l + 0);
        tessellator.addVertex(j + byte2, f, l + 0);
        tessellator.addVertex(j + byte2, f, l + byte2);
        tessellator.addVertex(j + 0, f, l + byte2);
        tessellator.draw();
      }
    }

    GL11.glEndList();
    this.glSkyList2 = this.starGLCallList + 2;
    GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE);
    f = -16F;
    tessellator.startDrawingQuads();

    for (int k = -byte2 * i; k <= byte2 * i; k += byte2) {
      for (int i1 = -byte2 * i; i1 <= byte2 * i; i1 += byte2) {
        tessellator.addVertex(k + byte2, f, i1 + 0);
        tessellator.addVertex(k + 0, f, i1 + 0);
        tessellator.addVertex(k + 0, f, i1 + byte2);
        tessellator.addVertex(k + byte2, f, i1 + byte2);
      }
    }

    tessellator.draw();
    GL11.glEndList();
  }

  private Minecraft minecraft = FMLClientHandler.instance().getClient();

  @Override
  public void render(float partialTicks, WorldClient world, Minecraft mc) {
    float var20 = 0.0F;

    if (this.minecraft.thePlayer.ridingEntity != null) {
      var20 = (float) (this.minecraft.thePlayer.ridingEntity.posY - 200.0F);
    }

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Vec3 var2 = this.minecraft.theWorld.getSkyColor(this.minecraft.renderViewEntity, partialTicks);
    float var3 = (float) var2.xCoord;
    float var4 = (float) var2.yCoord;
    float var5 = (float) var2.zCoord;
    float var8;

    if (this.minecraft.gameSettings.anaglyph) {
      float var6 = (var3 * 30.0F + var4 * 59.0F + var5 * 11.0F) / 100.0F;
      float var7 = (var3 * 30.0F + var4 * 70.0F) / 100.0F;
      var8 = (var3 * 30.0F + var5 * 70.0F) / 100.0F;
      var3 = var6;
      var4 = var7;
      var5 = var8;
    }

    GL11.glColor3f(var3, var4, var5);
    Tessellator var23 = Tessellator.instance;
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(var3, var4, var5);
    GL11.glCallList(this.glSkyList);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.disableStandardItemLighting();
    float[] var24 =
        this.minecraft.theWorld.provider.calcSunriseSunsetColors(
            this.minecraft.theWorld.getCelestialAngle(partialTicks), partialTicks);
    float var9;
    float var10;
    float var11;
    float var12;

    if (var24 != null) {
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      GL11.glShadeModel(GL11.GL_SMOOTH);
      GL11.glPushMatrix();
      GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(
          MathHelper.sin(this.minecraft.theWorld.getCelestialAngleRadians(partialTicks)) < 0.0F
              ? 180.0F
              : 0.0F,
          0.0F,
          0.0F,
          1.0F);
      GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
      var8 = var24[0];
      var9 = var24[1];
      var10 = var24[2];
      float var13;

      if (this.minecraft.gameSettings.anaglyph) {
        var11 = (var8 * 30.0F + var9 * 59.0F + var10 * 11.0F) / 100.0F;
        var12 = (var8 * 30.0F + var9 * 70.0F) / 100.0F;
        var13 = (var8 * 30.0F + var10 * 70.0F) / 100.0F;
        var8 = var11;
        var9 = var12;
        var10 = var13;
      }

      var23.startDrawing(6);
      var23.setColorRGBA_F(var8, var9, var10, var24[3]);
      var23.addVertex(0.0D, 100.0D, 0.0D);
      byte var26 = 16;
      var23.setColorRGBA_F(var24[0], var24[1], var24[2], 0.0F);

      for (int var27 = 0; var27 <= var26; ++var27) {
        var13 = (float) var27 * (float) Math.PI * 2.0F / (float) var26;
        float var14 = MathHelper.sin(var13);
        float var15 = MathHelper.cos(var13);
        var23.addVertex(
            (double) (var14 * 120.0F),
            (double) (var15 * 120.0F),
            (double) (-var15 * 40.0F * var24[3]));
      }

      var23.draw();
      GL11.glPopMatrix();
      GL11.glShadeModel(GL11.GL_FLAT);
    }

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glPushMatrix();
    var8 = 1.0F - this.minecraft.theWorld.getRainStrength(partialTicks);
    var9 = 0.0F;
    var10 = 0.0F;
    var11 = 0.0F;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, var8);
    GL11.glTranslatef(var9, var10, var11);
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(
        this.minecraft.theWorld.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
    var12 = 30.0F;
    GL11.glBindTexture(
        GL11.GL_TEXTURE_2D, this.minecraft.renderEngine.getTexture("/terrain/sun.png"));
    var23.startDrawingQuads();
    var23.addVertexWithUV((double) (-var12), 100.0D, (double) (-var12), 0.0D, 0.0D);
    var23.addVertexWithUV((double) var12, 100.0D, (double) (-var12), 1.0D, 0.0D);
    var23.addVertexWithUV((double) var12, 100.0D, (double) var12, 1.0D, 1.0D);
    var23.addVertexWithUV((double) (-var12), 100.0D, (double) var12, 0.0D, 1.0D);
    var23.draw();
    var12 = 20.0F;
    GL11.glBindTexture(
        GL11.GL_TEXTURE_2D, this.minecraft.renderEngine.getTexture("/terrain/moon_phases.png"));
    int var28 = this.minecraft.theWorld.getMoonPhase(partialTicks);
    int var30 = var28 % 4;
    int var29 = var28 / 4 % 2;
    float var16 = (float) (var30 + 0) / 4.0F;
    float var17 = (float) (var29 + 0) / 2.0F;
    float var18 = (float) (var30 + 1) / 4.0F;
    float var19 = (float) (var29 + 1) / 2.0F;
    var23.startDrawingQuads();
    var23.addVertexWithUV(
        (double) (-var12), -100.0D, (double) var12, (double) var18, (double) var19);
    var23.addVertexWithUV((double) var12, -100.0D, (double) var12, (double) var16, (double) var19);
    var23.addVertexWithUV(
        (double) var12, -100.0D, (double) (-var12), (double) var16, (double) var17);
    var23.addVertexWithUV(
        (double) (-var12), -100.0D, (double) (-var12), (double) var18, (double) var17);
    var23.draw();
    GL11.glDisable(GL11.GL_TEXTURE_2D);

    if (var20 > 0.0F) {
      GL11.glColor4f(var20, var20, var20, var20 / 100F);
      GL11.glCallList(this.starGLCallList);
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor3f(0.0F, 0.0F, 0.0F);

    double var25 = 0.0D;

    if (this.minecraft.thePlayer.ridingEntity != null) {
      var25 = this.minecraft.thePlayer.ridingEntity.posY - this.minecraft.theWorld.getHorizon();

      if (var25 < 0.0D) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 12.0F, 0.0F);
        GL11.glCallList(this.glSkyList2);
        GL11.glPopMatrix();
        var10 = 1.0F;
        var11 = -((float) (var25 + 65.0D));
        var12 = -var10;
        var23.startDrawingQuads();
        var23.setColorRGBA_I(0, 255);
        var23.addVertex((double) (-var10), (double) var11, (double) var10);
        var23.addVertex((double) var10, (double) var11, (double) var10);
        var23.addVertex((double) var10, (double) var12, (double) var10);
        var23.addVertex((double) (-var10), (double) var12, (double) var10);
        var23.addVertex((double) (-var10), (double) var12, (double) (-var10));
        var23.addVertex((double) var10, (double) var12, (double) (-var10));
        var23.addVertex((double) var10, (double) var11, (double) (-var10));
        var23.addVertex((double) (-var10), (double) var11, (double) (-var10));
        var23.addVertex((double) var10, (double) var12, (double) (-var10));
        var23.addVertex((double) var10, (double) var12, (double) var10);
        var23.addVertex((double) var10, (double) var11, (double) var10);
        var23.addVertex((double) var10, (double) var11, (double) (-var10));
        var23.addVertex((double) (-var10), (double) var11, (double) (-var10));
        var23.addVertex((double) (-var10), (double) var11, (double) var10);
        var23.addVertex((double) (-var10), (double) var12, (double) var10);
        var23.addVertex((double) (-var10), (double) var12, (double) (-var10));
        var23.addVertex((double) (-var10), (double) var12, (double) (-var10));
        var23.addVertex((double) (-var10), (double) var12, (double) var10);
        var23.addVertex((double) var10, (double) var12, (double) var10);
        var23.addVertex((double) var10, (double) var12, (double) (-var10));
        var23.draw();
      }

      if (var20 > 0.0F) {
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glTranslatef(0.0F, (-var20 / 10), 0.0F);
        float scale = 45 * (0.25F - (var20 / 10000.0F));
        scale = Math.max(scale, 0.2F);
        GL11.glScalef(scale, 0.0F, scale);
        GL11.glTranslatef(0.0F, -var20, 0.0F);
        this.minecraft.renderEngine.bindTexture(
            this.minecraft.renderEngine.getTexture(
                "/micdoodle8/mods/galacticraft/core/client/planets/overworld.png"));

        var10 = 1.0F;
        var12 = -1.0F;

        float alpha = ((var20 - 200) / 400.0F);
        alpha = (float) Math.pow(alpha, 2);
        GL11.glColor4f(
            Math.min(alpha, 1.0F),
            Math.min(alpha, 1.0F),
            Math.min(alpha, 1.0F),
            Math.min(alpha, 1.0F));
        var23.startDrawingQuads();
        var23.addVertexWithUV((double) (-var10), (double) 0, (double) var10, 0.0F, 1.0F);
        var23.addVertexWithUV((double) var10, (double) 0, (double) var10, 1.0F, 1.0F);
        var23.addVertexWithUV((double) var10, (double) 0, (double) (-var10), 1.0F, 0.0F);
        var23.addVertexWithUV((double) (-var10), (double) 0, (double) (-var10), 0.0F, 0.0F);
        var23.addVertexWithUV((double) (-var10), (double) 0, (double) var10, 0.0F, 1.0F);
        var23.addVertexWithUV((double) var10, (double) 0, (double) var10, 1.0F, 1.0F);
        var23.addVertexWithUV((double) var10, (double) 0, (double) (-var10), 1.0F, 0.0F);
        var23.addVertexWithUV((double) (-var10), (double) 0, (double) (-var10), 0.0F, 0.0F);
        var23.addVertexWithUV((double) (-var10), (double) -50, (double) (-var10), 0.0F, 0.0F);
        var23.draw();
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glPopMatrix();
      }
    }

    if (this.minecraft.theWorld.provider.isSkyColored()) {
      GL11.glColor3f(0.0f, 0.0f, 0.0f);
    } else {
      GL11.glColor3f(var3, var4, var5);
    }
    GL11.glColor3f(0.0f, 0.0f, 0.0f);

    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, -((float) (var25 - 16.0D)), 0.0F);
    GL11.glCallList(this.glSkyList2);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
  }

  private void renderStars() {
    final Random var1 = new Random(10842L);
    final Tessellator var2 = Tessellator.instance;
    var2.startDrawingQuads();

    for (int var3 = 0; var3 < (GCCoreConfigManager.moreStars ? 20000 : 6000); ++var3) {
      double var4 = var1.nextFloat() * 2.0F - 1.0F;
      double var6 = var1.nextFloat() * 2.0F - 1.0F;
      double var8 = var1.nextFloat() * 2.0F - 1.0F;
      final double var10 = 0.15F + var1.nextFloat() * 0.1F;
      double var12 = var4 * var4 + var6 * var6 + var8 * var8;

      if (var12 < 1.0D && var12 > 0.01D) {
        var12 = 1.0D / Math.sqrt(var12);
        var4 *= var12;
        var6 *= var12;
        var8 *= var12;
        final double var14 =
            var4 * (GCCoreConfigManager.moreStars ? var1.nextDouble() * 100D + 150D : 100.0D);
        final double var16 =
            var6 * (GCCoreConfigManager.moreStars ? var1.nextDouble() * 100D + 150D : 100.0D);
        final double var18 =
            var8 * (GCCoreConfigManager.moreStars ? var1.nextDouble() * 100D + 150D : 100.0D);
        final double var20 = Math.atan2(var4, var8);
        final double var22 = Math.sin(var20);
        final double var24 = Math.cos(var20);
        final double var26 = Math.atan2(Math.sqrt(var4 * var4 + var8 * var8), var6);
        final double var28 = Math.sin(var26);
        final double var30 = Math.cos(var26);
        final double var32 = var1.nextDouble() * Math.PI * 2.0D;
        final double var34 = Math.sin(var32);
        final double var36 = Math.cos(var32);

        for (int var38 = 0; var38 < 4; ++var38) {
          final double var39 = 0.0D;
          final double var41 = ((var38 & 2) - 1) * var10;
          final double var43 = ((var38 + 1 & 2) - 1) * var10;
          final double var47 = var41 * var36 - var43 * var34;
          final double var49 = var43 * var36 + var41 * var34;
          final double var53 = var47 * var28 + var39 * var30;
          final double var55 = var39 * var28 - var47 * var30;
          final double var57 = var55 * var22 - var49 * var24;
          final double var61 = var49 * var22 + var55 * var24;
          var2.addVertex(var14 + var57, var16 + var53, var18 + var61);
        }
      }
    }

    var2.draw();
  }
}
public abstract class RenderLocusPoint extends ChromaRenderBase {

  @Override
  public final void renderTileEntityAt(
      TileEntity tile, double par2, double par4, double par6, float par8) {
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDepthMask(false);
    GL11.glColor4f(1, 1, 1, 1);
    GL11.glTranslated(par2, par4, par6);
    if (MinecraftForgeClient.getRenderPass() == 1 || !tile.hasWorldObj())
      this.renderCore((TileEntityLocusPoint) tile, par2, par4, par6, par8);
    this.doOtherRendering((TileEntityLocusPoint) tile, par8);
    GL11.glPopAttrib();
    GL11.glPopMatrix();
  }

  protected abstract void doOtherRendering(TileEntityLocusPoint tile, float par8);

  private void renderCore(
      TileEntityLocusPoint tile, double par2, double par4, double par6, float par8) {
    Tessellator v5 = Tessellator.instance;
    // this.renderStaticTexture(par2, par4, par6, par8);
    // BlendMode.ADDITIVEDARK.apply();
    BlendMode.ADDITIVE2.apply();
    GL11.glPushMatrix();
    GL11.glTranslated(0.5, 0.5, 0.5);
    RenderManager rm = RenderManager.instance;
    if (tile.hasWorldObj()) {
      GL11.glRotatef(-rm.playerViewY, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(rm.playerViewX, 1.0F, 0.0F, 0.0F);
    } else {
      GL11.glTranslated(0.55, 0.5, 0.5);
      GL11.glRotatef(45, 0, 1, 0);
      GL11.glRotatef(-30, 1, 0, 0);
    }

    // ReikaJavaLibrary.pConsole(te.getEnergy());

    ReikaTextureHelper.bindTexture(ChromatiCraft.class, "Textures/aurapoint2-grid.png");

    for (int i = 0; i < 3; i++) {

      int alpha = 255 - i * 64; // 255;
      int tick =
          (int)
              ((System.currentTimeMillis() / 250)
                  % 80); // (tile.getTicksExisted()*(i*3+1))%80;//+par8;
      double u = (tick % 8) / 8D; // tick/80D;//0;//0.125;
      double v = (tick / 8) / 10D; // 0;//(int)(tick/20)/4D;//0.125;
      double du = u + 1 / 8D; // u+1/80D;//u+1;//0.9375;
      double dv = v + 1 / 10D; // v+1;//0.9375;

      double s = 1 - i * 0.25;
      // for (double s = 0.5; s >= 0.25; s -= 0.0625) {

      GL11.glPushMatrix();

      double s1 = tile.isInWorld() ? s : s;

      GL11.glScaled(s1, s1, s1);
      /*
      	GL11.glMatrixMode(GL11.GL_TEXTURE);
      	GL11.glPushMatrix();

      	/*
      double d = 0.5;
      GL11.glTranslated(d, d, d);
      GL11.glRotated(rm.playerViewY, 0, 0, 1);
      GL11.glTranslated(-d, -d, -d);
      	 */
      if (tile.isInWorld()) {
        double d = 0.5;
        GL11.glTranslated(d, d, d);

        double dx = tile.xCoord + 0.5 - RenderManager.renderPosX;
        double dy = tile.yCoord + 0.5 - RenderManager.renderPosY;
        double dz = tile.zCoord + 0.5 - RenderManager.renderPosZ;
        double[] angs = ReikaPhysicsHelper.cartesianToPolar(dx, dy, dz);
        GL11.glTranslated(-d, -d, -d);
        GL11.glRotated(angs[2], 0, 0, 1);
      }

      // GL11.glMatrixMode(GL11.GL_MODELVIEW);

      v5.startDrawingQuads();
      v5.setBrightness(240);
      int color =
          ReikaColorAPI.getColorWithBrightnessMultiplier(tile.getRenderColor(), alpha / 255F);
      v5.setColorRGBA_I(color, alpha);
      v5.addVertexWithUV(-1, -1, 0, u, v);
      v5.addVertexWithUV(1, -1, 0, du, v);
      v5.addVertexWithUV(1, 1, 0, du, dv);
      v5.addVertexWithUV(-1, 1, 0, u, dv);
      v5.draw();

      // GL11.glMatrixMode(GL11.GL_TEXTURE);
      // GL11.glPopMatrix();
      // GL11.glMatrixMode(GL11.GL_MODELVIEW);

      GL11.glPopMatrix();

      // }
    }

    double s = 0.5;
    GL11.glScaled(s, s, s);

    /*
    ReikaTextureHelper.bindTexture(ChromatiCraft.class, "Textures/Dimension Bump Maps/gray.png");

    u = 0;
    v = 0;
    du = 1;
    dv = 1;

    GL11.glMatrixMode(GL11.GL_TEXTURE);
    GL11.glPushMatrix();

    GL11.glRotated(angs[2], 0, 1, 0);
    GL11.glRotated(90-angs[1], 1, 0, 0);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    v5.startDrawingQuads();
    v5.setColorRGBA_I(this.getColor(), alpha);
    v5.addVertexWithUV(-1, -1, 0, u, v);
    v5.addVertexWithUV(1, -1, 0, du, v);
    v5.addVertexWithUV(1, 1, 0, du, dv);
    v5.addVertexWithUV(-1, 1, 0, u, dv);
    v5.draw();


    GL11.glMatrixMode(GL11.GL_TEXTURE);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
     */

    GL11.glPopMatrix();
  }

  private static final Random staticRand = new Random(31100L);
  FloatBuffer fBuffer = GLAllocation.createDirectFloatBuffer(16);

  private void renderStaticTexture(double par2, double par4, double par6, float ptick) {
    float f1 = (float) field_147501_a.field_147560_j;
    float f2 = (float) field_147501_a.field_147561_k;
    float f3 = (float) field_147501_a.field_147558_l;
    staticRand.setSeed(31100L);

    float f4 = 1.001F; // 0.75F;//+i*0.125F;
    GL11.glPushMatrix();
    float f5 = 16;
    float f6 = 0.0625F;
    float f7 = 1.0F / (f5 + 1.0F);

    float f8 = (float) (-(par4 + f4));
    float f9 = f8 + ActiveRenderInfo.objectY;
    float f10 = f8 + f5 + ActiveRenderInfo.objectY;
    float f11 = f9 / f10;
    f11 += (float) (par4 + f4);
    // GL11.glTranslatef(f1, f11, f3);
    GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
    GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
    GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
    GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR);
    GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.genBuffer(1.0F, 0.0F, 0.0F, 0.0F));
    GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.genBuffer(0.0F, 0.0F, 1.0F, 0.0F));
    GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.genBuffer(0.0F, 0.0F, 0.0F, 1.0F));
    GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, this.genBuffer(0.0F, 1.0F, 0.0F, 0.0F));
    GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
    GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
    GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
    GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_TEXTURE);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glTranslatef(0.0F, Minecraft.getSystemTime() % 700000L / 700000.0F, 0.0F);
    GL11.glScalef(f6, f6, f6);
    GL11.glTranslatef(0.5F, 0.5F, 0.0F);
    GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
    // GL11.glTranslatef(-f1, -f3, -f2);
    f9 = f8 + ActiveRenderInfo.objectY;
    GL11.glTranslatef(ActiveRenderInfo.objectX * f5 / f9, ActiveRenderInfo.objectZ * f5 / f9, -f2);
    Tessellator v5 = Tessellator.instance;
    v5.startDrawingQuads();
    f11 = staticRand.nextFloat() * 0.5F + 0.1F;
    float f12 = staticRand.nextFloat() * 0.5F + 0.4F;
    float f13 = staticRand.nextFloat() * 0.5F + 0.5F;

    f7 = 1;
    f13 = 1.0F;
    f12 = 1.0F;
    f11 = 1.0F;

    // v5.setColorRGBA_F(e.getRed()*f7/255F, e.getGreen()*f7/255F, e.getBlue()*f7/255F, 1);
    v5.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F);
    v5.addVertex(par2, par4 + f4, par6);
    v5.addVertex(par2, par4 + f4, par6 + 1.0D);
    v5.addVertex(par2 + 1.0D, par4 + f4, par6 + 1.0D);
    v5.addVertex(par2 + 1.0D, par4 + f4, par6);
    v5.draw();
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_R);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_Q);
  }

  private FloatBuffer genBuffer(float v1, float v2, float v3, float v4) {
    fBuffer.clear();
    fBuffer.put(v1).put(v2).put(v3).put(v4);
    fBuffer.flip();
    return fBuffer;
  }
}