private static void drawGradientRect(
     int p_73733_1_,
     int p_73733_2_,
     int p_73733_3_,
     int p_73733_4_,
     int p_73733_5_,
     int p_73733_6_,
     float zLevel) {
   float f = (float) (p_73733_5_ >> 24 & 255) / 255.0F;
   float f1 = (float) (p_73733_5_ >> 16 & 255) / 255.0F;
   float f2 = (float) (p_73733_5_ >> 8 & 255) / 255.0F;
   float f3 = (float) (p_73733_5_ & 255) / 255.0F;
   float f4 = (float) (p_73733_6_ >> 24 & 255) / 255.0F;
   float f5 = (float) (p_73733_6_ >> 16 & 255) / 255.0F;
   float f6 = (float) (p_73733_6_ >> 8 & 255) / 255.0F;
   float f7 = (float) (p_73733_6_ & 255) / 255.0F;
   GL11.glDisable(GL11.GL_TEXTURE_2D);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glDisable(GL11.GL_ALPHA_TEST);
   OpenGlHelper.glBlendFunc(770, 771, 1, 0);
   GL11.glShadeModel(GL11.GL_SMOOTH);
   Tessellator tessellator = Tessellator.instance;
   tessellator.startDrawingQuads();
   tessellator.setColorRGBA_F(f1, f2, f3, f);
   tessellator.addVertex((double) p_73733_3_, (double) p_73733_2_, (double) zLevel);
   tessellator.addVertex((double) p_73733_1_, (double) p_73733_2_, (double) zLevel);
   tessellator.setColorRGBA_F(f5, f6, f7, f4);
   tessellator.addVertex((double) p_73733_1_, (double) p_73733_4_, (double) zLevel);
   tessellator.addVertex((double) p_73733_3_, (double) p_73733_4_, (double) zLevel);
   tessellator.draw();
   GL11.glShadeModel(GL11.GL_FLAT);
   GL11.glDisable(GL11.GL_BLEND);
   GL11.glEnable(GL11.GL_ALPHA_TEST);
   GL11.glEnable(GL11.GL_TEXTURE_2D);
 }
Beispiel #2
0
 public static void drawGradientRectangle(
     int x, int y, int gradientX, int gradientY, int colorOne, int colorTwo) {
   float alphaOne = (float) (colorOne >> 24 & 255) / 255.0F;
   float redOne = (float) (colorOne >> 16 & 255) / 255.0F;
   float greenOne = (float) (colorOne >> 8 & 255) / 255.0F;
   float blueOne = (float) (colorOne & 255) / 255.0F;
   float alphaTwo = (float) (colorTwo >> 24 & 255) / 255.0F;
   float redTwo = (float) (colorTwo >> 16 & 255) / 255.0F;
   float greenTwo = (float) (colorTwo >> 8 & 255) / 255.0F;
   float blueTwo = (float) (colorTwo & 255) / 255.0F;
   GL11.glDisable(GL11.GL_TEXTURE_2D);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glDisable(GL11.GL_ALPHA_TEST);
   GL11.glBlendFunc(770, 771);
   GL11.glShadeModel(GL11.GL_SMOOTH);
   MinecraftTessellator tessellator = Spoutcraft.getTessellator();
   tessellator.startDrawingQuads();
   tessellator.setColorRGBAFloat(redOne, greenOne, blueOne, alphaOne);
   tessellator.addVertex((double) gradientX, (double) y, 0.0D);
   tessellator.addVertex((double) x, (double) y, 0.0D);
   tessellator.setColorRGBAFloat(redTwo, greenTwo, blueTwo, alphaTwo);
   tessellator.addVertex((double) x, (double) gradientY, 0.0D);
   tessellator.addVertex((double) gradientX, (double) gradientY, 0.0D);
   tessellator.draw();
   GL11.glShadeModel(GL11.GL_FLAT);
   GL11.glDisable(GL11.GL_BLEND);
   GL11.glEnable(GL11.GL_ALPHA_TEST);
   GL11.glEnable(GL11.GL_TEXTURE_2D);
 }
  @Override
  public void renderTileEntityAt(TileEntity var1, double xd, double yd, double zd, float partial) {
    SculptureEntity se = (SculptureEntity) var1;

    RenderHelper.disableStandardItemLighting();
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);

    if (!se.getRender().ready() && !se.getRender().hasContext()) {

      int lightX = (int) (OpenGlHelper.lastBrightnessX);
      int lightY = (int) (OpenGlHelper.lastBrightnessY);
      int light = lightY * 65536 + lightX;

      se.getRender().initFromSculptureAndLight(se.sculpture(), light);
    } else se.updateRender();

    GL11.glPushMatrix();
    GL11.glTranslated(xd, yd, zd);
    GL11.glCallList(se.getRender().glDisplayList);
    GL11.glPopMatrix();

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glShadeModel(GL11.GL_FLAT);
    RenderHelper.enableStandardItemLighting();
  }
  @Override
  public void renderTileEntityAt(TileEntity t, double x, double y, double z, float pt) {
    Block blockType = t.getBlockType();

    Tessellator tes = Tessellator.instance;
    tes.setColorOpaque_F(1.0F, 1.0F, 1.0F);

    renderBlocks.blockAccess = t.getWorldObj();

    {
      if (Minecraft.isAmbientOcclusionEnabled()) {
        GL11.glShadeModel(GL11.GL_SMOOTH);
      } else {
        GL11.glShadeModel(GL11.GL_FLAT);
      }
      RenderHelper.disableStandardItemLighting();

      RenderUtils.loadTexture(TextureMap.locationBlocksTexture);

      tes.startDrawingQuads();
      tes.setTranslation(x - t.xCoord, y - t.yCoord, z - t.zCoord);

      renderBlocks.renderBlockAllFaces(blockType, t.xCoord, t.yCoord, t.zCoord);
      tes.setTranslation(0, 0, 0);
      tes.draw();

      RenderHelper.enableStandardItemLighting();
    }
  }
