/** 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();
    }
  }
Example #2
0
  public void doRenderFishHook(
      EntityFishHook entityfishhook, double d, double d1, double d2, float f, float f1) {
    GL11.glPushMatrix();
    GL11.glTranslatef((float) d, (float) d1, (float) d2);
    GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
    GL11.glScalef(0.5F, 0.5F, 0.5F);
    int i = 1;
    byte byte0 = 2;
    loadTexture("/particles.png");
    Tessellator tessellator = Tessellator.instance;
    float f2 = (float) (i * 8 + 0) / 128F;
    float f3 = (float) (i * 8 + 8) / 128F;
    float f4 = (float) (byte0 * 8 + 0) / 128F;
    float f5 = (float) (byte0 * 8 + 8) / 128F;
    float f6 = 1.0F;
    float f7 = 0.5F;
    float f8 = 0.5F;
    GL11.glRotatef(180F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    tessellator.addVertexWithUV(0.0F - f7, 0.0F - f8, 0.0D, f2, f5);
    tessellator.addVertexWithUV(f6 - f7, 0.0F - f8, 0.0D, f3, f5);
    tessellator.addVertexWithUV(f6 - f7, 1.0F - f8, 0.0D, f3, f4);
    tessellator.addVertexWithUV(0.0F - f7, 1.0F - f8, 0.0D, f2, f4);
    tessellator.draw();
    GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
    GL11.glPopMatrix();
    if (entityfishhook.angler != null) {
      float f9 =
          ((entityfishhook.angler.prevRotationYaw
                      + (entityfishhook.angler.rotationYaw - entityfishhook.angler.prevRotationYaw)
                          * f1)
                  * 3.141593F)
              / 180F;
      double d3 = MathHelper.sin(f9);
      double d5 = MathHelper.cos(f9);
      float f11 = entityfishhook.angler.getSwingProgress(f1);
      float f12 = MathHelper.sin(MathHelper.sqrt_float(f11) * 3.141593F);
      Vec3D vec3d = Vec3D.createVector(-0.5D, 0.029999999999999999D, 0.80000000000000004D);
      vec3d.rotateAroundX(
          (-(entityfishhook.angler.prevRotationPitch
                      + (entityfishhook.angler.rotationPitch
                              - entityfishhook.angler.prevRotationPitch)
                          * f1)
                  * 3.141593F)
              / 180F);
      vec3d.rotateAroundY(
          (-(entityfishhook.angler.prevRotationYaw
                      + (entityfishhook.angler.rotationYaw - entityfishhook.angler.prevRotationYaw)
                          * f1)
                  * 3.141593F)
              / 180F);
      vec3d.rotateAroundY(f12 * 0.5F);
      vec3d.rotateAroundX(-f12 * 0.7F);
      double d7 =
          entityfishhook.angler.prevPosX
              + (entityfishhook.angler.posX - entityfishhook.angler.prevPosX) * (double) f1
              + vec3d.xCoord;
      double d8 =
          entityfishhook.angler.prevPosY
              + (entityfishhook.angler.posY - entityfishhook.angler.prevPosY) * (double) f1
              + vec3d.yCoord;
      double d9 =
          entityfishhook.angler.prevPosZ
              + (entityfishhook.angler.posZ - entityfishhook.angler.prevPosZ) * (double) f1
              + vec3d.zCoord;
      if (renderManager.options.thirdPersonView > 0) {
        float f10 =
            ((entityfishhook.angler.prevRenderYawOffset
                        + (entityfishhook.angler.renderYawOffset
                                - entityfishhook.angler.prevRenderYawOffset)
                            * f1)
                    * 3.141593F)
                / 180F;
        double d4 = MathHelper.sin(f10);
        double d6 = MathHelper.cos(f10);
        d7 =
            (entityfishhook.angler.prevPosX
                    + (entityfishhook.angler.posX - entityfishhook.angler.prevPosX) * (double) f1)
                - d6 * 0.34999999999999998D
                - d4 * 0.84999999999999998D;
        d8 =
            (entityfishhook.angler.prevPosY
                    + (entityfishhook.angler.posY - entityfishhook.angler.prevPosY) * (double) f1)
                - 0.45000000000000001D;
        d9 =
            ((entityfishhook.angler.prevPosZ
                        + (entityfishhook.angler.posZ - entityfishhook.angler.prevPosZ)
                            * (double) f1)
                    - d4 * 0.34999999999999998D)
                + d6 * 0.84999999999999998D;
      }
      double d10 =
          entityfishhook.prevPosX + (entityfishhook.posX - entityfishhook.prevPosX) * (double) f1;
      double d11 =
          entityfishhook.prevPosY
              + (entityfishhook.posY - entityfishhook.prevPosY) * (double) f1
              + 0.25D;
      double d12 =
          entityfishhook.prevPosZ + (entityfishhook.posZ - entityfishhook.prevPosZ) * (double) f1;
      double d13 = (float) (d7 - d10);
      double d14 = (float) (d8 - d11);
      double d15 = (float) (d9 - d12);
      GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
      GL11.glDisable(2896 /*GL_LIGHTING*/);
      tessellator.startDrawing(3);
      tessellator.setColorOpaque_I(0);
      int j = 16;
      for (int k = 0; k <= j; k++) {
        float f13 = (float) k / (float) j;
        tessellator.addVertex(
            d + d13 * (double) f13,
            d1 + d14 * (double) (f13 * f13 + f13) * 0.5D + 0.25D,
            d2 + d15 * (double) f13);
      }

      tessellator.draw();
      GL11.glEnable(2896 /*GL_LIGHTING*/);
      GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
    }
  }
