| 1 | package net.minecraft.client.renderer.entity;
|
| 2 |
|
| 3 | import net.minecraft.client.Minecraft;
|
| 4 | import net.minecraft.client.renderer.BlockRendererDispatcher;
|
| 5 | import net.minecraft.client.renderer.GlStateManager;
|
| 6 | import net.minecraft.client.renderer.texture.TextureMap;
|
| 7 | import net.minecraft.entity.item.EntityTNTPrimed;
|
| 8 | import net.minecraft.init.Blocks;
|
| 9 | import net.minecraft.util.MathHelper;
|
| 10 | import net.minecraft.util.ResourceLocation;
|
| 11 |
|
| 12 | public class RenderTNTPrimed extends Render<EntityTNTPrimed>
|
| 13 | {
|
| 14 | public RenderTNTPrimed(RenderManager renderManagerIn)
|
| 15 | {
|
| 16 | super(renderManagerIn);
|
| 17 | this.shadowSize = 0.5F;
|
| 18 | }
|
| 19 |
|
| 20 | /**
|
| 21 | * Renders the desired {@code T} type Entity.
|
| 22 | */
|
| 23 | public void doRender(EntityTNTPrimed entity, double x, double y, double z, float entityYaw, float partialTicks)
|
| 24 | {
|
| 25 | BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
|
| 26 | GlStateManager.pushMatrix();
|
| 27 | GlStateManager.translate((float)x, (float)y + 0.5F, (float)z);
|
| 28 |
|
| 29 | if ((float)entity.fuse - partialTicks + 1.0F < 10.0F)
|
| 30 | {
|
| 31 | float f = 1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 10.0F;
|
| 32 | f = MathHelper.clamp_float(f, 0.0F, 1.0F);
|
| 33 | f = f * f;
|
| 34 | f = f * f;
|
| 35 | float f1 = 1.0F + f * 0.3F;
|
| 36 | GlStateManager.scale(f1, f1, f1);
|
| 37 | }
|
| 38 |
|
| 39 | float f2 = (1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F;
|
| 40 | this.bindEntityTexture(entity);
|
| 41 | GlStateManager.translate(-0.5F, -0.5F, 0.5F);
|
| 42 | blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getDefaultState(), entity.getBrightness(partialTicks));
|
| 43 | GlStateManager.translate(0.0F, 0.0F, 1.0F);
|
| 44 |
|
| 45 | if (entity.fuse / 5 % 2 == 0)
|
| 46 | {
|
| 47 | GlStateManager.disableTexture2D();
|
| 48 | GlStateManager.disableLighting();
|
| 49 | GlStateManager.enableBlend();
|
| 50 | GlStateManager.blendFunc(770, 772);
|
| 51 | GlStateManager.color(1.0F, 1.0F, 1.0F, f2);
|
| 52 | GlStateManager.doPolygonOffset(-3.0F, -3.0F);
|
| 53 | GlStateManager.enablePolygonOffset();
|
| 54 | blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getDefaultState(), 1.0F);
|
| 55 | GlStateManager.doPolygonOffset(0.0F, 0.0F);
|
| 56 | GlStateManager.disablePolygonOffset();
|
| 57 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 58 | GlStateManager.disableBlend();
|
| 59 | GlStateManager.enableLighting();
|
| 60 | GlStateManager.enableTexture2D();
|
| 61 | }
|
| 62 |
|
| 63 | GlStateManager.popMatrix();
|
| 64 | super.doRender(entity, x, y, z, entityYaw, partialTicks);
|
| 65 | }
|
| 66 |
|
| 67 | /**
|
| 68 | * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
|
| 69 | */
|
| 70 | protected ResourceLocation getEntityTexture(EntityTNTPrimed entity)
|
| 71 | {
|
| 72 | return TextureMap.locationBlocksTexture;
|
| 73 | }
|
| 74 | }
|
| 75 |
|