Beispiel #5
0
 protected void a(int i, int j, int l, int i1, int j1, int k1) {
   float f = (float) (j1 >> 24 & 0xff) / 255F;
   float f1 = (float) (j1 >> 16 & 0xff) / 255F;
   float f2 = (float) (j1 >> 8 & 0xff) / 255F;
   float f3 = (float) (j1 & 0xff) / 255F;
   float f4 = (float) (k1 >> 24 & 0xff) / 255F;
   float f5 = (float) (k1 >> 16 & 0xff) / 255F;
   float f6 = (float) (k1 >> 8 & 0xff) / 255F;
   float f7 = (float) (k1 & 0xff) / 255F;
   GL11.glDisable(3553);
   GL11.glEnable(3042);
   GL11.glDisable(3008);
   GL11.glBlendFunc(770, 771);
   GL11.glShadeModel(7425);
   ho ho1 = ho.a;
   ho1.b();
   ho1.a(f1, f2, f3, f);
   ho1.a(l, j, 0.0D);
   ho1.a(i, j, 0.0D);
   ho1.a(f5, f6, f7, f4);
   ho1.a(i, i1, 0.0D);
   ho1.a(l, i1, 0.0D);
   ho1.a();
   GL11.glShadeModel(7424);
   GL11.glDisable(3042);
   GL11.glEnable(3008);
   GL11.glEnable(3553);
 }
 public static void drawGradientRect(
     int x, int y, float z, int toX, int toY, Color color, Color colorFade) {
   GL11.glDisable(GL11.GL_TEXTURE_2D);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glDisable(GL11.GL_ALPHA_TEST);
   GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
   GL11.glShadeModel(GL11.GL_SMOOTH);
   Tessellator tes = Tessellator.getInstance();
   VertexBuffer vb = tes.getBuffer();
   vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
   vb.pos(toX, y, z)
       .color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha())
       .endVertex();
   vb.pos(x, y, z)
       .color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha())
       .endVertex();
   vb.pos(x, toY, z)
       .color(colorFade.getRed(), colorFade.getGreen(), colorFade.getBlue(), colorFade.getAlpha())
       .endVertex();
   vb.pos(toX, toY, z)
       .color(colorFade.getRed(), colorFade.getGreen(), colorFade.getBlue(), colorFade.getAlpha())
       .endVertex();
   tes.draw();
   GL11.glShadeModel(GL11.GL_FLAT);
   GL11.glDisable(GL11.GL_BLEND);
   GL11.glEnable(GL11.GL_ALPHA_TEST);
   GL11.glEnable(GL11.GL_TEXTURE_2D);
 }
Beispiel #7
0
 public static void drawGradientRect(
     int minx, int miny, int maxx, int maxy, int zlevel, int color1, int color2) {
   float alpha1 = (float) (color1 >> 24 & 255) / 255.0F;
   float red1 = (float) (color1 >> 16 & 255) / 255.0F;
   float green1 = (float) (color1 >> 8 & 255) / 255.0F;
   float blue1 = (float) (color1 & 255) / 255.0F;
   float alpha2 = (float) (color2 >> 24 & 255) / 255.0F;
   float red2 = (float) (color2 >> 16 & 255) / 255.0F;
   float green2 = (float) (color2 >> 8 & 255) / 255.0F;
   float blue2 = (float) (color2 & 255) / 255.0F;
   GL11.glDisable(GL11.GL_TEXTURE_2D);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glDisable(GL11.GL_ALPHA_TEST);
   GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
   GL11.glShadeModel(GL11.GL_SMOOTH);
   Tessellator tessellator = Tessellator.instance;
   tessellator.startDrawingQuads();
   tessellator.setColorRGBA_F(red1, green1, blue1, alpha1);
   tessellator.addVertex((double) maxx, (double) miny, (double) zlevel);
   tessellator.addVertex((double) minx, (double) miny, (double) zlevel);
   tessellator.setColorRGBA_F(red2, green2, blue2, alpha2);
   tessellator.addVertex((double) minx, (double) maxy, (double) zlevel);
   tessellator.addVertex((double) maxx, (double) maxy, (double) zlevel);
   tessellator.draw();
   GL11.glShadeModel(GL11.GL_FLAT);
   GL11.glDisable(GL11.GL_BLEND);
   GL11.glEnable(GL11.GL_ALPHA_TEST);
   GL11.glEnable(GL11.GL_TEXTURE_2D);
 }
