/** Renders dragon's (boss) health on the HUD */ private void renderBossHealth() { if (RenderDragon.entityDragon != null) { EntityDragon var1 = RenderDragon.entityDragon; RenderDragon.entityDragon = null; FontRenderer var2 = this.mc.fontRenderer; ScaledResolution var3 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); int var4 = var3.getScaledWidth(); short var5 = 182; int var6 = var4 / 2 - var5 / 2; int var7 = (int) ((float) var1.getDragonHealth() / (float) var1.getMaxHealth() * (float) (var5 + 1)); byte var8 = 12; this.drawTexturedModalRect(var6, var8, 0, 74, var5, 5); this.drawTexturedModalRect(var6, var8, 0, 74, var5, 5); if (var7 > 0) { this.drawTexturedModalRect(var6, var8, 0, 79, var7, 5); } String var9 = "Boss health"; var2.drawStringWithShadow( var9, var4 / 2 - var2.getStringWidth(var9) / 2, var8 - 10, 16711935); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/icons.png")); } }
private void renderBossHealth() { if (RenderDragon.field_41038_a == null) { return; } EntityDragon entitydragon = RenderDragon.field_41038_a; RenderDragon.field_41038_a = null; FontRenderer fontrenderer = mc.fontRenderer; ScaledResolution scaledresolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight); int i = scaledresolution.getScaledWidth(); char c = '\266'; int j = i / 2 - c / 2; int k = (int) (((float) entitydragon.func_41010_ax() / (float) entitydragon.getMaxHealth()) * (float) (c + 1)); byte byte0 = 12; drawTexturedModalRect(j, byte0, 0, 74, c, 5); drawTexturedModalRect(j, byte0, 0, 74, c, 5); if (k > 0) { drawTexturedModalRect(j, byte0, 0, 79, k, 5); } String s = "Boss health"; fontrenderer.drawStringWithShadow( s, i / 2 - fontrenderer.getStringWidth(s) / 2, byte0 - 10, 0xff00ff); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/icons.png")); }
/** Renders the dragon model. Called by renderModel. */ protected void renderDragonModel( EntityDragon par1EntityDragon, float par2, float par3, float par4, float par5, float par6, float par7) { if (par1EntityDragon.deathTicks > 0) { float f = (float) par1EntityDragon.deathTicks / 200F; GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, f); loadDownloadableImageTexture(par1EntityDragon.skinUrl, "/mob/enderdragon/shuffle.png"); mainModel.render(par1EntityDragon, par2, par3, par4, par5, par6, par7); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDepthFunc(GL11.GL_EQUAL); } loadDownloadableImageTexture(par1EntityDragon.skinUrl, par1EntityDragon.getTexture()); mainModel.render(par1EntityDragon, par2, par3, par4, par5, par6, par7); if (par1EntityDragon.hurtTime > 0) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.5F); mainModel.render(par1EntityDragon, par2, par3, par4, par5, par6, par7); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthFunc(GL11.GL_LEQUAL); } }
/** * Used to rotate the dragon as a whole in RenderDragon. It's called in the rotateCorpse method. */ protected void rotateDragonBody( EntityDragon par1EntityDragon, float par2, float par3, float par4) { float f = (float) par1EntityDragon.getMovementOffsets(7, par4)[0]; float f1 = (float) (par1EntityDragon.getMovementOffsets(5, par4)[1] - par1EntityDragon.getMovementOffsets(10, par4)[1]); GL11.glRotatef(-f, 0.0F, 1.0F, 0.0F); GL11.glRotatef(f1 * 10F, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, 0.0F, 1.0F); if (par1EntityDragon.deathTime > 0) { float f2 = ((((float) par1EntityDragon.deathTime + par4) - 1.0F) / 20F) * 1.6F; f2 = MathHelper.sqrt_float(f2); if (f2 > 1.0F) { f2 = 1.0F; } GL11.glRotatef(f2 * getDeathMaxRotation(par1EntityDragon), 0.0F, 0.0F, 1.0F); } }
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { GL11.glPushMatrix(); EntityDragon entitydragon = (EntityDragon) entity; float f6 = entitydragon.field_40173_aw + (entitydragon.field_40172_ax - entitydragon.field_40173_aw) * field_40317_s; field_40313_c.rotateAngleX = (float) (Math.sin(f6 * 3.141593F * 2.0F) + 1.0D) * 0.2F; float f7 = (float) (Math.sin(f6 * 3.141593F * 2.0F - 1.0F) + 1.0D); f7 = (f7 * f7 * 1.0F + f7 * 2.0F) * 0.05F; GL11.glTranslatef(0.0F, f7 - 2.0F, -3F); GL11.glRotatef(f7 * 2.0F, 1.0F, 0.0F, 0.0F); float f8 = -30F; float f9 = 22F; float f10 = 0.0F; float f11 = 1.5F; double ad[] = entitydragon.func_40160_a(6, field_40317_s); float f12 = func_40307_a( entitydragon.func_40160_a(5, field_40317_s)[0] - entitydragon.func_40160_a(10, field_40317_s)[0]); float f13 = func_40307_a(entitydragon.func_40160_a(5, field_40317_s)[0] + (double) (f12 / 2.0F)); f8 += 2.0F; float f14 = 0.0F; float f15 = f6 * 3.141593F * 2.0F; f8 = 20F; f9 = -12F; for (int i = 0; i < 5; i++) { double ad3[] = entitydragon.func_40160_a(5 - i, field_40317_s); f14 = (float) Math.cos((float) i * 0.45F + f15) * 0.15F; field_40312_b.rotateAngleY = ((func_40307_a(ad3[0] - ad[0]) * 3.141593F) / 180F) * f11; field_40312_b.rotateAngleX = f14 + (((float) (ad3[1] - ad[1]) * 3.141593F) / 180F) * f11 * 5F; field_40312_b.rotateAngleZ = ((-func_40307_a(ad3[0] - (double) f13) * 3.141593F) / 180F) * f11; field_40312_b.rotationPointY = f8; field_40312_b.rotationPointZ = f9; field_40312_b.rotationPointX = f10; f8 = (float) ((double) f8 + Math.sin(field_40312_b.rotateAngleX) * 10D); f9 = (float) ((double) f9 - Math.cos(field_40312_b.rotateAngleY) * Math.cos(field_40312_b.rotateAngleX) * 10D); f10 = (float) ((double) f10 - Math.sin(field_40312_b.rotateAngleY) * Math.cos(field_40312_b.rotateAngleX) * 10D); field_40312_b.render(f5); } field_40314_a.rotationPointY = f8; field_40314_a.rotationPointZ = f9; field_40314_a.rotationPointX = f10; double ad1[] = entitydragon.func_40160_a(0, field_40317_s); field_40314_a.rotateAngleY = ((func_40307_a(ad1[0] - ad[0]) * 3.141593F) / 180F) * 1.0F; field_40314_a.rotateAngleZ = ((-func_40307_a(ad1[0] - (double) f13) * 3.141593F) / 180F) * 1.0F; field_40314_a.render(f5); GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 1.0F, 0.0F); GL11.glRotatef(-f12 * f11 * 1.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.0F, -1F, 0.0F); field_40310_d.rotateAngleZ = 0.0F; field_40310_d.render(f5); for (int j = 0; j < 2; j++) { GL11.glEnable(2884 /*GL_CULL_FACE*/); float f16 = f6 * 3.141593F * 2.0F; field_40319_q.rotateAngleX = 0.125F - (float) Math.cos(f16) * 0.2F; field_40319_q.rotateAngleY = 0.25F; field_40319_q.rotateAngleZ = (float) (Math.sin(f16) + 0.125D) * 0.8F; field_40318_r.rotateAngleZ = -(float) (Math.sin(f16 + 2.0F) + 0.5D) * 0.75F; field_40311_e.rotateAngleX = 1.0F + f7 * 0.1F; field_40309_g.rotateAngleX = 0.5F + f7 * 0.1F; field_40316_o.rotateAngleX = 0.75F + f7 * 0.1F; field_40308_f.rotateAngleX = 1.3F + f7 * 0.1F; field_40315_n.rotateAngleX = -0.5F - f7 * 0.1F; field_40320_p.rotateAngleX = 0.75F + f7 * 0.1F; field_40319_q.render(f5); field_40308_f.render(f5); field_40311_e.render(f5); GL11.glScalef(-1F, 1.0F, 1.0F); if (j == 0) { GL11.glCullFace(1028 /*GL_FRONT*/); } } GL11.glPopMatrix(); GL11.glCullFace(1029 /*GL_BACK*/); GL11.glDisable(2884 /*GL_CULL_FACE*/); f14 = -(float) Math.sin(f6 * 3.141593F * 2.0F) * 0.0F; f15 = f6 * 3.141593F * 2.0F; f8 = 10F; f9 = 60F; f10 = 0.0F; ad = entitydragon.func_40160_a(11, field_40317_s); for (int k = 0; k < 12; k++) { double ad2[] = entitydragon.func_40160_a(12 + k, field_40317_s); f14 = (float) ((double) f14 + Math.sin((float) k * 0.45F + f15) * 0.05000000074505806D); field_40312_b.rotateAngleY = ((func_40307_a(ad2[0] - ad[0]) * f11 + 180F) * 3.141593F) / 180F; field_40312_b.rotateAngleX = f14 + (((float) (ad2[1] - ad[1]) * 3.141593F) / 180F) * f11 * 5F; field_40312_b.rotateAngleZ = ((func_40307_a(ad2[0] - (double) f13) * 3.141593F) / 180F) * f11; field_40312_b.rotationPointY = f8; field_40312_b.rotationPointZ = f9; field_40312_b.rotationPointX = f10; f8 = (float) ((double) f8 + Math.sin(field_40312_b.rotateAngleX) * 10D); f9 = (float) ((double) f9 - Math.cos(field_40312_b.rotateAngleY) * Math.cos(field_40312_b.rotateAngleX) * 10D); f10 = (float) ((double) f10 - Math.sin(field_40312_b.rotateAngleY) * Math.cos(field_40312_b.rotateAngleX) * 10D); field_40312_b.render(f5); } GL11.glPopMatrix(); }