| 1 | package net.minecraft.client.renderer.tileentity;
|
| 2 |
|
| 3 | import net.minecraft.client.model.ModelChest;
|
| 4 | import net.minecraft.client.renderer.GlStateManager;
|
| 5 | import net.minecraft.tileentity.TileEntityEnderChest;
|
| 6 | import net.minecraft.util.ResourceLocation;
|
| 7 |
|
| 8 | public class TileEntityEnderChestRenderer extends TileEntitySpecialRenderer<TileEntityEnderChest>
|
| 9 | {
|
| 10 | private static final ResourceLocation ENDER_CHEST_TEXTURE = new ResourceLocation("textures/entity/chest/ender.png");
|
| 11 | private ModelChest field_147521_c = new ModelChest();
|
| 12 |
|
| 13 | public void renderTileEntityAt(TileEntityEnderChest te, double x, double y, double z, float partialTicks, int destroyStage)
|
| 14 | {
|
| 15 | int i = 0;
|
| 16 |
|
| 17 | if (te.hasWorldObj())
|
| 18 | {
|
| 19 | i = te.getBlockMetadata();
|
| 20 | }
|
| 21 |
|
| 22 | if (destroyStage >= 0)
|
| 23 | {
|
| 24 | this.bindTexture(DESTROY_STAGES[destroyStage]);
|
| 25 | GlStateManager.matrixMode(5890);
|
| 26 | GlStateManager.pushMatrix();
|
| 27 | GlStateManager.scale(4.0F, 4.0F, 1.0F);
|
| 28 | GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
|
| 29 | GlStateManager.matrixMode(5888);
|
| 30 | }
|
| 31 | else
|
| 32 | {
|
| 33 | this.bindTexture(ENDER_CHEST_TEXTURE);
|
| 34 | }
|
| 35 |
|
| 36 | GlStateManager.pushMatrix();
|
| 37 | GlStateManager.enableRescaleNormal();
|
| 38 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 39 | GlStateManager.translate((float)x, (float)y + 1.0F, (float)z + 1.0F);
|
| 40 | GlStateManager.scale(1.0F, -1.0F, -1.0F);
|
| 41 | GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
| 42 | int j = 0;
|
| 43 |
|
| 44 | if (i == 2)
|
| 45 | {
|
| 46 | j = 180;
|
| 47 | }
|
| 48 |
|
| 49 | if (i == 3)
|
| 50 | {
|
| 51 | j = 0;
|
| 52 | }
|
| 53 |
|
| 54 | if (i == 4)
|
| 55 | {
|
| 56 | j = 90;
|
| 57 | }
|
| 58 |
|
| 59 | if (i == 5)
|
| 60 | {
|
| 61 | j = -90;
|
| 62 | }
|
| 63 |
|
| 64 | GlStateManager.rotate((float)j, 0.0F, 1.0F, 0.0F);
|
| 65 | GlStateManager.translate(-0.5F, -0.5F, -0.5F);
|
| 66 | float f = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * partialTicks;
|
| 67 | f = 1.0F - f;
|
| 68 | f = 1.0F - f * f * f;
|
| 69 | this.field_147521_c.chestLid.rotateAngleX = -(f * (float)Math.PI / 2.0F);
|
| 70 | this.field_147521_c.renderAll();
|
| 71 | GlStateManager.disableRescaleNormal();
|
| 72 | GlStateManager.popMatrix();
|
| 73 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 74 |
|
| 75 | if (destroyStage >= 0)
|
| 76 | {
|
| 77 | GlStateManager.matrixMode(5890);
|
| 78 | GlStateManager.popMatrix();
|
| 79 | GlStateManager.matrixMode(5888);
|
| 80 | }
|
| 81 | }
|
| 82 | }
|
| 83 |
|