Beispiel #8
0
 /** Draws a rectangle with a vertical gradient between the specified colors. */
 protected void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) {
   float var7 = (float) (par5 >> 24 & 255) / 255.0F;
   float var8 = (float) (par5 >> 16 & 255) / 255.0F;
   float var9 = (float) (par5 >> 8 & 255) / 255.0F;
   float var10 = (float) (par5 & 255) / 255.0F;
   float var11 = (float) (par6 >> 24 & 255) / 255.0F;
   float var12 = (float) (par6 >> 16 & 255) / 255.0F;
   float var13 = (float) (par6 >> 8 & 255) / 255.0F;
   float var14 = (float) (par6 & 255) / 255.0F;
   GL11.glDisable(GL11.GL_TEXTURE_2D);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glDisable(GL11.GL_ALPHA_TEST);
   GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
   GL11.glShadeModel(GL11.GL_SMOOTH);
   Tessellator var15 = Tessellator.instance;
   var15.startDrawingQuads();
   var15.setColorRGBA_F(var8, var9, var10, var7);
   var15.addVertex((double) par3, (double) par2, (double) this.zLevel);
   var15.addVertex((double) par1, (double) par2, (double) this.zLevel);
   var15.setColorRGBA_F(var12, var13, var14, var11);
   var15.addVertex((double) par1, (double) par4, (double) this.zLevel);
   var15.addVertex((double) par3, (double) par4, (double) this.zLevel);
   var15.draw();
   GL11.glShadeModel(GL11.GL_FLAT);
   GL11.glDisable(GL11.GL_BLEND);
   GL11.glEnable(GL11.GL_ALPHA_TEST);
   GL11.glEnable(GL11.GL_TEXTURE_2D);
 }
  /** Renders the animation for when an enderdragon dies */
  protected void renderDragonDying(EntityDragonBoss par1entitydragonboss, float par2) {
    super.renderEquippedItems(par1entitydragonboss, par2);
    Tessellator tessellator = Tessellator.instance;

    if (par1entitydragonboss.deathTicks > 0) {
      RenderHelper.disableStandardItemLighting();
      float f1 = (par1entitydragonboss.deathTicks + par2) / 200.0F;
      float f2 = 0.0F;

      if (f1 > 0.8F) {
        f2 = (f1 - 0.8F) / 0.2F;
      }

      Random random = new Random(432L);
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      GL11.glShadeModel(GL11.GL_SMOOTH);
      GL11.glEnable(GL11.GL_BLEND);
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
      GL11.glDisable(GL11.GL_ALPHA_TEST);
      GL11.glEnable(GL11.GL_CULL_FACE);
      GL11.glDepthMask(false);
      GL11.glPushMatrix();
      GL11.glTranslatef(0.0F, -1.0F, -2.0F);

      for (int i = 0; i < (f1 + f1 * f1) / 2.0F * 60.0F; ++i) {
        GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F);
        tessellator.startDrawing(6);
        float f3 = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
        float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
        tessellator.setColorRGBA_I(16777215, (int) (255.0F * (1.0F - f2)));
        tessellator.addVertex(0.0D, 0.0D, 0.0D);
        tessellator.setColorRGBA_I(16711935, 0);
        tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4);
        tessellator.addVertex(0.866D * f4, f3, -0.5F * f4);
        tessellator.addVertex(0.0D, f3, 1.0F * f4);
        tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4);
        tessellator.draw();
      }

      GL11.glPopMatrix();
      GL11.glDepthMask(true);
      GL11.glDisable(GL11.GL_CULL_FACE);
      GL11.glDisable(GL11.GL_BLEND);
      GL11.glShadeModel(GL11.GL_FLAT);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      GL11.glEnable(GL11.GL_TEXTURE_2D);
      GL11.glEnable(GL11.GL_ALPHA_TEST);
      RenderHelper.enableStandardItemLighting();
    }
  }
  /** Renders the animation for when an enderdragon dies */
  protected void renderDragonDying(EntityDragon par1EntityDragon, float par2) {
    super.renderEquippedItems(par1EntityDragon, par2);
    Tessellator tessellator = Tessellator.instance;

    if (par1EntityDragon.deathTicks > 0) {
      RenderHelper.disableStandardItemLighting();
      float f = ((float) par1EntityDragon.deathTicks + par2) / 200F;
      float f1 = 0.0F;

      if (f > 0.8F) {
        f1 = (f - 0.8F) / 0.2F;
      }

      Random random = new Random(432L);
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      GL11.glShadeModel(GL11.GL_SMOOTH);
      GL11.glEnable(GL11.GL_BLEND);
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
      GL11.glDisable(GL11.GL_ALPHA_TEST);
      GL11.glEnable(GL11.GL_CULL_FACE);
      GL11.glDepthMask(false);
      GL11.glPushMatrix();
      GL11.glTranslatef(0.0F, -1F, -2F);

      for (int i = 0; (float) i < ((f + f * f) / 2.0F) * 60F; i++) {
        GL11.glRotatef(random.nextFloat() * 360F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(random.nextFloat() * 360F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360F + f * 90F, 0.0F, 0.0F, 1.0F);
        tessellator.startDrawing(6);
        float f2 = random.nextFloat() * 20F + 5F + f1 * 10F;
        float f3 = random.nextFloat() * 2.0F + 1.0F + f1 * 2.0F;
        tessellator.setColorRGBA_I(0xffffff, (int) (255F * (1.0F - f1)));
        tessellator.addVertex(0.0D, 0.0D, 0.0D);
        tessellator.setColorRGBA_I(0xff00ff, 0);
        tessellator.addVertex(-0.86599999999999999D * (double) f3, f2, -0.5F * f3);
        tessellator.addVertex(0.86599999999999999D * (double) f3, f2, -0.5F * f3);
        tessellator.addVertex(0.0D, f2, 1.0F * f3);
        tessellator.addVertex(-0.86599999999999999D * (double) f3, f2, -0.5F * f3);
        tessellator.draw();
      }

      GL11.glPopMatrix();
      GL11.glDepthMask(true);
      GL11.glDisable(GL11.GL_CULL_FACE);
      GL11.glDisable(GL11.GL_BLEND);
      GL11.glShadeModel(GL11.GL_FLAT);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      GL11.glEnable(GL11.GL_TEXTURE_2D);
      GL11.glEnable(GL11.GL_ALPHA_TEST);
      RenderHelper.enableStandardItemLighting();
    }
  }
Beispiel #11
0
  private void initialise() {
    DisplayMode mode = new DisplayMode(WIDTH, HEIGHT);
    Display.setTitle(TITLE);

    input = new InputHandler();
    display = new CodeDisplay(input);

    try {
      Display.setDisplayMode(mode);
      Display.setResizable(false);
      Display.create();

      if (!GLContext.getCapabilities().OpenGL33)
        System.err.printf("You must have at least OpenGL 3.3 to run this program\n");
    } catch (LWJGLException e) {
      e.printStackTrace();
      System.exit(-1);
    }

    // Set clear color

    glShadeModel(GL_SMOOTH);
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL); // Less than or equal
    glClearDepth(1.0);

    establishProjectionMatrix();

    // glEnable(GL_LIGHTING);
    // glEnable(GL_LIGHT0);
  }
