    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005
    006    public class ModelBox
    007    {
    008        /**
    009         * The (x,y,z) vertex positions and (u,v) texture coordinates for each of the 8 points on a cube
    010         */
    011        private PositionTextureVertex[] vertexPositions;
    012
    013        /** An array of 6 TexturedQuads, one for each face of a cube */
    014        private TexturedQuad[] quadList;
    015
    016        /** X vertex coordinate of lower box corner */
    017        public final float posX1;
    018
    019        /** Y vertex coordinate of lower box corner */
    020        public final float posY1;
    021
    022        /** Z vertex coordinate of lower box corner */
    023        public final float posZ1;
    024
    025        /** X vertex coordinate of upper box corner */
    026        public final float posX2;
    027
    028        /** Y vertex coordinate of upper box corner */
    029        public final float posY2;
    030
    031        /** Z vertex coordinate of upper box corner */
    032        public final float posZ2;
    033        public String field_78247_g;
    034
    035        public ModelBox(ModelRenderer par1ModelRenderer, int par2, int par3, float par4, float par5, float par6, int par7, int par8, int par9, float par10)
    036        {
    037            this.posX1 = par4;
    038            this.posY1 = par5;
    039            this.posZ1 = par6;
    040            this.posX2 = par4 + (float)par7;
    041            this.posY2 = par5 + (float)par8;
    042            this.posZ2 = par6 + (float)par9;
    043            this.vertexPositions = new PositionTextureVertex[8];
    044            this.quadList = new TexturedQuad[6];
    045            float var11 = par4 + (float)par7;
    046            float var12 = par5 + (float)par8;
    047            float var13 = par6 + (float)par9;
    048            par4 -= par10;
    049            par5 -= par10;
    050            par6 -= par10;
    051            var11 += par10;
    052            var12 += par10;
    053            var13 += par10;
    054
    055            if (par1ModelRenderer.mirror)
    056            {
    057                float var14 = var11;
    058                var11 = par4;
    059                par4 = var14;
    060            }
    061
    062            PositionTextureVertex var26 = new PositionTextureVertex(par4, par5, par6, 0.0F, 0.0F);
    063            PositionTextureVertex var15 = new PositionTextureVertex(var11, par5, par6, 0.0F, 8.0F);
    064            PositionTextureVertex var16 = new PositionTextureVertex(var11, var12, par6, 8.0F, 8.0F);
    065            PositionTextureVertex var17 = new PositionTextureVertex(par4, var12, par6, 8.0F, 0.0F);
    066            PositionTextureVertex var18 = new PositionTextureVertex(par4, par5, var13, 0.0F, 0.0F);
    067            PositionTextureVertex var19 = new PositionTextureVertex(var11, par5, var13, 0.0F, 8.0F);
    068            PositionTextureVertex var20 = new PositionTextureVertex(var11, var12, var13, 8.0F, 8.0F);
    069            PositionTextureVertex var21 = new PositionTextureVertex(par4, var12, var13, 8.0F, 0.0F);
    070            this.vertexPositions[0] = var26;
    071            this.vertexPositions[1] = var15;
    072            this.vertexPositions[2] = var16;
    073            this.vertexPositions[3] = var17;
    074            this.vertexPositions[4] = var18;
    075            this.vertexPositions[5] = var19;
    076            this.vertexPositions[6] = var20;
    077            this.vertexPositions[7] = var21;
    078            this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] {var19, var15, var16, var20}, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
    079            this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] {var26, var18, var21, var17}, par2, par3 + par9, par2 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
    080            this.quadList[2] = new TexturedQuad(new PositionTextureVertex[] {var19, var18, var26, var15}, par2 + par9, par3, par2 + par9 + par7, par3 + par9, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
    081            this.quadList[3] = new TexturedQuad(new PositionTextureVertex[] {var16, var17, var21, var20}, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par7, par3, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
    082            this.quadList[4] = new TexturedQuad(new PositionTextureVertex[] {var15, var26, var17, var16}, par2 + par9, par3 + par9, par2 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
    083            this.quadList[5] = new TexturedQuad(new PositionTextureVertex[] {var18, var19, var20, var21}, par2 + par9 + par7 + par9, par3 + par9, par2 + par9 + par7 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
    084
    085            if (par1ModelRenderer.mirror)
    086            {
    087                TexturedQuad[] var22 = this.quadList;
    088                int var23 = var22.length;
    089
    090                for (int var24 = 0; var24 < var23; ++var24)
    091                {
    092                    TexturedQuad var25 = var22[var24];
    093                    var25.flipFace();
    094                }
    095            }
    096        }
    097
    098        /**
    099         * Draw the six sided box defined by this ModelBox
    100         */
    101        @SideOnly(Side.CLIENT)
    102        public void render(Tessellator par1Tessellator, float par2)
    103        {
    104            TexturedQuad[] var3 = this.quadList;
    105            int var4 = var3.length;
    106
    107            for (int var5 = 0; var5 < var4; ++var5)
    108            {
    109                TexturedQuad var6 = var3[var5];
    110                var6.draw(par1Tessellator, par2);
    111            }
    112        }
    113
    114        public ModelBox func_78244_a(String par1Str)
    115        {
    116            this.field_78247_g = par1Str;
    117            return this;
    118        }
    119    }