Example #3
0
 /** Sets draw mode in the tessellator to draw quads. */
 public void startDrawingQuads() {
   startDrawing(7);
 }
  /** Actually renders the lightning bolt. This method is called through the doRender method. */
  public void doRenderLightningBolt(
      EntityLightningBolt par1EntityLightningBolt,
      double par2,
      double par4,
      double par6,
      float par8,
      float par9) {
    Tessellator var10 = Tessellator.instance;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    double[] var11 = new double[8];
    double[] var12 = new double[8];
    double var13 = 0.0D;
    double var15 = 0.0D;
    Random var17 = new Random(par1EntityLightningBolt.boltVertex);

    for (int var18 = 7; var18 >= 0; --var18) {
      var11[var18] = var13;
      var12[var18] = var15;
      var13 += (double) (var17.nextInt(11) - 5);
      var15 += (double) (var17.nextInt(11) - 5);
    }

    for (int var45 = 0; var45 < 4; ++var45) {
      Random var46 = new Random(par1EntityLightningBolt.boltVertex);

      for (int var19 = 0; var19 < 3; ++var19) {
        int var20 = 7;
        int var21 = 0;

        if (var19 > 0) {
          var20 = 7 - var19;
        }

        if (var19 > 0) {
          var21 = var20 - 2;
        }

        double var22 = var11[var20] - var13;
        double var24 = var12[var20] - var15;

        for (int var26 = var20; var26 >= var21; --var26) {
          double var27 = var22;
          double var29 = var24;

          if (var19 == 0) {
            var22 += (double) (var46.nextInt(11) - 5);
            var24 += (double) (var46.nextInt(11) - 5);
          } else {
            var22 += (double) (var46.nextInt(31) - 15);
            var24 += (double) (var46.nextInt(31) - 15);
          }

          var10.startDrawing(5);
          float var31 = 0.5F;
          var10.setColorRGBA_F(0.9F * var31, 0.9F * var31, 1.0F * var31, 0.3F);
          double var32 = 0.1D + (double) var45 * 0.2D;

          if (var19 == 0) {
            var32 *= (double) var26 * 0.1D + 1.0D;
          }

          double var34 = 0.1D + (double) var45 * 0.2D;

          if (var19 == 0) {
            var34 *= (double) (var26 - 1) * 0.1D + 1.0D;
          }

          for (int var36 = 0; var36 < 5; ++var36) {
            double var37 = par2 + 0.5D - var32;
            double var39 = par6 + 0.5D - var32;

            if (var36 == 1 || var36 == 2) {
              var37 += var32 * 2.0D;
            }

            if (var36 == 2 || var36 == 3) {
              var39 += var32 * 2.0D;
            }

            double var41 = par2 + 0.5D - var34;
            double var43 = par6 + 0.5D - var34;

            if (var36 == 1 || var36 == 2) {
              var41 += var34 * 2.0D;
            }

            if (var36 == 2 || var36 == 3) {
              var43 += var34 * 2.0D;
            }

            var10.addVertex(var41 + var22, par4 + (double) (var26 * 16), var43 + var24);
            var10.addVertex(var37 + var27, par4 + (double) ((var26 + 1) * 16), var39 + var29);
          }

          var10.draw();
        }
      }
    }

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
  }
  /** Renders the dragon, along with its dying animation */
  public void renderDragon(
      EntityDragon par1EntityDragon,
      double par2,
      double par4,
      double par6,
      float par8,
      float par9) {
    entityDragon = par1EntityDragon;

    if (updateModelState != 4) {
      mainModel = new ModelDragon(0.0F);
      updateModelState = 4;
    }

    super.doRenderLiving(par1EntityDragon, par2, par4, par6, par8, par9);

    if (par1EntityDragon.healingEnderCrystal != null) {
      float f = (float) par1EntityDragon.healingEnderCrystal.innerRotation + par9;
      float f1 = MathHelper.sin(f * 0.2F) / 2.0F + 0.5F;
      f1 = (f1 * f1 + f1) * 0.2F;
      float f2 =
          (float)
              (par1EntityDragon.healingEnderCrystal.posX
                  - par1EntityDragon.posX
                  - (par1EntityDragon.prevPosX - par1EntityDragon.posX) * (double) (1.0F - par9));
      float f3 =
          (float)
              (((double) f1 + par1EntityDragon.healingEnderCrystal.posY)
                  - 1.0D
                  - par1EntityDragon.posY
                  - (par1EntityDragon.prevPosY - par1EntityDragon.posY) * (double) (1.0F - par9));
      float f4 =
          (float)
              (par1EntityDragon.healingEnderCrystal.posZ
                  - par1EntityDragon.posZ
                  - (par1EntityDragon.prevPosZ - par1EntityDragon.posZ) * (double) (1.0F - par9));
      float f5 = MathHelper.sqrt_float(f2 * f2 + f4 * f4);
      float f6 = MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4);
      GL11.glPushMatrix();
      GL11.glTranslatef((float) par2, (float) par4 + 2.0F, (float) par6);
      GL11.glRotatef(
          ((float) (-Math.atan2(f4, f2)) * 180F) / (float) Math.PI - 90F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(
          ((float) (-Math.atan2(f5, f3)) * 180F) / (float) Math.PI - 90F, 1.0F, 0.0F, 0.0F);
      Tessellator tessellator = Tessellator.instance;
      RenderHelper.disableStandardItemLighting();
      GL11.glDisable(GL11.GL_CULL_FACE);
      loadTexture("/mob/enderdragon/beam.png");
      GL11.glShadeModel(GL11.GL_SMOOTH);
      float f7 = 0.0F - ((float) par1EntityDragon.ticksExisted + par9) * 0.01F;
      float f8 =
          MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4) / 32F
              - ((float) par1EntityDragon.ticksExisted + par9) * 0.01F;
      tessellator.startDrawing(5);
      int i = 8;

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

      tessellator.draw();
      GL11.glEnable(GL11.GL_CULL_FACE);
      GL11.glShadeModel(GL11.GL_FLAT);
      RenderHelper.enableStandardItemLighting();
      GL11.glPopMatrix();
    }
  }