Beispiel #12
0
 public final void renderMD3(
     EntityLiving entity, float f, float f1, float f2, float f3, float f4) {
   f3 = f2;
   f2 = f1 - (float) entity.yOffset;
   f1 = f;
   GL11.glPushMatrix();
   float f5 =
       entity.prevRenderYawOffset + (entity.renderYawOffset - entity.prevRenderYawOffset) * f4;
   GL11.glTranslatef(f1, f2, f3);
   func_110776_a(textures[getTextureIndex(entity) % textures.length]);
   GL11.glRotatef(-f5 + 180F, 0.0F, 1.0F, 0.0F);
   GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F);
   GL11.glScalef(0.02F, -0.02F, 0.02F);
   float rotation = handleRotationFloat(entity, f4) * getSpeedMultiplier(entity);
   try {
     int frame1 = (int) rotation % renderer.getAnimFrames();
     int frame2 = (frame1 + 1) % renderer.getAnimFrames();
     GL11.glShadeModel(GL11.GL_SMOOTH);
     GL11.glEnable(GL11.GL_NORMALIZE);
     renderer.render(frame1, frame2, rotation - (int) rotation);
     GL11.glDisable(GL11.GL_NORMALIZE);
   } catch (Exception e) {
     e.printStackTrace();
   }
   GL11.glPopMatrix();
   passSpecialRender(entity, f1, f2, f3);
 }
Beispiel #13
0
 public static void func_74519_b() {
   GL11.glEnable(2896);
   GL11.glEnable(16384);
   GL11.glEnable(16385);
   GL11.glEnable(2903);
   GL11.glColorMaterial(1032, 5634);
   float var0 = 0.4F;
   float var1 = 0.6F;
   float var2 = 0.0F;
   GL11.glLight(
       16384,
       4611,
       func_74517_a(
           field_82884_b.field_72450_a,
           field_82884_b.field_72448_b,
           field_82884_b.field_72449_c,
           0.0D));
   GL11.glLight(16384, 4609, func_74521_a(var1, var1, var1, 1.0F));
   GL11.glLight(16384, 4608, func_74521_a(0.0F, 0.0F, 0.0F, 1.0F));
   GL11.glLight(16384, 4610, func_74521_a(var2, var2, var2, 1.0F));
   GL11.glLight(
       16385,
       4611,
       func_74517_a(
           field_82885_c.field_72450_a,
           field_82885_c.field_72448_b,
           field_82885_c.field_72449_c,
           0.0D));
   GL11.glLight(16385, 4609, func_74521_a(var1, var1, var1, 1.0F));
   GL11.glLight(16385, 4608, func_74521_a(0.0F, 0.0F, 0.0F, 1.0F));
   GL11.glLight(16385, 4610, func_74521_a(var2, var2, var2, 1.0F));
   GL11.glShadeModel(7424);
   GL11.glLightModel(2899, func_74521_a(var0, var0, var0, 1.0F));
 }
  public void initialize() {
    if (GLContext.getCapabilities().OpenGL12) {
      gl12 = true;
    }

    // Default values for certain GL state.
    glShadeModel(GL_SMOOTH);
    glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

    // Enable rescaling/normaling of normal vectors.
    // Fixes lighting issues with scaled models.
    if (gl12) {
      glEnable(GL12.GL_RESCALE_NORMAL);
    } else {
      glEnable(GL_NORMALIZE);
    }

    if (GLContext.getCapabilities().GL_ARB_texture_non_power_of_two) {
      caps.add(Caps.NonPowerOfTwoTextures);
    } else {
      logger.log(
          Level.WARNING,
          "Your graphics card does not "
              + "support non-power-of-2 textures. "
              + "Some features might not work.");
    }

    maxLights = glGetInteger(GL_MAX_LIGHTS);
    maxTexSize = glGetInteger(GL_MAX_TEXTURE_SIZE);
  }
  /**
   * *************************************************************************************************************************************************************************************************
   * Initialization stuff comes in here...
   * ************************************************************************************************************************************************************************************************
   */
  private void init() {

    try {
      Display.setDisplayMode(new DisplayMode(640, 480));
      Display.setVSyncEnabled(true);
      Display.setTitle("MS3D Loader [G36C]");
      Display.create();

      Keyboard.create();

    } catch (LWJGLException e) {
      Sys.alert("Error", "Initialization failed!\n\n" + e.getMessage());
      System.exit(0);
    }

    /* OpenGL */
    int width = Display.getDisplayMode().getWidth();
    int height = Display.getDisplayMode().getHeight();

    GL11.glViewport(0, 0, width, height); // Reset The Current Viewport
    GL11.glMatrixMode(GL11.GL_PROJECTION); // Select The Projection Matrix
    GL11.glLoadIdentity(); // Reset The Projection Matrix
    GLU.gluPerspective(
        45.0f,
        ((float) width / (float) height),
        0.1f,
        1000.0f); // Calculate The Aspect Ratio Of The Window
    GL11.glMatrixMode(GL11.GL_MODELVIEW); // Select The Modelview Matrix
    GL11.glLoadIdentity(); // Reset The Modelview Matrix

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Background color
    GL11.glClearDepth(1.0f);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);

    // Load model
    //		g36c = new
    // MS3DModel(resourceLoader.loadResourceAsStream("models/gsg9.ms3d"),this.getClass().getResource("./data/textures").getPath());
    g36c =
        new MS3DModel(
            resourceLoader.loadResourceAsStream("models/assassin.ms3d"),
            this.getClass().getResource("./data/textures").getPath());

    //		tdsLoader=new TDSLoader();
    //		try {
    //			tdsLoader.load(resourceLoader.loadResourceAsStream("models/face.3ds"));
    //			System.out.println(tdsLoader.getObjectSize());
    //		} catch (IOException e) {
    //			e.printStackTrace();
    //		}

    // Load font
    font = new Font(resourceLoader.loadResourceAsStream("textures/font.bmp"), 12, width, height);

    // Init timer
    timer = new Timer();
  }
