| 1 | package net.minecraft.client.renderer.tileentity;
|
| 2 |
|
| 3 | import net.minecraft.client.model.ModelSkeletonHead;
|
| 4 | import net.minecraft.client.renderer.GlStateManager;
|
| 5 | import net.minecraft.client.renderer.entity.Render;
|
| 6 | import net.minecraft.client.renderer.entity.RenderManager;
|
| 7 | import net.minecraft.entity.projectile.EntityWitherSkull;
|
| 8 | import net.minecraft.util.ResourceLocation;
|
| 9 |
|
| 10 | public class RenderWitherSkull extends Render<EntityWitherSkull>
|
| 11 | {
|
| 12 | private static final ResourceLocation invulnerableWitherTextures = new ResourceLocation("textures/entity/wither/wither_invulnerable.png");
|
| 13 | private static final ResourceLocation witherTextures = new ResourceLocation("textures/entity/wither/wither.png");
|
| 14 |
|
| 15 | /** The Skeleton's head model. */
|
| 16 | private final ModelSkeletonHead skeletonHeadModel = new ModelSkeletonHead();
|
| 17 |
|
| 18 | public RenderWitherSkull(RenderManager renderManagerIn)
|
| 19 | {
|
| 20 | super(renderManagerIn);
|
| 21 | }
|
| 22 |
|
| 23 | private float func_82400_a(float p_82400_1_, float p_82400_2_, float p_82400_3_)
|
| 24 | {
|
| 25 | float f;
|
| 26 |
|
| 27 | for (f = p_82400_2_ - p_82400_1_; f < -180.0F; f += 360.0F)
|
| 28 | {
|
| 29 | ;
|
| 30 | }
|
| 31 |
|
| 32 | while (f >= 180.0F)
|
| 33 | {
|
| 34 | f -= 360.0F;
|
| 35 | }
|
| 36 |
|
| 37 | return p_82400_1_ + p_82400_3_ * f;
|
| 38 | }
|
| 39 |
|
| 40 | /**
|
| 41 | * Renders the desired {@code T} type Entity.
|
| 42 | */
|
| 43 | public void doRender(EntityWitherSkull entity, double x, double y, double z, float entityYaw, float partialTicks)
|
| 44 | {
|
| 45 | GlStateManager.pushMatrix();
|
| 46 | GlStateManager.disableCull();
|
| 47 | float f = this.func_82400_a(entity.prevRotationYaw, entity.rotationYaw, partialTicks);
|
| 48 | float f1 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks;
|
| 49 | GlStateManager.translate((float)x, (float)y, (float)z);
|
| 50 | float f2 = 0.0625F;
|
| 51 | GlStateManager.enableRescaleNormal();
|
| 52 | GlStateManager.scale(-1.0F, -1.0F, 1.0F);
|
| 53 | GlStateManager.enableAlpha();
|
| 54 | this.bindEntityTexture(entity);
|
| 55 | this.skeletonHeadModel.render(entity, 0.0F, 0.0F, 0.0F, f, f1, f2);
|
| 56 | GlStateManager.popMatrix();
|
| 57 | super.doRender(entity, x, y, z, entityYaw, partialTicks);
|
| 58 | }
|
| 59 |
|
| 60 | /**
|
| 61 | * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
|
| 62 | */
|
| 63 | protected ResourceLocation getEntityTexture(EntityWitherSkull entity)
|
| 64 | {
|
| 65 | return entity.isInvulnerable() ? invulnerableWitherTextures : witherTextures;
|
| 66 | }
|
| 67 | }
|
| 68 |
|