Example #6
0
  private void displayDebugInfo(long l) {
    long l1 = 0xfe502aL;
    if (prevFrameTime == -1L) {
      prevFrameTime = System.nanoTime();
    }
    long l2 = System.nanoTime();
    tickTimes[numRecordedFrameTimes & frameTimes.length - 1] = l;
    frameTimes[numRecordedFrameTimes++ & frameTimes.length - 1] = l2 - prevFrameTime;
    prevFrameTime = l2;
    GL11.glClear(256);
    GL11.glMatrixMode(5889 /*GL_PROJECTION*/);
    GL11.glLoadIdentity();
    GL11.glOrtho(0.0D, displayWidth, displayHeight, 0.0D, 1000D, 3000D);
    GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/);
    GL11.glLoadIdentity();
    GL11.glTranslatef(0.0F, 0.0F, -2000F);
    GL11.glLineWidth(1.0F);
    GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawing(7);
    int i = (int) (l1 / 0x30d40L);
    tessellator.setColorOpaque_I(0x20000000);
    tessellator.addVertex(0.0D, displayHeight - i, 0.0D);
    tessellator.addVertex(0.0D, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - i, 0.0D);
    tessellator.setColorOpaque_I(0x20200000);
    tessellator.addVertex(0.0D, displayHeight - i * 2, 0.0D);
    tessellator.addVertex(0.0D, displayHeight - i, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - i, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - i * 2, 0.0D);
    tessellator.draw();
    long l3 = 0L;
    for (int j = 0; j < frameTimes.length; j++) {
      l3 += frameTimes[j];
    }

    int k = (int) (l3 / 0x30d40L / (long) frameTimes.length);
    tessellator.startDrawing(7);
    tessellator.setColorOpaque_I(0x20400000);
    tessellator.addVertex(0.0D, displayHeight - k, 0.0D);
    tessellator.addVertex(0.0D, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - k, 0.0D);
    tessellator.draw();
    tessellator.startDrawing(1);
    for (int i1 = 0; i1 < frameTimes.length; i1++) {
      int j1 = ((i1 - numRecordedFrameTimes & frameTimes.length - 1) * 255) / frameTimes.length;
      int k1 = (j1 * j1) / 255;
      k1 = (k1 * k1) / 255;
      int i2 = (k1 * k1) / 255;
      i2 = (i2 * i2) / 255;
      if (frameTimes[i1] > l1) {
        tessellator.setColorOpaque_I(0xff000000 + k1 * 0x10000);
      } else {
        tessellator.setColorOpaque_I(0xff000000 + k1 * 256);
      }
      long l4 = frameTimes[i1] / 0x30d40L;
      long l5 = tickTimes[i1] / 0x30d40L;
      tessellator.addVertex((float) i1 + 0.5F, (float) ((long) displayHeight - l4) + 0.5F, 0.0D);
      tessellator.addVertex((float) i1 + 0.5F, (float) displayHeight + 0.5F, 0.0D);
      tessellator.setColorOpaque_I(0xff000000 + k1 * 0x10000 + k1 * 256 + k1 * 1);
      tessellator.addVertex((float) i1 + 0.5F, (float) ((long) displayHeight - l4) + 0.5F, 0.0D);
      tessellator.addVertex(
          (float) i1 + 0.5F, (float) ((long) displayHeight - (l4 - l5)) + 0.5F, 0.0D);
    }

    tessellator.draw();
    GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
  }