Beispiel #16
0
  public static void setupLighting() {
    FloatBuffer lightPosition = BufferUtils.createFloatBuffer(4);
    lightPosition.put(0.0f).put(0.0f).put(0.0f).put(0.0f).flip();

    FloatBuffer whiteLight = BufferUtils.createFloatBuffer(4);
    whiteLight.put(1.0f).put(1.0f).put(1.0f).put(1.0f).flip();

    FloatBuffer lModelAmbient = BufferUtils.createFloatBuffer(4);
    lModelAmbient.put(0.4f).put(0.4f).put(0.4f).put(1.0f).flip();

    glShadeModel(GL_SMOOTH);
    glMaterial(GL_FRONT, GL_SPECULAR, whiteLight);
    glMaterialf(GL_FRONT, GL_SHININESS, 50.0f);

    glLight(GL_LIGHT0, GL_POSITION, lightPosition);
    glLight(GL_LIGHT0, GL_SPECULAR, whiteLight);
    glLight(GL_LIGHT0, GL_DIFFUSE, whiteLight);
    glLightModel(GL_LIGHT_MODEL_AMBIENT, lModelAmbient);

    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);

    glEnable(GL_COLOR_MATERIAL);
    glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
  }
Beispiel #17
0
 private void initGL() {
   try {
     Display.setDisplayMode(new DisplayMode(GS.FRAMEWIDTH, GS.FRAMEHEIGHT));
     Display.setFullscreen(true);
     Display.create();
     Display.setVSyncEnabled(true);
   } catch (LWJGLException e) {
     e.printStackTrace();
     Display.destroy();
     System.exit(1);
   }
   GL11.glEnable(GL11.GL_TEXTURE_2D);
   // GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
   GL11.glClearDepth(1.0f);
   // GL11.glEnable(GL11.GL_DEPTH_TEST);
   // GL11.glDepthFunc(GL11.GL_ADD); //Wenn nicht auskommentiert führt es zu Exception
   GL11.glMatrixMode(GL11.GL_PROJECTION);
   GL11.glViewport(0, 0, GS.FRAMEWIDTH, GS.FRAMEHEIGHT);
   GL11.glOrtho(0, GS.FRAMEWIDTH, GS.FRAMEHEIGHT, 0, 0, 128);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
   // GL11.glBlendEquation( BLENDING_EQUATIONS[blendingEquationIndex]);
   GL11.glShadeModel(GL11.GL_FLAT);
   GL11.glMatrixMode(GL11.GL_MODELVIEW);
   GL11.glEnable(GL11.GL_ALPHA_TEST);
   GL11.glAlphaFunc(GL11.GL_GREATER, 0);
   GL11.glCullFace(GL11.GL_BACK);
   glEnable(GL_CULL_FACE);
   glCullFace(GL_BACK);
   GL11.glLoadIdentity();
 }
  /** Initialise the GL context */
  protected void initGL() {
    Log.info("Starting display " + width + "x" + height);
    String extensions = GL11.glGetString(GL11.GL_EXTENSIONS);

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glClearDepth(1);

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

    GL11.glViewport(0, 0, width, height);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    if (input == null) {
      input = new Input(height);
    }
    input.init(height);
    input.removeListener(lastGame);
    input.addListener(game);
    lastGame = game;
  }
  public void func_158_a(
      EntityWallpaper_Kaevator entitywallpaper, double d, double d1, double d2, float f, float f1) {
    rand.setSeed(187L);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) d, (float) d1, (float) d2);
    GL11.glRotatef(f, 0.0F, 1.0F, 0.0F);
    GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
    GL11.glShadeModel(7425 /*GL_SMOOTH*/);
    GL11.glDisable(2896 /*GL_LIGHTING*/);

    loadTexture("/kaevator/wallpapers.png");
    func_159_a(entitywallpaper);

    GL11.glShadeModel(7424 /*GL_FLAT*/);
    GL11.glEnable(2896 /*GL_LIGHTING*/);
    GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
    GL11.glPopMatrix();
  }
