    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import org.lwjgl.opengl.GL11;
    006
    007    @SideOnly(Side.CLIENT)
    008    public class TileEntitySignRenderer extends TileEntitySpecialRenderer
    009    {
    010        /** The ModelSign instance used by the TileEntitySignRenderer */
    011        private ModelSign modelSign = new ModelSign();
    012
    013        public void renderTileEntitySignAt(TileEntitySign par1TileEntitySign, double par2, double par4, double par6, float par8)
    014        {
    015            Block var9 = par1TileEntitySign.getBlockType();
    016            GL11.glPushMatrix();
    017            float var10 = 0.6666667F;
    018            float var12;
    019
    020            if (var9 == Block.signPost)
    021            {
    022                GL11.glTranslatef((float)par2 + 0.5F, (float)par4 + 0.75F * var10, (float)par6 + 0.5F);
    023                float var11 = (float)(par1TileEntitySign.getBlockMetadata() * 360) / 16.0F;
    024                GL11.glRotatef(-var11, 0.0F, 1.0F, 0.0F);
    025                this.modelSign.signStick.showModel = true;
    026            }
    027            else
    028            {
    029                int var16 = par1TileEntitySign.getBlockMetadata();
    030                var12 = 0.0F;
    031
    032                if (var16 == 2)
    033                {
    034                    var12 = 180.0F;
    035                }
    036
    037                if (var16 == 4)
    038                {
    039                    var12 = 90.0F;
    040                }
    041
    042                if (var16 == 5)
    043                {
    044                    var12 = -90.0F;
    045                }
    046
    047                GL11.glTranslatef((float)par2 + 0.5F, (float)par4 + 0.75F * var10, (float)par6 + 0.5F);
    048                GL11.glRotatef(-var12, 0.0F, 1.0F, 0.0F);
    049                GL11.glTranslatef(0.0F, -0.3125F, -0.4375F);
    050                this.modelSign.signStick.showModel = false;
    051            }
    052
    053            this.bindTextureByName("/item/sign.png");
    054            GL11.glPushMatrix();
    055            GL11.glScalef(var10, -var10, -var10);
    056            this.modelSign.renderSign();
    057            GL11.glPopMatrix();
    058            FontRenderer var17 = this.getFontRenderer();
    059            var12 = 0.016666668F * var10;
    060            GL11.glTranslatef(0.0F, 0.5F * var10, 0.07F * var10);
    061            GL11.glScalef(var12, -var12, var12);
    062            GL11.glNormal3f(0.0F, 0.0F, -1.0F * var12);
    063            GL11.glDepthMask(false);
    064            byte var13 = 0;
    065
    066            for (int var14 = 0; var14 < par1TileEntitySign.signText.length; ++var14)
    067            {
    068                String var15 = par1TileEntitySign.signText[var14];
    069
    070                if (var14 == par1TileEntitySign.lineBeingEdited)
    071                {
    072                    var15 = "> " + var15 + " <";
    073                    var17.drawString(var15, -var17.getStringWidth(var15) / 2, var14 * 10 - par1TileEntitySign.signText.length * 5, var13);
    074                }
    075                else
    076                {
    077                    var17.drawString(var15, -var17.getStringWidth(var15) / 2, var14 * 10 - par1TileEntitySign.signText.length * 5, var13);
    078                }
    079            }
    080
    081            GL11.glDepthMask(true);
    082            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    083            GL11.glPopMatrix();
    084        }
    085
    086        public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
    087        {
    088            this.renderTileEntitySignAt((TileEntitySign)par1TileEntity, par2, par4, par6, par8);
    089        }
    090    }