    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 RenderEnchantmentTable extends TileEntitySpecialRenderer
    009    {
    010        private ModelBook enchantmentBook = new ModelBook();
    011
    012        public void renderTileEntityEnchantmentTableAt(TileEntityEnchantmentTable par1TileEntityEnchantmentTable, double par2, double par4, double par6, float par8)
    013        {
    014            GL11.glPushMatrix();
    015            GL11.glTranslatef((float)par2 + 0.5F, (float)par4 + 0.75F, (float)par6 + 0.5F);
    016            float var9 = (float)par1TileEntityEnchantmentTable.tickCount + par8;
    017            GL11.glTranslatef(0.0F, 0.1F + MathHelper.sin(var9 * 0.1F) * 0.01F, 0.0F);
    018            float var10;
    019
    020            for (var10 = par1TileEntityEnchantmentTable.bookRotation2 - par1TileEntityEnchantmentTable.bookRotationPrev; var10 >= (float)Math.PI; var10 -= ((float)Math.PI * 2F))
    021            {
    022                ;
    023            }
    024
    025            while (var10 < -(float)Math.PI)
    026            {
    027                var10 += ((float)Math.PI * 2F);
    028            }
    029
    030            float var11 = par1TileEntityEnchantmentTable.bookRotationPrev + var10 * par8;
    031            GL11.glRotatef(-var11 * 180.0F / (float)Math.PI, 0.0F, 1.0F, 0.0F);
    032            GL11.glRotatef(80.0F, 0.0F, 0.0F, 1.0F);
    033            this.bindTextureByName("/item/book.png");
    034            float var12 = par1TileEntityEnchantmentTable.pageFlipPrev + (par1TileEntityEnchantmentTable.pageFlip - par1TileEntityEnchantmentTable.pageFlipPrev) * par8 + 0.25F;
    035            float var13 = par1TileEntityEnchantmentTable.pageFlipPrev + (par1TileEntityEnchantmentTable.pageFlip - par1TileEntityEnchantmentTable.pageFlipPrev) * par8 + 0.75F;
    036            var12 = (var12 - (float)MathHelper.truncateDoubleToInt((double)var12)) * 1.6F - 0.3F;
    037            var13 = (var13 - (float)MathHelper.truncateDoubleToInt((double)var13)) * 1.6F - 0.3F;
    038
    039            if (var12 < 0.0F)
    040            {
    041                var12 = 0.0F;
    042            }
    043
    044            if (var13 < 0.0F)
    045            {
    046                var13 = 0.0F;
    047            }
    048
    049            if (var12 > 1.0F)
    050            {
    051                var12 = 1.0F;
    052            }
    053
    054            if (var13 > 1.0F)
    055            {
    056                var13 = 1.0F;
    057            }
    058
    059            float var14 = par1TileEntityEnchantmentTable.bookSpreadPrev + (par1TileEntityEnchantmentTable.bookSpread - par1TileEntityEnchantmentTable.bookSpreadPrev) * par8;
    060            GL11.glEnable(GL11.GL_CULL_FACE);
    061            this.enchantmentBook.render((Entity)null, var9, var12, var13, var14, 0.0F, 0.0625F);
    062            GL11.glPopMatrix();
    063        }
    064
    065        public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
    066        {
    067            this.renderTileEntityEnchantmentTableAt((TileEntityEnchantmentTable)par1TileEntity, par2, par4, par6, par8);
    068        }
    069    }