Beispiel #20
0
  private void initGL() {
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // sets background to grey
    glClearDepth(1.0f); // clear depth buffer
    glEnable(GL_DEPTH_TEST); // Enables depth testing
    glDepthFunc(GL_LEQUAL); // sets the type of test to use for depth testing
    glMatrixMode(GL_PROJECTION); // sets the matrix mode to project

    // GLU.gluOrtho2D(-10, 10, -10, 10);
    // GLU.gluOrtho2D(0 - COORD_WIDTH / 2, 0 + COORD_WIDTH / 2, 0 - COORD_HEIGHT / 2, 0 +
    // COORD_HEIGHT / 2);
    float fovy = 90.0f;
    float aspect = DISPLAY_MODE.getWidth() / (float) DISPLAY_MODE.getHeight();
    float zNear = 0.1f;
    float zFar = 20000.0f;
    GLU.gluPerspective(fovy, aspect, zNear, zFar);

    glViewport(0, 0, DISPLAY_MODE.getWidth(), DISPLAY_MODE.getHeight());
    // GLU.gluOrtho2D(-10, 10, -10, 10);
    // GLU.gluOrtho2D(-1, 1, -1, 1);

    glOrtho(
        0 - COORD_WIDTH / 2,
        0 + COORD_WIDTH / 2,
        0 - COORD_HEIGHT / 2,
        0 + COORD_HEIGHT / 2,
        zNear,
        zFar);

    System.out.println(COORD_WIDTH + ", " + COORD_HEIGHT);

    glMatrixMode(GL_MODELVIEW);

    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

    // ----------- Variables & method calls added for Lighting Test -----------//
    initLightArrays();
    glShadeModel(GL_SMOOTH);
    glMaterial(GL_FRONT, GL_SPECULAR, matSpecular); // sets specular material color
    glMaterialf(GL_FRONT, GL_SHININESS, 50.0f); // sets shininess

    glLight(GL_LIGHT0, GL_POSITION, lightPosition); // sets light position
    glLight(GL_LIGHT0, GL_SPECULAR, whiteLight); // sets specular light to white
    glLight(GL_LIGHT0, GL_DIFFUSE, whiteLight); // sets diffuse light to white
    glLightModel(GL_LIGHT_MODEL_AMBIENT, lModelAmbient); // global ambient light

    glEnable(GL_LIGHTING); // enables lighting
    glEnable(GL_LIGHT0); // enables light0

    glEnable(GL_COLOR_MATERIAL); // enables opengl to use glColor3f to define material color
    glColorMaterial(
        GL_FRONT,
        GL_AMBIENT_AND_DIFFUSE); // tell opengl glColor3f effects the ambient and diffuse properties
                                 // of material
    // ----------- END: Variables & method calls added for Lighting Test -----------//

  }
Beispiel #21
0
 public void setUpLighting() {
   glShadeModel(GL_SMOOTH);
   glEnable(GL_DEPTH_TEST);
   glEnable(GL_LIGHTING);
   glEnable(GL_LIGHT0);
   glLightModel(GL_LIGHT_MODEL_AMBIENT, asFloatBuffer(new float[] {1.00f, 1.00f, 1.00f, 1f}));
   glLight(GL_LIGHT0, GL_POSITION, asFloatBuffer(new float[] {10000, 0, 0, 1}));
   glEnable(GL_CULL_FACE);
   glCullFace(GL_BACK);
   glEnable(GL_COLOR_MATERIAL);
   glColorMaterial(GL_FRONT, GL_DIFFUSE);
 }
 private static void setUpLighting() {
   glShadeModel(GL_SMOOTH);
   glEnable(GL_DEPTH_TEST);
   glEnable(GL_LIGHTING);
   glEnable(GL_LIGHT0);
   glLightModel(
       GL_LIGHT_MODEL_AMBIENT,
       BufferTools.asFlippedFloatBuffer(new float[] {0.05f, 0.05f, 0.05f, 1f}));
   glLight(GL_LIGHT0, GL_POSITION, BufferTools.asFlippedFloatBuffer(new float[] {0, 0, 0, 1}));
   glEnable(GL_CULL_FACE);
   glCullFace(GL_BACK);
   glEnable(GL_COLOR_MATERIAL);
   glColorMaterial(GL_FRONT, GL_DIFFUSE);
 }
Beispiel #23
0
 public static void initOpenGL() {
   GLPrep.resizedRefresh();
   GL11.glEnable(GL11.GL_ALPHA_TEST); // allows alpha channels or
   // transperancy
   GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f); // set alpha aceptance
   GL11.glEnable(GL11.GL_COLOR_MATERIAL);
   GL11.glDisable(GL11.GL_DITHER);
   GL11.glShadeModel(GL11.GL_SMOOTH); // smooth shading
   GL11.glClearDepth(1.0); // Enables Clearing Of The Depth Buffer
   GL11.glDepthMask(true); // turn on depth mask
   GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing
   GL11.glDepthFunc(GL11.GL_ALWAYS); // The Type Of Depth Test To Do
   GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
   GL11.glEnable(GL11.GL_TEXTURE_2D); // enable 2d textures
   RenderManager.registerRenders();
 }
