001    package net.minecraft.client.renderer.entity;
002    
003    import cpw.mods.fml.relauncher.Side;
004    import cpw.mods.fml.relauncher.SideOnly;
005    import java.util.Random;
006    import net.minecraft.block.Block;
007    import net.minecraft.client.Minecraft;
008    import net.minecraft.client.gui.FontRenderer;
009    import net.minecraft.client.renderer.ItemRenderer;
010    import net.minecraft.client.renderer.RenderBlocks;
011    import net.minecraft.client.renderer.RenderEngine;
012    import net.minecraft.client.renderer.Tessellator;
013    import net.minecraft.entity.Entity;
014    import net.minecraft.entity.item.EntityItem;
015    import net.minecraft.item.Item;
016    import net.minecraft.item.ItemBlock;
017    import net.minecraft.item.ItemStack;
018    import net.minecraft.util.MathHelper;
019    import org.lwjgl.opengl.GL11;
020    import org.lwjgl.opengl.GL12;
021    
022    import net.minecraftforge.client.ForgeHooksClient;
023    
024    @SideOnly(Side.CLIENT)
025    public class RenderItem extends Render
026    {
027        private RenderBlocks renderBlocks = new RenderBlocks();
028    
029        /** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
030        private Random random = new Random();
031        public boolean field_77024_a = true;
032    
033        /** Defines the zLevel of rendering of item on GUI. */
034        public float zLevel = 0.0F;
035        public static boolean field_82407_g = false;
036    
037        public RenderItem()
038        {
039            this.shadowSize = 0.15F;
040            this.shadowOpaque = 0.75F;
041        }
042    
043        /**
044         * Renders the item
045         */
046        public void doRenderItem(EntityItem par1EntityItem, double par2, double par4, double par6, float par8, float par9)
047        {
048            this.random.setSeed(187L);
049            ItemStack var10 = par1EntityItem.func_92014_d();
050    
051            if (var10.getItem() != null)
052            {
053                GL11.glPushMatrix();
054                float var11 = MathHelper.sin(((float)par1EntityItem.age + par9) / 10.0F + par1EntityItem.hoverStart) * 0.1F + 0.1F;
055                float var12 = (((float)par1EntityItem.age + par9) / 20.0F + par1EntityItem.hoverStart) * (180F / (float)Math.PI);
056                byte var13 = 1;
057    
058                if (par1EntityItem.func_92014_d().stackSize > 1)
059                {
060                    var13 = 2;
061                }
062    
063                if (par1EntityItem.func_92014_d().stackSize > 5)
064                {
065                    var13 = 3;
066                }
067    
068                if (par1EntityItem.func_92014_d().stackSize > 20)
069                {
070                    var13 = 4;
071                }
072    
073                if (par1EntityItem.func_92014_d().stackSize > 40)
074                {
075                    var13 = 5;
076                }
077    
078                GL11.glTranslatef((float)par2, (float)par4 + var11, (float)par6);
079                GL11.glEnable(GL12.GL_RESCALE_NORMAL);
080                int var16;
081                float var19;
082                float var20;
083                float var24;
084    
085                if (ForgeHooksClient.renderEntityItem(par1EntityItem, var10, var11, var12, random, renderManager.renderEngine, renderBlocks))
086                {
087                    ;
088                }
089                else if (var10.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[var10.itemID].getRenderType()))
090                {
091                    GL11.glRotatef(var12, 0.0F, 1.0F, 0.0F);
092    
093                    if (field_82407_g)
094                    {
095                        GL11.glScalef(1.25F, 1.25F, 1.25F);
096                        GL11.glTranslatef(0.0F, 0.05F, 0.0F);
097                        GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
098                    }
099    
100                    this.loadTexture(Block.blocksList[var10.itemID].getTextureFile());
101                    float var22 = 0.25F;
102                    var16 = Block.blocksList[var10.itemID].getRenderType();
103    
104                    if (var16 == 1 || var16 == 19 || var16 == 12 || var16 == 2)
105                    {
106                        var22 = 0.5F;
107                    }
108    
109                    GL11.glScalef(var22, var22, var22);
110    
111                    for (int var23 = 0; var23 < var13; ++var23)
112                    {
113                        GL11.glPushMatrix();
114    
115                        if (var23 > 0)
116                        {
117                            var24 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / var22;
118                            var19 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / var22;
119                            var20 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / var22;
120                            GL11.glTranslatef(var24, var19, var20);
121                        }
122    
123                        var24 = 1.0F;
124                        this.renderBlocks.renderBlockAsItem(Block.blocksList[var10.itemID], var10.getItemDamage(), var24);
125                        GL11.glPopMatrix();
126                    }
127                }
128                else
129                {
130                    int var15;
131                    float var17;
132    
133                    if (var10.getItem().requiresMultipleRenderPasses())
134                    {
135                        if (field_82407_g)
136                        {
137                            GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
138                            GL11.glTranslatef(0.0F, -0.05F, 0.0F);
139                        }
140                        else
141                        {
142                            GL11.glScalef(0.5F, 0.5F, 0.5F);
143                        }
144    
145                        this.loadTexture(Item.itemsList[var10.itemID].getTextureFile());
146    
147                        for (var15 = 0; var15 <= var10.getItem().getRenderPasses(var10.getItemDamage()); ++var15)
148                        {
149                            this.random.setSeed(187L);
150                            var16 = var10.getItem().getIconIndex(var10, var15);
151                            var17 = 1.0F;
152    
153                            if (this.field_77024_a)
154                            {
155                                int var18 = Item.itemsList[var10.itemID].getColorFromItemStack(var10, var15);
156                                var19 = (float)(var18 >> 16 & 255) / 255.0F;
157                                var20 = (float)(var18 >> 8 & 255) / 255.0F;
158                                float var21 = (float)(var18 & 255) / 255.0F;
159                                GL11.glColor4f(var19 * var17, var20 * var17, var21 * var17, 1.0F);
160                                this.func_77020_a(par1EntityItem, var16, var13, par9, var19 * var17, var20 * var17, var21 * var17);
161                            }
162                            else
163                            {
164                                this.func_77020_a(par1EntityItem, var16, var13, par9, 1.0F, 1.0F, 1.0F);
165                            }
166                        }
167                    }
168                    else
169                    {
170                        if (field_82407_g)
171                        {
172                            GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
173                            GL11.glTranslatef(0.0F, -0.05F, 0.0F);
174                        }
175                        else
176                        {
177                            GL11.glScalef(0.5F, 0.5F, 0.5F);
178                        }
179    
180                        var15 = var10.getIconIndex();
181    
182                        this.loadTexture(var10.getItem().getTextureFile());
183    
184                        if (this.field_77024_a)
185                        {
186                            var16 = Item.itemsList[var10.itemID].getColorFromItemStack(var10, 0);
187                            var17 = (float)(var16 >> 16 & 255) / 255.0F;
188                            var24 = (float)(var16 >> 8 & 255) / 255.0F;
189                            var19 = (float)(var16 & 255) / 255.0F;
190                            var20 = 1.0F;
191                            this.func_77020_a(par1EntityItem, var15, var13, par9, var17 * var20, var24 * var20, var19 * var20);
192                        }
193                        else
194                        {
195                            this.func_77020_a(par1EntityItem, var15, var13, par9, 1.0F, 1.0F, 1.0F);
196                        }
197                    }
198                }
199    
200                GL11.glDisable(GL12.GL_RESCALE_NORMAL);
201                GL11.glPopMatrix();
202            }
203        }
204    
205        private void func_77020_a(EntityItem par1EntityItem, int par2, int par3, float par4, float par5, float par6, float par7)
206        {
207            Tessellator var8 = Tessellator.instance;
208            float var9 = (float)(par2 % 16 * 16 + 0) / 256.0F;
209            float var10 = (float)(par2 % 16 * 16 + 16) / 256.0F;
210            float var11 = (float)(par2 / 16 * 16 + 0) / 256.0F;
211            float var12 = (float)(par2 / 16 * 16 + 16) / 256.0F;
212            float var13 = 1.0F;
213            float var14 = 0.5F;
214            float var15 = 0.25F;
215            float var17;
216    
217            if (this.renderManager.options.fancyGraphics)
218            {
219                GL11.glPushMatrix();
220    
221                if (field_82407_g)
222                {
223                    GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
224                }
225                else
226                {
227                    GL11.glRotatef((((float)par1EntityItem.age + par4) / 20.0F + par1EntityItem.hoverStart) * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F);
228                }
229    
230                float var16 = 0.0625F;
231                var17 = 0.021875F;
232                ItemStack var18 = par1EntityItem.func_92014_d();
233                int var19 = var18.stackSize;
234                byte var24;
235    
236                if (var19 < 2)
237                {
238                    var24 = 1;
239                }
240                else if (var19 < 16)
241                {
242                    var24 = 2;
243                }
244                else if (var19 < 32)
245                {
246                    var24 = 3;
247                }
248                else
249                {
250                    var24 = 4;
251                }
252    
253                GL11.glTranslatef(-var14, -var15, -((var16 + var17) * (float)var24 / 2.0F));
254    
255                for (int var20 = 0; var20 < var24; ++var20)
256                {
257                    GL11.glTranslatef(0.0F, 0.0F, var16 + var17);
258    
259                    this.loadTexture(Item.itemsList[var18.itemID].getTextureFile());
260    
261                    GL11.glColor4f(par5, par6, par7, 1.0F);
262                    ItemRenderer.renderItemIn2D(var8, var10, var11, var9, var12, var16);
263    
264                    if (var18 != null && var18.hasEffect())
265                    {
266                        GL11.glDepthFunc(GL11.GL_EQUAL);
267                        GL11.glDisable(GL11.GL_LIGHTING);
268                        this.renderManager.renderEngine.bindTexture(this.renderManager.renderEngine.getTexture("%blur%/misc/glint.png"));
269                        GL11.glEnable(GL11.GL_BLEND);
270                        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
271                        float var21 = 0.76F;
272                        GL11.glColor4f(0.5F * var21, 0.25F * var21, 0.8F * var21, 1.0F);
273                        GL11.glMatrixMode(GL11.GL_TEXTURE);
274                        GL11.glPushMatrix();
275                        float var22 = 0.125F;
276                        GL11.glScalef(var22, var22, var22);
277                        float var23 = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
278                        GL11.glTranslatef(var23, 0.0F, 0.0F);
279                        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
280                        ItemRenderer.renderItemIn2D(var8, 0.0F, 0.0F, 1.0F, 1.0F, var16);
281                        GL11.glPopMatrix();
282                        GL11.glPushMatrix();
283                        GL11.glScalef(var22, var22, var22);
284                        var23 = (float)(Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
285                        GL11.glTranslatef(-var23, 0.0F, 0.0F);
286                        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
287                        ItemRenderer.renderItemIn2D(var8, 0.0F, 0.0F, 1.0F, 1.0F, 0.0625F);
288                        GL11.glPopMatrix();
289                        GL11.glMatrixMode(GL11.GL_MODELVIEW);
290                        GL11.glDisable(GL11.GL_BLEND);
291                        GL11.glEnable(GL11.GL_LIGHTING);
292                        GL11.glDepthFunc(GL11.GL_LEQUAL);
293                    }
294                }
295    
296                GL11.glPopMatrix();
297            }
298            else
299            {
300                for (int var25 = 0; var25 < par3; ++var25)
301                {
302                    GL11.glPushMatrix();
303    
304                    if (var25 > 0)
305                    {
306                        var17 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F;
307                        float var27 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F;
308                        float var26 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F;
309                        GL11.glTranslatef(var17, var27, var26);
310                    }
311    
312                    if (!field_82407_g)
313                    {
314                        GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
315                    }
316    
317                    GL11.glColor4f(par5, par6, par7, 1.0F);
318                    var8.startDrawingQuads();
319                    var8.setNormal(0.0F, 1.0F, 0.0F);
320                    var8.addVertexWithUV((double)(0.0F - var14), (double)(0.0F - var15), 0.0D, (double)var9, (double)var12);
321                    var8.addVertexWithUV((double)(var13 - var14), (double)(0.0F - var15), 0.0D, (double)var10, (double)var12);
322                    var8.addVertexWithUV((double)(var13 - var14), (double)(1.0F - var15), 0.0D, (double)var10, (double)var11);
323                    var8.addVertexWithUV((double)(0.0F - var14), (double)(1.0F - var15), 0.0D, (double)var9, (double)var11);
324                    var8.draw();
325                    GL11.glPopMatrix();
326                }
327            }
328        }
329    
330        /**
331         * Renders the item's icon or block into the UI at the specified position.
332         */
333        public void renderItemIntoGUI(FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5)
334        {
335            int var6 = par3ItemStack.itemID;
336            int var7 = par3ItemStack.getItemDamage();
337            int var8 = par3ItemStack.getIconIndex();
338            int var10;
339            float var12;
340            float var13;
341            float var16;
342    
343            if (par3ItemStack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[par3ItemStack.itemID].getRenderType()))
344            {
345                Block var15 = Block.blocksList[var6];
346                par2RenderEngine.bindTexture(par2RenderEngine.getTexture(var15.getTextureFile()));
347                GL11.glPushMatrix();
348                GL11.glTranslatef((float)(par4 - 2), (float)(par5 + 3), -3.0F + this.zLevel);
349                GL11.glScalef(10.0F, 10.0F, 10.0F);
350                GL11.glTranslatef(1.0F, 0.5F, 1.0F);
351                GL11.glScalef(1.0F, 1.0F, -1.0F);
352                GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
353                GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
354                var10 = Item.itemsList[var6].getColorFromItemStack(par3ItemStack, 0);
355                var16 = (float)(var10 >> 16 & 255) / 255.0F;
356                var12 = (float)(var10 >> 8 & 255) / 255.0F;
357                var13 = (float)(var10 & 255) / 255.0F;
358    
359                if (this.field_77024_a)
360                {
361                    GL11.glColor4f(var16, var12, var13, 1.0F);
362                }
363    
364                GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
365                this.renderBlocks.useInventoryTint = this.field_77024_a;
366                this.renderBlocks.renderBlockAsItem(var15, var7, 1.0F);
367                this.renderBlocks.useInventoryTint = true;
368                GL11.glPopMatrix();
369            }
370            else
371            {
372                int var9;
373    
374                if (Item.itemsList[var6].requiresMultipleRenderPasses())
375                {
376                    GL11.glDisable(GL11.GL_LIGHTING);
377                    par2RenderEngine.bindTexture(par2RenderEngine.getTexture(Item.itemsList[var6].getTextureFile()));
378    
379                    for (var9 = 0; var9 < Item.itemsList[var6].getRenderPasses(var7); ++var9)
380                    {
381                        var10 = Item.itemsList[var6].getIconIndex(par3ItemStack, var9);
382                        int var11 = Item.itemsList[var6].getColorFromItemStack(par3ItemStack, var9);
383                        var12 = (float)(var11 >> 16 & 255) / 255.0F;
384                        var13 = (float)(var11 >> 8 & 255) / 255.0F;
385                        float var14 = (float)(var11 & 255) / 255.0F;
386    
387                        if (this.field_77024_a)
388                        {
389                            GL11.glColor4f(var12, var13, var14, 1.0F);
390                        }
391    
392                        this.renderTexturedQuad(par4, par5, var10 % 16 * 16, var10 / 16 * 16, 16, 16);
393                    }
394    
395                    GL11.glEnable(GL11.GL_LIGHTING);
396                }
397                else if (var8 >= 0)
398                {
399                    GL11.glDisable(GL11.GL_LIGHTING);
400    
401                    par2RenderEngine.bindTexture(par2RenderEngine.getTexture(par3ItemStack.getItem().getTextureFile()));
402    
403                    var9 = Item.itemsList[var6].getColorFromItemStack(par3ItemStack, 0);
404                    float var17 = (float)(var9 >> 16 & 255) / 255.0F;
405                    var16 = (float)(var9 >> 8 & 255) / 255.0F;
406                    var12 = (float)(var9 & 255) / 255.0F;
407    
408                    if (this.field_77024_a)
409                    {
410                        GL11.glColor4f(var17, var16, var12, 1.0F);
411                    }
412    
413                    this.renderTexturedQuad(par4, par5, var8 % 16 * 16, var8 / 16 * 16, 16, 16);
414                    GL11.glEnable(GL11.GL_LIGHTING);
415                }
416            }
417    
418            GL11.glEnable(GL11.GL_CULL_FACE);
419        }
420    
421        /**
422         * Render the item's icon or block into the GUI, including the glint effect.
423         */
424        public void renderItemAndEffectIntoGUI(FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5)
425        {
426            if (par3ItemStack != null)
427            {
428                if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2RenderEngine, par3ItemStack, field_77024_a, zLevel, (float)par4, (float)par5))
429                {
430                    this.renderItemIntoGUI(par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5);
431                }
432    
433                if (par3ItemStack != null && par3ItemStack.hasEffect())
434                {
435                    GL11.glDepthFunc(GL11.GL_GREATER);
436                    GL11.glDisable(GL11.GL_LIGHTING);
437                    GL11.glDepthMask(false);
438                    par2RenderEngine.bindTexture(par2RenderEngine.getTexture("%blur%/misc/glint.png"));
439                    this.zLevel -= 50.0F;
440                    GL11.glEnable(GL11.GL_BLEND);
441                    GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
442                    GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
443                    this.func_77018_a(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20);
444                    GL11.glDisable(GL11.GL_BLEND);
445                    GL11.glDepthMask(true);
446                    this.zLevel += 50.0F;
447                    GL11.glEnable(GL11.GL_LIGHTING);
448                    GL11.glDepthFunc(GL11.GL_LEQUAL);
449                }
450            }
451        }
452    
453        private void func_77018_a(int par1, int par2, int par3, int par4, int par5)
454        {
455            for (int var6 = 0; var6 < 2; ++var6)
456            {
457                if (var6 == 0)
458                {
459                    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
460                }
461    
462                if (var6 == 1)
463                {
464                    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
465                }
466    
467                float var7 = 0.00390625F;
468                float var8 = 0.00390625F;
469                float var9 = (float)(Minecraft.getSystemTime() % (long)(3000 + var6 * 1873)) / (3000.0F + (float)(var6 * 1873)) * 256.0F;
470                float var10 = 0.0F;
471                Tessellator var11 = Tessellator.instance;
472                float var12 = 4.0F;
473    
474                if (var6 == 1)
475                {
476                    var12 = -1.0F;
477                }
478    
479                var11.startDrawingQuads();
480                var11.addVertexWithUV((double)(par2 + 0), (double)(par3 + par5), (double)this.zLevel, (double)((var9 + (float)par5 * var12) * var7), (double)((var10 + (float)par5) * var8));
481                var11.addVertexWithUV((double)(par2 + par4), (double)(par3 + par5), (double)this.zLevel, (double)((var9 + (float)par4 + (float)par5 * var12) * var7), (double)((var10 + (float)par5) * var8));
482                var11.addVertexWithUV((double)(par2 + par4), (double)(par3 + 0), (double)this.zLevel, (double)((var9 + (float)par4) * var7), (double)((var10 + 0.0F) * var8));
483                var11.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)this.zLevel, (double)((var9 + 0.0F) * var7), (double)((var10 + 0.0F) * var8));
484                var11.draw();
485            }
486        }
487    
488        /**
489         * Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the
490         * specified position.
491         */
492        public void renderItemOverlayIntoGUI(FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5)
493        {
494            if (par3ItemStack != null)
495            {
496                if (par3ItemStack.stackSize > 1)
497                {
498                    String var6 = "" + par3ItemStack.stackSize;
499                    GL11.glDisable(GL11.GL_LIGHTING);
500                    GL11.glDisable(GL11.GL_DEPTH_TEST);
501                    par1FontRenderer.drawStringWithShadow(var6, par4 + 19 - 2 - par1FontRenderer.getStringWidth(var6), par5 + 6 + 3, 16777215);
502                    GL11.glEnable(GL11.GL_LIGHTING);
503                    GL11.glEnable(GL11.GL_DEPTH_TEST);
504                }
505    
506                if (par3ItemStack.isItemDamaged())
507                {
508                    int var11 = (int)Math.round(13.0D - (double)par3ItemStack.getItemDamageForDisplay() * 13.0D / (double)par3ItemStack.getMaxDamage());
509                    int var7 = (int)Math.round(255.0D - (double)par3ItemStack.getItemDamageForDisplay() * 255.0D / (double)par3ItemStack.getMaxDamage());
510                    GL11.glDisable(GL11.GL_LIGHTING);
511                    GL11.glDisable(GL11.GL_DEPTH_TEST);
512                    GL11.glDisable(GL11.GL_TEXTURE_2D);
513                    Tessellator var8 = Tessellator.instance;
514                    int var9 = 255 - var7 << 16 | var7 << 8;
515                    int var10 = (255 - var7) / 4 << 16 | 16128;
516                    this.renderQuad(var8, par4 + 2, par5 + 13, 13, 2, 0);
517                    this.renderQuad(var8, par4 + 2, par5 + 13, 12, 1, var10);
518                    this.renderQuad(var8, par4 + 2, par5 + 13, var11, 1, var9);
519                    GL11.glEnable(GL11.GL_TEXTURE_2D);
520                    GL11.glEnable(GL11.GL_LIGHTING);
521                    GL11.glEnable(GL11.GL_DEPTH_TEST);
522                    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
523                }
524            }
525        }
526    
527        /**
528         * Adds a quad to the tesselator at the specified position with the set width and height and color.  Args:
529         * tessellator, x, y, width, height, color
530         */
531        private void renderQuad(Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6)
532        {
533            par1Tessellator.startDrawingQuads();
534            par1Tessellator.setColorOpaque_I(par6);
535            par1Tessellator.addVertex((double)(par2 + 0), (double)(par3 + 0), 0.0D);
536            par1Tessellator.addVertex((double)(par2 + 0), (double)(par3 + par5), 0.0D);
537            par1Tessellator.addVertex((double)(par2 + par4), (double)(par3 + par5), 0.0D);
538            par1Tessellator.addVertex((double)(par2 + par4), (double)(par3 + 0), 0.0D);
539            par1Tessellator.draw();
540        }
541    
542        /**
543         * Adds a textured quad to the tesselator at the specified position with the specified texture coords, width and
544         * height.  Args: x, y, u, v, width, height
545         */
546        public void renderTexturedQuad(int par1, int par2, int par3, int par4, int par5, int par6)
547        {
548            float var7 = 0.00390625F;
549            float var8 = 0.00390625F;
550            Tessellator var9 = Tessellator.instance;
551            var9.startDrawingQuads();
552            var9.addVertexWithUV((double)(par1 + 0), (double)(par2 + par6), (double)this.zLevel, (double)((float)(par3 + 0) * var7), (double)((float)(par4 + par6) * var8));
553            var9.addVertexWithUV((double)(par1 + par5), (double)(par2 + par6), (double)this.zLevel, (double)((float)(par3 + par5) * var7), (double)((float)(par4 + par6) * var8));
554            var9.addVertexWithUV((double)(par1 + par5), (double)(par2 + 0), (double)this.zLevel, (double)((float)(par3 + par5) * var7), (double)((float)(par4 + 0) * var8));
555            var9.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)this.zLevel, (double)((float)(par3 + 0) * var7), (double)((float)(par4 + 0) * var8));
556            var9.draw();
557        }
558    
559        /**
560         * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
561         * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
562         * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
563         * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
564         */
565        public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
566        {
567            this.doRenderItem((EntityItem)par1Entity, par2, par4, par6, par8, par9);
568        }
569    }