Beispiel #24
0
  /** Initialisation de la fenêtre OpenGl, de la camera et des textures. */
  public final void initGL() {
    // Création de la fenetre
    try {
      if (Setting.getFullScreen()) {
        Display.setDisplayModeAndFullscreen(
            new DisplayMode(Setting.get3DWidth(), Setting.get3DHeight()));
      } else {
        Display.setDisplayMode(new DisplayMode(Setting.get3DWidth(), Setting.get3DHeight()));
      }

      Display.setTitle("Visualisation 3D");
      Display.sync(Setting.getFps());
      Display.create();

    } catch (LWJGLException e) {
      e.printStackTrace();
      System.exit(0);
    }

    float fAspect = (float) Setting.getWWidth() / (float) Setting.getWHeight();
    GL11.glViewport(0, 0, Setting.getWWidth(), Setting.getWHeight());
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GLU.gluPerspective(45.0f, fAspect, 1.0f, 1000.0f);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glEnable(GL11.GL_CULL_FACE);

    // Initialisation de la Camera
    camera = new Camera("3D");
    camera.init();
    camera.yaw(140.0f);
    camera.pitch(20.0f);

    // Récupération des textures
    textures = new Textures();
    textures.init();
    textures.loadTexture();

    wind = new Wind();

    matrice.loadImg();
  }
  public static void apply(final LwjglRenderer renderer, final ShadingState state) {
    // ask for the current state record
    final RenderContext context = ContextManager.getCurrentContext();
    final ShadingStateRecord record =
        (ShadingStateRecord) context.getStateRecord(StateType.Shading);
    context.setCurrentState(StateType.Shading, state);

    // If not enabled, we'll use smooth
    final int toApply = state.isEnabled() ? getGLShade(state.getShadingMode()) : GL11.GL_SMOOTH;
    // only apply if we're different. Update record to reflect any changes.
    if (!record.isValid() || toApply != record.lastShade) {
      GL11.glShadeModel(toApply);
      record.lastShade = toApply;
    }

    if (!record.isValid()) {
      record.validate();
    }
  }
 private static void setUpStates() {
   glShadeModel(GL_SMOOTH);
   glEnable(GL_DEPTH_TEST);
   glEnable(GL_LIGHTING);
   glEnable(GL_LIGHT0);
   glLightModel(
       GL_LIGHT_MODEL_AMBIENT,
       BufferTools.asFlippedFloatBuffer(new float[] {0.05f, 0.05f, 0.05f, 1f}));
   glLight(GL_LIGHT0, GL_POSITION, BufferTools.asFlippedFloatBuffer(new float[] {0, 0, 0, 1}));
   glEnable(GL_CULL_FACE);
   glCullFace(GL_BACK);
   glEnable(GL_COLOR_MATERIAL);
   glColorMaterial(GL_FRONT, GL_DIFFUSE);
   glColor3f(0.4f, 0.27f, 0.17f);
   glMaterialf(GL_FRONT, GL_SHININESS, 10f);
   if (GLContext.getCapabilities().GL_ARB_depth_clamp) {
     glEnable(ARBDepthClamp.GL_DEPTH_CLAMP);
   }
 }
Beispiel #27
0
  // ***************************************************************************
  // initGL
  // ***************************************************************************
  private static boolean initGL() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    // Calculate the aspect ratio of the window
    GLU.gluPerspective(45.0f, ((float) targetWidth) / ((float) targetHeight), 0.1f, 100.0f);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();

    GL11.glEnable(GL11.GL_TEXTURE_2D);

    // Enable Texture Mapping (NEW)
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glClearDepth(1.0f);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);

    return true;
  }
Beispiel #28
0
  public static void init(VorxelSettings set, Geode gamep) {
    world = new World();
    game = gamep;
    try {
      DisplayMode d[] = Display.getAvailableDisplayModes();
      DisplayMode displayMode = d[0];
      Display.setDisplayMode(displayMode);
      Display.create();

      Mouse.create();
      Keyboard.create();

      GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping
      GL11.glShadeModel(GL11.GL_SMOOTH); // Enable Smooth Shading
      GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
      GL11.glClearDepth(1.0); // Depth Buffer Setup
      GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing
      GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do

      GL11.glMatrixMode(GL11.GL_PROJECTION); // Select The Projection Matrix
      GL11.glLoadIdentity(); // Reset The Projection Matrix
      // Calculate The Aspect Ratio Of The Window
      GLU.gluPerspective(
          45.0f, (float) displayMode.getWidth() / (float) displayMode.getHeight(), 0.1f, 100.0f);
      GL11.glMatrixMode(GL11.GL_MODELVIEW); // Select The Modelview Matrix

      // Really Nice Perspective Calculations
      GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
      TextureHelper.init();
      Cube.dirt.texture = new VTex(4);
      Cube.grass.texture = Cube.dirt.texture;
      Cube.grass.toptexture = new VTex(1);
      Mouse.setGrabbed(true);
      world.createSpawn();
    } catch (LWJGLException e) {
      e.printStackTrace();
    }
  }
  /** Renders the dragon, along with its dying animation */
  public void renderDragon(
      EntityDragonBoss par1entitydragonboss,
      double par2,
      double par4,
      double par6,
      float par8,
      float par9) {
    BossStatus.setBossStatus(par1entitydragonboss, false);
    super.doRender(par1entitydragonboss, par2, par4, par6, par8, par9);

    if (par1entitydragonboss.healingcircle != null) {
      float f2 = EntityDragonMinion.innerRotation + par9;
      float f3 = MathHelper.sin(f2 * 0.2F) / 2.0F + 0.5F;
      f3 = (f3 * f3 + f3) * 0.2F;
      float f4 =
          (float)
              (par1entitydragonboss.healingcircle.posX
                  - par1entitydragonboss.posX
                  - (par1entitydragonboss.prevPosX - par1entitydragonboss.posX) * (1.0F - par9));
      float f5 =
          (float)
              (f3
                  + par1entitydragonboss.healingcircle.posY
                  - 1.0D
                  - par1entitydragonboss.posY
                  - (par1entitydragonboss.prevPosY - par1entitydragonboss.posY) * (1.0F - par9));
      float f6 =
          (float)
              (par1entitydragonboss.healingcircle.posZ
                  - par1entitydragonboss.posZ
                  - (par1entitydragonboss.prevPosZ - par1entitydragonboss.posZ) * (1.0F - par9));
      float f7 = MathHelper.sqrt_float(f4 * f4 + f6 * f6);
      float f8 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6);
      GL11.glPushMatrix();
      GL11.glTranslatef((float) par2, (float) par4 + 2.0F, (float) par6);
      GL11.glRotatef(
          (float) -Math.atan2(f6, f4) * 180.0F / (float) Math.PI - 90.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(
          (float) -Math.atan2(f7, f5) * 180.0F / (float) Math.PI - 90.0F, 1.0F, 0.0F, 0.0F);
      Tessellator tessellator = Tessellator.instance;
      RenderHelper.disableStandardItemLighting();
      GL11.glDisable(GL11.GL_CULL_FACE);
      bindTexture(field_110843_g);
      GL11.glShadeModel(GL11.GL_SMOOTH);
      float f9 = 0.0F - (par1entitydragonboss.ticksExisted + par9) * 0.01F;
      float f10 =
          MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6) / 32.0F
              - (par1entitydragonboss.ticksExisted + par9) * 0.01F;
      tessellator.startDrawing(5);
      byte b0 = 8;

      for (int i = 0; i <= b0; ++i) {
        float f11 = MathHelper.sin(i % b0 * (float) Math.PI * 2.0F / b0) * 0.75F;
        float f12 = MathHelper.cos(i % b0 * (float) Math.PI * 2.0F / b0) * 0.75F;
        float f13 = i % b0 * 1.0F / b0;
        tessellator.setColorOpaque_I(0);
        tessellator.addVertexWithUV(f11 * 0.2F, f12 * 0.2F, 0.0D, f13, f10);
        tessellator.setColorOpaque_I(16777215);
        tessellator.addVertexWithUV(f11, f12, f8, f13, f9);
      }

      tessellator.draw();
      GL11.glEnable(GL11.GL_CULL_FACE);
      GL11.glShadeModel(GL11.GL_FLAT);
      RenderHelper.enableStandardItemLighting();
      GL11.glPopMatrix();
    }
  }
  public void renderPiston(
      TileEntityPiston par1TileEntityPiston, double par2, double par4, double par6, float par8) {
    Block var9 = Block.blocksList[par1TileEntityPiston.getStoredBlockID()];

    if (var9 != null && par1TileEntityPiston.getProgress(par8) < 1.0F) {
      Tessellator var10 = Tessellator.instance;
      this.bindTextureByName("/terrain.png");
      RenderHelper.disableStandardItemLighting();
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
      GL11.glEnable(GL11.GL_BLEND);
      GL11.glDisable(GL11.GL_CULL_FACE);

      if (Minecraft.isAmbientOcclusionEnabled()) {
        GL11.glShadeModel(GL11.GL_SMOOTH);
      } else {
        GL11.glShadeModel(GL11.GL_FLAT);
      }

      ForgeHooksClient.beforeBlockRender(var9, blockRenderer);
      var10.startDrawingQuads();
      var10.setTranslation(
          (double)
              ((float) par2
                  - (float) par1TileEntityPiston.xCoord
                  + par1TileEntityPiston.getOffsetX(par8)),
          (double)
              ((float) par4
                  - (float) par1TileEntityPiston.yCoord
                  + par1TileEntityPiston.getOffsetY(par8)),
          (double)
              ((float) par6
                  - (float) par1TileEntityPiston.zCoord
                  + par1TileEntityPiston.getOffsetZ(par8)));
      var10.setColorOpaque(1, 1, 1);

      if (var9 == Block.pistonExtension && par1TileEntityPiston.getProgress(par8) < 0.5F) {
        this.blockRenderer.renderPistonExtensionAllFaces(
            var9,
            par1TileEntityPiston.xCoord,
            par1TileEntityPiston.yCoord,
            par1TileEntityPiston.zCoord,
            false);
      } else if (par1TileEntityPiston.shouldRenderHead() && !par1TileEntityPiston.isExtending()) {
        Block.pistonExtension.setHeadTexture(((BlockPistonBase) var9).getPistonExtensionTexture());
        this.blockRenderer.renderPistonExtensionAllFaces(
            Block.pistonExtension,
            par1TileEntityPiston.xCoord,
            par1TileEntityPiston.yCoord,
            par1TileEntityPiston.zCoord,
            par1TileEntityPiston.getProgress(par8) < 0.5F);
        Block.pistonExtension.clearHeadTexture();
        var10.setTranslation(
            (double) ((float) par2 - (float) par1TileEntityPiston.xCoord),
            (double) ((float) par4 - (float) par1TileEntityPiston.yCoord),
            (double) ((float) par6 - (float) par1TileEntityPiston.zCoord));
        this.blockRenderer.renderPistonBaseAllFaces(
            var9,
            par1TileEntityPiston.xCoord,
            par1TileEntityPiston.yCoord,
            par1TileEntityPiston.zCoord);
      } else {
        this.blockRenderer.renderBlockAllFaces(
            var9,
            par1TileEntityPiston.xCoord,
            par1TileEntityPiston.yCoord,
            par1TileEntityPiston.zCoord);
      }

      var10.setTranslation(0.0D, 0.0D, 0.0D);
      var10.draw();
      ForgeHooksClient.afterBlockRender(var9, blockRenderer);
      RenderHelper.enableStandardItemLighting();
    }
  }