001package net.minecraft.client.renderer;
002
003import cpw.mods.fml.relauncher.Side;
004import cpw.mods.fml.relauncher.SideOnly;
005import net.minecraft.block.Block;
006import net.minecraft.block.BlockAnvil;
007import net.minecraft.block.BlockBeacon;
008import net.minecraft.block.BlockBed;
009import net.minecraft.block.BlockBrewingStand;
010import net.minecraft.block.BlockCauldron;
011import net.minecraft.block.BlockCocoa;
012import net.minecraft.block.BlockComparator;
013import net.minecraft.block.BlockDirectional;
014import net.minecraft.block.BlockDragonEgg;
015import net.minecraft.block.BlockEndPortalFrame;
016import net.minecraft.block.BlockFence;
017import net.minecraft.block.BlockFenceGate;
018import net.minecraft.block.BlockFire;
019import net.minecraft.block.BlockFlower;
020import net.minecraft.block.BlockFlowerPot;
021import net.minecraft.block.BlockFluid;
022import net.minecraft.block.BlockGrass;
023import net.minecraft.block.BlockHopper;
024import net.minecraft.block.BlockPane;
025import net.minecraft.block.BlockPistonBase;
026import net.minecraft.block.BlockPistonExtension;
027import net.minecraft.block.BlockRailBase;
028import net.minecraft.block.BlockRedstoneLogic;
029import net.minecraft.block.BlockRedstoneRepeater;
030import net.minecraft.block.BlockRedstoneWire;
031import net.minecraft.block.BlockStairs;
032import net.minecraft.block.BlockStem;
033import net.minecraft.block.BlockTripWire;
034import net.minecraft.block.BlockWall;
035import net.minecraft.block.material.Material;
036import net.minecraft.client.Minecraft;
037import net.minecraft.src.FMLRenderAccessLibrary;
038import net.minecraft.util.Direction;
039import net.minecraft.util.Icon;
040import net.minecraft.util.MathHelper;
041import net.minecraft.util.Vec3;
042import net.minecraft.world.IBlockAccess;
043import net.minecraft.world.World;
044import org.lwjgl.opengl.GL11;
045import org.lwjgl.opengl.GL12;
046
047import static net.minecraftforge.common.ForgeDirection.*;
048
049@SideOnly(Side.CLIENT)
050public class RenderBlocks
051{
052    /** The IBlockAccess used by this instance of RenderBlocks */
053    public IBlockAccess blockAccess;
054
055    /**
056     * If set to >=0, all block faces will be rendered using this texture index
057     */
058    public Icon overrideBlockTexture = null;
059
060    /**
061     * Set to true if the texture should be flipped horizontally during render*Face
062     */
063    public boolean flipTexture = false;
064
065    /**
066     * If true, renders all faces on all blocks rather than using the logic in Block.shouldSideBeRendered.  Unused.
067     */
068    public boolean renderAllFaces = false;
069
070    /** Fancy grass side matching biome */
071    public static boolean fancyGrass = true;
072    public boolean useInventoryTint = true;
073
074    /** The minimum X value for rendering (default 0.0). */
075    public double renderMinX;
076
077    /** The maximum X value for rendering (default 1.0). */
078    public double renderMaxX;
079
080    /** The minimum Y value for rendering (default 0.0). */
081    public double renderMinY;
082
083    /** The maximum Y value for rendering (default 1.0). */
084    public double renderMaxY;
085
086    /** The minimum Z value for rendering (default 0.0). */
087    public double renderMinZ;
088
089    /** The maximum Z value for rendering (default 1.0). */
090    public double renderMaxZ;
091
092    /**
093     * Set by overrideBlockBounds, to keep this class from changing the visual bounding box.
094     */
095    public boolean lockBlockBounds = false;
096    public boolean partialRenderBounds = false;
097    public final Minecraft minecraftRB;
098    public int uvRotateEast = 0;
099    public int uvRotateWest = 0;
100    public int uvRotateSouth = 0;
101    public int uvRotateNorth = 0;
102    public int uvRotateTop = 0;
103    public int uvRotateBottom = 0;
104
105    /** Whether ambient occlusion is enabled or not */
106    public boolean enableAO;
107
108    /**
109     * Used as a scratch variable for ambient occlusion on the north/bottom/east corner.
110     */
111    public float aoLightValueScratchXYZNNN;
112
113    /**
114     * Used as a scratch variable for ambient occlusion between the bottom face and the north face.
115     */
116    public float aoLightValueScratchXYNN;
117
118    /**
119     * Used as a scratch variable for ambient occlusion on the north/bottom/west corner.
120     */
121    public float aoLightValueScratchXYZNNP;
122
123    /**
124     * Used as a scratch variable for ambient occlusion between the bottom face and the east face.
125     */
126    public float aoLightValueScratchYZNN;
127
128    /**
129     * Used as a scratch variable for ambient occlusion between the bottom face and the west face.
130     */
131    public float aoLightValueScratchYZNP;
132
133    /**
134     * Used as a scratch variable for ambient occlusion on the south/bottom/east corner.
135     */
136    public float aoLightValueScratchXYZPNN;
137
138    /**
139     * Used as a scratch variable for ambient occlusion between the bottom face and the south face.
140     */
141    public float aoLightValueScratchXYPN;
142
143    /**
144     * Used as a scratch variable for ambient occlusion on the south/bottom/west corner.
145     */
146    public float aoLightValueScratchXYZPNP;
147
148    /**
149     * Used as a scratch variable for ambient occlusion on the north/top/east corner.
150     */
151    public float aoLightValueScratchXYZNPN;
152
153    /**
154     * Used as a scratch variable for ambient occlusion between the top face and the north face.
155     */
156    public float aoLightValueScratchXYNP;
157
158    /**
159     * Used as a scratch variable for ambient occlusion on the north/top/west corner.
160     */
161    public float aoLightValueScratchXYZNPP;
162
163    /**
164     * Used as a scratch variable for ambient occlusion between the top face and the east face.
165     */
166    public float aoLightValueScratchYZPN;
167
168    /**
169     * Used as a scratch variable for ambient occlusion on the south/top/east corner.
170     */
171    public float aoLightValueScratchXYZPPN;
172
173    /**
174     * Used as a scratch variable for ambient occlusion between the top face and the south face.
175     */
176    public float aoLightValueScratchXYPP;
177
178    /**
179     * Used as a scratch variable for ambient occlusion between the top face and the west face.
180     */
181    public float aoLightValueScratchYZPP;
182
183    /**
184     * Used as a scratch variable for ambient occlusion on the south/top/west corner.
185     */
186    public float aoLightValueScratchXYZPPP;
187
188    /**
189     * Used as a scratch variable for ambient occlusion between the north face and the east face.
190     */
191    public float aoLightValueScratchXZNN;
192
193    /**
194     * Used as a scratch variable for ambient occlusion between the south face and the east face.
195     */
196    public float aoLightValueScratchXZPN;
197
198    /**
199     * Used as a scratch variable for ambient occlusion between the north face and the west face.
200     */
201    public float aoLightValueScratchXZNP;
202
203    /**
204     * Used as a scratch variable for ambient occlusion between the south face and the west face.
205     */
206    public float aoLightValueScratchXZPP;
207
208    /** Ambient occlusion brightness XYZNNN */
209    public int aoBrightnessXYZNNN;
210
211    /** Ambient occlusion brightness XYNN */
212    public int aoBrightnessXYNN;
213
214    /** Ambient occlusion brightness XYZNNP */
215    public int aoBrightnessXYZNNP;
216
217    /** Ambient occlusion brightness YZNN */
218    public int aoBrightnessYZNN;
219
220    /** Ambient occlusion brightness YZNP */
221    public int aoBrightnessYZNP;
222
223    /** Ambient occlusion brightness XYZPNN */
224    public int aoBrightnessXYZPNN;
225
226    /** Ambient occlusion brightness XYPN */
227    public int aoBrightnessXYPN;
228
229    /** Ambient occlusion brightness XYZPNP */
230    public int aoBrightnessXYZPNP;
231
232    /** Ambient occlusion brightness XYZNPN */
233    public int aoBrightnessXYZNPN;
234
235    /** Ambient occlusion brightness XYNP */
236    public int aoBrightnessXYNP;
237
238    /** Ambient occlusion brightness XYZNPP */
239    public int aoBrightnessXYZNPP;
240
241    /** Ambient occlusion brightness YZPN */
242    public int aoBrightnessYZPN;
243
244    /** Ambient occlusion brightness XYZPPN */
245    public int aoBrightnessXYZPPN;
246
247    /** Ambient occlusion brightness XYPP */
248    public int aoBrightnessXYPP;
249
250    /** Ambient occlusion brightness YZPP */
251    public int aoBrightnessYZPP;
252
253    /** Ambient occlusion brightness XYZPPP */
254    public int aoBrightnessXYZPPP;
255
256    /** Ambient occlusion brightness XZNN */
257    public int aoBrightnessXZNN;
258
259    /** Ambient occlusion brightness XZPN */
260    public int aoBrightnessXZPN;
261
262    /** Ambient occlusion brightness XZNP */
263    public int aoBrightnessXZNP;
264
265    /** Ambient occlusion brightness XZPP */
266    public int aoBrightnessXZPP;
267
268    /** Brightness top left */
269    public int brightnessTopLeft;
270
271    /** Brightness bottom left */
272    public int brightnessBottomLeft;
273
274    /** Brightness bottom right */
275    public int brightnessBottomRight;
276
277    /** Brightness top right */
278    public int brightnessTopRight;
279
280    /** Red color value for the top left corner */
281    public float colorRedTopLeft;
282
283    /** Red color value for the bottom left corner */
284    public float colorRedBottomLeft;
285
286    /** Red color value for the bottom right corner */
287    public float colorRedBottomRight;
288
289    /** Red color value for the top right corner */
290    public float colorRedTopRight;
291
292    /** Green color value for the top left corner */
293    public float colorGreenTopLeft;
294
295    /** Green color value for the bottom left corner */
296    public float colorGreenBottomLeft;
297
298    /** Green color value for the bottom right corner */
299    public float colorGreenBottomRight;
300
301    /** Green color value for the top right corner */
302    public float colorGreenTopRight;
303
304    /** Blue color value for the top left corner */
305    public float colorBlueTopLeft;
306
307    /** Blue color value for the bottom left corner */
308    public float colorBlueBottomLeft;
309
310    /** Blue color value for the bottom right corner */
311    public float colorBlueBottomRight;
312
313    /** Blue color value for the top right corner */
314    public float colorBlueTopRight;
315
316    public RenderBlocks(IBlockAccess par1IBlockAccess)
317    {
318        this.blockAccess = par1IBlockAccess;
319        this.minecraftRB = Minecraft.getMinecraft();
320    }
321
322    public RenderBlocks()
323    {
324        this.minecraftRB = Minecraft.getMinecraft();
325    }
326
327    /**
328     * Sets overrideBlockTexture
329     */
330    public void setOverrideBlockTexture(Icon par1Icon)
331    {
332        this.overrideBlockTexture = par1Icon;
333    }
334
335    /**
336     * Clear override block texture
337     */
338    public void clearOverrideBlockTexture()
339    {
340        this.overrideBlockTexture = null;
341    }
342
343    public boolean hasOverrideBlockTexture()
344    {
345        return this.overrideBlockTexture != null;
346    }
347
348    /**
349     * Sets the bounding box for the block to draw in, e.g. 0.25-0.75 on all axes for a half-size, centered block.
350     */
351    public void setRenderBounds(double par1, double par3, double par5, double par7, double par9, double par11)
352    {
353        if (!this.lockBlockBounds)
354        {
355            this.renderMinX = par1;
356            this.renderMaxX = par7;
357            this.renderMinY = par3;
358            this.renderMaxY = par9;
359            this.renderMinZ = par5;
360            this.renderMaxZ = par11;
361            this.partialRenderBounds = this.minecraftRB.gameSettings.ambientOcclusion >= 2 && (this.renderMinX > 0.0D || this.renderMaxX < 1.0D || this.renderMinY > 0.0D || this.renderMaxY < 1.0D || this.renderMinZ > 0.0D || this.renderMaxZ < 1.0D);
362        }
363    }
364
365    /**
366     * Like setRenderBounds, but automatically pulling the bounds from the given Block.
367     */
368    public void setRenderBoundsFromBlock(Block par1Block)
369    {
370        if (!this.lockBlockBounds)
371        {
372            this.renderMinX = par1Block.getBlockBoundsMinX();
373            this.renderMaxX = par1Block.getBlockBoundsMaxX();
374            this.renderMinY = par1Block.getBlockBoundsMinY();
375            this.renderMaxY = par1Block.getBlockBoundsMaxY();
376            this.renderMinZ = par1Block.getBlockBoundsMinZ();
377            this.renderMaxZ = par1Block.getBlockBoundsMaxZ();
378            this.partialRenderBounds = this.minecraftRB.gameSettings.ambientOcclusion >= 2 && (this.renderMinX > 0.0D || this.renderMaxX < 1.0D || this.renderMinY > 0.0D || this.renderMaxY < 1.0D || this.renderMinZ > 0.0D || this.renderMaxZ < 1.0D);
379        }
380    }
381
382    /**
383     * Like setRenderBounds, but locks the values so that RenderBlocks won't change them.  If you use this, you must
384     * call unlockBlockBounds after you finish rendering!
385     */
386    public void overrideBlockBounds(double par1, double par3, double par5, double par7, double par9, double par11)
387    {
388        this.renderMinX = par1;
389        this.renderMaxX = par7;
390        this.renderMinY = par3;
391        this.renderMaxY = par9;
392        this.renderMinZ = par5;
393        this.renderMaxZ = par11;
394        this.lockBlockBounds = true;
395        this.partialRenderBounds = this.minecraftRB.gameSettings.ambientOcclusion >= 2 && (this.renderMinX > 0.0D || this.renderMaxX < 1.0D || this.renderMinY > 0.0D || this.renderMaxY < 1.0D || this.renderMinZ > 0.0D || this.renderMaxZ < 1.0D);
396    }
397
398    /**
399     * Unlocks the visual bounding box so that RenderBlocks can change it again.
400     */
401    public void unlockBlockBounds()
402    {
403        this.lockBlockBounds = false;
404    }
405
406    /**
407     * Renders a block using the given texture instead of the block's own default texture
408     */
409    public void renderBlockUsingTexture(Block par1Block, int par2, int par3, int par4, Icon par5Icon)
410    {
411        this.setOverrideBlockTexture(par5Icon);
412        this.renderBlockByRenderType(par1Block, par2, par3, par4);
413        this.clearOverrideBlockTexture();
414    }
415
416    /**
417     * Render all faces of a block
418     */
419    public void renderBlockAllFaces(Block par1Block, int par2, int par3, int par4)
420    {
421        this.renderAllFaces = true;
422        this.renderBlockByRenderType(par1Block, par2, par3, par4);
423        this.renderAllFaces = false;
424    }
425
426    /**
427     * Renders the block at the given coordinates using the block's rendering type
428     */
429    public boolean renderBlockByRenderType(Block par1Block, int par2, int par3, int par4)
430    {
431        int l = par1Block.getRenderType();
432
433        if (l == -1)
434        {
435            return false;
436        }
437        else
438        {
439            par1Block.setBlockBoundsBasedOnState(this.blockAccess, par2, par3, par4);
440            this.setRenderBoundsFromBlock(par1Block);
441
442            switch (l)
443            {
444                //regex: ' : \(l == ([\d]+) \?' replace: ';\ncase \1: return' ::: IMPORTANT: REMEMBER THIS ON FIRST line!
445                case 0: return this.renderStandardBlock(par1Block, par2, par3, par4);
446                case 4: return this.renderBlockFluids(par1Block, par2, par3, par4);
447                case 31: return this.renderBlockLog(par1Block, par2, par3, par4);
448                case 1: return this.renderCrossedSquares(par1Block, par2, par3, par4);
449                case 2: return this.renderBlockTorch(par1Block, par2, par3, par4);
450                case 20: return this.renderBlockVine(par1Block, par2, par3, par4);
451                case 11: return this.renderBlockFence((BlockFence)par1Block, par2, par3, par4);
452                case 39: return this.renderBlockQuartz(par1Block, par2, par3, par4);
453                case 5: return this.renderBlockRedstoneWire(par1Block, par2, par3, par4);
454                case 13: return this.renderBlockCactus(par1Block, par2, par3, par4);
455                case 9: return this.renderBlockMinecartTrack((BlockRailBase)par1Block, par2, par3, par4);
456                case 19: return this.renderBlockStem(par1Block, par2, par3, par4);
457                case 23: return this.renderBlockLilyPad(par1Block, par2, par3, par4);
458                case 6: return this.renderBlockCrops(par1Block, par2, par3, par4);
459                case 3: return this.renderBlockFire((BlockFire)par1Block, par2, par3, par4);
460                case 8: return this.renderBlockLadder(par1Block, par2, par3, par4);
461                case 7: return this.renderBlockDoor(par1Block, par2, par3, par4);
462                case 10: return this.renderBlockStairs((BlockStairs)par1Block, par2, par3, par4);
463                case 27: return this.renderBlockDragonEgg((BlockDragonEgg)par1Block, par2, par3, par4);
464                case 32: return this.renderBlockWall((BlockWall)par1Block, par2, par3, par4);
465                case 12: return this.renderBlockLever(par1Block, par2, par3, par4);
466                case 29: return this.renderBlockTripWireSource(par1Block, par2, par3, par4);
467                case 30: return this.renderBlockTripWire(par1Block, par2, par3, par4);
468                case 14: return this.renderBlockBed(par1Block, par2, par3, par4);
469                case 15: return this.renderBlockRepeater((BlockRedstoneRepeater)par1Block, par2, par3, par4);
470                case 36: return this.renderBlockRedstoneLogic((BlockRedstoneLogic)par1Block, par2, par3, par4);
471                case 37: return this.renderBlockComparator((BlockComparator)par1Block, par2, par3, par4);
472                case 16: return this.renderPistonBase(par1Block, par2, par3, par4, false);
473                case 17: return this.renderPistonExtension(par1Block, par2, par3, par4, true);
474                case 18: return this.renderBlockPane((BlockPane)par1Block, par2, par3, par4);
475                case 21: return this.renderBlockFenceGate((BlockFenceGate)par1Block, par2, par3, par4);
476                case 24: return this.renderBlockCauldron((BlockCauldron)par1Block, par2, par3, par4);
477                case 33: return this.renderBlockFlowerpot((BlockFlowerPot)par1Block, par2, par3, par4);
478                case 35: return this.renderBlockAnvil((BlockAnvil)par1Block, par2, par3, par4);
479                case 25: return this.renderBlockBrewingStand((BlockBrewingStand)par1Block, par2, par3, par4);
480                case 26: return this.renderBlockEndPortalFrame((BlockEndPortalFrame)par1Block, par2, par3, par4);
481                case 28: return this.renderBlockCocoa((BlockCocoa)par1Block, par2, par3, par4);
482                case 34: return this.renderBlockBeacon((BlockBeacon)par1Block, par2, par3, par4);
483                case 38: return this.renderBlockHopper((BlockHopper)par1Block, par2, par3, par4);
484                default: return FMLRenderAccessLibrary.renderWorldBlock(this, blockAccess, par2, par3, par4, par1Block, l);
485            }
486        }
487    }
488
489    /**
490     * Render BlockEndPortalFrame
491     */
492    public boolean renderBlockEndPortalFrame(BlockEndPortalFrame par1BlockEndPortalFrame, int par2, int par3, int par4)
493    {
494        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
495        int i1 = l & 3;
496
497        if (i1 == 0)
498        {
499            this.uvRotateTop = 3;
500        }
501        else if (i1 == 3)
502        {
503            this.uvRotateTop = 1;
504        }
505        else if (i1 == 1)
506        {
507            this.uvRotateTop = 2;
508        }
509
510        if (!BlockEndPortalFrame.isEnderEyeInserted(l))
511        {
512            this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 0.8125D, 1.0D);
513            this.renderStandardBlock(par1BlockEndPortalFrame, par2, par3, par4);
514            this.uvRotateTop = 0;
515            return true;
516        }
517        else
518        {
519            this.renderAllFaces = true;
520            this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 0.8125D, 1.0D);
521            this.renderStandardBlock(par1BlockEndPortalFrame, par2, par3, par4);
522            this.setOverrideBlockTexture(par1BlockEndPortalFrame.func_94398_p());
523            this.setRenderBounds(0.25D, 0.8125D, 0.25D, 0.75D, 1.0D, 0.75D);
524            this.renderStandardBlock(par1BlockEndPortalFrame, par2, par3, par4);
525            this.renderAllFaces = false;
526            this.clearOverrideBlockTexture();
527            this.uvRotateTop = 0;
528            return true;
529        }
530    }
531
532    /**
533     * render a bed at the given coordinates
534     */
535    public boolean renderBlockBed(Block par1Block, int par2, int par3, int par4)
536    {
537        Tessellator tessellator = Tessellator.instance;
538        int i1 = par1Block.getBedDirection(blockAccess, par2, par3, par4);
539        boolean flag = par1Block.isBedFoot(blockAccess, par2, par3, par4);
540        float f = 0.5F;
541        float f1 = 1.0F;
542        float f2 = 0.8F;
543        float f3 = 0.6F;
544        int j1 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4);
545        tessellator.setBrightness(j1);
546        tessellator.setColorOpaque_F(f, f, f);
547        Icon icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0);
548        if (hasOverrideBlockTexture()) icon = overrideBlockTexture; //BugFix Proper breaking texture on underside
549        double d0 = (double)icon.getMinU();
550        double d1 = (double)icon.getMaxU();
551        double d2 = (double)icon.getMinV();
552        double d3 = (double)icon.getMaxV();
553        double d4 = (double)par2 + this.renderMinX;
554        double d5 = (double)par2 + this.renderMaxX;
555        double d6 = (double)par3 + this.renderMinY + 0.1875D;
556        double d7 = (double)par4 + this.renderMinZ;
557        double d8 = (double)par4 + this.renderMaxZ;
558        tessellator.addVertexWithUV(d4, d6, d8, d0, d3);
559        tessellator.addVertexWithUV(d4, d6, d7, d0, d2);
560        tessellator.addVertexWithUV(d5, d6, d7, d1, d2);
561        tessellator.addVertexWithUV(d5, d6, d8, d1, d3);
562        tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4));
563        tessellator.setColorOpaque_F(f1, f1, f1);
564        icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1);
565        if (hasOverrideBlockTexture()) icon = overrideBlockTexture; //BugFix Proper breaking texture on underside
566        d0 = (double)icon.getMinU();
567        d1 = (double)icon.getMaxU();
568        d2 = (double)icon.getMinV();
569        d3 = (double)icon.getMaxV();
570        d4 = d0;
571        d5 = d1;
572        d6 = d2;
573        d7 = d2;
574        d8 = d0;
575        double d9 = d1;
576        double d10 = d3;
577        double d11 = d3;
578
579        if (i1 == 0)
580        {
581            d5 = d0;
582            d6 = d3;
583            d8 = d1;
584            d11 = d2;
585        }
586        else if (i1 == 2)
587        {
588            d4 = d1;
589            d7 = d3;
590            d9 = d0;
591            d10 = d2;
592        }
593        else if (i1 == 3)
594        {
595            d4 = d1;
596            d7 = d3;
597            d9 = d0;
598            d10 = d2;
599            d5 = d0;
600            d6 = d3;
601            d8 = d1;
602            d11 = d2;
603        }
604
605        double d12 = (double)par2 + this.renderMinX;
606        double d13 = (double)par2 + this.renderMaxX;
607        double d14 = (double)par3 + this.renderMaxY;
608        double d15 = (double)par4 + this.renderMinZ;
609        double d16 = (double)par4 + this.renderMaxZ;
610        tessellator.addVertexWithUV(d13, d14, d16, d8, d10);
611        tessellator.addVertexWithUV(d13, d14, d15, d4, d6);
612        tessellator.addVertexWithUV(d12, d14, d15, d5, d7);
613        tessellator.addVertexWithUV(d12, d14, d16, d9, d11);
614        int k1 = Direction.directionToFacing[i1];
615
616        if (flag)
617        {
618            k1 = Direction.directionToFacing[Direction.rotateOpposite[i1]];
619        }
620
621        byte b0 = 4;
622
623        switch (i1)
624        {
625            case 0:
626                b0 = 5;
627                break;
628            case 1:
629                b0 = 3;
630            case 2:
631            default:
632                break;
633            case 3:
634                b0 = 2;
635        }
636
637        if (k1 != 2 && (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 - 1, 2)))
638        {
639            tessellator.setBrightness(this.renderMinZ > 0.0D ? j1 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1));
640            tessellator.setColorOpaque_F(f2, f2, f2);
641            this.flipTexture = b0 == 2;
642            this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 2));
643        }
644
645        if (k1 != 3 && (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 + 1, 3)))
646        {
647            tessellator.setBrightness(this.renderMaxZ < 1.0D ? j1 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1));
648            tessellator.setColorOpaque_F(f2, f2, f2);
649            this.flipTexture = b0 == 3;
650            this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3));
651        }
652
653        if (k1 != 4 && (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 - 1, par3, par4, 4)))
654        {
655            tessellator.setBrightness(this.renderMinZ > 0.0D ? j1 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4));
656            tessellator.setColorOpaque_F(f3, f3, f3);
657            this.flipTexture = b0 == 4;
658            this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 4));
659        }
660
661        if (k1 != 5 && (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 + 1, par3, par4, 5)))
662        {
663            tessellator.setBrightness(this.renderMaxZ < 1.0D ? j1 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4));
664            tessellator.setColorOpaque_F(f3, f3, f3);
665            this.flipTexture = b0 == 5;
666            this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 5));
667        }
668
669        this.flipTexture = false;
670        return true;
671    }
672
673    /**
674     * Render BlockBrewingStand
675     */
676    public boolean renderBlockBrewingStand(BlockBrewingStand par1BlockBrewingStand, int par2, int par3, int par4)
677    {
678        this.setRenderBounds(0.4375D, 0.0D, 0.4375D, 0.5625D, 0.875D, 0.5625D);
679        this.renderStandardBlock(par1BlockBrewingStand, par2, par3, par4);
680        this.setOverrideBlockTexture(par1BlockBrewingStand.func_94448_e());
681        this.setRenderBounds(0.5625D, 0.0D, 0.3125D, 0.9375D, 0.125D, 0.6875D);
682        this.renderStandardBlock(par1BlockBrewingStand, par2, par3, par4);
683        this.setRenderBounds(0.125D, 0.0D, 0.0625D, 0.5D, 0.125D, 0.4375D);
684        this.renderStandardBlock(par1BlockBrewingStand, par2, par3, par4);
685        this.setRenderBounds(0.125D, 0.0D, 0.5625D, 0.5D, 0.125D, 0.9375D);
686        this.renderStandardBlock(par1BlockBrewingStand, par2, par3, par4);
687        this.clearOverrideBlockTexture();
688        Tessellator tessellator = Tessellator.instance;
689        tessellator.setBrightness(par1BlockBrewingStand.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
690        float f = 1.0F;
691        int l = par1BlockBrewingStand.colorMultiplier(this.blockAccess, par2, par3, par4);
692        float f1 = (float)(l >> 16 & 255) / 255.0F;
693        float f2 = (float)(l >> 8 & 255) / 255.0F;
694        float f3 = (float)(l & 255) / 255.0F;
695
696        if (EntityRenderer.anaglyphEnable)
697        {
698            float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
699            float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
700            float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
701            f1 = f4;
702            f2 = f5;
703            f3 = f6;
704        }
705
706        tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
707        Icon icon = this.getBlockIconFromSideAndMetadata(par1BlockBrewingStand, 0, 0);
708
709        if (this.hasOverrideBlockTexture())
710        {
711            icon = this.overrideBlockTexture;
712        }
713
714        double d0 = (double)icon.getMinV();
715        double d1 = (double)icon.getMaxV();
716        int i1 = this.blockAccess.getBlockMetadata(par2, par3, par4);
717
718        for (int j1 = 0; j1 < 3; ++j1)
719        {
720            double d2 = (double)j1 * Math.PI * 2.0D / 3.0D + (Math.PI / 2D);
721            double d3 = (double)icon.getInterpolatedU(8.0D);
722            double d4 = (double)icon.getMaxU();
723
724            if ((i1 & 1 << j1) != 0)
725            {
726                d4 = (double)icon.getMinU();
727            }
728
729            double d5 = (double)par2 + 0.5D;
730            double d6 = (double)par2 + 0.5D + Math.sin(d2) * 8.0D / 16.0D;
731            double d7 = (double)par4 + 0.5D;
732            double d8 = (double)par4 + 0.5D + Math.cos(d2) * 8.0D / 16.0D;
733            tessellator.addVertexWithUV(d5, (double)(par3 + 1), d7, d3, d0);
734            tessellator.addVertexWithUV(d5, (double)(par3 + 0), d7, d3, d1);
735            tessellator.addVertexWithUV(d6, (double)(par3 + 0), d8, d4, d1);
736            tessellator.addVertexWithUV(d6, (double)(par3 + 1), d8, d4, d0);
737            tessellator.addVertexWithUV(d6, (double)(par3 + 1), d8, d4, d0);
738            tessellator.addVertexWithUV(d6, (double)(par3 + 0), d8, d4, d1);
739            tessellator.addVertexWithUV(d5, (double)(par3 + 0), d7, d3, d1);
740            tessellator.addVertexWithUV(d5, (double)(par3 + 1), d7, d3, d0);
741        }
742
743        par1BlockBrewingStand.setBlockBoundsForItemRender();
744        return true;
745    }
746
747    /**
748     * Render block cauldron
749     */
750    public boolean renderBlockCauldron(BlockCauldron par1BlockCauldron, int par2, int par3, int par4)
751    {
752        this.renderStandardBlock(par1BlockCauldron, par2, par3, par4);
753        Tessellator tessellator = Tessellator.instance;
754        tessellator.setBrightness(par1BlockCauldron.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
755        float f = 1.0F;
756        int l = par1BlockCauldron.colorMultiplier(this.blockAccess, par2, par3, par4);
757        float f1 = (float)(l >> 16 & 255) / 255.0F;
758        float f2 = (float)(l >> 8 & 255) / 255.0F;
759        float f3 = (float)(l & 255) / 255.0F;
760        float f4;
761
762        if (EntityRenderer.anaglyphEnable)
763        {
764            float f5 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
765            f4 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
766            float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
767            f1 = f5;
768            f2 = f4;
769            f3 = f6;
770        }
771
772        tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
773        Icon icon = par1BlockCauldron.getBlockTextureFromSide(2);
774        f4 = 0.125F;
775        this.renderSouthFace(par1BlockCauldron, (double)((float)par2 - 1.0F + f4), (double)par3, (double)par4, icon);
776        this.renderNorthFace(par1BlockCauldron, (double)((float)par2 + 1.0F - f4), (double)par3, (double)par4, icon);
777        this.renderWestFace(par1BlockCauldron, (double)par2, (double)par3, (double)((float)par4 - 1.0F + f4), icon);
778        this.renderEastFace(par1BlockCauldron, (double)par2, (double)par3, (double)((float)par4 + 1.0F - f4), icon);
779        Icon icon1 = BlockCauldron.func_94375_b("cauldron_inner");
780        this.renderTopFace(par1BlockCauldron, (double)par2, (double)((float)par3 - 1.0F + 0.25F), (double)par4, icon1);
781        this.renderBottomFace(par1BlockCauldron, (double)par2, (double)((float)par3 + 1.0F - 0.75F), (double)par4, icon1);
782        int i1 = this.blockAccess.getBlockMetadata(par2, par3, par4);
783
784        if (i1 > 0)
785        {
786            Icon icon2 = BlockFluid.func_94424_b("water");
787
788            if (i1 > 3)
789            {
790                i1 = 3;
791            }
792
793            this.renderTopFace(par1BlockCauldron, (double)par2, (double)((float)par3 - 1.0F + (6.0F + (float)i1 * 3.0F) / 16.0F), (double)par4, icon2);
794        }
795
796        return true;
797    }
798
799    /**
800     * Renders flower pot
801     */
802    public boolean renderBlockFlowerpot(BlockFlowerPot par1BlockFlowerPot, int par2, int par3, int par4)
803    {
804        this.renderStandardBlock(par1BlockFlowerPot, par2, par3, par4);
805        Tessellator tessellator = Tessellator.instance;
806        tessellator.setBrightness(par1BlockFlowerPot.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
807        float f = 1.0F;
808        int l = par1BlockFlowerPot.colorMultiplier(this.blockAccess, par2, par3, par4);
809        Icon icon = this.getBlockIconFromSide(par1BlockFlowerPot, 0);
810        float f1 = (float)(l >> 16 & 255) / 255.0F;
811        float f2 = (float)(l >> 8 & 255) / 255.0F;
812        float f3 = (float)(l & 255) / 255.0F;
813        float f4;
814        float f5;
815
816        if (EntityRenderer.anaglyphEnable)
817        {
818            f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
819            float f6 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
820            f5 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
821            f1 = f4;
822            f2 = f6;
823            f3 = f5;
824        }
825
826        tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
827        f4 = 0.1865F;
828        this.renderSouthFace(par1BlockFlowerPot, (double)((float)par2 - 0.5F + f4), (double)par3, (double)par4, icon);
829        this.renderNorthFace(par1BlockFlowerPot, (double)((float)par2 + 0.5F - f4), (double)par3, (double)par4, icon);
830        this.renderWestFace(par1BlockFlowerPot, (double)par2, (double)par3, (double)((float)par4 - 0.5F + f4), icon);
831        this.renderEastFace(par1BlockFlowerPot, (double)par2, (double)par3, (double)((float)par4 + 0.5F - f4), icon);
832        this.renderTopFace(par1BlockFlowerPot, (double)par2, (double)((float)par3 - 0.5F + f4 + 0.1875F), (double)par4, this.getBlockIcon(Block.dirt));
833        int i1 = this.blockAccess.getBlockMetadata(par2, par3, par4);
834
835        if (i1 != 0)
836        {
837            f5 = 0.0F;
838            float f7 = 4.0F;
839            float f8 = 0.0F;
840            BlockFlower blockflower = null;
841
842            switch (i1)
843            {
844                case 1:
845                    blockflower = Block.plantRed;
846                    break;
847                case 2:
848                    blockflower = Block.plantYellow;
849                case 3:
850                case 4:
851                case 5:
852                case 6:
853                default:
854                    break;
855                case 7:
856                    blockflower = Block.mushroomRed;
857                    break;
858                case 8:
859                    blockflower = Block.mushroomBrown;
860            }
861
862            tessellator.addTranslation(f5 / 16.0F, f7 / 16.0F, f8 / 16.0F);
863
864            if (blockflower != null)
865            {
866                this.renderBlockByRenderType(blockflower, par2, par3, par4);
867            }
868            else if (i1 == 9)
869            {
870                this.renderAllFaces = true;
871                float f9 = 0.125F;
872                this.setRenderBounds((double)(0.5F - f9), 0.0D, (double)(0.5F - f9), (double)(0.5F + f9), 0.25D, (double)(0.5F + f9));
873                this.renderStandardBlock(Block.cactus, par2, par3, par4);
874                this.setRenderBounds((double)(0.5F - f9), 0.25D, (double)(0.5F - f9), (double)(0.5F + f9), 0.5D, (double)(0.5F + f9));
875                this.renderStandardBlock(Block.cactus, par2, par3, par4);
876                this.setRenderBounds((double)(0.5F - f9), 0.5D, (double)(0.5F - f9), (double)(0.5F + f9), 0.75D, (double)(0.5F + f9));
877                this.renderStandardBlock(Block.cactus, par2, par3, par4);
878                this.renderAllFaces = false;
879                this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
880            }
881            else if (i1 == 3)
882            {
883                this.drawCrossedSquares(Block.sapling, 0, (double)par2, (double)par3, (double)par4, 0.75F);
884            }
885            else if (i1 == 5)
886            {
887                this.drawCrossedSquares(Block.sapling, 2, (double)par2, (double)par3, (double)par4, 0.75F);
888            }
889            else if (i1 == 4)
890            {
891                this.drawCrossedSquares(Block.sapling, 1, (double)par2, (double)par3, (double)par4, 0.75F);
892            }
893            else if (i1 == 6)
894            {
895                this.drawCrossedSquares(Block.sapling, 3, (double)par2, (double)par3, (double)par4, 0.75F);
896            }
897            else if (i1 == 11)
898            {
899                l = Block.tallGrass.colorMultiplier(this.blockAccess, par2, par3, par4);
900                f1 = (float)(l >> 16 & 255) / 255.0F;
901                f2 = (float)(l >> 8 & 255) / 255.0F;
902                f3 = (float)(l & 255) / 255.0F;
903                tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
904                this.drawCrossedSquares(Block.tallGrass, 2, (double)par2, (double)par3, (double)par4, 0.75F);
905            }
906            else if (i1 == 10)
907            {
908                this.drawCrossedSquares(Block.deadBush, 2, (double)par2, (double)par3, (double)par4, 0.75F);
909            }
910
911            tessellator.addTranslation(-f5 / 16.0F, -f7 / 16.0F, -f8 / 16.0F);
912        }
913
914        return true;
915    }
916
917    /**
918     * Renders anvil
919     */
920    public boolean renderBlockAnvil(BlockAnvil par1BlockAnvil, int par2, int par3, int par4)
921    {
922        return this.renderBlockAnvilMetadata(par1BlockAnvil, par2, par3, par4, this.blockAccess.getBlockMetadata(par2, par3, par4));
923    }
924
925    /**
926     * Renders anvil block with metadata
927     */
928    public boolean renderBlockAnvilMetadata(BlockAnvil par1BlockAnvil, int par2, int par3, int par4, int par5)
929    {
930        Tessellator tessellator = Tessellator.instance;
931        tessellator.setBrightness(par1BlockAnvil.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
932        float f = 1.0F;
933        int i1 = par1BlockAnvil.colorMultiplier(this.blockAccess, par2, par3, par4);
934        float f1 = (float)(i1 >> 16 & 255) / 255.0F;
935        float f2 = (float)(i1 >> 8 & 255) / 255.0F;
936        float f3 = (float)(i1 & 255) / 255.0F;
937
938        if (EntityRenderer.anaglyphEnable)
939        {
940            float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
941            float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
942            float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
943            f1 = f4;
944            f2 = f5;
945            f3 = f6;
946        }
947
948        tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
949        return this.renderBlockAnvilOrient(par1BlockAnvil, par2, par3, par4, par5, false);
950    }
951
952    /**
953     * Renders anvil block with orientation
954     */
955    public boolean renderBlockAnvilOrient(BlockAnvil par1BlockAnvil, int par2, int par3, int par4, int par5, boolean par6)
956    {
957        int i1 = par6 ? 0 : par5 & 3;
958        boolean flag1 = false;
959        float f = 0.0F;
960
961        switch (i1)
962        {
963            case 0:
964                this.uvRotateSouth = 2;
965                this.uvRotateNorth = 1;
966                this.uvRotateTop = 3;
967                this.uvRotateBottom = 3;
968                break;
969            case 1:
970                this.uvRotateEast = 1;
971                this.uvRotateWest = 2;
972                this.uvRotateTop = 2;
973                this.uvRotateBottom = 1;
974                flag1 = true;
975                break;
976            case 2:
977                this.uvRotateSouth = 1;
978                this.uvRotateNorth = 2;
979                break;
980            case 3:
981                this.uvRotateEast = 2;
982                this.uvRotateWest = 1;
983                this.uvRotateTop = 1;
984                this.uvRotateBottom = 2;
985                flag1 = true;
986        }
987
988        f = this.renderBlockAnvilRotate(par1BlockAnvil, par2, par3, par4, 0, f, 0.75F, 0.25F, 0.75F, flag1, par6, par5);
989        f = this.renderBlockAnvilRotate(par1BlockAnvil, par2, par3, par4, 1, f, 0.5F, 0.0625F, 0.625F, flag1, par6, par5);
990        f = this.renderBlockAnvilRotate(par1BlockAnvil, par2, par3, par4, 2, f, 0.25F, 0.3125F, 0.5F, flag1, par6, par5);
991        this.renderBlockAnvilRotate(par1BlockAnvil, par2, par3, par4, 3, f, 0.625F, 0.375F, 1.0F, flag1, par6, par5);
992        this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
993        this.uvRotateEast = 0;
994        this.uvRotateWest = 0;
995        this.uvRotateSouth = 0;
996        this.uvRotateNorth = 0;
997        this.uvRotateTop = 0;
998        this.uvRotateBottom = 0;
999        return true;
1000    }
1001
1002    /**
1003     * Renders anvil block with rotation
1004     */
1005    public float renderBlockAnvilRotate(BlockAnvil par1BlockAnvil, int par2, int par3, int par4, int par5, float par6, float par7, float par8, float par9, boolean par10, boolean par11, int par12)
1006    {
1007        if (par10)
1008        {
1009            float f4 = par7;
1010            par7 = par9;
1011            par9 = f4;
1012        }
1013
1014        par7 /= 2.0F;
1015        par9 /= 2.0F;
1016        par1BlockAnvil.field_82521_b = par5;
1017        this.setRenderBounds((double)(0.5F - par7), (double)par6, (double)(0.5F - par9), (double)(0.5F + par7), (double)(par6 + par8), (double)(0.5F + par9));
1018
1019        if (par11)
1020        {
1021            Tessellator tessellator = Tessellator.instance;
1022            tessellator.startDrawingQuads();
1023            tessellator.setNormal(0.0F, -1.0F, 0.0F);
1024            this.renderBottomFace(par1BlockAnvil, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockAnvil, 0, par12));
1025            tessellator.draw();
1026            tessellator.startDrawingQuads();
1027            tessellator.setNormal(0.0F, 1.0F, 0.0F);
1028            this.renderTopFace(par1BlockAnvil, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockAnvil, 1, par12));
1029            tessellator.draw();
1030            tessellator.startDrawingQuads();
1031            tessellator.setNormal(0.0F, 0.0F, -1.0F);
1032            this.renderEastFace(par1BlockAnvil, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockAnvil, 2, par12));
1033            tessellator.draw();
1034            tessellator.startDrawingQuads();
1035            tessellator.setNormal(0.0F, 0.0F, 1.0F);
1036            this.renderWestFace(par1BlockAnvil, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockAnvil, 3, par12));
1037            tessellator.draw();
1038            tessellator.startDrawingQuads();
1039            tessellator.setNormal(-1.0F, 0.0F, 0.0F);
1040            this.renderNorthFace(par1BlockAnvil, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockAnvil, 4, par12));
1041            tessellator.draw();
1042            tessellator.startDrawingQuads();
1043            tessellator.setNormal(1.0F, 0.0F, 0.0F);
1044            this.renderSouthFace(par1BlockAnvil, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockAnvil, 5, par12));
1045            tessellator.draw();
1046        }
1047        else
1048        {
1049            this.renderStandardBlock(par1BlockAnvil, par2, par3, par4);
1050        }
1051
1052        return par6 + par8;
1053    }
1054
1055    /**
1056     * Renders a torch block at the given coordinates
1057     */
1058    public boolean renderBlockTorch(Block par1Block, int par2, int par3, int par4)
1059    {
1060        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
1061        Tessellator tessellator = Tessellator.instance;
1062        tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
1063        tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
1064        double d0 = 0.4000000059604645D;
1065        double d1 = 0.5D - d0;
1066        double d2 = 0.20000000298023224D;
1067
1068        if (l == 1)
1069        {
1070            this.renderTorchAtAngle(par1Block, (double)par2 - d1, (double)par3 + d2, (double)par4, -d0, 0.0D, 0);
1071        }
1072        else if (l == 2)
1073        {
1074            this.renderTorchAtAngle(par1Block, (double)par2 + d1, (double)par3 + d2, (double)par4, d0, 0.0D, 0);
1075        }
1076        else if (l == 3)
1077        {
1078            this.renderTorchAtAngle(par1Block, (double)par2, (double)par3 + d2, (double)par4 - d1, 0.0D, -d0, 0);
1079        }
1080        else if (l == 4)
1081        {
1082            this.renderTorchAtAngle(par1Block, (double)par2, (double)par3 + d2, (double)par4 + d1, 0.0D, d0, 0);
1083        }
1084        else
1085        {
1086            this.renderTorchAtAngle(par1Block, (double)par2, (double)par3, (double)par4, 0.0D, 0.0D, 0);
1087        }
1088
1089        return true;
1090    }
1091
1092    /**
1093     * render a redstone repeater at the given coordinates
1094     */
1095    public boolean renderBlockRepeater(BlockRedstoneRepeater par1BlockRedstoneRepeater, int par2, int par3, int par4)
1096    {
1097        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
1098        int i1 = l & 3;
1099        int j1 = (l & 12) >> 2;
1100        Tessellator tessellator = Tessellator.instance;
1101        tessellator.setBrightness(par1BlockRedstoneRepeater.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
1102        tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
1103        double d0 = -0.1875D;
1104        boolean flag = par1BlockRedstoneRepeater.func_94476_e(this.blockAccess, par2, par3, par4, l);
1105        double d1 = 0.0D;
1106        double d2 = 0.0D;
1107        double d3 = 0.0D;
1108        double d4 = 0.0D;
1109
1110        switch (i1)
1111        {
1112            case 0:
1113                d4 = -0.3125D;
1114                d2 = BlockRedstoneRepeater.repeaterTorchOffset[j1];
1115                break;
1116            case 1:
1117                d3 = 0.3125D;
1118                d1 = -BlockRedstoneRepeater.repeaterTorchOffset[j1];
1119                break;
1120            case 2:
1121                d4 = 0.3125D;
1122                d2 = -BlockRedstoneRepeater.repeaterTorchOffset[j1];
1123                break;
1124            case 3:
1125                d3 = -0.3125D;
1126                d1 = BlockRedstoneRepeater.repeaterTorchOffset[j1];
1127        }
1128
1129        if (!flag)
1130        {
1131            this.renderTorchAtAngle(par1BlockRedstoneRepeater, (double)par2 + d1, (double)par3 + d0, (double)par4 + d2, 0.0D, 0.0D, 0);
1132        }
1133        else
1134        {
1135            Icon icon = this.getBlockIcon(Block.bedrock);
1136            this.setOverrideBlockTexture(icon);
1137            float f = 2.0F;
1138            float f1 = 14.0F;
1139            float f2 = 7.0F;
1140            float f3 = 9.0F;
1141
1142            switch (i1)
1143            {
1144                case 1:
1145                case 3:
1146                    f = 7.0F;
1147                    f1 = 9.0F;
1148                    f2 = 2.0F;
1149                    f3 = 14.0F;
1150                case 0:
1151                case 2:
1152                default:
1153                    this.setRenderBounds((double)(f / 16.0F + (float)d1), 0.125D, (double)(f2 / 16.0F + (float)d2), (double)(f1 / 16.0F + (float)d1), 0.25D, (double)(f3 / 16.0F + (float)d2));
1154                    double d5 = (double)icon.getInterpolatedU((double)f);
1155                    double d6 = (double)icon.getInterpolatedV((double)f2);
1156                    double d7 = (double)icon.getInterpolatedU((double)f1);
1157                    double d8 = (double)icon.getInterpolatedV((double)f3);
1158                    tessellator.addVertexWithUV((double)((float)par2 + f / 16.0F) + d1, (double)((float)par3 + 0.25F), (double)((float)par4 + f2 / 16.0F) + d2, d5, d6);
1159                    tessellator.addVertexWithUV((double)((float)par2 + f / 16.0F) + d1, (double)((float)par3 + 0.25F), (double)((float)par4 + f3 / 16.0F) + d2, d5, d8);
1160                    tessellator.addVertexWithUV((double)((float)par2 + f1 / 16.0F) + d1, (double)((float)par3 + 0.25F), (double)((float)par4 + f3 / 16.0F) + d2, d7, d8);
1161                    tessellator.addVertexWithUV((double)((float)par2 + f1 / 16.0F) + d1, (double)((float)par3 + 0.25F), (double)((float)par4 + f2 / 16.0F) + d2, d7, d6);
1162                    this.renderStandardBlock(par1BlockRedstoneRepeater, par2, par3, par4);
1163                    this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 0.125D, 1.0D);
1164                    this.clearOverrideBlockTexture();
1165            }
1166        }
1167
1168        tessellator.setBrightness(par1BlockRedstoneRepeater.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
1169        tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
1170        this.renderTorchAtAngle(par1BlockRedstoneRepeater, (double)par2 + d3, (double)par3 + d0, (double)par4 + d4, 0.0D, 0.0D, 0);
1171        this.renderBlockRedstoneLogic(par1BlockRedstoneRepeater, par2, par3, par4);
1172        return true;
1173    }
1174
1175    public boolean renderBlockComparator(BlockComparator par1BlockComparator, int par2, int par3, int par4)
1176    {
1177        Tessellator tessellator = Tessellator.instance;
1178        tessellator.setBrightness(par1BlockComparator.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
1179        tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
1180        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
1181        int i1 = l & 3;
1182        double d0 = 0.0D;
1183        double d1 = -0.1875D;
1184        double d2 = 0.0D;
1185        double d3 = 0.0D;
1186        double d4 = 0.0D;
1187        Icon icon;
1188
1189        if (par1BlockComparator.func_94490_c(l))
1190        {
1191            icon = Block.torchRedstoneActive.getBlockTextureFromSide(0);
1192        }
1193        else
1194        {
1195            d1 -= 0.1875D;
1196            icon = Block.torchRedstoneIdle.getBlockTextureFromSide(0);
1197        }
1198
1199        switch (i1)
1200        {
1201            case 0:
1202                d2 = -0.3125D;
1203                d4 = 1.0D;
1204                break;
1205            case 1:
1206                d0 = 0.3125D;
1207                d3 = -1.0D;
1208                break;
1209            case 2:
1210                d2 = 0.3125D;
1211                d4 = -1.0D;
1212                break;
1213            case 3:
1214                d0 = -0.3125D;
1215                d3 = 1.0D;
1216        }
1217
1218        this.renderTorchAtAngle(par1BlockComparator, (double)par2 + 0.25D * d3 + 0.1875D * d4, (double)((float)par3 - 0.1875F), (double)par4 + 0.25D * d4 + 0.1875D * d3, 0.0D, 0.0D, l);
1219        this.renderTorchAtAngle(par1BlockComparator, (double)par2 + 0.25D * d3 + -0.1875D * d4, (double)((float)par3 - 0.1875F), (double)par4 + 0.25D * d4 + -0.1875D * d3, 0.0D, 0.0D, l);
1220        this.setOverrideBlockTexture(icon);
1221        this.renderTorchAtAngle(par1BlockComparator, (double)par2 + d0, (double)par3 + d1, (double)par4 + d2, 0.0D, 0.0D, l);
1222        this.clearOverrideBlockTexture();
1223        this.renderBlockRedstoneLogicMetadata(par1BlockComparator, par2, par3, par4, i1);
1224        return true;
1225    }
1226
1227    public boolean renderBlockRedstoneLogic(BlockRedstoneLogic par1BlockRedstoneLogic, int par2, int par3, int par4)
1228    {
1229        Tessellator tessellator = Tessellator.instance;
1230        this.renderBlockRedstoneLogicMetadata(par1BlockRedstoneLogic, par2, par3, par4, this.blockAccess.getBlockMetadata(par2, par3, par4) & 3);
1231        return true;
1232    }
1233
1234    public void renderBlockRedstoneLogicMetadata(BlockRedstoneLogic par1BlockRedstoneLogic, int par2, int par3, int par4, int par5)
1235    {
1236        this.renderStandardBlock(par1BlockRedstoneLogic, par2, par3, par4);
1237        Tessellator tessellator = Tessellator.instance;
1238        tessellator.setBrightness(par1BlockRedstoneLogic.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
1239        tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
1240        int i1 = this.blockAccess.getBlockMetadata(par2, par3, par4);
1241        Icon icon = this.getBlockIconFromSideAndMetadata(par1BlockRedstoneLogic, 1, i1);
1242        double d0 = (double)icon.getMinU();
1243        double d1 = (double)icon.getMaxU();
1244        double d2 = (double)icon.getMinV();
1245        double d3 = (double)icon.getMaxV();
1246        double d4 = 0.125D;
1247        double d5 = (double)(par2 + 1);
1248        double d6 = (double)(par2 + 1);
1249        double d7 = (double)(par2 + 0);
1250        double d8 = (double)(par2 + 0);
1251        double d9 = (double)(par4 + 0);
1252        double d10 = (double)(par4 + 1);
1253        double d11 = (double)(par4 + 1);
1254        double d12 = (double)(par4 + 0);
1255        double d13 = (double)par3 + d4;
1256
1257        if (par5 == 2)
1258        {
1259            d5 = d6 = (double)(par2 + 0);
1260            d7 = d8 = (double)(par2 + 1);
1261            d9 = d12 = (double)(par4 + 1);
1262            d10 = d11 = (double)(par4 + 0);
1263        }
1264        else if (par5 == 3)
1265        {
1266            d5 = d8 = (double)(par2 + 0);
1267            d6 = d7 = (double)(par2 + 1);
1268            d9 = d10 = (double)(par4 + 0);
1269            d11 = d12 = (double)(par4 + 1);
1270        }
1271        else if (par5 == 1)
1272        {
1273            d5 = d8 = (double)(par2 + 1);
1274            d6 = d7 = (double)(par2 + 0);
1275            d9 = d10 = (double)(par4 + 1);
1276            d11 = d12 = (double)(par4 + 0);
1277        }
1278
1279        tessellator.addVertexWithUV(d8, d13, d12, d0, d2);
1280        tessellator.addVertexWithUV(d7, d13, d11, d0, d3);
1281        tessellator.addVertexWithUV(d6, d13, d10, d1, d3);
1282        tessellator.addVertexWithUV(d5, d13, d9, d1, d2);
1283    }
1284
1285    /**
1286     * Render all faces of the piston base
1287     */
1288    public void renderPistonBaseAllFaces(Block par1Block, int par2, int par3, int par4)
1289    {
1290        this.renderAllFaces = true;
1291        this.renderPistonBase(par1Block, par2, par3, par4, true);
1292        this.renderAllFaces = false;
1293    }
1294
1295    /**
1296     * renders a block as a piston base
1297     */
1298    public boolean renderPistonBase(Block par1Block, int par2, int par3, int par4, boolean par5)
1299    {
1300        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
1301        boolean flag1 = par5 || (l & 8) != 0;
1302        int i1 = BlockPistonBase.getOrientation(l);
1303
1304        if (flag1)
1305        {
1306            switch (i1)
1307            {
1308                case 0:
1309                    this.uvRotateEast = 3;
1310                    this.uvRotateWest = 3;
1311                    this.uvRotateSouth = 3;
1312                    this.uvRotateNorth = 3;
1313                    this.setRenderBounds(0.0D, 0.25D, 0.0D, 1.0D, 1.0D, 1.0D);
1314                    break;
1315                case 1:
1316                    this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 0.75D, 1.0D);
1317                    break;
1318                case 2:
1319                    this.uvRotateSouth = 1;
1320                    this.uvRotateNorth = 2;
1321                    this.setRenderBounds(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D);
1322                    break;
1323                case 3:
1324                    this.uvRotateSouth = 2;
1325                    this.uvRotateNorth = 1;
1326                    this.uvRotateTop = 3;
1327                    this.uvRotateBottom = 3;
1328                    this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D);
1329                    break;
1330                case 4:
1331                    this.uvRotateEast = 1;
1332                    this.uvRotateWest = 2;
1333                    this.uvRotateTop = 2;
1334                    this.uvRotateBottom = 1;
1335                    this.setRenderBounds(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
1336                    break;
1337                case 5:
1338                    this.uvRotateEast = 2;
1339                    this.uvRotateWest = 1;
1340                    this.uvRotateTop = 1;
1341                    this.uvRotateBottom = 2;
1342                    this.setRenderBounds(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D);
1343            }
1344
1345            ((BlockPistonBase)par1Block).func_96479_b((float)this.renderMinX, (float)this.renderMinY, (float)this.renderMinZ, (float)this.renderMaxX, (float)this.renderMaxY, (float)this.renderMaxZ);
1346            this.renderStandardBlock(par1Block, par2, par3, par4);
1347            this.uvRotateEast = 0;
1348            this.uvRotateWest = 0;
1349            this.uvRotateSouth = 0;
1350            this.uvRotateNorth = 0;
1351            this.uvRotateTop = 0;
1352            this.uvRotateBottom = 0;
1353            this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
1354            ((BlockPistonBase)par1Block).func_96479_b((float)this.renderMinX, (float)this.renderMinY, (float)this.renderMinZ, (float)this.renderMaxX, (float)this.renderMaxY, (float)this.renderMaxZ);
1355        }
1356        else
1357        {
1358            switch (i1)
1359            {
1360                case 0:
1361                    this.uvRotateEast = 3;
1362                    this.uvRotateWest = 3;
1363                    this.uvRotateSouth = 3;
1364                    this.uvRotateNorth = 3;
1365                case 1:
1366                default:
1367                    break;
1368                case 2:
1369                    this.uvRotateSouth = 1;
1370                    this.uvRotateNorth = 2;
1371                    break;
1372                case 3:
1373                    this.uvRotateSouth = 2;
1374                    this.uvRotateNorth = 1;
1375                    this.uvRotateTop = 3;
1376                    this.uvRotateBottom = 3;
1377                    break;
1378                case 4:
1379                    this.uvRotateEast = 1;
1380                    this.uvRotateWest = 2;
1381                    this.uvRotateTop = 2;
1382                    this.uvRotateBottom = 1;
1383                    break;
1384                case 5:
1385                    this.uvRotateEast = 2;
1386                    this.uvRotateWest = 1;
1387                    this.uvRotateTop = 1;
1388                    this.uvRotateBottom = 2;
1389            }
1390
1391            this.renderStandardBlock(par1Block, par2, par3, par4);
1392            this.uvRotateEast = 0;
1393            this.uvRotateWest = 0;
1394            this.uvRotateSouth = 0;
1395            this.uvRotateNorth = 0;
1396            this.uvRotateTop = 0;
1397            this.uvRotateBottom = 0;
1398        }
1399
1400        return true;
1401    }
1402
1403    /**
1404     * Render piston rod up/down
1405     */
1406    public void renderPistonRodUD(double par1, double par3, double par5, double par7, double par9, double par11, float par13, double par14)
1407    {
1408        Icon icon = BlockPistonBase.func_94496_b("piston_side");
1409
1410        if (this.hasOverrideBlockTexture())
1411        {
1412            icon = this.overrideBlockTexture;
1413        }
1414
1415        Tessellator tessellator = Tessellator.instance;
1416        double d7 = (double)icon.getMinU();
1417        double d8 = (double)icon.getMinV();
1418        double d9 = (double)icon.getInterpolatedU(par14);
1419        double d10 = (double)icon.getInterpolatedV(4.0D);
1420        tessellator.setColorOpaque_F(par13, par13, par13);
1421        tessellator.addVertexWithUV(par1, par7, par9, d9, d8);
1422        tessellator.addVertexWithUV(par1, par5, par9, d7, d8);
1423        tessellator.addVertexWithUV(par3, par5, par11, d7, d10);
1424        tessellator.addVertexWithUV(par3, par7, par11, d9, d10);
1425    }
1426
1427    /**
1428     * Render piston rod south/north
1429     */
1430    public void renderPistonRodSN(double par1, double par3, double par5, double par7, double par9, double par11, float par13, double par14)
1431    {
1432        Icon icon = BlockPistonBase.func_94496_b("piston_side");
1433
1434        if (this.hasOverrideBlockTexture())
1435        {
1436            icon = this.overrideBlockTexture;
1437        }
1438
1439        Tessellator tessellator = Tessellator.instance;
1440        double d7 = (double)icon.getMinU();
1441        double d8 = (double)icon.getMinV();
1442        double d9 = (double)icon.getInterpolatedU(par14);
1443        double d10 = (double)icon.getInterpolatedV(4.0D);
1444        tessellator.setColorOpaque_F(par13, par13, par13);
1445        tessellator.addVertexWithUV(par1, par5, par11, d9, d8);
1446        tessellator.addVertexWithUV(par1, par5, par9, d7, d8);
1447        tessellator.addVertexWithUV(par3, par7, par9, d7, d10);
1448        tessellator.addVertexWithUV(par3, par7, par11, d9, d10);
1449    }
1450
1451    /**
1452     * Render piston rod east/west
1453     */
1454    public void renderPistonRodEW(double par1, double par3, double par5, double par7, double par9, double par11, float par13, double par14)
1455    {
1456        Icon icon = BlockPistonBase.func_94496_b("piston_side");
1457
1458        if (this.hasOverrideBlockTexture())
1459        {
1460            icon = this.overrideBlockTexture;
1461        }
1462
1463        Tessellator tessellator = Tessellator.instance;
1464        double d7 = (double)icon.getMinU();
1465        double d8 = (double)icon.getMinV();
1466        double d9 = (double)icon.getInterpolatedU(par14);
1467        double d10 = (double)icon.getInterpolatedV(4.0D);
1468        tessellator.setColorOpaque_F(par13, par13, par13);
1469        tessellator.addVertexWithUV(par3, par5, par9, d9, d8);
1470        tessellator.addVertexWithUV(par1, par5, par9, d7, d8);
1471        tessellator.addVertexWithUV(par1, par7, par11, d7, d10);
1472        tessellator.addVertexWithUV(par3, par7, par11, d9, d10);
1473    }
1474
1475    /**
1476     * Render all faces of the piston extension
1477     */
1478    public void renderPistonExtensionAllFaces(Block par1Block, int par2, int par3, int par4, boolean par5)
1479    {
1480        this.renderAllFaces = true;
1481        this.renderPistonExtension(par1Block, par2, par3, par4, par5);
1482        this.renderAllFaces = false;
1483    }
1484
1485    /**
1486     * renders the pushing part of a piston
1487     */
1488    public boolean renderPistonExtension(Block par1Block, int par2, int par3, int par4, boolean par5)
1489    {
1490        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
1491        int i1 = BlockPistonExtension.getDirectionMeta(l);
1492        float f = par1Block.getBlockBrightness(this.blockAccess, par2, par3, par4);
1493        float f1 = par5 ? 1.0F : 0.5F;
1494        double d0 = par5 ? 16.0D : 8.0D;
1495
1496        switch (i1)
1497        {
1498            case 0:
1499                this.uvRotateEast = 3;
1500                this.uvRotateWest = 3;
1501                this.uvRotateSouth = 3;
1502                this.uvRotateNorth = 3;
1503                this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 0.25D, 1.0D);
1504                this.renderStandardBlock(par1Block, par2, par3, par4);
1505                this.renderPistonRodUD((double)((float)par2 + 0.375F), (double)((float)par2 + 0.625F), (double)((float)par3 + 0.25F), (double)((float)par3 + 0.25F + f1), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.625F), f * 0.8F, d0);
1506                this.renderPistonRodUD((double)((float)par2 + 0.625F), (double)((float)par2 + 0.375F), (double)((float)par3 + 0.25F), (double)((float)par3 + 0.25F + f1), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.375F), f * 0.8F, d0);
1507                this.renderPistonRodUD((double)((float)par2 + 0.375F), (double)((float)par2 + 0.375F), (double)((float)par3 + 0.25F), (double)((float)par3 + 0.25F + f1), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.625F), f * 0.6F, d0);
1508                this.renderPistonRodUD((double)((float)par2 + 0.625F), (double)((float)par2 + 0.625F), (double)((float)par3 + 0.25F), (double)((float)par3 + 0.25F + f1), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.375F), f * 0.6F, d0);
1509                break;
1510            case 1:
1511                this.setRenderBounds(0.0D, 0.75D, 0.0D, 1.0D, 1.0D, 1.0D);
1512                this.renderStandardBlock(par1Block, par2, par3, par4);
1513                this.renderPistonRodUD((double)((float)par2 + 0.375F), (double)((float)par2 + 0.625F), (double)((float)par3 - 0.25F + 1.0F - f1), (double)((float)par3 - 0.25F + 1.0F), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.625F), f * 0.8F, d0);
1514                this.renderPistonRodUD((double)((float)par2 + 0.625F), (double)((float)par2 + 0.375F), (double)((float)par3 - 0.25F + 1.0F - f1), (double)((float)par3 - 0.25F + 1.0F), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.375F), f * 0.8F, d0);
1515                this.renderPistonRodUD((double)((float)par2 + 0.375F), (double)((float)par2 + 0.375F), (double)((float)par3 - 0.25F + 1.0F - f1), (double)((float)par3 - 0.25F + 1.0F), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.625F), f * 0.6F, d0);
1516                this.renderPistonRodUD((double)((float)par2 + 0.625F), (double)((float)par2 + 0.625F), (double)((float)par3 - 0.25F + 1.0F - f1), (double)((float)par3 - 0.25F + 1.0F), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.375F), f * 0.6F, d0);
1517                break;
1518            case 2:
1519                this.uvRotateSouth = 1;
1520                this.uvRotateNorth = 2;
1521                this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.25D);
1522                this.renderStandardBlock(par1Block, par2, par3, par4);
1523                this.renderPistonRodSN((double)((float)par2 + 0.375F), (double)((float)par2 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par4 + 0.25F), (double)((float)par4 + 0.25F + f1), f * 0.6F, d0);
1524                this.renderPistonRodSN((double)((float)par2 + 0.625F), (double)((float)par2 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par4 + 0.25F), (double)((float)par4 + 0.25F + f1), f * 0.6F, d0);
1525                this.renderPistonRodSN((double)((float)par2 + 0.375F), (double)((float)par2 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.375F), (double)((float)par4 + 0.25F), (double)((float)par4 + 0.25F + f1), f * 0.5F, d0);
1526                this.renderPistonRodSN((double)((float)par2 + 0.625F), (double)((float)par2 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.625F), (double)((float)par4 + 0.25F), (double)((float)par4 + 0.25F + f1), f, d0);
1527                break;
1528            case 3:
1529                this.uvRotateSouth = 2;
1530                this.uvRotateNorth = 1;
1531                this.uvRotateTop = 3;
1532                this.uvRotateBottom = 3;
1533                this.setRenderBounds(0.0D, 0.0D, 0.75D, 1.0D, 1.0D, 1.0D);
1534                this.renderStandardBlock(par1Block, par2, par3, par4);
1535                this.renderPistonRodSN((double)((float)par2 + 0.375F), (double)((float)par2 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par4 - 0.25F + 1.0F - f1), (double)((float)par4 - 0.25F + 1.0F), f * 0.6F, d0);
1536                this.renderPistonRodSN((double)((float)par2 + 0.625F), (double)((float)par2 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par4 - 0.25F + 1.0F - f1), (double)((float)par4 - 0.25F + 1.0F), f * 0.6F, d0);
1537                this.renderPistonRodSN((double)((float)par2 + 0.375F), (double)((float)par2 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.375F), (double)((float)par4 - 0.25F + 1.0F - f1), (double)((float)par4 - 0.25F + 1.0F), f * 0.5F, d0);
1538                this.renderPistonRodSN((double)((float)par2 + 0.625F), (double)((float)par2 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.625F), (double)((float)par4 - 0.25F + 1.0F - f1), (double)((float)par4 - 0.25F + 1.0F), f, d0);
1539                break;
1540            case 4:
1541                this.uvRotateEast = 1;
1542                this.uvRotateWest = 2;
1543                this.uvRotateTop = 2;
1544                this.uvRotateBottom = 1;
1545                this.setRenderBounds(0.0D, 0.0D, 0.0D, 0.25D, 1.0D, 1.0D);
1546                this.renderStandardBlock(par1Block, par2, par3, par4);
1547                this.renderPistonRodEW((double)((float)par2 + 0.25F), (double)((float)par2 + 0.25F + f1), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.375F), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.375F), f * 0.5F, d0);
1548                this.renderPistonRodEW((double)((float)par2 + 0.25F), (double)((float)par2 + 0.25F + f1), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.625F), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.625F), f, d0);
1549                this.renderPistonRodEW((double)((float)par2 + 0.25F), (double)((float)par2 + 0.25F + f1), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.375F), f * 0.6F, d0);
1550                this.renderPistonRodEW((double)((float)par2 + 0.25F), (double)((float)par2 + 0.25F + f1), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.625F), f * 0.6F, d0);
1551                break;
1552            case 5:
1553                this.uvRotateEast = 2;
1554                this.uvRotateWest = 1;
1555                this.uvRotateTop = 1;
1556                this.uvRotateBottom = 2;
1557                this.setRenderBounds(0.75D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
1558                this.renderStandardBlock(par1Block, par2, par3, par4);
1559                this.renderPistonRodEW((double)((float)par2 - 0.25F + 1.0F - f1), (double)((float)par2 - 0.25F + 1.0F), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.375F), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.375F), f * 0.5F, d0);
1560                this.renderPistonRodEW((double)((float)par2 - 0.25F + 1.0F - f1), (double)((float)par2 - 0.25F + 1.0F), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.625F), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.625F), f, d0);
1561                this.renderPistonRodEW((double)((float)par2 - 0.25F + 1.0F - f1), (double)((float)par2 - 0.25F + 1.0F), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.375F), f * 0.6F, d0);
1562                this.renderPistonRodEW((double)((float)par2 - 0.25F + 1.0F - f1), (double)((float)par2 - 0.25F + 1.0F), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.625F), f * 0.6F, d0);
1563        }
1564
1565        this.uvRotateEast = 0;
1566        this.uvRotateWest = 0;
1567        this.uvRotateSouth = 0;
1568        this.uvRotateNorth = 0;
1569        this.uvRotateTop = 0;
1570        this.uvRotateBottom = 0;
1571        this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
1572        return true;
1573    }
1574
1575    /**
1576     * Renders a lever block at the given coordinates
1577     */
1578    public boolean renderBlockLever(Block par1Block, int par2, int par3, int par4)
1579    {
1580        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
1581        int i1 = l & 7;
1582        boolean flag = (l & 8) > 0;
1583        Tessellator tessellator = Tessellator.instance;
1584        boolean flag1 = this.hasOverrideBlockTexture();
1585
1586        if (!flag1)
1587        {
1588            this.setOverrideBlockTexture(this.getBlockIcon(Block.cobblestone));
1589        }
1590
1591        float f = 0.25F;
1592        float f1 = 0.1875F;
1593        float f2 = 0.1875F;
1594
1595        if (i1 == 5)
1596        {
1597            this.setRenderBounds((double)(0.5F - f1), 0.0D, (double)(0.5F - f), (double)(0.5F + f1), (double)f2, (double)(0.5F + f));
1598        }
1599        else if (i1 == 6)
1600        {
1601            this.setRenderBounds((double)(0.5F - f), 0.0D, (double)(0.5F - f1), (double)(0.5F + f), (double)f2, (double)(0.5F + f1));
1602        }
1603        else if (i1 == 4)
1604        {
1605            this.setRenderBounds((double)(0.5F - f1), (double)(0.5F - f), (double)(1.0F - f2), (double)(0.5F + f1), (double)(0.5F + f), 1.0D);
1606        }
1607        else if (i1 == 3)
1608        {
1609            this.setRenderBounds((double)(0.5F - f1), (double)(0.5F - f), 0.0D, (double)(0.5F + f1), (double)(0.5F + f), (double)f2);
1610        }
1611        else if (i1 == 2)
1612        {
1613            this.setRenderBounds((double)(1.0F - f2), (double)(0.5F - f), (double)(0.5F - f1), 1.0D, (double)(0.5F + f), (double)(0.5F + f1));
1614        }
1615        else if (i1 == 1)
1616        {
1617            this.setRenderBounds(0.0D, (double)(0.5F - f), (double)(0.5F - f1), (double)f2, (double)(0.5F + f), (double)(0.5F + f1));
1618        }
1619        else if (i1 == 0)
1620        {
1621            this.setRenderBounds((double)(0.5F - f), (double)(1.0F - f2), (double)(0.5F - f1), (double)(0.5F + f), 1.0D, (double)(0.5F + f1));
1622        }
1623        else if (i1 == 7)
1624        {
1625            this.setRenderBounds((double)(0.5F - f1), (double)(1.0F - f2), (double)(0.5F - f), (double)(0.5F + f1), 1.0D, (double)(0.5F + f));
1626        }
1627
1628        this.renderStandardBlock(par1Block, par2, par3, par4);
1629
1630        if (!flag1)
1631        {
1632            this.clearOverrideBlockTexture();
1633        }
1634
1635        tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
1636        float f3 = 1.0F;
1637
1638        if (Block.lightValue[par1Block.blockID] > 0)
1639        {
1640            f3 = 1.0F;
1641        }
1642
1643        tessellator.setColorOpaque_F(f3, f3, f3);
1644        Icon icon = this.getBlockIconFromSide(par1Block, 0);
1645
1646        if (this.hasOverrideBlockTexture())
1647        {
1648            icon = this.overrideBlockTexture;
1649        }
1650
1651        double d0 = (double)icon.getMinU();
1652        double d1 = (double)icon.getMinV();
1653        double d2 = (double)icon.getMaxU();
1654        double d3 = (double)icon.getMaxV();
1655        Vec3[] avec3 = new Vec3[8];
1656        float f4 = 0.0625F;
1657        float f5 = 0.0625F;
1658        float f6 = 0.625F;
1659        avec3[0] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-f4), 0.0D, (double)(-f5));
1660        avec3[1] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)f4, 0.0D, (double)(-f5));
1661        avec3[2] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)f4, 0.0D, (double)f5);
1662        avec3[3] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-f4), 0.0D, (double)f5);
1663        avec3[4] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-f4), (double)f6, (double)(-f5));
1664        avec3[5] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)f4, (double)f6, (double)(-f5));
1665        avec3[6] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)f4, (double)f6, (double)f5);
1666        avec3[7] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-f4), (double)f6, (double)f5);
1667
1668        for (int j1 = 0; j1 < 8; ++j1)
1669        {
1670            if (flag)
1671            {
1672                avec3[j1].zCoord -= 0.0625D;
1673                avec3[j1].rotateAroundX(((float)Math.PI * 2F / 9F));
1674            }
1675            else
1676            {
1677                avec3[j1].zCoord += 0.0625D;
1678                avec3[j1].rotateAroundX(-((float)Math.PI * 2F / 9F));
1679            }
1680
1681            if (i1 == 0 || i1 == 7)
1682            {
1683                avec3[j1].rotateAroundZ((float)Math.PI);
1684            }
1685
1686            if (i1 == 6 || i1 == 0)
1687            {
1688                avec3[j1].rotateAroundY(((float)Math.PI / 2F));
1689            }
1690
1691            if (i1 > 0 && i1 < 5)
1692            {
1693                avec3[j1].yCoord -= 0.375D;
1694                avec3[j1].rotateAroundX(((float)Math.PI / 2F));
1695
1696                if (i1 == 4)
1697                {
1698                    avec3[j1].rotateAroundY(0.0F);
1699                }
1700
1701                if (i1 == 3)
1702                {
1703                    avec3[j1].rotateAroundY((float)Math.PI);
1704                }
1705
1706                if (i1 == 2)
1707                {
1708                    avec3[j1].rotateAroundY(((float)Math.PI / 2F));
1709                }
1710
1711                if (i1 == 1)
1712                {
1713                    avec3[j1].rotateAroundY(-((float)Math.PI / 2F));
1714                }
1715
1716                avec3[j1].xCoord += (double)par2 + 0.5D;
1717                avec3[j1].yCoord += (double)((float)par3 + 0.5F);
1718                avec3[j1].zCoord += (double)par4 + 0.5D;
1719            }
1720            else if (i1 != 0 && i1 != 7)
1721            {
1722                avec3[j1].xCoord += (double)par2 + 0.5D;
1723                avec3[j1].yCoord += (double)((float)par3 + 0.125F);
1724                avec3[j1].zCoord += (double)par4 + 0.5D;
1725            }
1726            else
1727            {
1728                avec3[j1].xCoord += (double)par2 + 0.5D;
1729                avec3[j1].yCoord += (double)((float)par3 + 0.875F);
1730                avec3[j1].zCoord += (double)par4 + 0.5D;
1731            }
1732        }
1733
1734        Vec3 vec3 = null;
1735        Vec3 vec31 = null;
1736        Vec3 vec32 = null;
1737        Vec3 vec33 = null;
1738
1739        for (int k1 = 0; k1 < 6; ++k1)
1740        {
1741            if (k1 == 0)
1742            {
1743                d0 = (double)icon.getInterpolatedU(7.0D);
1744                d1 = (double)icon.getInterpolatedV(6.0D);
1745                d2 = (double)icon.getInterpolatedU(9.0D);
1746                d3 = (double)icon.getInterpolatedV(8.0D);
1747            }
1748            else if (k1 == 2)
1749            {
1750                d0 = (double)icon.getInterpolatedU(7.0D);
1751                d1 = (double)icon.getInterpolatedV(6.0D);
1752                d2 = (double)icon.getInterpolatedU(9.0D);
1753                d3 = (double)icon.getMaxV();
1754            }
1755
1756            if (k1 == 0)
1757            {
1758                vec3 = avec3[0];
1759                vec31 = avec3[1];
1760                vec32 = avec3[2];
1761                vec33 = avec3[3];
1762            }
1763            else if (k1 == 1)
1764            {
1765                vec3 = avec3[7];
1766                vec31 = avec3[6];
1767                vec32 = avec3[5];
1768                vec33 = avec3[4];
1769            }
1770            else if (k1 == 2)
1771            {
1772                vec3 = avec3[1];
1773                vec31 = avec3[0];
1774                vec32 = avec3[4];
1775                vec33 = avec3[5];
1776            }
1777            else if (k1 == 3)
1778            {
1779                vec3 = avec3[2];
1780                vec31 = avec3[1];
1781                vec32 = avec3[5];
1782                vec33 = avec3[6];
1783            }
1784            else if (k1 == 4)
1785            {
1786                vec3 = avec3[3];
1787                vec31 = avec3[2];
1788                vec32 = avec3[6];
1789                vec33 = avec3[7];
1790            }
1791            else if (k1 == 5)
1792            {
1793                vec3 = avec3[0];
1794                vec31 = avec3[3];
1795                vec32 = avec3[7];
1796                vec33 = avec3[4];
1797            }
1798
1799            tessellator.addVertexWithUV(vec3.xCoord, vec3.yCoord, vec3.zCoord, d0, d3);
1800            tessellator.addVertexWithUV(vec31.xCoord, vec31.yCoord, vec31.zCoord, d2, d3);
1801            tessellator.addVertexWithUV(vec32.xCoord, vec32.yCoord, vec32.zCoord, d2, d1);
1802            tessellator.addVertexWithUV(vec33.xCoord, vec33.yCoord, vec33.zCoord, d0, d1);
1803        }
1804
1805        return true;
1806    }
1807
1808    /**
1809     * Renders a trip wire source block at the given coordinates
1810     */
1811    public boolean renderBlockTripWireSource(Block par1Block, int par2, int par3, int par4)
1812    {
1813        Tessellator tessellator = Tessellator.instance;
1814        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
1815        int i1 = l & 3;
1816        boolean flag = (l & 4) == 4;
1817        boolean flag1 = (l & 8) == 8;
1818        boolean flag2 = !this.blockAccess.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4);
1819        boolean flag3 = this.hasOverrideBlockTexture();
1820
1821        if (!flag3)
1822        {
1823            this.setOverrideBlockTexture(this.getBlockIcon(Block.planks));
1824        }
1825
1826        float f = 0.25F;
1827        float f1 = 0.125F;
1828        float f2 = 0.125F;
1829        float f3 = 0.3F - f;
1830        float f4 = 0.3F + f;
1831
1832        if (i1 == 2)
1833        {
1834            this.setRenderBounds((double)(0.5F - f1), (double)f3, (double)(1.0F - f2), (double)(0.5F + f1), (double)f4, 1.0D);
1835        }
1836        else if (i1 == 0)
1837        {
1838            this.setRenderBounds((double)(0.5F - f1), (double)f3, 0.0D, (double)(0.5F + f1), (double)f4, (double)f2);
1839        }
1840        else if (i1 == 1)
1841        {
1842            this.setRenderBounds((double)(1.0F - f2), (double)f3, (double)(0.5F - f1), 1.0D, (double)f4, (double)(0.5F + f1));
1843        }
1844        else if (i1 == 3)
1845        {
1846            this.setRenderBounds(0.0D, (double)f3, (double)(0.5F - f1), (double)f2, (double)f4, (double)(0.5F + f1));
1847        }
1848
1849        this.renderStandardBlock(par1Block, par2, par3, par4);
1850
1851        if (!flag3)
1852        {
1853            this.clearOverrideBlockTexture();
1854        }
1855
1856        tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
1857        float f5 = 1.0F;
1858
1859        if (Block.lightValue[par1Block.blockID] > 0)
1860        {
1861            f5 = 1.0F;
1862        }
1863
1864        tessellator.setColorOpaque_F(f5, f5, f5);
1865        Icon icon = this.getBlockIconFromSide(par1Block, 0);
1866
1867        if (this.hasOverrideBlockTexture())
1868        {
1869            icon = this.overrideBlockTexture;
1870        }
1871
1872        double d0 = (double)icon.getMinU();
1873        double d1 = (double)icon.getMinV();
1874        double d2 = (double)icon.getMaxU();
1875        double d3 = (double)icon.getMaxV();
1876        Vec3[] avec3 = new Vec3[8];
1877        float f6 = 0.046875F;
1878        float f7 = 0.046875F;
1879        float f8 = 0.3125F;
1880        avec3[0] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-f6), 0.0D, (double)(-f7));
1881        avec3[1] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)f6, 0.0D, (double)(-f7));
1882        avec3[2] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)f6, 0.0D, (double)f7);
1883        avec3[3] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-f6), 0.0D, (double)f7);
1884        avec3[4] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-f6), (double)f8, (double)(-f7));
1885        avec3[5] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)f6, (double)f8, (double)(-f7));
1886        avec3[6] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)f6, (double)f8, (double)f7);
1887        avec3[7] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-f6), (double)f8, (double)f7);
1888
1889        for (int j1 = 0; j1 < 8; ++j1)
1890        {
1891            avec3[j1].zCoord += 0.0625D;
1892
1893            if (flag1)
1894            {
1895                avec3[j1].rotateAroundX(0.5235988F);
1896                avec3[j1].yCoord -= 0.4375D;
1897            }
1898            else if (flag)
1899            {
1900                avec3[j1].rotateAroundX(0.08726647F);
1901                avec3[j1].yCoord -= 0.4375D;
1902            }
1903            else
1904            {
1905                avec3[j1].rotateAroundX(-((float)Math.PI * 2F / 9F));
1906                avec3[j1].yCoord -= 0.375D;
1907            }
1908
1909            avec3[j1].rotateAroundX(((float)Math.PI / 2F));
1910
1911            if (i1 == 2)
1912            {
1913                avec3[j1].rotateAroundY(0.0F);
1914            }
1915
1916            if (i1 == 0)
1917            {
1918                avec3[j1].rotateAroundY((float)Math.PI);
1919            }
1920
1921            if (i1 == 1)
1922            {
1923                avec3[j1].rotateAroundY(((float)Math.PI / 2F));
1924            }
1925
1926            if (i1 == 3)
1927            {
1928                avec3[j1].rotateAroundY(-((float)Math.PI / 2F));
1929            }
1930
1931            avec3[j1].xCoord += (double)par2 + 0.5D;
1932            avec3[j1].yCoord += (double)((float)par3 + 0.3125F);
1933            avec3[j1].zCoord += (double)par4 + 0.5D;
1934        }
1935
1936        Vec3 vec3 = null;
1937        Vec3 vec31 = null;
1938        Vec3 vec32 = null;
1939        Vec3 vec33 = null;
1940        byte b0 = 7;
1941        byte b1 = 9;
1942        byte b2 = 9;
1943        byte b3 = 16;
1944
1945        for (int k1 = 0; k1 < 6; ++k1)
1946        {
1947            if (k1 == 0)
1948            {
1949                vec3 = avec3[0];
1950                vec31 = avec3[1];
1951                vec32 = avec3[2];
1952                vec33 = avec3[3];
1953                d0 = (double)icon.getInterpolatedU((double)b0);
1954                d1 = (double)icon.getInterpolatedV((double)b2);
1955                d2 = (double)icon.getInterpolatedU((double)b1);
1956                d3 = (double)icon.getInterpolatedV((double)(b2 + 2));
1957            }
1958            else if (k1 == 1)
1959            {
1960                vec3 = avec3[7];
1961                vec31 = avec3[6];
1962                vec32 = avec3[5];
1963                vec33 = avec3[4];
1964            }
1965            else if (k1 == 2)
1966            {
1967                vec3 = avec3[1];
1968                vec31 = avec3[0];
1969                vec32 = avec3[4];
1970                vec33 = avec3[5];
1971                d0 = (double)icon.getInterpolatedU((double)b0);
1972                d1 = (double)icon.getInterpolatedV((double)b2);
1973                d2 = (double)icon.getInterpolatedU((double)b1);
1974                d3 = (double)icon.getInterpolatedV((double)b3);
1975            }
1976            else if (k1 == 3)
1977            {
1978                vec3 = avec3[2];
1979                vec31 = avec3[1];
1980                vec32 = avec3[5];
1981                vec33 = avec3[6];
1982            }
1983            else if (k1 == 4)
1984            {
1985                vec3 = avec3[3];
1986                vec31 = avec3[2];
1987                vec32 = avec3[6];
1988                vec33 = avec3[7];
1989            }
1990            else if (k1 == 5)
1991            {
1992                vec3 = avec3[0];
1993                vec31 = avec3[3];
1994                vec32 = avec3[7];
1995                vec33 = avec3[4];
1996            }
1997
1998            tessellator.addVertexWithUV(vec3.xCoord, vec3.yCoord, vec3.zCoord, d0, d3);
1999            tessellator.addVertexWithUV(vec31.xCoord, vec31.yCoord, vec31.zCoord, d2, d3);
2000            tessellator.addVertexWithUV(vec32.xCoord, vec32.yCoord, vec32.zCoord, d2, d1);
2001            tessellator.addVertexWithUV(vec33.xCoord, vec33.yCoord, vec33.zCoord, d0, d1);
2002        }
2003
2004        float f9 = 0.09375F;
2005        float f10 = 0.09375F;
2006        float f11 = 0.03125F;
2007        avec3[0] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-f9), 0.0D, (double)(-f10));
2008        avec3[1] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)f9, 0.0D, (double)(-f10));
2009        avec3[2] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)f9, 0.0D, (double)f10);
2010        avec3[3] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-f9), 0.0D, (double)f10);
2011        avec3[4] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-f9), (double)f11, (double)(-f10));
2012        avec3[5] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)f9, (double)f11, (double)(-f10));
2013        avec3[6] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)f9, (double)f11, (double)f10);
2014        avec3[7] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-f9), (double)f11, (double)f10);
2015
2016        for (int l1 = 0; l1 < 8; ++l1)
2017        {
2018            avec3[l1].zCoord += 0.21875D;
2019
2020            if (flag1)
2021            {
2022                avec3[l1].yCoord -= 0.09375D;
2023                avec3[l1].zCoord -= 0.1625D;
2024                avec3[l1].rotateAroundX(0.0F);
2025            }
2026            else if (flag)
2027            {
2028                avec3[l1].yCoord += 0.015625D;
2029                avec3[l1].zCoord -= 0.171875D;
2030                avec3[l1].rotateAroundX(0.17453294F);
2031            }
2032            else
2033            {
2034                avec3[l1].rotateAroundX(0.87266463F);
2035            }
2036
2037            if (i1 == 2)
2038            {
2039                avec3[l1].rotateAroundY(0.0F);
2040            }
2041
2042            if (i1 == 0)
2043            {
2044                avec3[l1].rotateAroundY((float)Math.PI);
2045            }
2046
2047            if (i1 == 1)
2048            {
2049                avec3[l1].rotateAroundY(((float)Math.PI / 2F));
2050            }
2051
2052            if (i1 == 3)
2053            {
2054                avec3[l1].rotateAroundY(-((float)Math.PI / 2F));
2055            }
2056
2057            avec3[l1].xCoord += (double)par2 + 0.5D;
2058            avec3[l1].yCoord += (double)((float)par3 + 0.3125F);
2059            avec3[l1].zCoord += (double)par4 + 0.5D;
2060        }
2061
2062        byte b4 = 5;
2063        byte b5 = 11;
2064        byte b6 = 3;
2065        byte b7 = 9;
2066
2067        for (int i2 = 0; i2 < 6; ++i2)
2068        {
2069            if (i2 == 0)
2070            {
2071                vec3 = avec3[0];
2072                vec31 = avec3[1];
2073                vec32 = avec3[2];
2074                vec33 = avec3[3];
2075                d0 = (double)icon.getInterpolatedU((double)b4);
2076                d1 = (double)icon.getInterpolatedV((double)b6);
2077                d2 = (double)icon.getInterpolatedU((double)b5);
2078                d3 = (double)icon.getInterpolatedV((double)b7);
2079            }
2080            else if (i2 == 1)
2081            {
2082                vec3 = avec3[7];
2083                vec31 = avec3[6];
2084                vec32 = avec3[5];
2085                vec33 = avec3[4];
2086            }
2087            else if (i2 == 2)
2088            {
2089                vec3 = avec3[1];
2090                vec31 = avec3[0];
2091                vec32 = avec3[4];
2092                vec33 = avec3[5];
2093                d0 = (double)icon.getInterpolatedU((double)b4);
2094                d1 = (double)icon.getInterpolatedV((double)b6);
2095                d2 = (double)icon.getInterpolatedU((double)b5);
2096                d3 = (double)icon.getInterpolatedV((double)(b6 + 2));
2097            }
2098            else if (i2 == 3)
2099            {
2100                vec3 = avec3[2];
2101                vec31 = avec3[1];
2102                vec32 = avec3[5];
2103                vec33 = avec3[6];
2104            }
2105            else if (i2 == 4)
2106            {
2107                vec3 = avec3[3];
2108                vec31 = avec3[2];
2109                vec32 = avec3[6];
2110                vec33 = avec3[7];
2111            }
2112            else if (i2 == 5)
2113            {
2114                vec3 = avec3[0];
2115                vec31 = avec3[3];
2116                vec32 = avec3[7];
2117                vec33 = avec3[4];
2118            }
2119
2120            tessellator.addVertexWithUV(vec3.xCoord, vec3.yCoord, vec3.zCoord, d0, d3);
2121            tessellator.addVertexWithUV(vec31.xCoord, vec31.yCoord, vec31.zCoord, d2, d3);
2122            tessellator.addVertexWithUV(vec32.xCoord, vec32.yCoord, vec32.zCoord, d2, d1);
2123            tessellator.addVertexWithUV(vec33.xCoord, vec33.yCoord, vec33.zCoord, d0, d1);
2124        }
2125
2126        if (flag)
2127        {
2128            double d4 = avec3[0].yCoord;
2129            float f12 = 0.03125F;
2130            float f13 = 0.5F - f12 / 2.0F;
2131            float f14 = f13 + f12;
2132            Icon icon1 = this.getBlockIcon(Block.tripWire);
2133            double d5 = (double)icon.getMinU();
2134            double d6 = (double)icon.getInterpolatedV(flag ? 2.0D : 0.0D);
2135            double d7 = (double)icon.getMaxU();
2136            double d8 = (double)icon.getInterpolatedV(flag ? 4.0D : 2.0D);
2137            double d9 = (double)(flag2 ? 3.5F : 1.5F) / 16.0D;
2138            f5 = par1Block.getBlockBrightness(this.blockAccess, par2, par3, par4) * 0.75F;
2139            tessellator.setColorOpaque_F(f5, f5, f5);
2140
2141            if (i1 == 2)
2142            {
2143                tessellator.addVertexWithUV((double)((float)par2 + f13), (double)par3 + d9, (double)par4 + 0.25D, d5, d6);
2144                tessellator.addVertexWithUV((double)((float)par2 + f14), (double)par3 + d9, (double)par4 + 0.25D, d5, d8);
2145                tessellator.addVertexWithUV((double)((float)par2 + f14), (double)par3 + d9, (double)par4, d7, d8);
2146                tessellator.addVertexWithUV((double)((float)par2 + f13), (double)par3 + d9, (double)par4, d7, d6);
2147                tessellator.addVertexWithUV((double)((float)par2 + f13), d4, (double)par4 + 0.5D, d5, d6);
2148                tessellator.addVertexWithUV((double)((float)par2 + f14), d4, (double)par4 + 0.5D, d5, d8);
2149                tessellator.addVertexWithUV((double)((float)par2 + f14), (double)par3 + d9, (double)par4 + 0.25D, d7, d8);
2150                tessellator.addVertexWithUV((double)((float)par2 + f13), (double)par3 + d9, (double)par4 + 0.25D, d7, d6);
2151            }
2152            else if (i1 == 0)
2153            {
2154                tessellator.addVertexWithUV((double)((float)par2 + f13), (double)par3 + d9, (double)par4 + 0.75D, d5, d6);
2155                tessellator.addVertexWithUV((double)((float)par2 + f14), (double)par3 + d9, (double)par4 + 0.75D, d5, d8);
2156                tessellator.addVertexWithUV((double)((float)par2 + f14), d4, (double)par4 + 0.5D, d7, d8);
2157                tessellator.addVertexWithUV((double)((float)par2 + f13), d4, (double)par4 + 0.5D, d7, d6);
2158                tessellator.addVertexWithUV((double)((float)par2 + f13), (double)par3 + d9, (double)(par4 + 1), d5, d6);
2159                tessellator.addVertexWithUV((double)((float)par2 + f14), (double)par3 + d9, (double)(par4 + 1), d5, d8);
2160                tessellator.addVertexWithUV((double)((float)par2 + f14), (double)par3 + d9, (double)par4 + 0.75D, d7, d8);
2161                tessellator.addVertexWithUV((double)((float)par2 + f13), (double)par3 + d9, (double)par4 + 0.75D, d7, d6);
2162            }
2163            else if (i1 == 1)
2164            {
2165                tessellator.addVertexWithUV((double)par2, (double)par3 + d9, (double)((float)par4 + f14), d5, d8);
2166                tessellator.addVertexWithUV((double)par2 + 0.25D, (double)par3 + d9, (double)((float)par4 + f14), d7, d8);
2167                tessellator.addVertexWithUV((double)par2 + 0.25D, (double)par3 + d9, (double)((float)par4 + f13), d7, d6);
2168                tessellator.addVertexWithUV((double)par2, (double)par3 + d9, (double)((float)par4 + f13), d5, d6);
2169                tessellator.addVertexWithUV((double)par2 + 0.25D, (double)par3 + d9, (double)((float)par4 + f14), d5, d8);
2170                tessellator.addVertexWithUV((double)par2 + 0.5D, d4, (double)((float)par4 + f14), d7, d8);
2171                tessellator.addVertexWithUV((double)par2 + 0.5D, d4, (double)((float)par4 + f13), d7, d6);
2172                tessellator.addVertexWithUV((double)par2 + 0.25D, (double)par3 + d9, (double)((float)par4 + f13), d5, d6);
2173            }
2174            else
2175            {
2176                tessellator.addVertexWithUV((double)par2 + 0.5D, d4, (double)((float)par4 + f14), d5, d8);
2177                tessellator.addVertexWithUV((double)par2 + 0.75D, (double)par3 + d9, (double)((float)par4 + f14), d7, d8);
2178                tessellator.addVertexWithUV((double)par2 + 0.75D, (double)par3 + d9, (double)((float)par4 + f13), d7, d6);
2179                tessellator.addVertexWithUV((double)par2 + 0.5D, d4, (double)((float)par4 + f13), d5, d6);
2180                tessellator.addVertexWithUV((double)par2 + 0.75D, (double)par3 + d9, (double)((float)par4 + f14), d5, d8);
2181                tessellator.addVertexWithUV((double)(par2 + 1), (double)par3 + d9, (double)((float)par4 + f14), d7, d8);
2182                tessellator.addVertexWithUV((double)(par2 + 1), (double)par3 + d9, (double)((float)par4 + f13), d7, d6);
2183                tessellator.addVertexWithUV((double)par2 + 0.75D, (double)par3 + d9, (double)((float)par4 + f13), d5, d6);
2184            }
2185        }
2186
2187        return true;
2188    }
2189
2190    /**
2191     * Renders a trip wire block at the given coordinates
2192     */
2193    public boolean renderBlockTripWire(Block par1Block, int par2, int par3, int par4)
2194    {
2195        Tessellator tessellator = Tessellator.instance;
2196        Icon icon = this.getBlockIconFromSide(par1Block, 0);
2197        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
2198        boolean flag = (l & 4) == 4;
2199        boolean flag1 = (l & 2) == 2;
2200
2201        if (this.hasOverrideBlockTexture())
2202        {
2203            icon = this.overrideBlockTexture;
2204        }
2205
2206        tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
2207        float f = par1Block.getBlockBrightness(this.blockAccess, par2, par3, par4) * 0.75F;
2208        tessellator.setColorOpaque_F(f, f, f);
2209        double d0 = (double)icon.getMinU();
2210        double d1 = (double)icon.getInterpolatedV(flag ? 2.0D : 0.0D);
2211        double d2 = (double)icon.getMaxU();
2212        double d3 = (double)icon.getInterpolatedV(flag ? 4.0D : 2.0D);
2213        double d4 = (double)(flag1 ? 3.5F : 1.5F) / 16.0D;
2214        boolean flag2 = BlockTripWire.func_72148_a(this.blockAccess, par2, par3, par4, l, 1);
2215        boolean flag3 = BlockTripWire.func_72148_a(this.blockAccess, par2, par3, par4, l, 3);
2216        boolean flag4 = BlockTripWire.func_72148_a(this.blockAccess, par2, par3, par4, l, 2);
2217        boolean flag5 = BlockTripWire.func_72148_a(this.blockAccess, par2, par3, par4, l, 0);
2218        float f1 = 0.03125F;
2219        float f2 = 0.5F - f1 / 2.0F;
2220        float f3 = f2 + f1;
2221
2222        if (!flag4 && !flag3 && !flag5 && !flag2)
2223        {
2224            flag4 = true;
2225            flag5 = true;
2226        }
2227
2228        if (flag4)
2229        {
2230            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)par4 + 0.25D, d0, d1);
2231            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)par4 + 0.25D, d0, d3);
2232            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)par4, d2, d3);
2233            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)par4, d2, d1);
2234            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)par4, d2, d1);
2235            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)par4, d2, d3);
2236            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)par4 + 0.25D, d0, d3);
2237            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)par4 + 0.25D, d0, d1);
2238        }
2239
2240        if (flag4 || flag5 && !flag3 && !flag2)
2241        {
2242            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)par4 + 0.5D, d0, d1);
2243            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)par4 + 0.5D, d0, d3);
2244            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)par4 + 0.25D, d2, d3);
2245            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)par4 + 0.25D, d2, d1);
2246            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)par4 + 0.25D, d2, d1);
2247            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)par4 + 0.25D, d2, d3);
2248            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)par4 + 0.5D, d0, d3);
2249            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)par4 + 0.5D, d0, d1);
2250        }
2251
2252        if (flag5 || flag4 && !flag3 && !flag2)
2253        {
2254            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)par4 + 0.75D, d0, d1);
2255            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)par4 + 0.75D, d0, d3);
2256            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)par4 + 0.5D, d2, d3);
2257            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)par4 + 0.5D, d2, d1);
2258            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)par4 + 0.5D, d2, d1);
2259            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)par4 + 0.5D, d2, d3);
2260            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)par4 + 0.75D, d0, d3);
2261            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)par4 + 0.75D, d0, d1);
2262        }
2263
2264        if (flag5)
2265        {
2266            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)(par4 + 1), d0, d1);
2267            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)(par4 + 1), d0, d3);
2268            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)par4 + 0.75D, d2, d3);
2269            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)par4 + 0.75D, d2, d1);
2270            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)par4 + 0.75D, d2, d1);
2271            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)par4 + 0.75D, d2, d3);
2272            tessellator.addVertexWithUV((double)((float)par2 + f3), (double)par3 + d4, (double)(par4 + 1), d0, d3);
2273            tessellator.addVertexWithUV((double)((float)par2 + f2), (double)par3 + d4, (double)(par4 + 1), d0, d1);
2274        }
2275
2276        if (flag2)
2277        {
2278            tessellator.addVertexWithUV((double)par2, (double)par3 + d4, (double)((float)par4 + f3), d0, d3);
2279            tessellator.addVertexWithUV((double)par2 + 0.25D, (double)par3 + d4, (double)((float)par4 + f3), d2, d3);
2280            tessellator.addVertexWithUV((double)par2 + 0.25D, (double)par3 + d4, (double)((float)par4 + f2), d2, d1);
2281            tessellator.addVertexWithUV((double)par2, (double)par3 + d4, (double)((float)par4 + f2), d0, d1);
2282            tessellator.addVertexWithUV((double)par2, (double)par3 + d4, (double)((float)par4 + f2), d0, d1);
2283            tessellator.addVertexWithUV((double)par2 + 0.25D, (double)par3 + d4, (double)((float)par4 + f2), d2, d1);
2284            tessellator.addVertexWithUV((double)par2 + 0.25D, (double)par3 + d4, (double)((float)par4 + f3), d2, d3);
2285            tessellator.addVertexWithUV((double)par2, (double)par3 + d4, (double)((float)par4 + f3), d0, d3);
2286        }
2287
2288        if (flag2 || flag3 && !flag4 && !flag5)
2289        {
2290            tessellator.addVertexWithUV((double)par2 + 0.25D, (double)par3 + d4, (double)((float)par4 + f3), d0, d3);
2291            tessellator.addVertexWithUV((double)par2 + 0.5D, (double)par3 + d4, (double)((float)par4 + f3), d2, d3);
2292            tessellator.addVertexWithUV((double)par2 + 0.5D, (double)par3 + d4, (double)((float)par4 + f2), d2, d1);
2293            tessellator.addVertexWithUV((double)par2 + 0.25D, (double)par3 + d4, (double)((float)par4 + f2), d0, d1);
2294            tessellator.addVertexWithUV((double)par2 + 0.25D, (double)par3 + d4, (double)((float)par4 + f2), d0, d1);
2295            tessellator.addVertexWithUV((double)par2 + 0.5D, (double)par3 + d4, (double)((float)par4 + f2), d2, d1);
2296            tessellator.addVertexWithUV((double)par2 + 0.5D, (double)par3 + d4, (double)((float)par4 + f3), d2, d3);
2297            tessellator.addVertexWithUV((double)par2 + 0.25D, (double)par3 + d4, (double)((float)par4 + f3), d0, d3);
2298        }
2299
2300        if (flag3 || flag2 && !flag4 && !flag5)
2301        {
2302            tessellator.addVertexWithUV((double)par2 + 0.5D, (double)par3 + d4, (double)((float)par4 + f3), d0, d3);
2303            tessellator.addVertexWithUV((double)par2 + 0.75D, (double)par3 + d4, (double)((float)par4 + f3), d2, d3);
2304            tessellator.addVertexWithUV((double)par2 + 0.75D, (double)par3 + d4, (double)((float)par4 + f2), d2, d1);
2305            tessellator.addVertexWithUV((double)par2 + 0.5D, (double)par3 + d4, (double)((float)par4 + f2), d0, d1);
2306            tessellator.addVertexWithUV((double)par2 + 0.5D, (double)par3 + d4, (double)((float)par4 + f2), d0, d1);
2307            tessellator.addVertexWithUV((double)par2 + 0.75D, (double)par3 + d4, (double)((float)par4 + f2), d2, d1);
2308            tessellator.addVertexWithUV((double)par2 + 0.75D, (double)par3 + d4, (double)((float)par4 + f3), d2, d3);
2309            tessellator.addVertexWithUV((double)par2 + 0.5D, (double)par3 + d4, (double)((float)par4 + f3), d0, d3);
2310        }
2311
2312        if (flag3)
2313        {
2314            tessellator.addVertexWithUV((double)par2 + 0.75D, (double)par3 + d4, (double)((float)par4 + f3), d0, d3);
2315            tessellator.addVertexWithUV((double)(par2 + 1), (double)par3 + d4, (double)((float)par4 + f3), d2, d3);
2316            tessellator.addVertexWithUV((double)(par2 + 1), (double)par3 + d4, (double)((float)par4 + f2), d2, d1);
2317            tessellator.addVertexWithUV((double)par2 + 0.75D, (double)par3 + d4, (double)((float)par4 + f2), d0, d1);
2318            tessellator.addVertexWithUV((double)par2 + 0.75D, (double)par3 + d4, (double)((float)par4 + f2), d0, d1);
2319            tessellator.addVertexWithUV((double)(par2 + 1), (double)par3 + d4, (double)((float)par4 + f2), d2, d1);
2320            tessellator.addVertexWithUV((double)(par2 + 1), (double)par3 + d4, (double)((float)par4 + f3), d2, d3);
2321            tessellator.addVertexWithUV((double)par2 + 0.75D, (double)par3 + d4, (double)((float)par4 + f3), d0, d3);
2322        }
2323
2324        return true;
2325    }
2326
2327    /**
2328     * Renders a fire block at the given coordinates
2329     */
2330    public boolean renderBlockFire(BlockFire par1BlockFire, int par2, int par3, int par4)
2331    {
2332        Tessellator tessellator = Tessellator.instance;
2333        Icon icon = par1BlockFire.func_94438_c(0);
2334        Icon icon1 = par1BlockFire.func_94438_c(1);
2335        Icon icon2 = icon;
2336
2337        if (this.hasOverrideBlockTexture())
2338        {
2339            icon2 = this.overrideBlockTexture;
2340        }
2341
2342        tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
2343        tessellator.setBrightness(par1BlockFire.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
2344        double d0 = (double)icon2.getMinU();
2345        double d1 = (double)icon2.getMinV();
2346        double d2 = (double)icon2.getMaxU();
2347        double d3 = (double)icon2.getMaxV();
2348        float f = 1.4F;
2349        double d4;
2350        double d5;
2351        double d6;
2352        double d7;
2353        double d8;
2354        double d9;
2355        double d10;
2356
2357        if (!this.blockAccess.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 - 1, par4, UP))
2358        {
2359            float f1 = 0.2F;
2360            float f2 = 0.0625F;
2361
2362            if ((par2 + par3 + par4 & 1) == 1)
2363            {
2364                d0 = (double)icon1.getMinU();
2365                d1 = (double)icon1.getMinV();
2366                d2 = (double)icon1.getMaxU();
2367                d3 = (double)icon1.getMaxV();
2368            }
2369
2370            if ((par2 / 2 + par3 / 2 + par4 / 2 & 1) == 1)
2371            {
2372                d5 = d2;
2373                d2 = d0;
2374                d0 = d5;
2375            }
2376
2377            if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4, EAST))
2378            {
2379                tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d2, d1);
2380                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 1), d2, d3);
2381                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d0, d3);
2382                tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d1);
2383                tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d1);
2384                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d0, d3);
2385                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 1), d2, d3);
2386                tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d2, d1);
2387            }
2388
2389            if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4, WEST))
2390            {
2391                tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d1);
2392                tessellator.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d0, d3);
2393                tessellator.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 1), d2, d3);
2394                tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d2, d1);
2395                tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d2, d1);
2396                tessellator.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 1), d2, d3);
2397                tessellator.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d0, d3);
2398                tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d1);
2399            }
2400
2401            if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1, SOUTH))
2402            {
2403                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d2, d1);
2404                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d2, d3);
2405                tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d0, d3);
2406                tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d0, d1);
2407                tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d0, d1);
2408                tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d0, d3);
2409                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d2, d3);
2410                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d2, d1);
2411            }
2412
2413            if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1, NORTH))
2414            {
2415                tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d0, d1);
2416                tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + f2), (double)(par4 + 1 - 0), d0, d3);
2417                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 1 - 0), d2, d3);
2418                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d2, d1);
2419                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d2, d1);
2420                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 1 - 0), d2, d3);
2421                tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + f2), (double)(par4 + 1 - 0), d0, d3);
2422                tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d0, d1);
2423            }
2424
2425            if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4, DOWN))
2426            {
2427                d5 = (double)par2 + 0.5D + 0.5D;
2428                d6 = (double)par2 + 0.5D - 0.5D;
2429                d7 = (double)par4 + 0.5D + 0.5D;
2430                d8 = (double)par4 + 0.5D - 0.5D;
2431                d9 = (double)par2 + 0.5D - 0.5D;
2432                d10 = (double)par2 + 0.5D + 0.5D;
2433                d4 = (double)par4 + 0.5D - 0.5D;
2434                double d11 = (double)par4 + 0.5D + 0.5D;
2435                d0 = (double)icon.getMinU();
2436                d1 = (double)icon.getMinV();
2437                d2 = (double)icon.getMaxU();
2438                d3 = (double)icon.getMaxV();
2439                ++par3;
2440                f = -0.2F;
2441
2442                if ((par2 + par3 + par4 & 1) == 0)
2443                {
2444                    tessellator.addVertexWithUV(d9, (double)((float)par3 + f), (double)(par4 + 0), d2, d1);
2445                    tessellator.addVertexWithUV(d5, (double)(par3 + 0), (double)(par4 + 0), d2, d3);
2446                    tessellator.addVertexWithUV(d5, (double)(par3 + 0), (double)(par4 + 1), d0, d3);
2447                    tessellator.addVertexWithUV(d9, (double)((float)par3 + f), (double)(par4 + 1), d0, d1);
2448                    d0 = (double)icon1.getMinU();
2449                    d1 = (double)icon1.getMinV();
2450                    d2 = (double)icon1.getMaxU();
2451                    d3 = (double)icon1.getMaxV();
2452                    tessellator.addVertexWithUV(d10, (double)((float)par3 + f), (double)(par4 + 1), d2, d1);
2453                    tessellator.addVertexWithUV(d6, (double)(par3 + 0), (double)(par4 + 1), d2, d3);
2454                    tessellator.addVertexWithUV(d6, (double)(par3 + 0), (double)(par4 + 0), d0, d3);
2455                    tessellator.addVertexWithUV(d10, (double)((float)par3 + f), (double)(par4 + 0), d0, d1);
2456                }
2457                else
2458                {
2459                    tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f), d11, d2, d1);
2460                    tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), d8, d2, d3);
2461                    tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), d8, d0, d3);
2462                    tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f), d11, d0, d1);
2463                    d0 = (double)icon1.getMinU();
2464                    d1 = (double)icon1.getMinV();
2465                    d2 = (double)icon1.getMaxU();
2466                    d3 = (double)icon1.getMaxV();
2467                    tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f), d4, d2, d1);
2468                    tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), d7, d2, d3);
2469                    tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), d7, d0, d3);
2470                    tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f), d4, d0, d1);
2471                }
2472            }
2473        }
2474        else
2475        {
2476            double d12 = (double)par2 + 0.5D + 0.2D;
2477            d5 = (double)par2 + 0.5D - 0.2D;
2478            d6 = (double)par4 + 0.5D + 0.2D;
2479            d7 = (double)par4 + 0.5D - 0.2D;
2480            d8 = (double)par2 + 0.5D - 0.3D;
2481            d9 = (double)par2 + 0.5D + 0.3D;
2482            d10 = (double)par4 + 0.5D - 0.3D;
2483            d4 = (double)par4 + 0.5D + 0.3D;
2484            tessellator.addVertexWithUV(d8, (double)((float)par3 + f), (double)(par4 + 1), d2, d1);
2485            tessellator.addVertexWithUV(d12, (double)(par3 + 0), (double)(par4 + 1), d2, d3);
2486            tessellator.addVertexWithUV(d12, (double)(par3 + 0), (double)(par4 + 0), d0, d3);
2487            tessellator.addVertexWithUV(d8, (double)((float)par3 + f), (double)(par4 + 0), d0, d1);
2488            tessellator.addVertexWithUV(d9, (double)((float)par3 + f), (double)(par4 + 0), d2, d1);
2489            tessellator.addVertexWithUV(d5, (double)(par3 + 0), (double)(par4 + 0), d2, d3);
2490            tessellator.addVertexWithUV(d5, (double)(par3 + 0), (double)(par4 + 1), d0, d3);
2491            tessellator.addVertexWithUV(d9, (double)((float)par3 + f), (double)(par4 + 1), d0, d1);
2492            d0 = (double)icon1.getMinU();
2493            d1 = (double)icon1.getMinV();
2494            d2 = (double)icon1.getMaxU();
2495            d3 = (double)icon1.getMaxV();
2496            tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f), d4, d2, d1);
2497            tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), d7, d2, d3);
2498            tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), d7, d0, d3);
2499            tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f), d4, d0, d1);
2500            tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f), d10, d2, d1);
2501            tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), d6, d2, d3);
2502            tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), d6, d0, d3);
2503            tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f), d10, d0, d1);
2504            d12 = (double)par2 + 0.5D - 0.5D;
2505            d5 = (double)par2 + 0.5D + 0.5D;
2506            d6 = (double)par4 + 0.5D - 0.5D;
2507            d7 = (double)par4 + 0.5D + 0.5D;
2508            d8 = (double)par2 + 0.5D - 0.4D;
2509            d9 = (double)par2 + 0.5D + 0.4D;
2510            d10 = (double)par4 + 0.5D - 0.4D;
2511            d4 = (double)par4 + 0.5D + 0.4D;
2512            tessellator.addVertexWithUV(d8, (double)((float)par3 + f), (double)(par4 + 0), d0, d1);
2513            tessellator.addVertexWithUV(d12, (double)(par3 + 0), (double)(par4 + 0), d0, d3);
2514            tessellator.addVertexWithUV(d12, (double)(par3 + 0), (double)(par4 + 1), d2, d3);
2515            tessellator.addVertexWithUV(d8, (double)((float)par3 + f), (double)(par4 + 1), d2, d1);
2516            tessellator.addVertexWithUV(d9, (double)((float)par3 + f), (double)(par4 + 1), d0, d1);
2517            tessellator.addVertexWithUV(d5, (double)(par3 + 0), (double)(par4 + 1), d0, d3);
2518            tessellator.addVertexWithUV(d5, (double)(par3 + 0), (double)(par4 + 0), d2, d3);
2519            tessellator.addVertexWithUV(d9, (double)((float)par3 + f), (double)(par4 + 0), d2, d1);
2520            d0 = (double)icon.getMinU();
2521            d1 = (double)icon.getMinV();
2522            d2 = (double)icon.getMaxU();
2523            d3 = (double)icon.getMaxV();
2524            tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f), d4, d0, d1);
2525            tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), d7, d0, d3);
2526            tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), d7, d2, d3);
2527            tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f), d4, d2, d1);
2528            tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f), d10, d0, d1);
2529            tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), d6, d0, d3);
2530            tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), d6, d2, d3);
2531            tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f), d10, d2, d1);
2532        }
2533
2534        return true;
2535    }
2536
2537    /**
2538     * Renders a redstone wire block at the given coordinates
2539     */
2540    public boolean renderBlockRedstoneWire(Block par1Block, int par2, int par3, int par4)
2541    {
2542        Tessellator tessellator = Tessellator.instance;
2543        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
2544        Icon icon = BlockRedstoneWire.func_94409_b("redstoneDust_cross");
2545        Icon icon1 = BlockRedstoneWire.func_94409_b("redstoneDust_line");
2546        Icon icon2 = BlockRedstoneWire.func_94409_b("redstoneDust_cross_overlay");
2547        Icon icon3 = BlockRedstoneWire.func_94409_b("redstoneDust_line_overlay");
2548        tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
2549        float f = 1.0F;
2550        float f1 = (float)l / 15.0F;
2551        float f2 = f1 * 0.6F + 0.4F;
2552
2553        if (l == 0)
2554        {
2555            f2 = 0.3F;
2556        }
2557
2558        float f3 = f1 * f1 * 0.7F - 0.5F;
2559        float f4 = f1 * f1 * 0.6F - 0.7F;
2560
2561        if (f3 < 0.0F)
2562        {
2563            f3 = 0.0F;
2564        }
2565
2566        if (f4 < 0.0F)
2567        {
2568            f4 = 0.0F;
2569        }
2570
2571        tessellator.setColorOpaque_F(f2, f3, f4);
2572        boolean flag = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 - 1, par3, par4, 1) || !this.blockAccess.isBlockNormalCube(par2 - 1, par3, par4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 - 1, par3 - 1, par4, -1);
2573        boolean flag1 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 + 1, par3, par4, 3) || !this.blockAccess.isBlockNormalCube(par2 + 1, par3, par4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 + 1, par3 - 1, par4, -1);
2574        boolean flag2 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3, par4 - 1, 2) || !this.blockAccess.isBlockNormalCube(par2, par3, par4 - 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3 - 1, par4 - 1, -1);
2575        boolean flag3 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3, par4 + 1, 0) || !this.blockAccess.isBlockNormalCube(par2, par3, par4 + 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3 - 1, par4 + 1, -1);
2576
2577        if (!this.blockAccess.isBlockNormalCube(par2, par3 + 1, par4))
2578        {
2579            if (this.blockAccess.isBlockNormalCube(par2 - 1, par3, par4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 - 1, par3 + 1, par4, -1))
2580            {
2581                flag = true;
2582            }
2583
2584            if (this.blockAccess.isBlockNormalCube(par2 + 1, par3, par4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 + 1, par3 + 1, par4, -1))
2585            {
2586                flag1 = true;
2587            }
2588
2589            if (this.blockAccess.isBlockNormalCube(par2, par3, par4 - 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3 + 1, par4 - 1, -1))
2590            {
2591                flag2 = true;
2592            }
2593
2594            if (this.blockAccess.isBlockNormalCube(par2, par3, par4 + 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3 + 1, par4 + 1, -1))
2595            {
2596                flag3 = true;
2597            }
2598        }
2599
2600        float f5 = (float)(par2 + 0);
2601        float f6 = (float)(par2 + 1);
2602        float f7 = (float)(par4 + 0);
2603        float f8 = (float)(par4 + 1);
2604        int i1 = 0;
2605
2606        if ((flag || flag1) && !flag2 && !flag3)
2607        {
2608            i1 = 1;
2609        }
2610
2611        if ((flag2 || flag3) && !flag1 && !flag)
2612        {
2613            i1 = 2;
2614        }
2615
2616        if (i1 == 0)
2617        {
2618            int j1 = 0;
2619            int k1 = 0;
2620            int l1 = 16;
2621            int i2 = 16;
2622
2623            if (!flag)
2624            {
2625                f5 += 0.3125F;
2626            }
2627
2628            if (!flag)
2629            {
2630                j1 += 5;
2631            }
2632
2633            if (!flag1)
2634            {
2635                f6 -= 0.3125F;
2636            }
2637
2638            if (!flag1)
2639            {
2640                l1 -= 5;
2641            }
2642
2643            if (!flag2)
2644            {
2645                f7 += 0.3125F;
2646            }
2647
2648            if (!flag2)
2649            {
2650                k1 += 5;
2651            }
2652
2653            if (!flag3)
2654            {
2655                f8 -= 0.3125F;
2656            }
2657
2658            if (!flag3)
2659            {
2660                i2 -= 5;
2661            }
2662
2663            tessellator.addVertexWithUV((double)f6, (double)par3 + 0.015625D, (double)f8, (double)icon.getInterpolatedU((double)l1), (double)icon.getInterpolatedV((double)i2));
2664            tessellator.addVertexWithUV((double)f6, (double)par3 + 0.015625D, (double)f7, (double)icon.getInterpolatedU((double)l1), (double)icon.getInterpolatedV((double)k1));
2665            tessellator.addVertexWithUV((double)f5, (double)par3 + 0.015625D, (double)f7, (double)icon.getInterpolatedU((double)j1), (double)icon.getInterpolatedV((double)k1));
2666            tessellator.addVertexWithUV((double)f5, (double)par3 + 0.015625D, (double)f8, (double)icon.getInterpolatedU((double)j1), (double)icon.getInterpolatedV((double)i2));
2667            tessellator.setColorOpaque_F(f, f, f);
2668            tessellator.addVertexWithUV((double)f6, (double)par3 + 0.015625D, (double)f8, (double)icon2.getInterpolatedU((double)l1), (double)icon2.getInterpolatedV((double)i2));
2669            tessellator.addVertexWithUV((double)f6, (double)par3 + 0.015625D, (double)f7, (double)icon2.getInterpolatedU((double)l1), (double)icon2.getInterpolatedV((double)k1));
2670            tessellator.addVertexWithUV((double)f5, (double)par3 + 0.015625D, (double)f7, (double)icon2.getInterpolatedU((double)j1), (double)icon2.getInterpolatedV((double)k1));
2671            tessellator.addVertexWithUV((double)f5, (double)par3 + 0.015625D, (double)f8, (double)icon2.getInterpolatedU((double)j1), (double)icon2.getInterpolatedV((double)i2));
2672        }
2673        else if (i1 == 1)
2674        {
2675            tessellator.addVertexWithUV((double)f6, (double)par3 + 0.015625D, (double)f8, (double)icon1.getMaxU(), (double)icon1.getMaxV());
2676            tessellator.addVertexWithUV((double)f6, (double)par3 + 0.015625D, (double)f7, (double)icon1.getMaxU(), (double)icon1.getMinV());
2677            tessellator.addVertexWithUV((double)f5, (double)par3 + 0.015625D, (double)f7, (double)icon1.getMinU(), (double)icon1.getMinV());
2678            tessellator.addVertexWithUV((double)f5, (double)par3 + 0.015625D, (double)f8, (double)icon1.getMinU(), (double)icon1.getMaxV());
2679            tessellator.setColorOpaque_F(f, f, f);
2680            tessellator.addVertexWithUV((double)f6, (double)par3 + 0.015625D, (double)f8, (double)icon3.getMaxU(), (double)icon3.getMaxV());
2681            tessellator.addVertexWithUV((double)f6, (double)par3 + 0.015625D, (double)f7, (double)icon3.getMaxU(), (double)icon3.getMinV());
2682            tessellator.addVertexWithUV((double)f5, (double)par3 + 0.015625D, (double)f7, (double)icon3.getMinU(), (double)icon3.getMinV());
2683            tessellator.addVertexWithUV((double)f5, (double)par3 + 0.015625D, (double)f8, (double)icon3.getMinU(), (double)icon3.getMaxV());
2684        }
2685        else
2686        {
2687            tessellator.addVertexWithUV((double)f6, (double)par3 + 0.015625D, (double)f8, (double)icon1.getMaxU(), (double)icon1.getMaxV());
2688            tessellator.addVertexWithUV((double)f6, (double)par3 + 0.015625D, (double)f7, (double)icon1.getMinU(), (double)icon1.getMaxV());
2689            tessellator.addVertexWithUV((double)f5, (double)par3 + 0.015625D, (double)f7, (double)icon1.getMinU(), (double)icon1.getMinV());
2690            tessellator.addVertexWithUV((double)f5, (double)par3 + 0.015625D, (double)f8, (double)icon1.getMaxU(), (double)icon1.getMinV());
2691            tessellator.setColorOpaque_F(f, f, f);
2692            tessellator.addVertexWithUV((double)f6, (double)par3 + 0.015625D, (double)f8, (double)icon3.getMaxU(), (double)icon3.getMaxV());
2693            tessellator.addVertexWithUV((double)f6, (double)par3 + 0.015625D, (double)f7, (double)icon3.getMinU(), (double)icon3.getMaxV());
2694            tessellator.addVertexWithUV((double)f5, (double)par3 + 0.015625D, (double)f7, (double)icon3.getMinU(), (double)icon3.getMinV());
2695            tessellator.addVertexWithUV((double)f5, (double)par3 + 0.015625D, (double)f8, (double)icon3.getMaxU(), (double)icon3.getMinV());
2696        }
2697
2698        if (!this.blockAccess.isBlockNormalCube(par2, par3 + 1, par4))
2699        {
2700            if (this.blockAccess.isBlockNormalCube(par2 - 1, par3, par4) && this.blockAccess.getBlockId(par2 - 1, par3 + 1, par4) == Block.redstoneWire.blockID)
2701            {
2702                tessellator.setColorOpaque_F(f * f2, f * f3, f * f4);
2703                tessellator.addVertexWithUV((double)par2 + 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1), (double)icon1.getMaxU(), (double)icon1.getMinV());
2704                tessellator.addVertexWithUV((double)par2 + 0.015625D, (double)(par3 + 0), (double)(par4 + 1), (double)icon1.getMinU(), (double)icon1.getMinV());
2705                tessellator.addVertexWithUV((double)par2 + 0.015625D, (double)(par3 + 0), (double)(par4 + 0), (double)icon1.getMinU(), (double)icon1.getMaxV());
2706                tessellator.addVertexWithUV((double)par2 + 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 0), (double)icon1.getMaxU(), (double)icon1.getMaxV());
2707                tessellator.setColorOpaque_F(f, f, f);
2708                tessellator.addVertexWithUV((double)par2 + 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1), (double)icon3.getMaxU(), (double)icon3.getMinV());
2709                tessellator.addVertexWithUV((double)par2 + 0.015625D, (double)(par3 + 0), (double)(par4 + 1), (double)icon3.getMinU(), (double)icon3.getMinV());
2710                tessellator.addVertexWithUV((double)par2 + 0.015625D, (double)(par3 + 0), (double)(par4 + 0), (double)icon3.getMinU(), (double)icon3.getMaxV());
2711                tessellator.addVertexWithUV((double)par2 + 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 0), (double)icon3.getMaxU(), (double)icon3.getMaxV());
2712            }
2713
2714            if (this.blockAccess.isBlockNormalCube(par2 + 1, par3, par4) && this.blockAccess.getBlockId(par2 + 1, par3 + 1, par4) == Block.redstoneWire.blockID)
2715            {
2716                tessellator.setColorOpaque_F(f * f2, f * f3, f * f4);
2717                tessellator.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)(par3 + 0), (double)(par4 + 1), (double)icon1.getMinU(), (double)icon1.getMaxV());
2718                tessellator.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1), (double)icon1.getMaxU(), (double)icon1.getMaxV());
2719                tessellator.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 0), (double)icon1.getMaxU(), (double)icon1.getMinV());
2720                tessellator.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)(par3 + 0), (double)(par4 + 0), (double)icon1.getMinU(), (double)icon1.getMinV());
2721                tessellator.setColorOpaque_F(f, f, f);
2722                tessellator.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)(par3 + 0), (double)(par4 + 1), (double)icon3.getMinU(), (double)icon3.getMaxV());
2723                tessellator.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1), (double)icon3.getMaxU(), (double)icon3.getMaxV());
2724                tessellator.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 0), (double)icon3.getMaxU(), (double)icon3.getMinV());
2725                tessellator.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)(par3 + 0), (double)(par4 + 0), (double)icon3.getMinU(), (double)icon3.getMinV());
2726            }
2727
2728            if (this.blockAccess.isBlockNormalCube(par2, par3, par4 - 1) && this.blockAccess.getBlockId(par2, par3 + 1, par4 - 1) == Block.redstoneWire.blockID)
2729            {
2730                tessellator.setColorOpaque_F(f * f2, f * f3, f * f4);
2731                tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)par4 + 0.015625D, (double)icon1.getMinU(), (double)icon1.getMaxV());
2732                tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 1) + 0.021875F), (double)par4 + 0.015625D, (double)icon1.getMaxU(), (double)icon1.getMaxV());
2733                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 1) + 0.021875F), (double)par4 + 0.015625D, (double)icon1.getMaxU(), (double)icon1.getMinV());
2734                tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)par4 + 0.015625D, (double)icon1.getMinU(), (double)icon1.getMinV());
2735                tessellator.setColorOpaque_F(f, f, f);
2736                tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)par4 + 0.015625D, (double)icon3.getMinU(), (double)icon3.getMaxV());
2737                tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 1) + 0.021875F), (double)par4 + 0.015625D, (double)icon3.getMaxU(), (double)icon3.getMaxV());
2738                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 1) + 0.021875F), (double)par4 + 0.015625D, (double)icon3.getMaxU(), (double)icon3.getMinV());
2739                tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)par4 + 0.015625D, (double)icon3.getMinU(), (double)icon3.getMinV());
2740            }
2741
2742            if (this.blockAccess.isBlockNormalCube(par2, par3, par4 + 1) && this.blockAccess.getBlockId(par2, par3 + 1, par4 + 1) == Block.redstoneWire.blockID)
2743            {
2744                tessellator.setColorOpaque_F(f * f2, f * f3, f * f4);
2745                tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1) - 0.015625D, (double)icon1.getMaxU(), (double)icon1.getMinV());
2746                tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)(par4 + 1) - 0.015625D, (double)icon1.getMinU(), (double)icon1.getMinV());
2747                tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)(par4 + 1) - 0.015625D, (double)icon1.getMinU(), (double)icon1.getMaxV());
2748                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1) - 0.015625D, (double)icon1.getMaxU(), (double)icon1.getMaxV());
2749                tessellator.setColorOpaque_F(f, f, f);
2750                tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1) - 0.015625D, (double)icon3.getMaxU(), (double)icon3.getMinV());
2751                tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)(par4 + 1) - 0.015625D, (double)icon3.getMinU(), (double)icon3.getMinV());
2752                tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)(par4 + 1) - 0.015625D, (double)icon3.getMinU(), (double)icon3.getMaxV());
2753                tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1) - 0.015625D, (double)icon3.getMaxU(), (double)icon3.getMaxV());
2754            }
2755        }
2756
2757        return true;
2758    }
2759
2760    /**
2761     * Renders a minecart track block at the given coordinates
2762     */
2763    public boolean renderBlockMinecartTrack(BlockRailBase par1BlockRailBase, int par2, int par3, int par4)
2764    {
2765        Tessellator tessellator = Tessellator.instance;
2766        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
2767        Icon icon = this.getBlockIconFromSideAndMetadata(par1BlockRailBase, 0, l);
2768
2769        if (this.hasOverrideBlockTexture())
2770        {
2771            icon = this.overrideBlockTexture;
2772        }
2773
2774        if (par1BlockRailBase.isPowered())
2775        {
2776            l &= 7;
2777        }
2778
2779        tessellator.setBrightness(par1BlockRailBase.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
2780        tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
2781        double d0 = (double)icon.getMinU();
2782        double d1 = (double)icon.getMinV();
2783        double d2 = (double)icon.getMaxU();
2784        double d3 = (double)icon.getMaxV();
2785        double d4 = 0.0625D;
2786        double d5 = (double)(par2 + 1);
2787        double d6 = (double)(par2 + 1);
2788        double d7 = (double)(par2 + 0);
2789        double d8 = (double)(par2 + 0);
2790        double d9 = (double)(par4 + 0);
2791        double d10 = (double)(par4 + 1);
2792        double d11 = (double)(par4 + 1);
2793        double d12 = (double)(par4 + 0);
2794        double d13 = (double)par3 + d4;
2795        double d14 = (double)par3 + d4;
2796        double d15 = (double)par3 + d4;
2797        double d16 = (double)par3 + d4;
2798
2799        if (l != 1 && l != 2 && l != 3 && l != 7)
2800        {
2801            if (l == 8)
2802            {
2803                d5 = d6 = (double)(par2 + 0);
2804                d7 = d8 = (double)(par2 + 1);
2805                d9 = d12 = (double)(par4 + 1);
2806                d10 = d11 = (double)(par4 + 0);
2807            }
2808            else if (l == 9)
2809            {
2810                d5 = d8 = (double)(par2 + 0);
2811                d6 = d7 = (double)(par2 + 1);
2812                d9 = d10 = (double)(par4 + 0);
2813                d11 = d12 = (double)(par4 + 1);
2814            }
2815        }
2816        else
2817        {
2818            d5 = d8 = (double)(par2 + 1);
2819            d6 = d7 = (double)(par2 + 0);
2820            d9 = d10 = (double)(par4 + 1);
2821            d11 = d12 = (double)(par4 + 0);
2822        }
2823
2824        if (l != 2 && l != 4)
2825        {
2826            if (l == 3 || l == 5)
2827            {
2828                ++d14;
2829                ++d15;
2830            }
2831        }
2832        else
2833        {
2834            ++d13;
2835            ++d16;
2836        }
2837
2838        tessellator.addVertexWithUV(d5, d13, d9, d2, d1);
2839        tessellator.addVertexWithUV(d6, d14, d10, d2, d3);
2840        tessellator.addVertexWithUV(d7, d15, d11, d0, d3);
2841        tessellator.addVertexWithUV(d8, d16, d12, d0, d1);
2842        tessellator.addVertexWithUV(d8, d16, d12, d0, d1);
2843        tessellator.addVertexWithUV(d7, d15, d11, d0, d3);
2844        tessellator.addVertexWithUV(d6, d14, d10, d2, d3);
2845        tessellator.addVertexWithUV(d5, d13, d9, d2, d1);
2846        return true;
2847    }
2848
2849    /**
2850     * Renders a ladder block at the given coordinates
2851     */
2852    public boolean renderBlockLadder(Block par1Block, int par2, int par3, int par4)
2853    {
2854        Tessellator tessellator = Tessellator.instance;
2855        Icon icon = this.getBlockIconFromSide(par1Block, 0);
2856
2857        if (this.hasOverrideBlockTexture())
2858        {
2859            icon = this.overrideBlockTexture;
2860        }
2861
2862        tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
2863        float f = 1.0F;
2864        tessellator.setColorOpaque_F(f, f, f);
2865        double d0 = (double)icon.getMinU();
2866        double d1 = (double)icon.getMinV();
2867        double d2 = (double)icon.getMaxU();
2868        double d3 = (double)icon.getMaxV();
2869        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
2870        double d4 = 0.0D;
2871        double d5 = 0.05000000074505806D;
2872
2873        if (l == 5)
2874        {
2875            tessellator.addVertexWithUV((double)par2 + d5, (double)(par3 + 1) + d4, (double)(par4 + 1) + d4, d0, d1);
2876            tessellator.addVertexWithUV((double)par2 + d5, (double)(par3 + 0) - d4, (double)(par4 + 1) + d4, d0, d3);
2877            tessellator.addVertexWithUV((double)par2 + d5, (double)(par3 + 0) - d4, (double)(par4 + 0) - d4, d2, d3);
2878            tessellator.addVertexWithUV((double)par2 + d5, (double)(par3 + 1) + d4, (double)(par4 + 0) - d4, d2, d1);
2879        }
2880
2881        if (l == 4)
2882        {
2883            tessellator.addVertexWithUV((double)(par2 + 1) - d5, (double)(par3 + 0) - d4, (double)(par4 + 1) + d4, d2, d3);
2884            tessellator.addVertexWithUV((double)(par2 + 1) - d5, (double)(par3 + 1) + d4, (double)(par4 + 1) + d4, d2, d1);
2885            tessellator.addVertexWithUV((double)(par2 + 1) - d5, (double)(par3 + 1) + d4, (double)(par4 + 0) - d4, d0, d1);
2886            tessellator.addVertexWithUV((double)(par2 + 1) - d5, (double)(par3 + 0) - d4, (double)(par4 + 0) - d4, d0, d3);
2887        }
2888
2889        if (l == 3)
2890        {
2891            tessellator.addVertexWithUV((double)(par2 + 1) + d4, (double)(par3 + 0) - d4, (double)par4 + d5, d2, d3);
2892            tessellator.addVertexWithUV((double)(par2 + 1) + d4, (double)(par3 + 1) + d4, (double)par4 + d5, d2, d1);
2893            tessellator.addVertexWithUV((double)(par2 + 0) - d4, (double)(par3 + 1) + d4, (double)par4 + d5, d0, d1);
2894            tessellator.addVertexWithUV((double)(par2 + 0) - d4, (double)(par3 + 0) - d4, (double)par4 + d5, d0, d3);
2895        }
2896
2897        if (l == 2)
2898        {
2899            tessellator.addVertexWithUV((double)(par2 + 1) + d4, (double)(par3 + 1) + d4, (double)(par4 + 1) - d5, d0, d1);
2900            tessellator.addVertexWithUV((double)(par2 + 1) + d4, (double)(par3 + 0) - d4, (double)(par4 + 1) - d5, d0, d3);
2901            tessellator.addVertexWithUV((double)(par2 + 0) - d4, (double)(par3 + 0) - d4, (double)(par4 + 1) - d5, d2, d3);
2902            tessellator.addVertexWithUV((double)(par2 + 0) - d4, (double)(par3 + 1) + d4, (double)(par4 + 1) - d5, d2, d1);
2903        }
2904
2905        return true;
2906    }
2907
2908    /**
2909     * Render block vine
2910     */
2911    public boolean renderBlockVine(Block par1Block, int par2, int par3, int par4)
2912    {
2913        Tessellator tessellator = Tessellator.instance;
2914        Icon icon = this.getBlockIconFromSide(par1Block, 0);
2915
2916        if (this.hasOverrideBlockTexture())
2917        {
2918            icon = this.overrideBlockTexture;
2919        }
2920
2921        float f = 1.0F;
2922        tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
2923        int l = par1Block.colorMultiplier(this.blockAccess, par2, par3, par4);
2924        float f1 = (float)(l >> 16 & 255) / 255.0F;
2925        float f2 = (float)(l >> 8 & 255) / 255.0F;
2926        float f3 = (float)(l & 255) / 255.0F;
2927        tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
2928        double d0 = (double)icon.getMinU();
2929        double d1 = (double)icon.getMinV();
2930        double d2 = (double)icon.getMaxU();
2931        double d3 = (double)icon.getMaxV();
2932        double d4 = 0.05000000074505806D;
2933        int i1 = this.blockAccess.getBlockMetadata(par2, par3, par4);
2934
2935        if ((i1 & 2) != 0)
2936        {
2937            tessellator.addVertexWithUV((double)par2 + d4, (double)(par3 + 1), (double)(par4 + 1), d0, d1);
2938            tessellator.addVertexWithUV((double)par2 + d4, (double)(par3 + 0), (double)(par4 + 1), d0, d3);
2939            tessellator.addVertexWithUV((double)par2 + d4, (double)(par3 + 0), (double)(par4 + 0), d2, d3);
2940            tessellator.addVertexWithUV((double)par2 + d4, (double)(par3 + 1), (double)(par4 + 0), d2, d1);
2941            tessellator.addVertexWithUV((double)par2 + d4, (double)(par3 + 1), (double)(par4 + 0), d2, d1);
2942            tessellator.addVertexWithUV((double)par2 + d4, (double)(par3 + 0), (double)(par4 + 0), d2, d3);
2943            tessellator.addVertexWithUV((double)par2 + d4, (double)(par3 + 0), (double)(par4 + 1), d0, d3);
2944            tessellator.addVertexWithUV((double)par2 + d4, (double)(par3 + 1), (double)(par4 + 1), d0, d1);
2945        }
2946
2947        if ((i1 & 8) != 0)
2948        {
2949            tessellator.addVertexWithUV((double)(par2 + 1) - d4, (double)(par3 + 0), (double)(par4 + 1), d2, d3);
2950            tessellator.addVertexWithUV((double)(par2 + 1) - d4, (double)(par3 + 1), (double)(par4 + 1), d2, d1);
2951            tessellator.addVertexWithUV((double)(par2 + 1) - d4, (double)(par3 + 1), (double)(par4 + 0), d0, d1);
2952            tessellator.addVertexWithUV((double)(par2 + 1) - d4, (double)(par3 + 0), (double)(par4 + 0), d0, d3);
2953            tessellator.addVertexWithUV((double)(par2 + 1) - d4, (double)(par3 + 0), (double)(par4 + 0), d0, d3);
2954            tessellator.addVertexWithUV((double)(par2 + 1) - d4, (double)(par3 + 1), (double)(par4 + 0), d0, d1);
2955            tessellator.addVertexWithUV((double)(par2 + 1) - d4, (double)(par3 + 1), (double)(par4 + 1), d2, d1);
2956            tessellator.addVertexWithUV((double)(par2 + 1) - d4, (double)(par3 + 0), (double)(par4 + 1), d2, d3);
2957        }
2958
2959        if ((i1 & 4) != 0)
2960        {
2961            tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)par4 + d4, d2, d3);
2962            tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 1), (double)par4 + d4, d2, d1);
2963            tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 1), (double)par4 + d4, d0, d1);
2964            tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)par4 + d4, d0, d3);
2965            tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)par4 + d4, d0, d3);
2966            tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 1), (double)par4 + d4, d0, d1);
2967            tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 1), (double)par4 + d4, d2, d1);
2968            tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)par4 + d4, d2, d3);
2969        }
2970
2971        if ((i1 & 1) != 0)
2972        {
2973            tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 1), (double)(par4 + 1) - d4, d0, d1);
2974            tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)(par4 + 1) - d4, d0, d3);
2975            tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)(par4 + 1) - d4, d2, d3);
2976            tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 1), (double)(par4 + 1) - d4, d2, d1);
2977            tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 1), (double)(par4 + 1) - d4, d2, d1);
2978            tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)(par4 + 1) - d4, d2, d3);
2979            tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)(par4 + 1) - d4, d0, d3);
2980            tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 1), (double)(par4 + 1) - d4, d0, d1);
2981        }
2982
2983        if (this.blockAccess.isBlockNormalCube(par2, par3 + 1, par4))
2984        {
2985            tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 1) - d4, (double)(par4 + 0), d0, d1);
2986            tessellator.addVertexWithUV((double)(par2 + 1), (double)(par3 + 1) - d4, (double)(par4 + 1), d0, d3);
2987            tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 1) - d4, (double)(par4 + 1), d2, d3);
2988            tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 1) - d4, (double)(par4 + 0), d2, d1);
2989        }
2990
2991        return true;
2992    }
2993
2994    public boolean renderBlockPane(BlockPane par1BlockPane, int par2, int par3, int par4)
2995    {
2996        int l = this.blockAccess.getHeight();
2997        Tessellator tessellator = Tessellator.instance;
2998        tessellator.setBrightness(par1BlockPane.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
2999        float f = 1.0F;
3000        int i1 = par1BlockPane.colorMultiplier(this.blockAccess, par2, par3, par4);
3001        float f1 = (float)(i1 >> 16 & 255) / 255.0F;
3002        float f2 = (float)(i1 >> 8 & 255) / 255.0F;
3003        float f3 = (float)(i1 & 255) / 255.0F;
3004
3005        if (EntityRenderer.anaglyphEnable)
3006        {
3007            float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
3008            float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
3009            float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
3010            f1 = f4;
3011            f2 = f5;
3012            f3 = f6;
3013        }
3014
3015        tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
3016        Icon icon;
3017        Icon icon1;
3018        int j1;
3019
3020        if (this.hasOverrideBlockTexture())
3021        {
3022            icon = this.overrideBlockTexture;
3023            icon1 = this.overrideBlockTexture;
3024        }
3025        else
3026        {
3027            j1 = this.blockAccess.getBlockMetadata(par2, par3, par4);
3028            icon = this.getBlockIconFromSideAndMetadata(par1BlockPane, 0, j1);
3029            icon1 = par1BlockPane.getSideTextureIndex();
3030        }
3031
3032        j1 = icon.getOriginX();
3033        int k1 = icon.getOriginY();
3034        double d0 = (double)icon.getMinU();
3035        double d1 = (double)icon.getInterpolatedU(8.0D);
3036        double d2 = (double)icon.getMaxU();
3037        double d3 = (double)icon.getMinV();
3038        double d4 = (double)icon.getMaxV();
3039        int l1 = icon1.getOriginX();
3040        int i2 = icon1.getOriginY();
3041        double d5 = (double)icon1.getInterpolatedU(7.0D);
3042        double d6 = (double)icon1.getInterpolatedU(9.0D);
3043        double d7 = (double)icon1.getMinV();
3044        double d8 = (double)icon1.getInterpolatedV(8.0D);
3045        double d9 = (double)icon1.getMaxV();
3046        double d10 = (double)par2;
3047        double d11 = (double)par2 + 0.5D;
3048        double d12 = (double)(par2 + 1);
3049        double d13 = (double)par4;
3050        double d14 = (double)par4 + 0.5D;
3051        double d15 = (double)(par4 + 1);
3052        double d16 = (double)par2 + 0.5D - 0.0625D;
3053        double d17 = (double)par2 + 0.5D + 0.0625D;
3054        double d18 = (double)par4 + 0.5D - 0.0625D;
3055        double d19 = (double)par4 + 0.5D + 0.0625D;
3056        boolean flag = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2, par3, par4 - 1));
3057        boolean flag1 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2, par3, par4 + 1));
3058        boolean flag2 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2 - 1, par3, par4));
3059        boolean flag3 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2 + 1, par3, par4));
3060        boolean flag4 = par1BlockPane.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1);
3061        boolean flag5 = par1BlockPane.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0);
3062
3063        if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1))
3064        {
3065            if (flag2 && !flag3)
3066            {
3067                tessellator.addVertexWithUV(d10, (double)(par3 + 1), d14, d0, d3);
3068                tessellator.addVertexWithUV(d10, (double)(par3 + 0), d14, d0, d4);
3069                tessellator.addVertexWithUV(d11, (double)(par3 + 0), d14, d1, d4);
3070                tessellator.addVertexWithUV(d11, (double)(par3 + 1), d14, d1, d3);
3071                tessellator.addVertexWithUV(d11, (double)(par3 + 1), d14, d0, d3);
3072                tessellator.addVertexWithUV(d11, (double)(par3 + 0), d14, d0, d4);
3073                tessellator.addVertexWithUV(d10, (double)(par3 + 0), d14, d1, d4);
3074                tessellator.addVertexWithUV(d10, (double)(par3 + 1), d14, d1, d3);
3075
3076                if (!flag1 && !flag)
3077                {
3078                    tessellator.addVertexWithUV(d11, (double)(par3 + 1), d19, d5, d7);
3079                    tessellator.addVertexWithUV(d11, (double)(par3 + 0), d19, d5, d9);
3080                    tessellator.addVertexWithUV(d11, (double)(par3 + 0), d18, d6, d9);
3081                    tessellator.addVertexWithUV(d11, (double)(par3 + 1), d18, d6, d7);
3082                    tessellator.addVertexWithUV(d11, (double)(par3 + 1), d18, d5, d7);
3083                    tessellator.addVertexWithUV(d11, (double)(par3 + 0), d18, d5, d9);
3084                    tessellator.addVertexWithUV(d11, (double)(par3 + 0), d19, d6, d9);
3085                    tessellator.addVertexWithUV(d11, (double)(par3 + 1), d19, d6, d7);
3086                }
3087
3088                if (flag4 || par3 < l - 1 && this.blockAccess.isAirBlock(par2 - 1, par3 + 1, par4))
3089                {
3090                    tessellator.addVertexWithUV(d10, (double)(par3 + 1) + 0.01D, d19, d6, d8);
3091                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d19, d6, d9);
3092                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d18, d5, d9);
3093                    tessellator.addVertexWithUV(d10, (double)(par3 + 1) + 0.01D, d18, d5, d8);
3094                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d19, d6, d8);
3095                    tessellator.addVertexWithUV(d10, (double)(par3 + 1) + 0.01D, d19, d6, d9);
3096                    tessellator.addVertexWithUV(d10, (double)(par3 + 1) + 0.01D, d18, d5, d9);
3097                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d18, d5, d8);
3098                }
3099
3100                if (flag5 || par3 > 1 && this.blockAccess.isAirBlock(par2 - 1, par3 - 1, par4))
3101                {
3102                    tessellator.addVertexWithUV(d10, (double)par3 - 0.01D, d19, d6, d8);
3103                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d19, d6, d9);
3104                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d18, d5, d9);
3105                    tessellator.addVertexWithUV(d10, (double)par3 - 0.01D, d18, d5, d8);
3106                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d19, d6, d8);
3107                    tessellator.addVertexWithUV(d10, (double)par3 - 0.01D, d19, d6, d9);
3108                    tessellator.addVertexWithUV(d10, (double)par3 - 0.01D, d18, d5, d9);
3109                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d18, d5, d8);
3110                }
3111            }
3112            else if (!flag2 && flag3)
3113            {
3114                tessellator.addVertexWithUV(d11, (double)(par3 + 1), d14, d1, d3);
3115                tessellator.addVertexWithUV(d11, (double)(par3 + 0), d14, d1, d4);
3116                tessellator.addVertexWithUV(d12, (double)(par3 + 0), d14, d2, d4);
3117                tessellator.addVertexWithUV(d12, (double)(par3 + 1), d14, d2, d3);
3118                tessellator.addVertexWithUV(d12, (double)(par3 + 1), d14, d1, d3);
3119                tessellator.addVertexWithUV(d12, (double)(par3 + 0), d14, d1, d4);
3120                tessellator.addVertexWithUV(d11, (double)(par3 + 0), d14, d2, d4);
3121                tessellator.addVertexWithUV(d11, (double)(par3 + 1), d14, d2, d3);
3122
3123                if (!flag1 && !flag)
3124                {
3125                    tessellator.addVertexWithUV(d11, (double)(par3 + 1), d18, d5, d7);
3126                    tessellator.addVertexWithUV(d11, (double)(par3 + 0), d18, d5, d9);
3127                    tessellator.addVertexWithUV(d11, (double)(par3 + 0), d19, d6, d9);
3128                    tessellator.addVertexWithUV(d11, (double)(par3 + 1), d19, d6, d7);
3129                    tessellator.addVertexWithUV(d11, (double)(par3 + 1), d19, d5, d7);
3130                    tessellator.addVertexWithUV(d11, (double)(par3 + 0), d19, d5, d9);
3131                    tessellator.addVertexWithUV(d11, (double)(par3 + 0), d18, d6, d9);
3132                    tessellator.addVertexWithUV(d11, (double)(par3 + 1), d18, d6, d7);
3133                }
3134
3135                if (flag4 || par3 < l - 1 && this.blockAccess.isAirBlock(par2 + 1, par3 + 1, par4))
3136                {
3137                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d19, d6, d7);
3138                    tessellator.addVertexWithUV(d12, (double)(par3 + 1) + 0.01D, d19, d6, d8);
3139                    tessellator.addVertexWithUV(d12, (double)(par3 + 1) + 0.01D, d18, d5, d8);
3140                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d18, d5, d7);
3141                    tessellator.addVertexWithUV(d12, (double)(par3 + 1) + 0.01D, d19, d6, d7);
3142                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d19, d6, d8);
3143                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d18, d5, d8);
3144                    tessellator.addVertexWithUV(d12, (double)(par3 + 1) + 0.01D, d18, d5, d7);
3145                }
3146
3147                if (flag5 || par3 > 1 && this.blockAccess.isAirBlock(par2 + 1, par3 - 1, par4))
3148                {
3149                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d19, d6, d7);
3150                    tessellator.addVertexWithUV(d12, (double)par3 - 0.01D, d19, d6, d8);
3151                    tessellator.addVertexWithUV(d12, (double)par3 - 0.01D, d18, d5, d8);
3152                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d18, d5, d7);
3153                    tessellator.addVertexWithUV(d12, (double)par3 - 0.01D, d19, d6, d7);
3154                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d19, d6, d8);
3155                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d18, d5, d8);
3156                    tessellator.addVertexWithUV(d12, (double)par3 - 0.01D, d18, d5, d7);
3157                }
3158            }
3159        }
3160        else
3161        {
3162            tessellator.addVertexWithUV(d10, (double)(par3 + 1), d14, d0, d3);
3163            tessellator.addVertexWithUV(d10, (double)(par3 + 0), d14, d0, d4);
3164            tessellator.addVertexWithUV(d12, (double)(par3 + 0), d14, d2, d4);
3165            tessellator.addVertexWithUV(d12, (double)(par3 + 1), d14, d2, d3);
3166            tessellator.addVertexWithUV(d12, (double)(par3 + 1), d14, d0, d3);
3167            tessellator.addVertexWithUV(d12, (double)(par3 + 0), d14, d0, d4);
3168            tessellator.addVertexWithUV(d10, (double)(par3 + 0), d14, d2, d4);
3169            tessellator.addVertexWithUV(d10, (double)(par3 + 1), d14, d2, d3);
3170
3171            if (flag4)
3172            {
3173                tessellator.addVertexWithUV(d10, (double)(par3 + 1) + 0.01D, d19, d6, d9);
3174                tessellator.addVertexWithUV(d12, (double)(par3 + 1) + 0.01D, d19, d6, d7);
3175                tessellator.addVertexWithUV(d12, (double)(par3 + 1) + 0.01D, d18, d5, d7);
3176                tessellator.addVertexWithUV(d10, (double)(par3 + 1) + 0.01D, d18, d5, d9);
3177                tessellator.addVertexWithUV(d12, (double)(par3 + 1) + 0.01D, d19, d6, d9);
3178                tessellator.addVertexWithUV(d10, (double)(par3 + 1) + 0.01D, d19, d6, d7);
3179                tessellator.addVertexWithUV(d10, (double)(par3 + 1) + 0.01D, d18, d5, d7);
3180                tessellator.addVertexWithUV(d12, (double)(par3 + 1) + 0.01D, d18, d5, d9);
3181            }
3182            else
3183            {
3184                if (par3 < l - 1 && this.blockAccess.isAirBlock(par2 - 1, par3 + 1, par4))
3185                {
3186                    tessellator.addVertexWithUV(d10, (double)(par3 + 1) + 0.01D, d19, d6, d8);
3187                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d19, d6, d9);
3188                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d18, d5, d9);
3189                    tessellator.addVertexWithUV(d10, (double)(par3 + 1) + 0.01D, d18, d5, d8);
3190                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d19, d6, d8);
3191                    tessellator.addVertexWithUV(d10, (double)(par3 + 1) + 0.01D, d19, d6, d9);
3192                    tessellator.addVertexWithUV(d10, (double)(par3 + 1) + 0.01D, d18, d5, d9);
3193                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d18, d5, d8);
3194                }
3195
3196                if (par3 < l - 1 && this.blockAccess.isAirBlock(par2 + 1, par3 + 1, par4))
3197                {
3198                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d19, d6, d7);
3199                    tessellator.addVertexWithUV(d12, (double)(par3 + 1) + 0.01D, d19, d6, d8);
3200                    tessellator.addVertexWithUV(d12, (double)(par3 + 1) + 0.01D, d18, d5, d8);
3201                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d18, d5, d7);
3202                    tessellator.addVertexWithUV(d12, (double)(par3 + 1) + 0.01D, d19, d6, d7);
3203                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d19, d6, d8);
3204                    tessellator.addVertexWithUV(d11, (double)(par3 + 1) + 0.01D, d18, d5, d8);
3205                    tessellator.addVertexWithUV(d12, (double)(par3 + 1) + 0.01D, d18, d5, d7);
3206                }
3207            }
3208
3209            if (flag5)
3210            {
3211                tessellator.addVertexWithUV(d10, (double)par3 - 0.01D, d19, d6, d9);
3212                tessellator.addVertexWithUV(d12, (double)par3 - 0.01D, d19, d6, d7);
3213                tessellator.addVertexWithUV(d12, (double)par3 - 0.01D, d18, d5, d7);
3214                tessellator.addVertexWithUV(d10, (double)par3 - 0.01D, d18, d5, d9);
3215                tessellator.addVertexWithUV(d12, (double)par3 - 0.01D, d19, d6, d9);
3216                tessellator.addVertexWithUV(d10, (double)par3 - 0.01D, d19, d6, d7);
3217                tessellator.addVertexWithUV(d10, (double)par3 - 0.01D, d18, d5, d7);
3218                tessellator.addVertexWithUV(d12, (double)par3 - 0.01D, d18, d5, d9);
3219            }
3220            else
3221            {
3222                if (par3 > 1 && this.blockAccess.isAirBlock(par2 - 1, par3 - 1, par4))
3223                {
3224                    tessellator.addVertexWithUV(d10, (double)par3 - 0.01D, d19, d6, d8);
3225                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d19, d6, d9);
3226                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d18, d5, d9);
3227                    tessellator.addVertexWithUV(d10, (double)par3 - 0.01D, d18, d5, d8);
3228                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d19, d6, d8);
3229                    tessellator.addVertexWithUV(d10, (double)par3 - 0.01D, d19, d6, d9);
3230                    tessellator.addVertexWithUV(d10, (double)par3 - 0.01D, d18, d5, d9);
3231                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d18, d5, d8);
3232                }
3233
3234                if (par3 > 1 && this.blockAccess.isAirBlock(par2 + 1, par3 - 1, par4))
3235                {
3236                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d19, d6, d7);
3237                    tessellator.addVertexWithUV(d12, (double)par3 - 0.01D, d19, d6, d8);
3238                    tessellator.addVertexWithUV(d12, (double)par3 - 0.01D, d18, d5, d8);
3239                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d18, d5, d7);
3240                    tessellator.addVertexWithUV(d12, (double)par3 - 0.01D, d19, d6, d7);
3241                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d19, d6, d8);
3242                    tessellator.addVertexWithUV(d11, (double)par3 - 0.01D, d18, d5, d8);
3243                    tessellator.addVertexWithUV(d12, (double)par3 - 0.01D, d18, d5, d7);
3244                }
3245            }
3246        }
3247
3248        if ((!flag || !flag1) && (flag2 || flag3 || flag || flag1))
3249        {
3250            if (flag && !flag1)
3251            {
3252                tessellator.addVertexWithUV(d11, (double)(par3 + 1), d13, d0, d3);
3253                tessellator.addVertexWithUV(d11, (double)(par3 + 0), d13, d0, d4);
3254                tessellator.addVertexWithUV(d11, (double)(par3 + 0), d14, d1, d4);
3255                tessellator.addVertexWithUV(d11, (double)(par3 + 1), d14, d1, d3);
3256                tessellator.addVertexWithUV(d11, (double)(par3 + 1), d14, d0, d3);
3257                tessellator.addVertexWithUV(d11, (double)(par3 + 0), d14, d0, d4);
3258                tessellator.addVertexWithUV(d11, (double)(par3 + 0), d13, d1, d4);
3259                tessellator.addVertexWithUV(d11, (double)(par3 + 1), d13, d1, d3);
3260
3261                if (!flag3 && !flag2)
3262                {
3263                    tessellator.addVertexWithUV(d16, (double)(par3 + 1), d14, d5, d7);
3264                    tessellator.addVertexWithUV(d16, (double)(par3 + 0), d14, d5, d9);
3265                    tessellator.addVertexWithUV(d17, (double)(par3 + 0), d14, d6, d9);
3266                    tessellator.addVertexWithUV(d17, (double)(par3 + 1), d14, d6, d7);
3267                    tessellator.addVertexWithUV(d17, (double)(par3 + 1), d14, d5, d7);
3268                    tessellator.addVertexWithUV(d17, (double)(par3 + 0), d14, d5, d9);
3269                    tessellator.addVertexWithUV(d16, (double)(par3 + 0), d14, d6, d9);
3270                    tessellator.addVertexWithUV(d16, (double)(par3 + 1), d14, d6, d7);
3271                }
3272
3273                if (flag4 || par3 < l - 1 && this.blockAccess.isAirBlock(par2, par3 + 1, par4 - 1))
3274                {
3275                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d13, d6, d7);
3276                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d14, d6, d8);
3277                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d14, d5, d8);
3278                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d13, d5, d7);
3279                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d14, d6, d7);
3280                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d13, d6, d8);
3281                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d13, d5, d8);
3282                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d14, d5, d7);
3283                }
3284
3285                if (flag5 || par3 > 1 && this.blockAccess.isAirBlock(par2, par3 - 1, par4 - 1))
3286                {
3287                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d13, d6, d7);
3288                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d14, d6, d8);
3289                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d14, d5, d8);
3290                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d13, d5, d7);
3291                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d14, d6, d7);
3292                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d13, d6, d8);
3293                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d13, d5, d8);
3294                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d14, d5, d7);
3295                }
3296            }
3297            else if (!flag && flag1)
3298            {
3299                tessellator.addVertexWithUV(d11, (double)(par3 + 1), d14, d1, d3);
3300                tessellator.addVertexWithUV(d11, (double)(par3 + 0), d14, d1, d4);
3301                tessellator.addVertexWithUV(d11, (double)(par3 + 0), d15, d2, d4);
3302                tessellator.addVertexWithUV(d11, (double)(par3 + 1), d15, d2, d3);
3303                tessellator.addVertexWithUV(d11, (double)(par3 + 1), d15, d1, d3);
3304                tessellator.addVertexWithUV(d11, (double)(par3 + 0), d15, d1, d4);
3305                tessellator.addVertexWithUV(d11, (double)(par3 + 0), d14, d2, d4);
3306                tessellator.addVertexWithUV(d11, (double)(par3 + 1), d14, d2, d3);
3307
3308                if (!flag3 && !flag2)
3309                {
3310                    tessellator.addVertexWithUV(d17, (double)(par3 + 1), d14, d5, d7);
3311                    tessellator.addVertexWithUV(d17, (double)(par3 + 0), d14, d5, d9);
3312                    tessellator.addVertexWithUV(d16, (double)(par3 + 0), d14, d6, d9);
3313                    tessellator.addVertexWithUV(d16, (double)(par3 + 1), d14, d6, d7);
3314                    tessellator.addVertexWithUV(d16, (double)(par3 + 1), d14, d5, d7);
3315                    tessellator.addVertexWithUV(d16, (double)(par3 + 0), d14, d5, d9);
3316                    tessellator.addVertexWithUV(d17, (double)(par3 + 0), d14, d6, d9);
3317                    tessellator.addVertexWithUV(d17, (double)(par3 + 1), d14, d6, d7);
3318                }
3319
3320                if (flag4 || par3 < l - 1 && this.blockAccess.isAirBlock(par2, par3 + 1, par4 + 1))
3321                {
3322                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d14, d5, d8);
3323                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d15, d5, d9);
3324                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d15, d6, d9);
3325                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d14, d6, d8);
3326                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d15, d5, d8);
3327                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d14, d5, d9);
3328                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d14, d6, d9);
3329                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d15, d6, d8);
3330                }
3331
3332                if (flag5 || par3 > 1 && this.blockAccess.isAirBlock(par2, par3 - 1, par4 + 1))
3333                {
3334                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d14, d5, d8);
3335                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d15, d5, d9);
3336                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d15, d6, d9);
3337                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d14, d6, d8);
3338                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d15, d5, d8);
3339                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d14, d5, d9);
3340                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d14, d6, d9);
3341                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d15, d6, d8);
3342                }
3343            }
3344        }
3345        else
3346        {
3347            tessellator.addVertexWithUV(d11, (double)(par3 + 1), d15, d0, d3);
3348            tessellator.addVertexWithUV(d11, (double)(par3 + 0), d15, d0, d4);
3349            tessellator.addVertexWithUV(d11, (double)(par3 + 0), d13, d2, d4);
3350            tessellator.addVertexWithUV(d11, (double)(par3 + 1), d13, d2, d3);
3351            tessellator.addVertexWithUV(d11, (double)(par3 + 1), d13, d0, d3);
3352            tessellator.addVertexWithUV(d11, (double)(par3 + 0), d13, d0, d4);
3353            tessellator.addVertexWithUV(d11, (double)(par3 + 0), d15, d2, d4);
3354            tessellator.addVertexWithUV(d11, (double)(par3 + 1), d15, d2, d3);
3355
3356            if (flag4)
3357            {
3358                tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d15, d6, d9);
3359                tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d13, d6, d7);
3360                tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d13, d5, d7);
3361                tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d15, d5, d9);
3362                tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d13, d6, d9);
3363                tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d15, d6, d7);
3364                tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d15, d5, d7);
3365                tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d13, d5, d9);
3366            }
3367            else
3368            {
3369                if (par3 < l - 1 && this.blockAccess.isAirBlock(par2, par3 + 1, par4 - 1))
3370                {
3371                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d13, d6, d7);
3372                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d14, d6, d8);
3373                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d14, d5, d8);
3374                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d13, d5, d7);
3375                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d14, d6, d7);
3376                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d13, d6, d8);
3377                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d13, d5, d8);
3378                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d14, d5, d7);
3379                }
3380
3381                if (par3 < l - 1 && this.blockAccess.isAirBlock(par2, par3 + 1, par4 + 1))
3382                {
3383                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d14, d5, d8);
3384                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d15, d5, d9);
3385                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d15, d6, d9);
3386                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d14, d6, d8);
3387                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d15, d5, d8);
3388                    tessellator.addVertexWithUV(d16, (double)(par3 + 1) + 0.005D, d14, d5, d9);
3389                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d14, d6, d9);
3390                    tessellator.addVertexWithUV(d17, (double)(par3 + 1) + 0.005D, d15, d6, d8);
3391                }
3392            }
3393
3394            if (flag5)
3395            {
3396                tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d15, d6, d9);
3397                tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d13, d6, d7);
3398                tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d13, d5, d7);
3399                tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d15, d5, d9);
3400                tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d13, d6, d9);
3401                tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d15, d6, d7);
3402                tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d15, d5, d7);
3403                tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d13, d5, d9);
3404            }
3405            else
3406            {
3407                if (par3 > 1 && this.blockAccess.isAirBlock(par2, par3 - 1, par4 - 1))
3408                {
3409                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d13, d6, d7);
3410                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d14, d6, d8);
3411                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d14, d5, d8);
3412                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d13, d5, d7);
3413                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d14, d6, d7);
3414                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d13, d6, d8);
3415                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d13, d5, d8);
3416                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d14, d5, d7);
3417                }
3418
3419                if (par3 > 1 && this.blockAccess.isAirBlock(par2, par3 - 1, par4 + 1))
3420                {
3421                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d14, d5, d8);
3422                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d15, d5, d9);
3423                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d15, d6, d9);
3424                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d14, d6, d8);
3425                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d15, d5, d8);
3426                    tessellator.addVertexWithUV(d16, (double)par3 - 0.005D, d14, d5, d9);
3427                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d14, d6, d9);
3428                    tessellator.addVertexWithUV(d17, (double)par3 - 0.005D, d15, d6, d8);
3429                }
3430            }
3431        }
3432
3433        return true;
3434    }
3435
3436    /**
3437     * Renders any block requiring croseed squares such as reeds, flowers, and mushrooms
3438     */
3439    public boolean renderCrossedSquares(Block par1Block, int par2, int par3, int par4)
3440    {
3441        Tessellator tessellator = Tessellator.instance;
3442        tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
3443        float f = 1.0F;
3444        int l = par1Block.colorMultiplier(this.blockAccess, par2, par3, par4);
3445        float f1 = (float)(l >> 16 & 255) / 255.0F;
3446        float f2 = (float)(l >> 8 & 255) / 255.0F;
3447        float f3 = (float)(l & 255) / 255.0F;
3448
3449        if (EntityRenderer.anaglyphEnable)
3450        {
3451            float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
3452            float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
3453            float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
3454            f1 = f4;
3455            f2 = f5;
3456            f3 = f6;
3457        }
3458
3459        tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
3460        double d0 = (double)par2;
3461        double d1 = (double)par3;
3462        double d2 = (double)par4;
3463
3464        if (par1Block == Block.tallGrass)
3465        {
3466            long i1 = (long)(par2 * 3129871) ^ (long)par4 * 116129781L ^ (long)par3;
3467            i1 = i1 * i1 * 42317861L + i1 * 11L;
3468            d0 += ((double)((float)(i1 >> 16 & 15L) / 15.0F) - 0.5D) * 0.5D;
3469            d1 += ((double)((float)(i1 >> 20 & 15L) / 15.0F) - 1.0D) * 0.2D;
3470            d2 += ((double)((float)(i1 >> 24 & 15L) / 15.0F) - 0.5D) * 0.5D;
3471        }
3472
3473        this.drawCrossedSquares(par1Block, this.blockAccess.getBlockMetadata(par2, par3, par4), d0, d1, d2, 1.0F);
3474        return true;
3475    }
3476
3477    /**
3478     * Render block stem
3479     */
3480    public boolean renderBlockStem(Block par1Block, int par2, int par3, int par4)
3481    {
3482        BlockStem blockstem = (BlockStem)par1Block;
3483        Tessellator tessellator = Tessellator.instance;
3484        tessellator.setBrightness(blockstem.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
3485        float f = 1.0F;
3486        int l = blockstem.colorMultiplier(this.blockAccess, par2, par3, par4);
3487        float f1 = (float)(l >> 16 & 255) / 255.0F;
3488        float f2 = (float)(l >> 8 & 255) / 255.0F;
3489        float f3 = (float)(l & 255) / 255.0F;
3490
3491        if (EntityRenderer.anaglyphEnable)
3492        {
3493            float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
3494            float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
3495            float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
3496            f1 = f4;
3497            f2 = f5;
3498            f3 = f6;
3499        }
3500
3501        tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
3502        blockstem.setBlockBoundsBasedOnState(this.blockAccess, par2, par3, par4);
3503        int i1 = blockstem.getState(this.blockAccess, par2, par3, par4);
3504
3505        if (i1 < 0)
3506        {
3507            this.renderBlockStemSmall(blockstem, this.blockAccess.getBlockMetadata(par2, par3, par4), this.renderMaxY, (double)par2, (double)((float)par3 - 0.0625F), (double)par4);
3508        }
3509        else
3510        {
3511            this.renderBlockStemSmall(blockstem, this.blockAccess.getBlockMetadata(par2, par3, par4), 0.5D, (double)par2, (double)((float)par3 - 0.0625F), (double)par4);
3512            this.renderBlockStemBig(blockstem, this.blockAccess.getBlockMetadata(par2, par3, par4), i1, this.renderMaxY, (double)par2, (double)((float)par3 - 0.0625F), (double)par4);
3513        }
3514
3515        return true;
3516    }
3517
3518    /**
3519     * Render block crops
3520     */
3521    public boolean renderBlockCrops(Block par1Block, int par2, int par3, int par4)
3522    {
3523        Tessellator tessellator = Tessellator.instance;
3524        tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
3525        tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
3526        this.renderBlockCropsImpl(par1Block, this.blockAccess.getBlockMetadata(par2, par3, par4), (double)par2, (double)((float)par3 - 0.0625F), (double)par4);
3527        return true;
3528    }
3529
3530    /**
3531     * Renders a torch at the given coordinates, with the base slanting at the given delta
3532     */
3533    public void renderTorchAtAngle(Block par1Block, double par2, double par4, double par6, double par8, double par10, int par12)
3534    {
3535        Tessellator tessellator = Tessellator.instance;
3536        Icon icon = this.getBlockIconFromSideAndMetadata(par1Block, 0, par12);
3537
3538        if (this.hasOverrideBlockTexture())
3539        {
3540            icon = this.overrideBlockTexture;
3541        }
3542
3543        double d5 = (double)icon.getMinU();
3544        double d6 = (double)icon.getMinV();
3545        double d7 = (double)icon.getMaxU();
3546        double d8 = (double)icon.getMaxV();
3547        double d9 = (double)icon.getInterpolatedU(7.0D);
3548        double d10 = (double)icon.getInterpolatedV(6.0D);
3549        double d11 = (double)icon.getInterpolatedU(9.0D);
3550        double d12 = (double)icon.getInterpolatedV(8.0D);
3551        double d13 = (double)icon.getInterpolatedU(7.0D);
3552        double d14 = (double)icon.getInterpolatedV(13.0D);
3553        double d15 = (double)icon.getInterpolatedU(9.0D);
3554        double d16 = (double)icon.getInterpolatedV(15.0D);
3555        par2 += 0.5D;
3556        par6 += 0.5D;
3557        double d17 = par2 - 0.5D;
3558        double d18 = par2 + 0.5D;
3559        double d19 = par6 - 0.5D;
3560        double d20 = par6 + 0.5D;
3561        double d21 = 0.0625D;
3562        double d22 = 0.625D;
3563        tessellator.addVertexWithUV(par2 + par8 * (1.0D - d22) - d21, par4 + d22, par6 + par10 * (1.0D - d22) - d21, d9, d10);
3564        tessellator.addVertexWithUV(par2 + par8 * (1.0D - d22) - d21, par4 + d22, par6 + par10 * (1.0D - d22) + d21, d9, d12);
3565        tessellator.addVertexWithUV(par2 + par8 * (1.0D - d22) + d21, par4 + d22, par6 + par10 * (1.0D - d22) + d21, d11, d12);
3566        tessellator.addVertexWithUV(par2 + par8 * (1.0D - d22) + d21, par4 + d22, par6 + par10 * (1.0D - d22) - d21, d11, d10);
3567        tessellator.addVertexWithUV(par2 + d21 + par8, par4, par6 - d21 + par10, d15, d14);
3568        tessellator.addVertexWithUV(par2 + d21 + par8, par4, par6 + d21 + par10, d15, d16);
3569        tessellator.addVertexWithUV(par2 - d21 + par8, par4, par6 + d21 + par10, d13, d16);
3570        tessellator.addVertexWithUV(par2 - d21 + par8, par4, par6 - d21 + par10, d13, d14);
3571        tessellator.addVertexWithUV(par2 - d21, par4 + 1.0D, d19, d5, d6);
3572        tessellator.addVertexWithUV(par2 - d21 + par8, par4 + 0.0D, d19 + par10, d5, d8);
3573        tessellator.addVertexWithUV(par2 - d21 + par8, par4 + 0.0D, d20 + par10, d7, d8);
3574        tessellator.addVertexWithUV(par2 - d21, par4 + 1.0D, d20, d7, d6);
3575        tessellator.addVertexWithUV(par2 + d21, par4 + 1.0D, d20, d5, d6);
3576        tessellator.addVertexWithUV(par2 + par8 + d21, par4 + 0.0D, d20 + par10, d5, d8);
3577        tessellator.addVertexWithUV(par2 + par8 + d21, par4 + 0.0D, d19 + par10, d7, d8);
3578        tessellator.addVertexWithUV(par2 + d21, par4 + 1.0D, d19, d7, d6);
3579        tessellator.addVertexWithUV(d17, par4 + 1.0D, par6 + d21, d5, d6);
3580        tessellator.addVertexWithUV(d17 + par8, par4 + 0.0D, par6 + d21 + par10, d5, d8);
3581        tessellator.addVertexWithUV(d18 + par8, par4 + 0.0D, par6 + d21 + par10, d7, d8);
3582        tessellator.addVertexWithUV(d18, par4 + 1.0D, par6 + d21, d7, d6);
3583        tessellator.addVertexWithUV(d18, par4 + 1.0D, par6 - d21, d5, d6);
3584        tessellator.addVertexWithUV(d18 + par8, par4 + 0.0D, par6 - d21 + par10, d5, d8);
3585        tessellator.addVertexWithUV(d17 + par8, par4 + 0.0D, par6 - d21 + par10, d7, d8);
3586        tessellator.addVertexWithUV(d17, par4 + 1.0D, par6 - d21, d7, d6);
3587    }
3588
3589    /**
3590     * Utility function to draw crossed swuares
3591     */
3592    public void drawCrossedSquares(Block par1Block, int par2, double par3, double par5, double par7, float par9)
3593    {
3594        Tessellator tessellator = Tessellator.instance;
3595        Icon icon = this.getBlockIconFromSideAndMetadata(par1Block, 0, par2);
3596
3597        if (this.hasOverrideBlockTexture())
3598        {
3599            icon = this.overrideBlockTexture;
3600        }
3601
3602        double d3 = (double)icon.getMinU();
3603        double d4 = (double)icon.getMinV();
3604        double d5 = (double)icon.getMaxU();
3605        double d6 = (double)icon.getMaxV();
3606        double d7 = 0.45D * (double)par9;
3607        double d8 = par3 + 0.5D - d7;
3608        double d9 = par3 + 0.5D + d7;
3609        double d10 = par7 + 0.5D - d7;
3610        double d11 = par7 + 0.5D + d7;
3611        tessellator.addVertexWithUV(d8, par5 + (double)par9, d10, d3, d4);
3612        tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d3, d6);
3613        tessellator.addVertexWithUV(d9, par5 + 0.0D, d11, d5, d6);
3614        tessellator.addVertexWithUV(d9, par5 + (double)par9, d11, d5, d4);
3615        tessellator.addVertexWithUV(d9, par5 + (double)par9, d11, d3, d4);
3616        tessellator.addVertexWithUV(d9, par5 + 0.0D, d11, d3, d6);
3617        tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d5, d6);
3618        tessellator.addVertexWithUV(d8, par5 + (double)par9, d10, d5, d4);
3619        tessellator.addVertexWithUV(d8, par5 + (double)par9, d11, d3, d4);
3620        tessellator.addVertexWithUV(d8, par5 + 0.0D, d11, d3, d6);
3621        tessellator.addVertexWithUV(d9, par5 + 0.0D, d10, d5, d6);
3622        tessellator.addVertexWithUV(d9, par5 + (double)par9, d10, d5, d4);
3623        tessellator.addVertexWithUV(d9, par5 + (double)par9, d10, d3, d4);
3624        tessellator.addVertexWithUV(d9, par5 + 0.0D, d10, d3, d6);
3625        tessellator.addVertexWithUV(d8, par5 + 0.0D, d11, d5, d6);
3626        tessellator.addVertexWithUV(d8, par5 + (double)par9, d11, d5, d4);
3627    }
3628
3629    /**
3630     * Render block stem small
3631     */
3632    public void renderBlockStemSmall(Block par1Block, int par2, double par3, double par5, double par7, double par9)
3633    {
3634        Tessellator tessellator = Tessellator.instance;
3635        Icon icon = this.getBlockIconFromSideAndMetadata(par1Block, 0, par2);
3636
3637        if (this.hasOverrideBlockTexture())
3638        {
3639            icon = this.overrideBlockTexture;
3640        }
3641
3642        double d4 = (double)icon.getMinU();
3643        double d5 = (double)icon.getMinV();
3644        double d6 = (double)icon.getMaxU();
3645        double d7 = (double)icon.getInterpolatedV(par3 * 16.0D);
3646        double d8 = par5 + 0.5D - 0.44999998807907104D;
3647        double d9 = par5 + 0.5D + 0.44999998807907104D;
3648        double d10 = par9 + 0.5D - 0.44999998807907104D;
3649        double d11 = par9 + 0.5D + 0.44999998807907104D;
3650        tessellator.addVertexWithUV(d8, par7 + par3, d10, d4, d5);
3651        tessellator.addVertexWithUV(d8, par7 + 0.0D, d10, d4, d7);
3652        tessellator.addVertexWithUV(d9, par7 + 0.0D, d11, d6, d7);
3653        tessellator.addVertexWithUV(d9, par7 + par3, d11, d6, d5);
3654        tessellator.addVertexWithUV(d9, par7 + par3, d11, d4, d5);
3655        tessellator.addVertexWithUV(d9, par7 + 0.0D, d11, d4, d7);
3656        tessellator.addVertexWithUV(d8, par7 + 0.0D, d10, d6, d7);
3657        tessellator.addVertexWithUV(d8, par7 + par3, d10, d6, d5);
3658        tessellator.addVertexWithUV(d8, par7 + par3, d11, d4, d5);
3659        tessellator.addVertexWithUV(d8, par7 + 0.0D, d11, d4, d7);
3660        tessellator.addVertexWithUV(d9, par7 + 0.0D, d10, d6, d7);
3661        tessellator.addVertexWithUV(d9, par7 + par3, d10, d6, d5);
3662        tessellator.addVertexWithUV(d9, par7 + par3, d10, d4, d5);
3663        tessellator.addVertexWithUV(d9, par7 + 0.0D, d10, d4, d7);
3664        tessellator.addVertexWithUV(d8, par7 + 0.0D, d11, d6, d7);
3665        tessellator.addVertexWithUV(d8, par7 + par3, d11, d6, d5);
3666    }
3667
3668    /**
3669     * Render BlockLilyPad
3670     */
3671    public boolean renderBlockLilyPad(Block par1Block, int par2, int par3, int par4)
3672    {
3673        Tessellator tessellator = Tessellator.instance;
3674        Icon icon = this.getBlockIconFromSide(par1Block, 1);
3675
3676        if (this.hasOverrideBlockTexture())
3677        {
3678            icon = this.overrideBlockTexture;
3679        }
3680
3681        float f = 0.015625F;
3682        double d0 = (double)icon.getMinU();
3683        double d1 = (double)icon.getMinV();
3684        double d2 = (double)icon.getMaxU();
3685        double d3 = (double)icon.getMaxV();
3686        long l = (long)(par2 * 3129871) ^ (long)par4 * 116129781L ^ (long)par3;
3687        l = l * l * 42317861L + l * 11L;
3688        int i1 = (int)(l >> 16 & 3L);
3689        tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
3690        float f1 = (float)par2 + 0.5F;
3691        float f2 = (float)par4 + 0.5F;
3692        float f3 = (float)(i1 & 1) * 0.5F * (float)(1 - i1 / 2 % 2 * 2);
3693        float f4 = (float)(i1 + 1 & 1) * 0.5F * (float)(1 - (i1 + 1) / 2 % 2 * 2);
3694        tessellator.setColorOpaque_I(par1Block.getBlockColor());
3695        tessellator.addVertexWithUV((double)(f1 + f3 - f4), (double)((float)par3 + f), (double)(f2 + f3 + f4), d0, d1);
3696        tessellator.addVertexWithUV((double)(f1 + f3 + f4), (double)((float)par3 + f), (double)(f2 - f3 + f4), d2, d1);
3697        tessellator.addVertexWithUV((double)(f1 - f3 + f4), (double)((float)par3 + f), (double)(f2 - f3 - f4), d2, d3);
3698        tessellator.addVertexWithUV((double)(f1 - f3 - f4), (double)((float)par3 + f), (double)(f2 + f3 - f4), d0, d3);
3699        tessellator.setColorOpaque_I((par1Block.getBlockColor() & 16711422) >> 1);
3700        tessellator.addVertexWithUV((double)(f1 - f3 - f4), (double)((float)par3 + f), (double)(f2 + f3 - f4), d0, d3);
3701        tessellator.addVertexWithUV((double)(f1 - f3 + f4), (double)((float)par3 + f), (double)(f2 - f3 - f4), d2, d3);
3702        tessellator.addVertexWithUV((double)(f1 + f3 + f4), (double)((float)par3 + f), (double)(f2 - f3 + f4), d2, d1);
3703        tessellator.addVertexWithUV((double)(f1 + f3 - f4), (double)((float)par3 + f), (double)(f2 + f3 + f4), d0, d1);
3704        return true;
3705    }
3706
3707    /**
3708     * Render block stem big
3709     */
3710    public void renderBlockStemBig(BlockStem par1BlockStem, int par2, int par3, double par4, double par6, double par8, double par10)
3711    {
3712        Tessellator tessellator = Tessellator.instance;
3713        Icon icon = par1BlockStem.func_94368_p();
3714
3715        if (this.hasOverrideBlockTexture())
3716        {
3717            icon = this.overrideBlockTexture;
3718        }
3719
3720        double d4 = (double)icon.getMinU();
3721        double d5 = (double)icon.getMinV();
3722        double d6 = (double)icon.getMaxU();
3723        double d7 = (double)icon.getMaxV();
3724        double d8 = par6 + 0.5D - 0.5D;
3725        double d9 = par6 + 0.5D + 0.5D;
3726        double d10 = par10 + 0.5D - 0.5D;
3727        double d11 = par10 + 0.5D + 0.5D;
3728        double d12 = par6 + 0.5D;
3729        double d13 = par10 + 0.5D;
3730
3731        if ((par3 + 1) / 2 % 2 == 1)
3732        {
3733            double d14 = d6;
3734            d6 = d4;
3735            d4 = d14;
3736        }
3737
3738        if (par3 < 2)
3739        {
3740            tessellator.addVertexWithUV(d8, par8 + par4, d13, d4, d5);
3741            tessellator.addVertexWithUV(d8, par8 + 0.0D, d13, d4, d7);
3742            tessellator.addVertexWithUV(d9, par8 + 0.0D, d13, d6, d7);
3743            tessellator.addVertexWithUV(d9, par8 + par4, d13, d6, d5);
3744            tessellator.addVertexWithUV(d9, par8 + par4, d13, d6, d5);
3745            tessellator.addVertexWithUV(d9, par8 + 0.0D, d13, d6, d7);
3746            tessellator.addVertexWithUV(d8, par8 + 0.0D, d13, d4, d7);
3747            tessellator.addVertexWithUV(d8, par8 + par4, d13, d4, d5);
3748        }
3749        else
3750        {
3751            tessellator.addVertexWithUV(d12, par8 + par4, d11, d4, d5);
3752            tessellator.addVertexWithUV(d12, par8 + 0.0D, d11, d4, d7);
3753            tessellator.addVertexWithUV(d12, par8 + 0.0D, d10, d6, d7);
3754            tessellator.addVertexWithUV(d12, par8 + par4, d10, d6, d5);
3755            tessellator.addVertexWithUV(d12, par8 + par4, d10, d6, d5);
3756            tessellator.addVertexWithUV(d12, par8 + 0.0D, d10, d6, d7);
3757            tessellator.addVertexWithUV(d12, par8 + 0.0D, d11, d4, d7);
3758            tessellator.addVertexWithUV(d12, par8 + par4, d11, d4, d5);
3759        }
3760    }
3761
3762    /**
3763     * Render block crops implementation
3764     */
3765    public void renderBlockCropsImpl(Block par1Block, int par2, double par3, double par5, double par7)
3766    {
3767        Tessellator tessellator = Tessellator.instance;
3768        Icon icon = this.getBlockIconFromSideAndMetadata(par1Block, 0, par2);
3769
3770        if (this.hasOverrideBlockTexture())
3771        {
3772            icon = this.overrideBlockTexture;
3773        }
3774
3775        double d3 = (double)icon.getMinU();
3776        double d4 = (double)icon.getMinV();
3777        double d5 = (double)icon.getMaxU();
3778        double d6 = (double)icon.getMaxV();
3779        double d7 = par3 + 0.5D - 0.25D;
3780        double d8 = par3 + 0.5D + 0.25D;
3781        double d9 = par7 + 0.5D - 0.5D;
3782        double d10 = par7 + 0.5D + 0.5D;
3783        tessellator.addVertexWithUV(d7, par5 + 1.0D, d9, d3, d4);
3784        tessellator.addVertexWithUV(d7, par5 + 0.0D, d9, d3, d6);
3785        tessellator.addVertexWithUV(d7, par5 + 0.0D, d10, d5, d6);
3786        tessellator.addVertexWithUV(d7, par5 + 1.0D, d10, d5, d4);
3787        tessellator.addVertexWithUV(d7, par5 + 1.0D, d10, d3, d4);
3788        tessellator.addVertexWithUV(d7, par5 + 0.0D, d10, d3, d6);
3789        tessellator.addVertexWithUV(d7, par5 + 0.0D, d9, d5, d6);
3790        tessellator.addVertexWithUV(d7, par5 + 1.0D, d9, d5, d4);
3791        tessellator.addVertexWithUV(d8, par5 + 1.0D, d10, d3, d4);
3792        tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d3, d6);
3793        tessellator.addVertexWithUV(d8, par5 + 0.0D, d9, d5, d6);
3794        tessellator.addVertexWithUV(d8, par5 + 1.0D, d9, d5, d4);
3795        tessellator.addVertexWithUV(d8, par5 + 1.0D, d9, d3, d4);
3796        tessellator.addVertexWithUV(d8, par5 + 0.0D, d9, d3, d6);
3797        tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d5, d6);
3798        tessellator.addVertexWithUV(d8, par5 + 1.0D, d10, d5, d4);
3799        d7 = par3 + 0.5D - 0.5D;
3800        d8 = par3 + 0.5D + 0.5D;
3801        d9 = par7 + 0.5D - 0.25D;
3802        d10 = par7 + 0.5D + 0.25D;
3803        tessellator.addVertexWithUV(d7, par5 + 1.0D, d9, d3, d4);
3804        tessellator.addVertexWithUV(d7, par5 + 0.0D, d9, d3, d6);
3805        tessellator.addVertexWithUV(d8, par5 + 0.0D, d9, d5, d6);
3806        tessellator.addVertexWithUV(d8, par5 + 1.0D, d9, d5, d4);
3807        tessellator.addVertexWithUV(d8, par5 + 1.0D, d9, d3, d4);
3808        tessellator.addVertexWithUV(d8, par5 + 0.0D, d9, d3, d6);
3809        tessellator.addVertexWithUV(d7, par5 + 0.0D, d9, d5, d6);
3810        tessellator.addVertexWithUV(d7, par5 + 1.0D, d9, d5, d4);
3811        tessellator.addVertexWithUV(d8, par5 + 1.0D, d10, d3, d4);
3812        tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d3, d6);
3813        tessellator.addVertexWithUV(d7, par5 + 0.0D, d10, d5, d6);
3814        tessellator.addVertexWithUV(d7, par5 + 1.0D, d10, d5, d4);
3815        tessellator.addVertexWithUV(d7, par5 + 1.0D, d10, d3, d4);
3816        tessellator.addVertexWithUV(d7, par5 + 0.0D, d10, d3, d6);
3817        tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d5, d6);
3818        tessellator.addVertexWithUV(d8, par5 + 1.0D, d10, d5, d4);
3819    }
3820
3821    /**
3822     * Renders a block based on the BlockFluids class at the given coordinates
3823     */
3824    public boolean renderBlockFluids(Block par1Block, int par2, int par3, int par4)
3825    {
3826        Tessellator tessellator = Tessellator.instance;
3827        int l = par1Block.colorMultiplier(this.blockAccess, par2, par3, par4);
3828        float f = (float)(l >> 16 & 255) / 255.0F;
3829        float f1 = (float)(l >> 8 & 255) / 255.0F;
3830        float f2 = (float)(l & 255) / 255.0F;
3831        boolean flag = par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1);
3832        boolean flag1 = par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0);
3833        boolean[] aboolean = new boolean[] {par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 - 1, 2), par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 + 1, 3), par1Block.shouldSideBeRendered(this.blockAccess, par2 - 1, par3, par4, 4), par1Block.shouldSideBeRendered(this.blockAccess, par2 + 1, par3, par4, 5)};
3834
3835        if (!flag && !flag1 && !aboolean[0] && !aboolean[1] && !aboolean[2] && !aboolean[3])
3836        {
3837            return false;
3838        }
3839        else
3840        {
3841            boolean flag2 = false;
3842            float f3 = 0.5F;
3843            float f4 = 1.0F;
3844            float f5 = 0.8F;
3845            float f6 = 0.6F;
3846            double d0 = 0.0D;
3847            double d1 = 1.0D;
3848            Material material = par1Block.blockMaterial;
3849            int i1 = this.blockAccess.getBlockMetadata(par2, par3, par4);
3850            double d2 = (double)this.getFluidHeight(par2, par3, par4, material);
3851            double d3 = (double)this.getFluidHeight(par2, par3, par4 + 1, material);
3852            double d4 = (double)this.getFluidHeight(par2 + 1, par3, par4 + 1, material);
3853            double d5 = (double)this.getFluidHeight(par2 + 1, par3, par4, material);
3854            double d6 = 0.0010000000474974513D;
3855            float f7;
3856            float f8;
3857
3858            if (this.renderAllFaces || flag)
3859            {
3860                flag2 = true;
3861                Icon icon = this.getBlockIconFromSideAndMetadata(par1Block, 1, i1);
3862                float f9 = (float)BlockFluid.getFlowDirection(this.blockAccess, par2, par3, par4, material);
3863
3864                if (f9 > -999.0F)
3865                {
3866                    icon = this.getBlockIconFromSideAndMetadata(par1Block, 2, i1);
3867                }
3868
3869                d2 -= d6;
3870                d3 -= d6;
3871                d4 -= d6;
3872                d5 -= d6;
3873                double d7;
3874                double d8;
3875                double d9;
3876                double d10;
3877                double d11;
3878                double d12;
3879                double d13;
3880                double d14;
3881
3882                if (f9 < -999.0F)
3883                {
3884                    d8 = (double)icon.getInterpolatedU(0.0D);
3885                    d12 = (double)icon.getInterpolatedV(0.0D);
3886                    d7 = d8;
3887                    d11 = (double)icon.getInterpolatedV(16.0D);
3888                    d10 = (double)icon.getInterpolatedU(16.0D);
3889                    d14 = d11;
3890                    d9 = d10;
3891                    d13 = d12;
3892                }
3893                else
3894                {
3895                    f8 = MathHelper.sin(f9) * 0.25F;
3896                    f7 = MathHelper.cos(f9) * 0.25F;
3897                    d8 = (double)icon.getInterpolatedU((double)(8.0F + (-f7 - f8) * 16.0F));
3898                    d12 = (double)icon.getInterpolatedV((double)(8.0F + (-f7 + f8) * 16.0F));
3899                    d7 = (double)icon.getInterpolatedU((double)(8.0F + (-f7 + f8) * 16.0F));
3900                    d11 = (double)icon.getInterpolatedV((double)(8.0F + (f7 + f8) * 16.0F));
3901                    d10 = (double)icon.getInterpolatedU((double)(8.0F + (f7 + f8) * 16.0F));
3902                    d14 = (double)icon.getInterpolatedV((double)(8.0F + (f7 - f8) * 16.0F));
3903                    d9 = (double)icon.getInterpolatedU((double)(8.0F + (f7 - f8) * 16.0F));
3904                    d13 = (double)icon.getInterpolatedV((double)(8.0F + (-f7 - f8) * 16.0F));
3905                }
3906
3907                tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
3908                f8 = 1.0F;
3909                tessellator.setColorOpaque_F(f4 * f8 * f, f4 * f8 * f1, f4 * f8 * f2);
3910                tessellator.addVertexWithUV((double)(par2 + 0), (double)par3 + d2, (double)(par4 + 0), d8, d12);
3911                tessellator.addVertexWithUV((double)(par2 + 0), (double)par3 + d3, (double)(par4 + 1), d7, d11);
3912                tessellator.addVertexWithUV((double)(par2 + 1), (double)par3 + d4, (double)(par4 + 1), d10, d14);
3913                tessellator.addVertexWithUV((double)(par2 + 1), (double)par3 + d5, (double)(par4 + 0), d9, d13);
3914            }
3915
3916            if (this.renderAllFaces || flag1)
3917            {
3918                tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4));
3919                float f10 = 1.0F;
3920                tessellator.setColorOpaque_F(f3 * f10, f3 * f10, f3 * f10);
3921                this.renderBottomFace(par1Block, (double)par2, (double)par3 + d6, (double)par4, this.getBlockIconFromSide(par1Block, 0));
3922                flag2 = true;
3923            }
3924
3925            for (int j1 = 0; j1 < 4; ++j1)
3926            {
3927                int k1 = par2;
3928                int l1 = par4;
3929
3930                if (j1 == 0)
3931                {
3932                    l1 = par4 - 1;
3933                }
3934
3935                if (j1 == 1)
3936                {
3937                    ++l1;
3938                }
3939
3940                if (j1 == 2)
3941                {
3942                    k1 = par2 - 1;
3943                }
3944
3945                if (j1 == 3)
3946                {
3947                    ++k1;
3948                }
3949
3950                Icon icon1 = this.getBlockIconFromSideAndMetadata(par1Block, j1 + 2, i1);
3951
3952                if (this.renderAllFaces || aboolean[j1])
3953                {
3954                    double d15;
3955                    double d16;
3956                    double d17;
3957                    double d18;
3958                    double d19;
3959                    double d20;
3960
3961                    if (j1 == 0)
3962                    {
3963                        d15 = d2;
3964                        d17 = d5;
3965                        d16 = (double)par2;
3966                        d18 = (double)(par2 + 1);
3967                        d19 = (double)par4 + d6;
3968                        d20 = (double)par4 + d6;
3969                    }
3970                    else if (j1 == 1)
3971                    {
3972                        d15 = d4;
3973                        d17 = d3;
3974                        d16 = (double)(par2 + 1);
3975                        d18 = (double)par2;
3976                        d19 = (double)(par4 + 1) - d6;
3977                        d20 = (double)(par4 + 1) - d6;
3978                    }
3979                    else if (j1 == 2)
3980                    {
3981                        d15 = d3;
3982                        d17 = d2;
3983                        d16 = (double)par2 + d6;
3984                        d18 = (double)par2 + d6;
3985                        d19 = (double)(par4 + 1);
3986                        d20 = (double)par4;
3987                    }
3988                    else
3989                    {
3990                        d15 = d5;
3991                        d17 = d4;
3992                        d16 = (double)(par2 + 1) - d6;
3993                        d18 = (double)(par2 + 1) - d6;
3994                        d19 = (double)par4;
3995                        d20 = (double)(par4 + 1);
3996                    }
3997
3998                    flag2 = true;
3999                    float f11 = icon1.getInterpolatedU(0.0D);
4000                    f8 = icon1.getInterpolatedU(8.0D);
4001                    f7 = icon1.getInterpolatedV((1.0D - d15) * 16.0D * 0.5D);
4002                    float f12 = icon1.getInterpolatedV((1.0D - d17) * 16.0D * 0.5D);
4003                    float f13 = icon1.getInterpolatedV(8.0D);
4004                    tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, k1, par3, l1));
4005                    float f14 = 1.0F;
4006
4007                    if (j1 < 2)
4008                    {
4009                        f14 *= f5;
4010                    }
4011                    else
4012                    {
4013                        f14 *= f6;
4014                    }
4015
4016                    tessellator.setColorOpaque_F(f4 * f14 * f, f4 * f14 * f1, f4 * f14 * f2);
4017                    tessellator.addVertexWithUV(d16, (double)par3 + d15, d19, (double)f11, (double)f7);
4018                    tessellator.addVertexWithUV(d18, (double)par3 + d17, d20, (double)f8, (double)f12);
4019                    tessellator.addVertexWithUV(d18, (double)(par3 + 0), d20, (double)f8, (double)f13);
4020                    tessellator.addVertexWithUV(d16, (double)(par3 + 0), d19, (double)f11, (double)f13);
4021                }
4022            }
4023
4024            this.renderMinY = d0;
4025            this.renderMaxY = d1;
4026            return flag2;
4027        }
4028    }
4029
4030    /**
4031     * Get fluid height
4032     */
4033    public float getFluidHeight(int par1, int par2, int par3, Material par4Material)
4034    {
4035        int l = 0;
4036        float f = 0.0F;
4037
4038        for (int i1 = 0; i1 < 4; ++i1)
4039        {
4040            int j1 = par1 - (i1 & 1);
4041            int k1 = par3 - (i1 >> 1 & 1);
4042
4043            if (this.blockAccess.getBlockMaterial(j1, par2 + 1, k1) == par4Material)
4044            {
4045                return 1.0F;
4046            }
4047
4048            Material material1 = this.blockAccess.getBlockMaterial(j1, par2, k1);
4049
4050            if (material1 == par4Material)
4051            {
4052                int l1 = this.blockAccess.getBlockMetadata(j1, par2, k1);
4053
4054                if (l1 >= 8 || l1 == 0)
4055                {
4056                    f += BlockFluid.getFluidHeightPercent(l1) * 10.0F;
4057                    l += 10;
4058                }
4059
4060                f += BlockFluid.getFluidHeightPercent(l1);
4061                ++l;
4062            }
4063            else if (!material1.isSolid())
4064            {
4065                ++f;
4066                ++l;
4067            }
4068        }
4069
4070        return 1.0F - f / (float)l;
4071    }
4072
4073    /**
4074     * Renders a falling sand block
4075     */
4076    public void renderBlockSandFalling(Block par1Block, World par2World, int par3, int par4, int par5, int par6)
4077    {
4078        float f = 0.5F;
4079        float f1 = 1.0F;
4080        float f2 = 0.8F;
4081        float f3 = 0.6F;
4082        Tessellator tessellator = Tessellator.instance;
4083        tessellator.startDrawingQuads();
4084        tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(par2World, par3, par4, par5));
4085        float f4 = 1.0F;
4086        float f5 = 1.0F;
4087
4088        if (f5 < f4)
4089        {
4090            f5 = f4;
4091        }
4092
4093        tessellator.setColorOpaque_F(f * f5, f * f5, f * f5);
4094        this.renderBottomFace(par1Block, -0.5D, -0.5D, -0.5D, this.getBlockIconFromSideAndMetadata(par1Block, 0, par6));
4095        f5 = 1.0F;
4096
4097        if (f5 < f4)
4098        {
4099            f5 = f4;
4100        }
4101
4102        tessellator.setColorOpaque_F(f1 * f5, f1 * f5, f1 * f5);
4103        this.renderTopFace(par1Block, -0.5D, -0.5D, -0.5D, this.getBlockIconFromSideAndMetadata(par1Block, 1, par6));
4104        f5 = 1.0F;
4105
4106        if (f5 < f4)
4107        {
4108            f5 = f4;
4109        }
4110
4111        tessellator.setColorOpaque_F(f2 * f5, f2 * f5, f2 * f5);
4112        this.renderEastFace(par1Block, -0.5D, -0.5D, -0.5D, this.getBlockIconFromSideAndMetadata(par1Block, 2, par6));
4113        f5 = 1.0F;
4114
4115        if (f5 < f4)
4116        {
4117            f5 = f4;
4118        }
4119
4120        tessellator.setColorOpaque_F(f2 * f5, f2 * f5, f2 * f5);
4121        this.renderWestFace(par1Block, -0.5D, -0.5D, -0.5D, this.getBlockIconFromSideAndMetadata(par1Block, 3, par6));
4122        f5 = 1.0F;
4123
4124        if (f5 < f4)
4125        {
4126            f5 = f4;
4127        }
4128
4129        tessellator.setColorOpaque_F(f3 * f5, f3 * f5, f3 * f5);
4130        this.renderNorthFace(par1Block, -0.5D, -0.5D, -0.5D, this.getBlockIconFromSideAndMetadata(par1Block, 4, par6));
4131        f5 = 1.0F;
4132
4133        if (f5 < f4)
4134        {
4135            f5 = f4;
4136        }
4137
4138        tessellator.setColorOpaque_F(f3 * f5, f3 * f5, f3 * f5);
4139        this.renderSouthFace(par1Block, -0.5D, -0.5D, -0.5D, this.getBlockIconFromSideAndMetadata(par1Block, 5, par6));
4140        tessellator.draw();
4141    }
4142
4143    /**
4144     * Renders a standard cube block at the given coordinates
4145     */
4146    public boolean renderStandardBlock(Block par1Block, int par2, int par3, int par4)
4147    {
4148        int l = par1Block.colorMultiplier(this.blockAccess, par2, par3, par4);
4149        float f = (float)(l >> 16 & 255) / 255.0F;
4150        float f1 = (float)(l >> 8 & 255) / 255.0F;
4151        float f2 = (float)(l & 255) / 255.0F;
4152
4153        if (EntityRenderer.anaglyphEnable)
4154        {
4155            float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F;
4156            float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F;
4157            float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F;
4158            f = f3;
4159            f1 = f4;
4160            f2 = f5;
4161        }
4162
4163        return Minecraft.isAmbientOcclusionEnabled() && Block.lightValue[par1Block.blockID] == 0 ? (this.partialRenderBounds ? this.func_102027_b(par1Block, par2, par3, par4, f, f1, f2) : this.renderStandardBlockWithAmbientOcclusion(par1Block, par2, par3, par4, f, f1, f2)) : this.renderStandardBlockWithColorMultiplier(par1Block, par2, par3, par4, f, f1, f2);
4164    }
4165
4166    /**
4167     * Renders a log block at the given coordinates
4168     */
4169    public boolean renderBlockLog(Block par1Block, int par2, int par3, int par4)
4170    {
4171        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
4172        int i1 = l & 12;
4173
4174        if (i1 == 4)
4175        {
4176            this.uvRotateEast = 1;
4177            this.uvRotateWest = 1;
4178            this.uvRotateTop = 1;
4179            this.uvRotateBottom = 1;
4180        }
4181        else if (i1 == 8)
4182        {
4183            this.uvRotateSouth = 1;
4184            this.uvRotateNorth = 1;
4185        }
4186
4187        boolean flag = this.renderStandardBlock(par1Block, par2, par3, par4);
4188        this.uvRotateSouth = 0;
4189        this.uvRotateEast = 0;
4190        this.uvRotateWest = 0;
4191        this.uvRotateNorth = 0;
4192        this.uvRotateTop = 0;
4193        this.uvRotateBottom = 0;
4194        return flag;
4195    }
4196
4197    public boolean renderBlockQuartz(Block par1Block, int par2, int par3, int par4)
4198    {
4199        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
4200
4201        if (l == 3)
4202        {
4203            this.uvRotateEast = 1;
4204            this.uvRotateWest = 1;
4205            this.uvRotateTop = 1;
4206            this.uvRotateBottom = 1;
4207        }
4208        else if (l == 4)
4209        {
4210            this.uvRotateSouth = 1;
4211            this.uvRotateNorth = 1;
4212        }
4213
4214        boolean flag = this.renderStandardBlock(par1Block, par2, par3, par4);
4215        this.uvRotateSouth = 0;
4216        this.uvRotateEast = 0;
4217        this.uvRotateWest = 0;
4218        this.uvRotateNorth = 0;
4219        this.uvRotateTop = 0;
4220        this.uvRotateBottom = 0;
4221        return flag;
4222    }
4223
4224    public boolean renderStandardBlockWithAmbientOcclusion(Block par1Block, int par2, int par3, int par4, float par5, float par6, float par7)
4225    {
4226        this.enableAO = true;
4227        boolean flag = false;
4228        float f3 = 0.0F;
4229        float f4 = 0.0F;
4230        float f5 = 0.0F;
4231        float f6 = 0.0F;
4232        boolean flag1 = true;
4233        int l = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4);
4234        Tessellator tessellator = Tessellator.instance;
4235        tessellator.setBrightness(983055);
4236
4237        if (this.getBlockIcon(par1Block).getIconName().equals("grass_top"))
4238        {
4239            flag1 = false;
4240        }
4241        else if (this.hasOverrideBlockTexture())
4242        {
4243            flag1 = false;
4244        }
4245
4246        boolean flag2;
4247        boolean flag3;
4248        boolean flag4;
4249        boolean flag5;
4250        float f7;
4251        int i1;
4252
4253        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0))
4254        {
4255            if (this.renderMinY <= 0.0D)
4256            {
4257                --par3;
4258            }
4259
4260            this.aoBrightnessXYNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4);
4261            this.aoBrightnessYZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1);
4262            this.aoBrightnessYZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1);
4263            this.aoBrightnessXYPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4);
4264            this.aoLightValueScratchXYNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4);
4265            this.aoLightValueScratchYZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1);
4266            this.aoLightValueScratchYZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1);
4267            this.aoLightValueScratchXYPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4);
4268            flag3 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 - 1, par4)];
4269            flag2 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 - 1, par4)];
4270            flag5 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 + 1)];
4271            flag4 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 - 1)];
4272
4273            if (!flag4 && !flag2)
4274            {
4275                this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN;
4276                this.aoBrightnessXYZNNN = this.aoBrightnessXYNN;
4277            }
4278            else
4279            {
4280                this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 - 1);
4281                this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 - 1);
4282            }
4283
4284            if (!flag5 && !flag2)
4285            {
4286                this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXYNN;
4287                this.aoBrightnessXYZNNP = this.aoBrightnessXYNN;
4288            }
4289            else
4290            {
4291                this.aoLightValueScratchXYZNNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 + 1);
4292                this.aoBrightnessXYZNNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 + 1);
4293            }
4294
4295            if (!flag4 && !flag3)
4296            {
4297                this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXYPN;
4298                this.aoBrightnessXYZPNN = this.aoBrightnessXYPN;
4299            }
4300            else
4301            {
4302                this.aoLightValueScratchXYZPNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 - 1);
4303                this.aoBrightnessXYZPNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 - 1);
4304            }
4305
4306            if (!flag5 && !flag3)
4307            {
4308                this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXYPN;
4309                this.aoBrightnessXYZPNP = this.aoBrightnessXYPN;
4310            }
4311            else
4312            {
4313                this.aoLightValueScratchXYZPNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 + 1);
4314                this.aoBrightnessXYZPNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 + 1);
4315            }
4316
4317            if (this.renderMinY <= 0.0D)
4318            {
4319                ++par3;
4320            }
4321
4322            i1 = l;
4323
4324            if (this.renderMinY <= 0.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3 - 1, par4))
4325            {
4326                i1 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4);
4327            }
4328
4329            f7 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4);
4330            f3 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXYNN + this.aoLightValueScratchYZNP + f7) / 4.0F;
4331            f6 = (this.aoLightValueScratchYZNP + f7 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXYPN) / 4.0F;
4332            f5 = (f7 + this.aoLightValueScratchYZNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNN) / 4.0F;
4333            f4 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNN + f7 + this.aoLightValueScratchYZNN) / 4.0F;
4334            this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXYNN, this.aoBrightnessYZNP, i1);
4335            this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXYPN, i1);
4336            this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYPN, this.aoBrightnessXYZPNN, i1);
4337            this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNN, this.aoBrightnessYZNN, i1);
4338
4339            if (flag1)
4340            {
4341                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.5F;
4342                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.5F;
4343                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.5F;
4344            }
4345            else
4346            {
4347                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.5F;
4348                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.5F;
4349                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.5F;
4350            }
4351
4352            this.colorRedTopLeft *= f3;
4353            this.colorGreenTopLeft *= f3;
4354            this.colorBlueTopLeft *= f3;
4355            this.colorRedBottomLeft *= f4;
4356            this.colorGreenBottomLeft *= f4;
4357            this.colorBlueBottomLeft *= f4;
4358            this.colorRedBottomRight *= f5;
4359            this.colorGreenBottomRight *= f5;
4360            this.colorBlueBottomRight *= f5;
4361            this.colorRedTopRight *= f6;
4362            this.colorGreenTopRight *= f6;
4363            this.colorBlueTopRight *= f6;
4364            this.renderBottomFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0));
4365            flag = true;
4366        }
4367
4368        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1))
4369        {
4370            if (this.renderMaxY >= 1.0D)
4371            {
4372                ++par3;
4373            }
4374
4375            this.aoBrightnessXYNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4);
4376            this.aoBrightnessXYPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4);
4377            this.aoBrightnessYZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1);
4378            this.aoBrightnessYZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1);
4379            this.aoLightValueScratchXYNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4);
4380            this.aoLightValueScratchXYPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4);
4381            this.aoLightValueScratchYZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1);
4382            this.aoLightValueScratchYZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1);
4383            flag3 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 + 1, par4)];
4384            flag2 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 + 1, par4)];
4385            flag5 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 + 1)];
4386            flag4 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 - 1)];
4387
4388            if (!flag4 && !flag2)
4389            {
4390                this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXYNP;
4391                this.aoBrightnessXYZNPN = this.aoBrightnessXYNP;
4392            }
4393            else
4394            {
4395                this.aoLightValueScratchXYZNPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 - 1);
4396                this.aoBrightnessXYZNPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 - 1);
4397            }
4398
4399            if (!flag4 && !flag3)
4400            {
4401                this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXYPP;
4402                this.aoBrightnessXYZPPN = this.aoBrightnessXYPP;
4403            }
4404            else
4405            {
4406                this.aoLightValueScratchXYZPPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 - 1);
4407                this.aoBrightnessXYZPPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 - 1);
4408            }
4409
4410            if (!flag5 && !flag2)
4411            {
4412                this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXYNP;
4413                this.aoBrightnessXYZNPP = this.aoBrightnessXYNP;
4414            }
4415            else
4416            {
4417                this.aoLightValueScratchXYZNPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 + 1);
4418                this.aoBrightnessXYZNPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 + 1);
4419            }
4420
4421            if (!flag5 && !flag3)
4422            {
4423                this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXYPP;
4424                this.aoBrightnessXYZPPP = this.aoBrightnessXYPP;
4425            }
4426            else
4427            {
4428                this.aoLightValueScratchXYZPPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 + 1);
4429                this.aoBrightnessXYZPPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 + 1);
4430            }
4431
4432            if (this.renderMaxY >= 1.0D)
4433            {
4434                --par3;
4435            }
4436
4437            i1 = l;
4438
4439            if (this.renderMaxY >= 1.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3 + 1, par4))
4440            {
4441                i1 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4);
4442            }
4443
4444            f7 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4);
4445            f6 = (this.aoLightValueScratchXYZNPP + this.aoLightValueScratchXYNP + this.aoLightValueScratchYZPP + f7) / 4.0F;
4446            f3 = (this.aoLightValueScratchYZPP + f7 + this.aoLightValueScratchXYZPPP + this.aoLightValueScratchXYPP) / 4.0F;
4447            f4 = (f7 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPN) / 4.0F;
4448            f5 = (this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPN + f7 + this.aoLightValueScratchYZPN) / 4.0F;
4449            this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessXYZNPP, this.aoBrightnessXYNP, this.aoBrightnessYZPP, i1);
4450            this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXYZPPP, this.aoBrightnessXYPP, i1);
4451            this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXYPP, this.aoBrightnessXYZPPN, i1);
4452            this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessXYNP, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, i1);
4453            this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5;
4454            this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6;
4455            this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7;
4456            this.colorRedTopLeft *= f3;
4457            this.colorGreenTopLeft *= f3;
4458            this.colorBlueTopLeft *= f3;
4459            this.colorRedBottomLeft *= f4;
4460            this.colorGreenBottomLeft *= f4;
4461            this.colorBlueBottomLeft *= f4;
4462            this.colorRedBottomRight *= f5;
4463            this.colorGreenBottomRight *= f5;
4464            this.colorBlueBottomRight *= f5;
4465            this.colorRedTopRight *= f6;
4466            this.colorGreenTopRight *= f6;
4467            this.colorBlueTopRight *= f6;
4468            this.renderTopFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1));
4469            flag = true;
4470        }
4471
4472        Icon icon;
4473
4474        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 - 1, 2))
4475        {
4476            if (this.renderMinZ <= 0.0D)
4477            {
4478                --par4;
4479            }
4480
4481            this.aoLightValueScratchXZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4);
4482            this.aoLightValueScratchYZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4);
4483            this.aoLightValueScratchYZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4);
4484            this.aoLightValueScratchXZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4);
4485            this.aoBrightnessXZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4);
4486            this.aoBrightnessYZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4);
4487            this.aoBrightnessYZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4);
4488            this.aoBrightnessXZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4);
4489            flag3 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 - 1)];
4490            flag2 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 - 1)];
4491            flag5 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 - 1)];
4492            flag4 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 - 1)];
4493
4494            if (!flag2 && !flag4)
4495            {
4496                this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN;
4497                this.aoBrightnessXYZNNN = this.aoBrightnessXZNN;
4498            }
4499            else
4500            {
4501                this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 - 1, par4);
4502                this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 - 1, par4);
4503            }
4504
4505            if (!flag2 && !flag5)
4506            {
4507                this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN;
4508                this.aoBrightnessXYZNPN = this.aoBrightnessXZNN;
4509            }
4510            else
4511            {
4512                this.aoLightValueScratchXYZNPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 + 1, par4);
4513                this.aoBrightnessXYZNPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 + 1, par4);
4514            }
4515
4516            if (!flag3 && !flag4)
4517            {
4518                this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN;
4519                this.aoBrightnessXYZPNN = this.aoBrightnessXZPN;
4520            }
4521            else
4522            {
4523                this.aoLightValueScratchXYZPNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 - 1, par4);
4524                this.aoBrightnessXYZPNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 - 1, par4);
4525            }
4526
4527            if (!flag3 && !flag5)
4528            {
4529                this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN;
4530                this.aoBrightnessXYZPPN = this.aoBrightnessXZPN;
4531            }
4532            else
4533            {
4534                this.aoLightValueScratchXYZPPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 + 1, par4);
4535                this.aoBrightnessXYZPPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 + 1, par4);
4536            }
4537
4538            if (this.renderMinZ <= 0.0D)
4539            {
4540                ++par4;
4541            }
4542
4543            i1 = l;
4544
4545            if (this.renderMinZ <= 0.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3, par4 - 1))
4546            {
4547                i1 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1);
4548            }
4549
4550            f7 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1);
4551            f3 = (this.aoLightValueScratchXZNN + this.aoLightValueScratchXYZNPN + f7 + this.aoLightValueScratchYZPN) / 4.0F;
4552            f4 = (f7 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXZPN + this.aoLightValueScratchXYZPPN) / 4.0F;
4553            f5 = (this.aoLightValueScratchYZNN + f7 + this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXZPN) / 4.0F;
4554            f6 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXZNN + this.aoLightValueScratchYZNN + f7) / 4.0F;
4555            this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, i1);
4556            this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, i1);
4557            this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYZPNN, this.aoBrightnessXZPN, i1);
4558            this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXZNN, this.aoBrightnessYZNN, i1);
4559
4560            if (flag1)
4561            {
4562                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.8F;
4563                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.8F;
4564                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.8F;
4565            }
4566            else
4567            {
4568                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F;
4569                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F;
4570                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F;
4571            }
4572
4573            this.colorRedTopLeft *= f3;
4574            this.colorGreenTopLeft *= f3;
4575            this.colorBlueTopLeft *= f3;
4576            this.colorRedBottomLeft *= f4;
4577            this.colorGreenBottomLeft *= f4;
4578            this.colorBlueBottomLeft *= f4;
4579            this.colorRedBottomRight *= f5;
4580            this.colorGreenBottomRight *= f5;
4581            this.colorBlueBottomRight *= f5;
4582            this.colorRedTopRight *= f6;
4583            this.colorGreenTopRight *= f6;
4584            this.colorBlueTopRight *= f6;
4585            icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 2);
4586            this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, icon);
4587
4588            if (fancyGrass && icon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture())
4589            {
4590                this.colorRedTopLeft *= par5;
4591                this.colorRedBottomLeft *= par5;
4592                this.colorRedBottomRight *= par5;
4593                this.colorRedTopRight *= par5;
4594                this.colorGreenTopLeft *= par6;
4595                this.colorGreenBottomLeft *= par6;
4596                this.colorGreenBottomRight *= par6;
4597                this.colorGreenTopRight *= par6;
4598                this.colorBlueTopLeft *= par7;
4599                this.colorBlueBottomLeft *= par7;
4600                this.colorBlueBottomRight *= par7;
4601                this.colorBlueTopRight *= par7;
4602                this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay());
4603            }
4604
4605            flag = true;
4606        }
4607
4608        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 + 1, 3))
4609        {
4610            if (this.renderMaxZ >= 1.0D)
4611            {
4612                ++par4;
4613            }
4614
4615            this.aoLightValueScratchXZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4);
4616            this.aoLightValueScratchXZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4);
4617            this.aoLightValueScratchYZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4);
4618            this.aoLightValueScratchYZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4);
4619            this.aoBrightnessXZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4);
4620            this.aoBrightnessXZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4);
4621            this.aoBrightnessYZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4);
4622            this.aoBrightnessYZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4);
4623            flag3 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 + 1)];
4624            flag2 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 + 1)];
4625            flag5 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 + 1)];
4626            flag4 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 + 1)];
4627
4628            if (!flag2 && !flag4)
4629            {
4630                this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXZNP;
4631                this.aoBrightnessXYZNNP = this.aoBrightnessXZNP;
4632            }
4633            else
4634            {
4635                this.aoLightValueScratchXYZNNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 - 1, par4);
4636                this.aoBrightnessXYZNNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 - 1, par4);
4637            }
4638
4639            if (!flag2 && !flag5)
4640            {
4641                this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXZNP;
4642                this.aoBrightnessXYZNPP = this.aoBrightnessXZNP;
4643            }
4644            else
4645            {
4646                this.aoLightValueScratchXYZNPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 + 1, par4);
4647                this.aoBrightnessXYZNPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 + 1, par4);
4648            }
4649
4650            if (!flag3 && !flag4)
4651            {
4652                this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXZPP;
4653                this.aoBrightnessXYZPNP = this.aoBrightnessXZPP;
4654            }
4655            else
4656            {
4657                this.aoLightValueScratchXYZPNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 - 1, par4);
4658                this.aoBrightnessXYZPNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 - 1, par4);
4659            }
4660
4661            if (!flag3 && !flag5)
4662            {
4663                this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXZPP;
4664                this.aoBrightnessXYZPPP = this.aoBrightnessXZPP;
4665            }
4666            else
4667            {
4668                this.aoLightValueScratchXYZPPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 + 1, par4);
4669                this.aoBrightnessXYZPPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 + 1, par4);
4670            }
4671
4672            if (this.renderMaxZ >= 1.0D)
4673            {
4674                --par4;
4675            }
4676
4677            i1 = l;
4678
4679            if (this.renderMaxZ >= 1.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3, par4 + 1))
4680            {
4681                i1 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1);
4682            }
4683
4684            f7 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1);
4685            f3 = (this.aoLightValueScratchXZNP + this.aoLightValueScratchXYZNPP + f7 + this.aoLightValueScratchYZPP) / 4.0F;
4686            f6 = (f7 + this.aoLightValueScratchYZPP + this.aoLightValueScratchXZPP + this.aoLightValueScratchXYZPPP) / 4.0F;
4687            f5 = (this.aoLightValueScratchYZNP + f7 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXZPP) / 4.0F;
4688            f4 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXZNP + this.aoLightValueScratchYZNP + f7) / 4.0F;
4689            this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessXZNP, this.aoBrightnessXYZNPP, this.aoBrightnessYZPP, i1);
4690            this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXZPP, this.aoBrightnessXYZPPP, i1);
4691            this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXZPP, i1);
4692            this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXZNP, this.aoBrightnessYZNP, i1);
4693
4694            if (flag1)
4695            {
4696                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.8F;
4697                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.8F;
4698                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.8F;
4699            }
4700            else
4701            {
4702                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F;
4703                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F;
4704                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F;
4705            }
4706
4707            this.colorRedTopLeft *= f3;
4708            this.colorGreenTopLeft *= f3;
4709            this.colorBlueTopLeft *= f3;
4710            this.colorRedBottomLeft *= f4;
4711            this.colorGreenBottomLeft *= f4;
4712            this.colorBlueBottomLeft *= f4;
4713            this.colorRedBottomRight *= f5;
4714            this.colorGreenBottomRight *= f5;
4715            this.colorBlueBottomRight *= f5;
4716            this.colorRedTopRight *= f6;
4717            this.colorGreenTopRight *= f6;
4718            this.colorBlueTopRight *= f6;
4719            icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3);
4720            this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3));
4721
4722            if (fancyGrass && icon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture())
4723            {
4724                this.colorRedTopLeft *= par5;
4725                this.colorRedBottomLeft *= par5;
4726                this.colorRedBottomRight *= par5;
4727                this.colorRedTopRight *= par5;
4728                this.colorGreenTopLeft *= par6;
4729                this.colorGreenBottomLeft *= par6;
4730                this.colorGreenBottomRight *= par6;
4731                this.colorGreenTopRight *= par6;
4732                this.colorBlueTopLeft *= par7;
4733                this.colorBlueBottomLeft *= par7;
4734                this.colorBlueBottomRight *= par7;
4735                this.colorBlueTopRight *= par7;
4736                this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay());
4737            }
4738
4739            flag = true;
4740        }
4741
4742        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 - 1, par3, par4, 4))
4743        {
4744            if (this.renderMinX <= 0.0D)
4745            {
4746                --par2;
4747            }
4748
4749            this.aoLightValueScratchXYNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4);
4750            this.aoLightValueScratchXZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1);
4751            this.aoLightValueScratchXZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1);
4752            this.aoLightValueScratchXYNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4);
4753            this.aoBrightnessXYNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4);
4754            this.aoBrightnessXZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1);
4755            this.aoBrightnessXZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1);
4756            this.aoBrightnessXYNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4);
4757            flag3 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 + 1, par4)];
4758            flag2 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 - 1, par4)];
4759            flag5 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 - 1)];
4760            flag4 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 + 1)];
4761
4762            if (!flag5 && !flag2)
4763            {
4764                this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN;
4765                this.aoBrightnessXYZNNN = this.aoBrightnessXZNN;
4766            }
4767            else
4768            {
4769                this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 - 1);
4770                this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 - 1);
4771            }
4772
4773            if (!flag4 && !flag2)
4774            {
4775                this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXZNP;
4776                this.aoBrightnessXYZNNP = this.aoBrightnessXZNP;
4777            }
4778            else
4779            {
4780                this.aoLightValueScratchXYZNNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 + 1);
4781                this.aoBrightnessXYZNNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 + 1);
4782            }
4783
4784            if (!flag5 && !flag3)
4785            {
4786                this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN;
4787                this.aoBrightnessXYZNPN = this.aoBrightnessXZNN;
4788            }
4789            else
4790            {
4791                this.aoLightValueScratchXYZNPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 - 1);
4792                this.aoBrightnessXYZNPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 - 1);
4793            }
4794
4795            if (!flag4 && !flag3)
4796            {
4797                this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXZNP;
4798                this.aoBrightnessXYZNPP = this.aoBrightnessXZNP;
4799            }
4800            else
4801            {
4802                this.aoLightValueScratchXYZNPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 + 1);
4803                this.aoBrightnessXYZNPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 + 1);
4804            }
4805
4806            if (this.renderMinX <= 0.0D)
4807            {
4808                ++par2;
4809            }
4810
4811            i1 = l;
4812
4813            if (this.renderMinX <= 0.0D || !this.blockAccess.isBlockOpaqueCube(par2 - 1, par3, par4))
4814            {
4815                i1 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4);
4816            }
4817
4818            f7 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4);
4819            f6 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNP + f7 + this.aoLightValueScratchXZNP) / 4.0F;
4820            f3 = (f7 + this.aoLightValueScratchXZNP + this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPP) / 4.0F;
4821            f4 = (this.aoLightValueScratchXZNN + f7 + this.aoLightValueScratchXYZNPN + this.aoLightValueScratchXYNP) / 4.0F;
4822            f5 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXYNN + this.aoLightValueScratchXZNN + f7) / 4.0F;
4823            this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNP, this.aoBrightnessXZNP, i1);
4824            this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessXZNP, this.aoBrightnessXYNP, this.aoBrightnessXYZNPP, i1);
4825            this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessXYNP, i1);
4826            this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXYNN, this.aoBrightnessXZNN, i1);
4827
4828            if (flag1)
4829            {
4830                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.6F;
4831                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.6F;
4832                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.6F;
4833            }
4834            else
4835            {
4836                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.6F;
4837                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.6F;
4838                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.6F;
4839            }
4840
4841            this.colorRedTopLeft *= f3;
4842            this.colorGreenTopLeft *= f3;
4843            this.colorBlueTopLeft *= f3;
4844            this.colorRedBottomLeft *= f4;
4845            this.colorGreenBottomLeft *= f4;
4846            this.colorBlueBottomLeft *= f4;
4847            this.colorRedBottomRight *= f5;
4848            this.colorGreenBottomRight *= f5;
4849            this.colorBlueBottomRight *= f5;
4850            this.colorRedTopRight *= f6;
4851            this.colorGreenTopRight *= f6;
4852            this.colorBlueTopRight *= f6;
4853            icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 4);
4854            this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, icon);
4855
4856            if (fancyGrass && icon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture())
4857            {
4858                this.colorRedTopLeft *= par5;
4859                this.colorRedBottomLeft *= par5;
4860                this.colorRedBottomRight *= par5;
4861                this.colorRedTopRight *= par5;
4862                this.colorGreenTopLeft *= par6;
4863                this.colorGreenBottomLeft *= par6;
4864                this.colorGreenBottomRight *= par6;
4865                this.colorGreenTopRight *= par6;
4866                this.colorBlueTopLeft *= par7;
4867                this.colorBlueBottomLeft *= par7;
4868                this.colorBlueBottomRight *= par7;
4869                this.colorBlueTopRight *= par7;
4870                this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay());
4871            }
4872
4873            flag = true;
4874        }
4875
4876        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 + 1, par3, par4, 5))
4877        {
4878            if (this.renderMaxX >= 1.0D)
4879            {
4880                ++par2;
4881            }
4882
4883            this.aoLightValueScratchXYPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4);
4884            this.aoLightValueScratchXZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1);
4885            this.aoLightValueScratchXZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1);
4886            this.aoLightValueScratchXYPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4);
4887            this.aoBrightnessXYPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4);
4888            this.aoBrightnessXZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1);
4889            this.aoBrightnessXZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1);
4890            this.aoBrightnessXYPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4);
4891            flag3 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 + 1, par4)];
4892            flag2 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 - 1, par4)];
4893            flag5 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 + 1)];
4894            flag4 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 - 1)];
4895
4896            if (!flag2 && !flag4)
4897            {
4898                this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN;
4899                this.aoBrightnessXYZPNN = this.aoBrightnessXZPN;
4900            }
4901            else
4902            {
4903                this.aoLightValueScratchXYZPNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 - 1);
4904                this.aoBrightnessXYZPNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 - 1);
4905            }
4906
4907            if (!flag2 && !flag5)
4908            {
4909                this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXZPP;
4910                this.aoBrightnessXYZPNP = this.aoBrightnessXZPP;
4911            }
4912            else
4913            {
4914                this.aoLightValueScratchXYZPNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 + 1);
4915                this.aoBrightnessXYZPNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 + 1);
4916            }
4917
4918            if (!flag3 && !flag4)
4919            {
4920                this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN;
4921                this.aoBrightnessXYZPPN = this.aoBrightnessXZPN;
4922            }
4923            else
4924            {
4925                this.aoLightValueScratchXYZPPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 - 1);
4926                this.aoBrightnessXYZPPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 - 1);
4927            }
4928
4929            if (!flag3 && !flag5)
4930            {
4931                this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXZPP;
4932                this.aoBrightnessXYZPPP = this.aoBrightnessXZPP;
4933            }
4934            else
4935            {
4936                this.aoLightValueScratchXYZPPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 + 1);
4937                this.aoBrightnessXYZPPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 + 1);
4938            }
4939
4940            if (this.renderMaxX >= 1.0D)
4941            {
4942                --par2;
4943            }
4944
4945            i1 = l;
4946
4947            if (this.renderMaxX >= 1.0D || !this.blockAccess.isBlockOpaqueCube(par2 + 1, par3, par4))
4948            {
4949                i1 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4);
4950            }
4951
4952            f7 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4);
4953            f3 = (this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNP + f7 + this.aoLightValueScratchXZPP) / 4.0F;
4954            f4 = (this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXZPN + f7) / 4.0F;
4955            f5 = (this.aoLightValueScratchXZPN + f7 + this.aoLightValueScratchXYZPPN + this.aoLightValueScratchXYPP) / 4.0F;
4956            f6 = (f7 + this.aoLightValueScratchXZPP + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPP) / 4.0F;
4957            this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessXYPN, this.aoBrightnessXYZPNP, this.aoBrightnessXZPP, i1);
4958            this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessXZPP, this.aoBrightnessXYPP, this.aoBrightnessXYZPPP, i1);
4959            this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, this.aoBrightnessXYPP, i1);
4960            this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessXYZPNN, this.aoBrightnessXYPN, this.aoBrightnessXZPN, i1);
4961
4962            if (flag1)
4963            {
4964                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.6F;
4965                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.6F;
4966                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.6F;
4967            }
4968            else
4969            {
4970                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.6F;
4971                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.6F;
4972                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.6F;
4973            }
4974
4975            this.colorRedTopLeft *= f3;
4976            this.colorGreenTopLeft *= f3;
4977            this.colorBlueTopLeft *= f3;
4978            this.colorRedBottomLeft *= f4;
4979            this.colorGreenBottomLeft *= f4;
4980            this.colorBlueBottomLeft *= f4;
4981            this.colorRedBottomRight *= f5;
4982            this.colorGreenBottomRight *= f5;
4983            this.colorBlueBottomRight *= f5;
4984            this.colorRedTopRight *= f6;
4985            this.colorGreenTopRight *= f6;
4986            this.colorBlueTopRight *= f6;
4987            icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 5);
4988            this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, icon);
4989
4990            if (fancyGrass && icon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture())
4991            {
4992                this.colorRedTopLeft *= par5;
4993                this.colorRedBottomLeft *= par5;
4994                this.colorRedBottomRight *= par5;
4995                this.colorRedTopRight *= par5;
4996                this.colorGreenTopLeft *= par6;
4997                this.colorGreenBottomLeft *= par6;
4998                this.colorGreenBottomRight *= par6;
4999                this.colorGreenTopRight *= par6;
5000                this.colorBlueTopLeft *= par7;
5001                this.colorBlueBottomLeft *= par7;
5002                this.colorBlueBottomRight *= par7;
5003                this.colorBlueTopRight *= par7;
5004                this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay());
5005            }
5006
5007            flag = true;
5008        }
5009
5010        this.enableAO = false;
5011        return flag;
5012    }
5013
5014    public boolean func_102027_b(Block par1Block, int par2, int par3, int par4, float par5, float par6, float par7)
5015    {
5016        this.enableAO = true;
5017        boolean flag = false;
5018        float f3 = 0.0F;
5019        float f4 = 0.0F;
5020        float f5 = 0.0F;
5021        float f6 = 0.0F;
5022        boolean flag1 = true;
5023        int l = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4);
5024        Tessellator tessellator = Tessellator.instance;
5025        tessellator.setBrightness(983055);
5026
5027        if (this.getBlockIcon(par1Block).getIconName().equals("grass_top"))
5028        {
5029            flag1 = false;
5030        }
5031        else if (this.hasOverrideBlockTexture())
5032        {
5033            flag1 = false;
5034        }
5035
5036        boolean flag2;
5037        boolean flag3;
5038        boolean flag4;
5039        boolean flag5;
5040        float f7;
5041        int i1;
5042
5043        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0))
5044        {
5045            if (this.renderMinY <= 0.0D)
5046            {
5047                --par3;
5048            }
5049
5050            this.aoBrightnessXYNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4);
5051            this.aoBrightnessYZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1);
5052            this.aoBrightnessYZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1);
5053            this.aoBrightnessXYPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4);
5054            this.aoLightValueScratchXYNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4);
5055            this.aoLightValueScratchYZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1);
5056            this.aoLightValueScratchYZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1);
5057            this.aoLightValueScratchXYPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4);
5058            flag3 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 - 1, par4)];
5059            flag2 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 - 1, par4)];
5060            flag5 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 + 1)];
5061            flag4 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 - 1)];
5062
5063            if (!flag4 && !flag2)
5064            {
5065                this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN;
5066                this.aoBrightnessXYZNNN = this.aoBrightnessXYNN;
5067            }
5068            else
5069            {
5070                this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 - 1);
5071                this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 - 1);
5072            }
5073
5074            if (!flag5 && !flag2)
5075            {
5076                this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXYNN;
5077                this.aoBrightnessXYZNNP = this.aoBrightnessXYNN;
5078            }
5079            else
5080            {
5081                this.aoLightValueScratchXYZNNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 + 1);
5082                this.aoBrightnessXYZNNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 + 1);
5083            }
5084
5085            if (!flag4 && !flag3)
5086            {
5087                this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXYPN;
5088                this.aoBrightnessXYZPNN = this.aoBrightnessXYPN;
5089            }
5090            else
5091            {
5092                this.aoLightValueScratchXYZPNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 - 1);
5093                this.aoBrightnessXYZPNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 - 1);
5094            }
5095
5096            if (!flag5 && !flag3)
5097            {
5098                this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXYPN;
5099                this.aoBrightnessXYZPNP = this.aoBrightnessXYPN;
5100            }
5101            else
5102            {
5103                this.aoLightValueScratchXYZPNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 + 1);
5104                this.aoBrightnessXYZPNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 + 1);
5105            }
5106
5107            if (this.renderMinY <= 0.0D)
5108            {
5109                ++par3;
5110            }
5111
5112            i1 = l;
5113
5114            if (this.renderMinY <= 0.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3 - 1, par4))
5115            {
5116                i1 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4);
5117            }
5118
5119            f7 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4);
5120            f3 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXYNN + this.aoLightValueScratchYZNP + f7) / 4.0F;
5121            f6 = (this.aoLightValueScratchYZNP + f7 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXYPN) / 4.0F;
5122            f5 = (f7 + this.aoLightValueScratchYZNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNN) / 4.0F;
5123            f4 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNN + f7 + this.aoLightValueScratchYZNN) / 4.0F;
5124            this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXYNN, this.aoBrightnessYZNP, i1);
5125            this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXYPN, i1);
5126            this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYPN, this.aoBrightnessXYZPNN, i1);
5127            this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNN, this.aoBrightnessYZNN, i1);
5128
5129            if (flag1)
5130            {
5131                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.5F;
5132                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.5F;
5133                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.5F;
5134            }
5135            else
5136            {
5137                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.5F;
5138                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.5F;
5139                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.5F;
5140            }
5141
5142            this.colorRedTopLeft *= f3;
5143            this.colorGreenTopLeft *= f3;
5144            this.colorBlueTopLeft *= f3;
5145            this.colorRedBottomLeft *= f4;
5146            this.colorGreenBottomLeft *= f4;
5147            this.colorBlueBottomLeft *= f4;
5148            this.colorRedBottomRight *= f5;
5149            this.colorGreenBottomRight *= f5;
5150            this.colorBlueBottomRight *= f5;
5151            this.colorRedTopRight *= f6;
5152            this.colorGreenTopRight *= f6;
5153            this.colorBlueTopRight *= f6;
5154            this.renderBottomFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0));
5155            flag = true;
5156        }
5157
5158        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1))
5159        {
5160            if (this.renderMaxY >= 1.0D)
5161            {
5162                ++par3;
5163            }
5164
5165            this.aoBrightnessXYNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4);
5166            this.aoBrightnessXYPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4);
5167            this.aoBrightnessYZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1);
5168            this.aoBrightnessYZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1);
5169            this.aoLightValueScratchXYNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4);
5170            this.aoLightValueScratchXYPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4);
5171            this.aoLightValueScratchYZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1);
5172            this.aoLightValueScratchYZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1);
5173            flag3 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 + 1, par4)];
5174            flag2 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 + 1, par4)];
5175            flag5 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 + 1)];
5176            flag4 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 - 1)];
5177
5178            if (!flag4 && !flag2)
5179            {
5180                this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXYNP;
5181                this.aoBrightnessXYZNPN = this.aoBrightnessXYNP;
5182            }
5183            else
5184            {
5185                this.aoLightValueScratchXYZNPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 - 1);
5186                this.aoBrightnessXYZNPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 - 1);
5187            }
5188
5189            if (!flag4 && !flag3)
5190            {
5191                this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXYPP;
5192                this.aoBrightnessXYZPPN = this.aoBrightnessXYPP;
5193            }
5194            else
5195            {
5196                this.aoLightValueScratchXYZPPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 - 1);
5197                this.aoBrightnessXYZPPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 - 1);
5198            }
5199
5200            if (!flag5 && !flag2)
5201            {
5202                this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXYNP;
5203                this.aoBrightnessXYZNPP = this.aoBrightnessXYNP;
5204            }
5205            else
5206            {
5207                this.aoLightValueScratchXYZNPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 + 1);
5208                this.aoBrightnessXYZNPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 + 1);
5209            }
5210
5211            if (!flag5 && !flag3)
5212            {
5213                this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXYPP;
5214                this.aoBrightnessXYZPPP = this.aoBrightnessXYPP;
5215            }
5216            else
5217            {
5218                this.aoLightValueScratchXYZPPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 + 1);
5219                this.aoBrightnessXYZPPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 + 1);
5220            }
5221
5222            if (this.renderMaxY >= 1.0D)
5223            {
5224                --par3;
5225            }
5226
5227            i1 = l;
5228
5229            if (this.renderMaxY >= 1.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3 + 1, par4))
5230            {
5231                i1 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4);
5232            }
5233
5234            f7 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4);
5235            f6 = (this.aoLightValueScratchXYZNPP + this.aoLightValueScratchXYNP + this.aoLightValueScratchYZPP + f7) / 4.0F;
5236            f3 = (this.aoLightValueScratchYZPP + f7 + this.aoLightValueScratchXYZPPP + this.aoLightValueScratchXYPP) / 4.0F;
5237            f4 = (f7 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPN) / 4.0F;
5238            f5 = (this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPN + f7 + this.aoLightValueScratchYZPN) / 4.0F;
5239            this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessXYZNPP, this.aoBrightnessXYNP, this.aoBrightnessYZPP, i1);
5240            this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXYZPPP, this.aoBrightnessXYPP, i1);
5241            this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXYPP, this.aoBrightnessXYZPPN, i1);
5242            this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessXYNP, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, i1);
5243            this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5;
5244            this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6;
5245            this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7;
5246            this.colorRedTopLeft *= f3;
5247            this.colorGreenTopLeft *= f3;
5248            this.colorBlueTopLeft *= f3;
5249            this.colorRedBottomLeft *= f4;
5250            this.colorGreenBottomLeft *= f4;
5251            this.colorBlueBottomLeft *= f4;
5252            this.colorRedBottomRight *= f5;
5253            this.colorGreenBottomRight *= f5;
5254            this.colorBlueBottomRight *= f5;
5255            this.colorRedTopRight *= f6;
5256            this.colorGreenTopRight *= f6;
5257            this.colorBlueTopRight *= f6;
5258            this.renderTopFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1));
5259            flag = true;
5260        }
5261
5262        float f8;
5263        float f9;
5264        float f10;
5265        float f11;
5266        int j1;
5267        int k1;
5268        int l1;
5269        int i2;
5270        Icon icon;
5271
5272        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 - 1, 2))
5273        {
5274            if (this.renderMinZ <= 0.0D)
5275            {
5276                --par4;
5277            }
5278
5279            this.aoLightValueScratchXZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4);
5280            this.aoLightValueScratchYZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4);
5281            this.aoLightValueScratchYZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4);
5282            this.aoLightValueScratchXZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4);
5283            this.aoBrightnessXZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4);
5284            this.aoBrightnessYZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4);
5285            this.aoBrightnessYZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4);
5286            this.aoBrightnessXZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4);
5287            flag3 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 - 1)];
5288            flag2 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 - 1)];
5289            flag5 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 - 1)];
5290            flag4 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 - 1)];
5291
5292            if (!flag2 && !flag4)
5293            {
5294                this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN;
5295                this.aoBrightnessXYZNNN = this.aoBrightnessXZNN;
5296            }
5297            else
5298            {
5299                this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 - 1, par4);
5300                this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 - 1, par4);
5301            }
5302
5303            if (!flag2 && !flag5)
5304            {
5305                this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN;
5306                this.aoBrightnessXYZNPN = this.aoBrightnessXZNN;
5307            }
5308            else
5309            {
5310                this.aoLightValueScratchXYZNPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 + 1, par4);
5311                this.aoBrightnessXYZNPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 + 1, par4);
5312            }
5313
5314            if (!flag3 && !flag4)
5315            {
5316                this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN;
5317                this.aoBrightnessXYZPNN = this.aoBrightnessXZPN;
5318            }
5319            else
5320            {
5321                this.aoLightValueScratchXYZPNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 - 1, par4);
5322                this.aoBrightnessXYZPNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 - 1, par4);
5323            }
5324
5325            if (!flag3 && !flag5)
5326            {
5327                this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN;
5328                this.aoBrightnessXYZPPN = this.aoBrightnessXZPN;
5329            }
5330            else
5331            {
5332                this.aoLightValueScratchXYZPPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 + 1, par4);
5333                this.aoBrightnessXYZPPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 + 1, par4);
5334            }
5335
5336            if (this.renderMinZ <= 0.0D)
5337            {
5338                ++par4;
5339            }
5340
5341            i1 = l;
5342
5343            if (this.renderMinZ <= 0.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3, par4 - 1))
5344            {
5345                i1 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1);
5346            }
5347
5348            f7 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1);
5349            f9 = (this.aoLightValueScratchXZNN + this.aoLightValueScratchXYZNPN + f7 + this.aoLightValueScratchYZPN) / 4.0F;
5350            f8 = (f7 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXZPN + this.aoLightValueScratchXYZPPN) / 4.0F;
5351            f11 = (this.aoLightValueScratchYZNN + f7 + this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXZPN) / 4.0F;
5352            f10 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXZNN + this.aoLightValueScratchYZNN + f7) / 4.0F;
5353            f3 = (float)((double)f9 * this.renderMaxY * (1.0D - this.renderMinX) + (double)f8 * this.renderMinY * this.renderMinX + (double)f11 * (1.0D - this.renderMaxY) * this.renderMinX + (double)f10 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinX));
5354            f4 = (float)((double)f9 * this.renderMaxY * (1.0D - this.renderMaxX) + (double)f8 * this.renderMaxY * this.renderMaxX + (double)f11 * (1.0D - this.renderMaxY) * this.renderMaxX + (double)f10 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX));
5355            f5 = (float)((double)f9 * this.renderMinY * (1.0D - this.renderMaxX) + (double)f8 * this.renderMinY * this.renderMaxX + (double)f11 * (1.0D - this.renderMinY) * this.renderMaxX + (double)f10 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxX));
5356            f6 = (float)((double)f9 * this.renderMinY * (1.0D - this.renderMinX) + (double)f8 * this.renderMinY * this.renderMinX + (double)f11 * (1.0D - this.renderMinY) * this.renderMinX + (double)f10 * (1.0D - this.renderMinY) * (1.0D - this.renderMinX));
5357            k1 = this.getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, i1);
5358            j1 = this.getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, i1);
5359            i2 = this.getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYZPNN, this.aoBrightnessXZPN, i1);
5360            l1 = this.getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXZNN, this.aoBrightnessYZNN, i1);
5361            this.brightnessTopLeft = this.mixAoBrightness(k1, j1, i2, l1, this.renderMaxY * (1.0D - this.renderMinX), this.renderMaxY * this.renderMinX, (1.0D - this.renderMaxY) * this.renderMinX, (1.0D - this.renderMaxY) * (1.0D - this.renderMinX));
5362            this.brightnessBottomLeft = this.mixAoBrightness(k1, j1, i2, l1, this.renderMaxY * (1.0D - this.renderMaxX), this.renderMaxY * this.renderMaxX, (1.0D - this.renderMaxY) * this.renderMaxX, (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX));
5363            this.brightnessBottomRight = this.mixAoBrightness(k1, j1, i2, l1, this.renderMinY * (1.0D - this.renderMaxX), this.renderMinY * this.renderMaxX, (1.0D - this.renderMinY) * this.renderMaxX, (1.0D - this.renderMinY) * (1.0D - this.renderMaxX));
5364            this.brightnessTopRight = this.mixAoBrightness(k1, j1, i2, l1, this.renderMinY * (1.0D - this.renderMinX), this.renderMinY * this.renderMinX, (1.0D - this.renderMinY) * this.renderMinX, (1.0D - this.renderMinY) * (1.0D - this.renderMinX));
5365
5366            if (flag1)
5367            {
5368                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.8F;
5369                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.8F;
5370                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.8F;
5371            }
5372            else
5373            {
5374                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F;
5375                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F;
5376                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F;
5377            }
5378
5379            this.colorRedTopLeft *= f3;
5380            this.colorGreenTopLeft *= f3;
5381            this.colorBlueTopLeft *= f3;
5382            this.colorRedBottomLeft *= f4;
5383            this.colorGreenBottomLeft *= f4;
5384            this.colorBlueBottomLeft *= f4;
5385            this.colorRedBottomRight *= f5;
5386            this.colorGreenBottomRight *= f5;
5387            this.colorBlueBottomRight *= f5;
5388            this.colorRedTopRight *= f6;
5389            this.colorGreenTopRight *= f6;
5390            this.colorBlueTopRight *= f6;
5391            icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 2);
5392            this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, icon);
5393
5394            if (fancyGrass && icon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture())
5395            {
5396                this.colorRedTopLeft *= par5;
5397                this.colorRedBottomLeft *= par5;
5398                this.colorRedBottomRight *= par5;
5399                this.colorRedTopRight *= par5;
5400                this.colorGreenTopLeft *= par6;
5401                this.colorGreenBottomLeft *= par6;
5402                this.colorGreenBottomRight *= par6;
5403                this.colorGreenTopRight *= par6;
5404                this.colorBlueTopLeft *= par7;
5405                this.colorBlueBottomLeft *= par7;
5406                this.colorBlueBottomRight *= par7;
5407                this.colorBlueTopRight *= par7;
5408                this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay());
5409            }
5410
5411            flag = true;
5412        }
5413
5414        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 + 1, 3))
5415        {
5416            if (this.renderMaxZ >= 1.0D)
5417            {
5418                ++par4;
5419            }
5420
5421            this.aoLightValueScratchXZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4);
5422            this.aoLightValueScratchXZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4);
5423            this.aoLightValueScratchYZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4);
5424            this.aoLightValueScratchYZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4);
5425            this.aoBrightnessXZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4);
5426            this.aoBrightnessXZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4);
5427            this.aoBrightnessYZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4);
5428            this.aoBrightnessYZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4);
5429            flag3 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 + 1)];
5430            flag2 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 + 1)];
5431            flag5 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 + 1)];
5432            flag4 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 + 1)];
5433
5434            if (!flag2 && !flag4)
5435            {
5436                this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXZNP;
5437                this.aoBrightnessXYZNNP = this.aoBrightnessXZNP;
5438            }
5439            else
5440            {
5441                this.aoLightValueScratchXYZNNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 - 1, par4);
5442                this.aoBrightnessXYZNNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 - 1, par4);
5443            }
5444
5445            if (!flag2 && !flag5)
5446            {
5447                this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXZNP;
5448                this.aoBrightnessXYZNPP = this.aoBrightnessXZNP;
5449            }
5450            else
5451            {
5452                this.aoLightValueScratchXYZNPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 + 1, par4);
5453                this.aoBrightnessXYZNPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 + 1, par4);
5454            }
5455
5456            if (!flag3 && !flag4)
5457            {
5458                this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXZPP;
5459                this.aoBrightnessXYZPNP = this.aoBrightnessXZPP;
5460            }
5461            else
5462            {
5463                this.aoLightValueScratchXYZPNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 - 1, par4);
5464                this.aoBrightnessXYZPNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 - 1, par4);
5465            }
5466
5467            if (!flag3 && !flag5)
5468            {
5469                this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXZPP;
5470                this.aoBrightnessXYZPPP = this.aoBrightnessXZPP;
5471            }
5472            else
5473            {
5474                this.aoLightValueScratchXYZPPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 + 1, par4);
5475                this.aoBrightnessXYZPPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 + 1, par4);
5476            }
5477
5478            if (this.renderMaxZ >= 1.0D)
5479            {
5480                --par4;
5481            }
5482
5483            i1 = l;
5484
5485            if (this.renderMaxZ >= 1.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3, par4 + 1))
5486            {
5487                i1 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1);
5488            }
5489
5490            f7 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1);
5491            f9 = (this.aoLightValueScratchXZNP + this.aoLightValueScratchXYZNPP + f7 + this.aoLightValueScratchYZPP) / 4.0F;
5492            f8 = (f7 + this.aoLightValueScratchYZPP + this.aoLightValueScratchXZPP + this.aoLightValueScratchXYZPPP) / 4.0F;
5493            f11 = (this.aoLightValueScratchYZNP + f7 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXZPP) / 4.0F;
5494            f10 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXZNP + this.aoLightValueScratchYZNP + f7) / 4.0F;
5495            f3 = (float)((double)f9 * this.renderMaxY * (1.0D - this.renderMinX) + (double)f8 * this.renderMaxY * this.renderMinX + (double)f11 * (1.0D - this.renderMaxY) * this.renderMinX + (double)f10 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinX));
5496            f4 = (float)((double)f9 * this.renderMinY * (1.0D - this.renderMinX) + (double)f8 * this.renderMinY * this.renderMinX + (double)f11 * (1.0D - this.renderMinY) * this.renderMinX + (double)f10 * (1.0D - this.renderMinY) * (1.0D - this.renderMinX));
5497            f5 = (float)((double)f9 * this.renderMinY * (1.0D - this.renderMaxX) + (double)f8 * this.renderMinY * this.renderMaxX + (double)f11 * (1.0D - this.renderMinY) * this.renderMaxX + (double)f10 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxX));
5498            f6 = (float)((double)f9 * this.renderMaxY * (1.0D - this.renderMaxX) + (double)f8 * this.renderMaxY * this.renderMaxX + (double)f11 * (1.0D - this.renderMaxY) * this.renderMaxX + (double)f10 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX));
5499            k1 = this.getAoBrightness(this.aoBrightnessXZNP, this.aoBrightnessXYZNPP, this.aoBrightnessYZPP, i1);
5500            j1 = this.getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXZPP, this.aoBrightnessXYZPPP, i1);
5501            i2 = this.getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXZPP, i1);
5502            l1 = this.getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXZNP, this.aoBrightnessYZNP, i1);
5503            this.brightnessTopLeft = this.mixAoBrightness(k1, l1, i2, j1, this.renderMaxY * (1.0D - this.renderMinX), (1.0D - this.renderMaxY) * (1.0D - this.renderMinX), (1.0D - this.renderMaxY) * this.renderMinX, this.renderMaxY * this.renderMinX);
5504            this.brightnessBottomLeft = this.mixAoBrightness(k1, l1, i2, j1, this.renderMinY * (1.0D - this.renderMinX), (1.0D - this.renderMinY) * (1.0D - this.renderMinX), (1.0D - this.renderMinY) * this.renderMinX, this.renderMinY * this.renderMinX);
5505            this.brightnessBottomRight = this.mixAoBrightness(k1, l1, i2, j1, this.renderMinY * (1.0D - this.renderMaxX), (1.0D - this.renderMinY) * (1.0D - this.renderMaxX), (1.0D - this.renderMinY) * this.renderMaxX, this.renderMinY * this.renderMaxX);
5506            this.brightnessTopRight = this.mixAoBrightness(k1, l1, i2, j1, this.renderMaxY * (1.0D - this.renderMaxX), (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX), (1.0D - this.renderMaxY) * this.renderMaxX, this.renderMaxY * this.renderMaxX);
5507
5508            if (flag1)
5509            {
5510                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.8F;
5511                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.8F;
5512                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.8F;
5513            }
5514            else
5515            {
5516                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F;
5517                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F;
5518                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F;
5519            }
5520
5521            this.colorRedTopLeft *= f3;
5522            this.colorGreenTopLeft *= f3;
5523            this.colorBlueTopLeft *= f3;
5524            this.colorRedBottomLeft *= f4;
5525            this.colorGreenBottomLeft *= f4;
5526            this.colorBlueBottomLeft *= f4;
5527            this.colorRedBottomRight *= f5;
5528            this.colorGreenBottomRight *= f5;
5529            this.colorBlueBottomRight *= f5;
5530            this.colorRedTopRight *= f6;
5531            this.colorGreenTopRight *= f6;
5532            this.colorBlueTopRight *= f6;
5533            icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3);
5534            this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3));
5535
5536            if (fancyGrass && icon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture())
5537            {
5538                this.colorRedTopLeft *= par5;
5539                this.colorRedBottomLeft *= par5;
5540                this.colorRedBottomRight *= par5;
5541                this.colorRedTopRight *= par5;
5542                this.colorGreenTopLeft *= par6;
5543                this.colorGreenBottomLeft *= par6;
5544                this.colorGreenBottomRight *= par6;
5545                this.colorGreenTopRight *= par6;
5546                this.colorBlueTopLeft *= par7;
5547                this.colorBlueBottomLeft *= par7;
5548                this.colorBlueBottomRight *= par7;
5549                this.colorBlueTopRight *= par7;
5550                this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay());
5551            }
5552
5553            flag = true;
5554        }
5555
5556        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 - 1, par3, par4, 4))
5557        {
5558            if (this.renderMinX <= 0.0D)
5559            {
5560                --par2;
5561            }
5562
5563            this.aoLightValueScratchXYNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4);
5564            this.aoLightValueScratchXZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1);
5565            this.aoLightValueScratchXZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1);
5566            this.aoLightValueScratchXYNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4);
5567            this.aoBrightnessXYNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4);
5568            this.aoBrightnessXZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1);
5569            this.aoBrightnessXZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1);
5570            this.aoBrightnessXYNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4);
5571            flag3 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 + 1, par4)];
5572            flag2 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 - 1, par4)];
5573            flag5 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 - 1)];
5574            flag4 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 + 1)];
5575
5576            if (!flag5 && !flag2)
5577            {
5578                this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN;
5579                this.aoBrightnessXYZNNN = this.aoBrightnessXZNN;
5580            }
5581            else
5582            {
5583                this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 - 1);
5584                this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 - 1);
5585            }
5586
5587            if (!flag4 && !flag2)
5588            {
5589                this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXZNP;
5590                this.aoBrightnessXYZNNP = this.aoBrightnessXZNP;
5591            }
5592            else
5593            {
5594                this.aoLightValueScratchXYZNNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 + 1);
5595                this.aoBrightnessXYZNNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 + 1);
5596            }
5597
5598            if (!flag5 && !flag3)
5599            {
5600                this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN;
5601                this.aoBrightnessXYZNPN = this.aoBrightnessXZNN;
5602            }
5603            else
5604            {
5605                this.aoLightValueScratchXYZNPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 - 1);
5606                this.aoBrightnessXYZNPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 - 1);
5607            }
5608
5609            if (!flag4 && !flag3)
5610            {
5611                this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXZNP;
5612                this.aoBrightnessXYZNPP = this.aoBrightnessXZNP;
5613            }
5614            else
5615            {
5616                this.aoLightValueScratchXYZNPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 + 1);
5617                this.aoBrightnessXYZNPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 + 1);
5618            }
5619
5620            if (this.renderMinX <= 0.0D)
5621            {
5622                ++par2;
5623            }
5624
5625            i1 = l;
5626
5627            if (this.renderMinX <= 0.0D || !this.blockAccess.isBlockOpaqueCube(par2 - 1, par3, par4))
5628            {
5629                i1 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4);
5630            }
5631
5632            f7 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4);
5633            f9 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNP + f7 + this.aoLightValueScratchXZNP) / 4.0F;
5634            f8 = (f7 + this.aoLightValueScratchXZNP + this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPP) / 4.0F;
5635            f11 = (this.aoLightValueScratchXZNN + f7 + this.aoLightValueScratchXYZNPN + this.aoLightValueScratchXYNP) / 4.0F;
5636            f10 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXYNN + this.aoLightValueScratchXZNN + f7) / 4.0F;
5637            f3 = (float)((double)f8 * this.renderMaxY * this.renderMaxZ + (double)f11 * this.renderMaxY * (1.0D - this.renderMaxZ) + (double)f10 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ) + (double)f9 * (1.0D - this.renderMaxY) * this.renderMaxZ);
5638            f4 = (float)((double)f8 * this.renderMaxY * this.renderMinZ + (double)f11 * this.renderMaxY * (1.0D - this.renderMinZ) + (double)f10 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ) + (double)f9 * (1.0D - this.renderMaxY) * this.renderMinZ);
5639            f5 = (float)((double)f8 * this.renderMinY * this.renderMinZ + (double)f11 * this.renderMinY * (1.0D - this.renderMinZ) + (double)f10 * (1.0D - this.renderMinY) * (1.0D - this.renderMinZ) + (double)f9 * (1.0D - this.renderMinY) * this.renderMinZ);
5640            f6 = (float)((double)f8 * this.renderMinY * this.renderMaxZ + (double)f11 * this.renderMinY * (1.0D - this.renderMaxZ) + (double)f10 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ) + (double)f9 * (1.0D - this.renderMinY) * this.renderMaxZ);
5641            k1 = this.getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNP, this.aoBrightnessXZNP, i1);
5642            j1 = this.getAoBrightness(this.aoBrightnessXZNP, this.aoBrightnessXYNP, this.aoBrightnessXYZNPP, i1);
5643            i2 = this.getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessXYNP, i1);
5644            l1 = this.getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXYNN, this.aoBrightnessXZNN, i1);
5645            this.brightnessTopLeft = this.mixAoBrightness(j1, i2, l1, k1, this.renderMaxY * this.renderMaxZ, this.renderMaxY * (1.0D - this.renderMaxZ), (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ), (1.0D - this.renderMaxY) * this.renderMaxZ);
5646            this.brightnessBottomLeft = this.mixAoBrightness(j1, i2, l1, k1, this.renderMaxY * this.renderMinZ, this.renderMaxY * (1.0D - this.renderMinZ), (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ), (1.0D - this.renderMaxY) * this.renderMinZ);
5647            this.brightnessBottomRight = this.mixAoBrightness(j1, i2, l1, k1, this.renderMinY * this.renderMinZ, this.renderMinY * (1.0D - this.renderMinZ), (1.0D - this.renderMinY) * (1.0D - this.renderMinZ), (1.0D - this.renderMinY) * this.renderMinZ);
5648            this.brightnessTopRight = this.mixAoBrightness(j1, i2, l1, k1, this.renderMinY * this.renderMaxZ, this.renderMinY * (1.0D - this.renderMaxZ), (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ), (1.0D - this.renderMinY) * this.renderMaxZ);
5649
5650            if (flag1)
5651            {
5652                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.6F;
5653                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.6F;
5654                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.6F;
5655            }
5656            else
5657            {
5658                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.6F;
5659                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.6F;
5660                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.6F;
5661            }
5662
5663            this.colorRedTopLeft *= f3;
5664            this.colorGreenTopLeft *= f3;
5665            this.colorBlueTopLeft *= f3;
5666            this.colorRedBottomLeft *= f4;
5667            this.colorGreenBottomLeft *= f4;
5668            this.colorBlueBottomLeft *= f4;
5669            this.colorRedBottomRight *= f5;
5670            this.colorGreenBottomRight *= f5;
5671            this.colorBlueBottomRight *= f5;
5672            this.colorRedTopRight *= f6;
5673            this.colorGreenTopRight *= f6;
5674            this.colorBlueTopRight *= f6;
5675            icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 4);
5676            this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, icon);
5677
5678            if (fancyGrass && icon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture())
5679            {
5680                this.colorRedTopLeft *= par5;
5681                this.colorRedBottomLeft *= par5;
5682                this.colorRedBottomRight *= par5;
5683                this.colorRedTopRight *= par5;
5684                this.colorGreenTopLeft *= par6;
5685                this.colorGreenBottomLeft *= par6;
5686                this.colorGreenBottomRight *= par6;
5687                this.colorGreenTopRight *= par6;
5688                this.colorBlueTopLeft *= par7;
5689                this.colorBlueBottomLeft *= par7;
5690                this.colorBlueBottomRight *= par7;
5691                this.colorBlueTopRight *= par7;
5692                this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay());
5693            }
5694
5695            flag = true;
5696        }
5697
5698        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 + 1, par3, par4, 5))
5699        {
5700            if (this.renderMaxX >= 1.0D)
5701            {
5702                ++par2;
5703            }
5704
5705            this.aoLightValueScratchXYPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4);
5706            this.aoLightValueScratchXZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1);
5707            this.aoLightValueScratchXZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1);
5708            this.aoLightValueScratchXYPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4);
5709            this.aoBrightnessXYPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4);
5710            this.aoBrightnessXZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1);
5711            this.aoBrightnessXZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1);
5712            this.aoBrightnessXYPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4);
5713            flag3 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 + 1, par4)];
5714            flag2 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 - 1, par4)];
5715            flag5 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 + 1)];
5716            flag4 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 - 1)];
5717
5718            if (!flag2 && !flag4)
5719            {
5720                this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN;
5721                this.aoBrightnessXYZPNN = this.aoBrightnessXZPN;
5722            }
5723            else
5724            {
5725                this.aoLightValueScratchXYZPNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 - 1);
5726                this.aoBrightnessXYZPNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 - 1);
5727            }
5728
5729            if (!flag2 && !flag5)
5730            {
5731                this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXZPP;
5732                this.aoBrightnessXYZPNP = this.aoBrightnessXZPP;
5733            }
5734            else
5735            {
5736                this.aoLightValueScratchXYZPNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 + 1);
5737                this.aoBrightnessXYZPNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 + 1);
5738            }
5739
5740            if (!flag3 && !flag4)
5741            {
5742                this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN;
5743                this.aoBrightnessXYZPPN = this.aoBrightnessXZPN;
5744            }
5745            else
5746            {
5747                this.aoLightValueScratchXYZPPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 - 1);
5748                this.aoBrightnessXYZPPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 - 1);
5749            }
5750
5751            if (!flag3 && !flag5)
5752            {
5753                this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXZPP;
5754                this.aoBrightnessXYZPPP = this.aoBrightnessXZPP;
5755            }
5756            else
5757            {
5758                this.aoLightValueScratchXYZPPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 + 1);
5759                this.aoBrightnessXYZPPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 + 1);
5760            }
5761
5762            if (this.renderMaxX >= 1.0D)
5763            {
5764                --par2;
5765            }
5766
5767            i1 = l;
5768
5769            if (this.renderMaxX >= 1.0D || !this.blockAccess.isBlockOpaqueCube(par2 + 1, par3, par4))
5770            {
5771                i1 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4);
5772            }
5773
5774            f7 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4);
5775            f9 = (this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNP + f7 + this.aoLightValueScratchXZPP) / 4.0F;
5776            f8 = (this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXZPN + f7) / 4.0F;
5777            f11 = (this.aoLightValueScratchXZPN + f7 + this.aoLightValueScratchXYZPPN + this.aoLightValueScratchXYPP) / 4.0F;
5778            f10 = (f7 + this.aoLightValueScratchXZPP + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPP) / 4.0F;
5779            f3 = (float)((double)f9 * (1.0D - this.renderMinY) * this.renderMaxZ + (double)f8 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ) + (double)f11 * this.renderMinY * (1.0D - this.renderMaxZ) + (double)f10 * this.renderMinY * this.renderMaxZ);
5780            f4 = (float)((double)f9 * (1.0D - this.renderMinY) * this.renderMinZ + (double)f8 * (1.0D - this.renderMinY) * (1.0D - this.renderMinZ) + (double)f11 * this.renderMinY * (1.0D - this.renderMinZ) + (double)f10 * this.renderMinY * this.renderMinZ);
5781            f5 = (float)((double)f9 * (1.0D - this.renderMaxY) * this.renderMinZ + (double)f8 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ) + (double)f11 * this.renderMaxY * (1.0D - this.renderMinZ) + (double)f10 * this.renderMaxY * this.renderMinZ);
5782            f6 = (float)((double)f9 * (1.0D - this.renderMaxY) * this.renderMaxZ + (double)f8 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ) + (double)f11 * this.renderMaxY * (1.0D - this.renderMaxZ) + (double)f10 * this.renderMaxY * this.renderMaxZ);
5783            k1 = this.getAoBrightness(this.aoBrightnessXYPN, this.aoBrightnessXYZPNP, this.aoBrightnessXZPP, i1);
5784            j1 = this.getAoBrightness(this.aoBrightnessXZPP, this.aoBrightnessXYPP, this.aoBrightnessXYZPPP, i1);
5785            i2 = this.getAoBrightness(this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, this.aoBrightnessXYPP, i1);
5786            l1 = this.getAoBrightness(this.aoBrightnessXYZPNN, this.aoBrightnessXYPN, this.aoBrightnessXZPN, i1);
5787            this.brightnessTopLeft = this.mixAoBrightness(k1, l1, i2, j1, (1.0D - this.renderMinY) * this.renderMaxZ, (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ), this.renderMinY * (1.0D - this.renderMaxZ), this.renderMinY * this.renderMaxZ);
5788            this.brightnessBottomLeft = this.mixAoBrightness(k1, l1, i2, j1, (1.0D - this.renderMinY) * this.renderMinZ, (1.0D - this.renderMinY) * (1.0D - this.renderMinZ), this.renderMinY * (1.0D - this.renderMinZ), this.renderMinY * this.renderMinZ);
5789            this.brightnessBottomRight = this.mixAoBrightness(k1, l1, i2, j1, (1.0D - this.renderMaxY) * this.renderMinZ, (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ), this.renderMaxY * (1.0D - this.renderMinZ), this.renderMaxY * this.renderMinZ);
5790            this.brightnessTopRight = this.mixAoBrightness(k1, l1, i2, j1, (1.0D - this.renderMaxY) * this.renderMaxZ, (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ), this.renderMaxY * (1.0D - this.renderMaxZ), this.renderMaxY * this.renderMaxZ);
5791
5792            if (flag1)
5793            {
5794                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.6F;
5795                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.6F;
5796                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.6F;
5797            }
5798            else
5799            {
5800                this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.6F;
5801                this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.6F;
5802                this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.6F;
5803            }
5804
5805            this.colorRedTopLeft *= f3;
5806            this.colorGreenTopLeft *= f3;
5807            this.colorBlueTopLeft *= f3;
5808            this.colorRedBottomLeft *= f4;
5809            this.colorGreenBottomLeft *= f4;
5810            this.colorBlueBottomLeft *= f4;
5811            this.colorRedBottomRight *= f5;
5812            this.colorGreenBottomRight *= f5;
5813            this.colorBlueBottomRight *= f5;
5814            this.colorRedTopRight *= f6;
5815            this.colorGreenTopRight *= f6;
5816            this.colorBlueTopRight *= f6;
5817            icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 5);
5818            this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, icon);
5819
5820            if (fancyGrass && icon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture())
5821            {
5822                this.colorRedTopLeft *= par5;
5823                this.colorRedBottomLeft *= par5;
5824                this.colorRedBottomRight *= par5;
5825                this.colorRedTopRight *= par5;
5826                this.colorGreenTopLeft *= par6;
5827                this.colorGreenBottomLeft *= par6;
5828                this.colorGreenBottomRight *= par6;
5829                this.colorGreenTopRight *= par6;
5830                this.colorBlueTopLeft *= par7;
5831                this.colorBlueBottomLeft *= par7;
5832                this.colorBlueBottomRight *= par7;
5833                this.colorBlueTopRight *= par7;
5834                this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay());
5835            }
5836
5837            flag = true;
5838        }
5839
5840        this.enableAO = false;
5841        return flag;
5842    }
5843
5844    /**
5845     * Get ambient occlusion brightness
5846     */
5847    public int getAoBrightness(int par1, int par2, int par3, int par4)
5848    {
5849        if (par1 == 0)
5850        {
5851            par1 = par4;
5852        }
5853
5854        if (par2 == 0)
5855        {
5856            par2 = par4;
5857        }
5858
5859        if (par3 == 0)
5860        {
5861            par3 = par4;
5862        }
5863
5864        return par1 + par2 + par3 + par4 >> 2 & 16711935;
5865    }
5866
5867    public int mixAoBrightness(int par1, int par2, int par3, int par4, double par5, double par7, double par9, double par11)
5868    {
5869        int i1 = (int)((double)(par1 >> 16 & 255) * par5 + (double)(par2 >> 16 & 255) * par7 + (double)(par3 >> 16 & 255) * par9 + (double)(par4 >> 16 & 255) * par11) & 255;
5870        int j1 = (int)((double)(par1 & 255) * par5 + (double)(par2 & 255) * par7 + (double)(par3 & 255) * par9 + (double)(par4 & 255) * par11) & 255;
5871        return i1 << 16 | j1;
5872    }
5873
5874    /**
5875     * Renders a standard cube block at the given coordinates, with a given color ratio.  Args: block, x, y, z, r, g, b
5876     */
5877    public boolean renderStandardBlockWithColorMultiplier(Block par1Block, int par2, int par3, int par4, float par5, float par6, float par7)
5878    {
5879        this.enableAO = false;
5880        Tessellator tessellator = Tessellator.instance;
5881        boolean flag = false;
5882        float f3 = 0.5F;
5883        float f4 = 1.0F;
5884        float f5 = 0.8F;
5885        float f6 = 0.6F;
5886        float f7 = f4 * par5;
5887        float f8 = f4 * par6;
5888        float f9 = f4 * par7;
5889        float f10 = f3;
5890        float f11 = f5;
5891        float f12 = f6;
5892        float f13 = f3;
5893        float f14 = f5;
5894        float f15 = f6;
5895        float f16 = f3;
5896        float f17 = f5;
5897        float f18 = f6;
5898
5899        if (par1Block != Block.grass)
5900        {
5901            f10 = f3 * par5;
5902            f11 = f5 * par5;
5903            f12 = f6 * par5;
5904            f13 = f3 * par6;
5905            f14 = f5 * par6;
5906            f15 = f6 * par6;
5907            f16 = f3 * par7;
5908            f17 = f5 * par7;
5909            f18 = f6 * par7;
5910        }
5911
5912        int l = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4);
5913
5914        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0))
5915        {
5916            tessellator.setBrightness(this.renderMinY > 0.0D ? l : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4));
5917            tessellator.setColorOpaque_F(f10, f13, f16);
5918            this.renderBottomFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0));
5919            flag = true;
5920        }
5921
5922        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1))
5923        {
5924            tessellator.setBrightness(this.renderMaxY < 1.0D ? l : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4));
5925            tessellator.setColorOpaque_F(f7, f8, f9);
5926            this.renderTopFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1));
5927            flag = true;
5928        }
5929
5930        Icon icon;
5931
5932        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 - 1, 2))
5933        {
5934            tessellator.setBrightness(this.renderMinZ > 0.0D ? l : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1));
5935            tessellator.setColorOpaque_F(f11, f14, f17);
5936            icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 2);
5937            this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, icon);
5938
5939            if (fancyGrass && icon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture())
5940            {
5941                tessellator.setColorOpaque_F(f11 * par5, f14 * par6, f17 * par7);
5942                this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay());
5943            }
5944
5945            flag = true;
5946        }
5947
5948        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 + 1, 3))
5949        {
5950            tessellator.setBrightness(this.renderMaxZ < 1.0D ? l : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1));
5951            tessellator.setColorOpaque_F(f11, f14, f17);
5952            icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3);
5953            this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, icon);
5954
5955            if (fancyGrass && icon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture())
5956            {
5957                tessellator.setColorOpaque_F(f11 * par5, f14 * par6, f17 * par7);
5958                this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay());
5959            }
5960
5961            flag = true;
5962        }
5963
5964        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 - 1, par3, par4, 4))
5965        {
5966            tessellator.setBrightness(this.renderMinX > 0.0D ? l : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4));
5967            tessellator.setColorOpaque_F(f12, f15, f18);
5968            icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 4);
5969            this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, icon);
5970
5971            if (fancyGrass && icon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture())
5972            {
5973                tessellator.setColorOpaque_F(f12 * par5, f15 * par6, f18 * par7);
5974                this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay());
5975            }
5976
5977            flag = true;
5978        }
5979
5980        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 + 1, par3, par4, 5))
5981        {
5982            tessellator.setBrightness(this.renderMaxX < 1.0D ? l : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4));
5983            tessellator.setColorOpaque_F(f12, f15, f18);
5984            icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 5);
5985            this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, icon);
5986
5987            if (fancyGrass && icon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture())
5988            {
5989                tessellator.setColorOpaque_F(f12 * par5, f15 * par6, f18 * par7);
5990                this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay());
5991            }
5992
5993            flag = true;
5994        }
5995
5996        return flag;
5997    }
5998
5999    /**
6000     * Renders a Cocoa block at the given coordinates
6001     */
6002    public boolean renderBlockCocoa(BlockCocoa par1BlockCocoa, int par2, int par3, int par4)
6003    {
6004        Tessellator tessellator = Tessellator.instance;
6005        tessellator.setBrightness(par1BlockCocoa.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
6006        tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
6007        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
6008        int i1 = BlockDirectional.getDirection(l);
6009        int j1 = BlockCocoa.func_72219_c(l);
6010        Icon icon = par1BlockCocoa.func_94468_i_(j1);
6011        int k1 = 4 + j1 * 2;
6012        int l1 = 5 + j1 * 2;
6013        double d0 = 15.0D - (double)k1;
6014        double d1 = 15.0D;
6015        double d2 = 4.0D;
6016        double d3 = 4.0D + (double)l1;
6017        double d4 = (double)icon.getInterpolatedU(d0);
6018        double d5 = (double)icon.getInterpolatedU(d1);
6019        double d6 = (double)icon.getInterpolatedV(d2);
6020        double d7 = (double)icon.getInterpolatedV(d3);
6021        double d8 = 0.0D;
6022        double d9 = 0.0D;
6023
6024        switch (i1)
6025        {
6026            case 0:
6027                d8 = 8.0D - (double)(k1 / 2);
6028                d9 = 15.0D - (double)k1;
6029                break;
6030            case 1:
6031                d8 = 1.0D;
6032                d9 = 8.0D - (double)(k1 / 2);
6033                break;
6034            case 2:
6035                d8 = 8.0D - (double)(k1 / 2);
6036                d9 = 1.0D;
6037                break;
6038            case 3:
6039                d8 = 15.0D - (double)k1;
6040                d9 = 8.0D - (double)(k1 / 2);
6041        }
6042
6043        double d10 = (double)par2 + d8 / 16.0D;
6044        double d11 = (double)par2 + (d8 + (double)k1) / 16.0D;
6045        double d12 = (double)par3 + (12.0D - (double)l1) / 16.0D;
6046        double d13 = (double)par3 + 0.75D;
6047        double d14 = (double)par4 + d9 / 16.0D;
6048        double d15 = (double)par4 + (d9 + (double)k1) / 16.0D;
6049        tessellator.addVertexWithUV(d10, d12, d14, d4, d7);
6050        tessellator.addVertexWithUV(d10, d12, d15, d5, d7);
6051        tessellator.addVertexWithUV(d10, d13, d15, d5, d6);
6052        tessellator.addVertexWithUV(d10, d13, d14, d4, d6);
6053        tessellator.addVertexWithUV(d11, d12, d15, d4, d7);
6054        tessellator.addVertexWithUV(d11, d12, d14, d5, d7);
6055        tessellator.addVertexWithUV(d11, d13, d14, d5, d6);
6056        tessellator.addVertexWithUV(d11, d13, d15, d4, d6);
6057        tessellator.addVertexWithUV(d11, d12, d14, d4, d7);
6058        tessellator.addVertexWithUV(d10, d12, d14, d5, d7);
6059        tessellator.addVertexWithUV(d10, d13, d14, d5, d6);
6060        tessellator.addVertexWithUV(d11, d13, d14, d4, d6);
6061        tessellator.addVertexWithUV(d10, d12, d15, d4, d7);
6062        tessellator.addVertexWithUV(d11, d12, d15, d5, d7);
6063        tessellator.addVertexWithUV(d11, d13, d15, d5, d6);
6064        tessellator.addVertexWithUV(d10, d13, d15, d4, d6);
6065        int i2 = k1;
6066
6067        if (j1 >= 2)
6068        {
6069            i2 = k1 - 1;
6070        }
6071
6072        d4 = (double)icon.getMinU();
6073        d5 = (double)icon.getInterpolatedU((double)i2);
6074        d6 = (double)icon.getMinV();
6075        d7 = (double)icon.getInterpolatedV((double)i2);
6076        tessellator.addVertexWithUV(d10, d13, d15, d4, d7);
6077        tessellator.addVertexWithUV(d11, d13, d15, d5, d7);
6078        tessellator.addVertexWithUV(d11, d13, d14, d5, d6);
6079        tessellator.addVertexWithUV(d10, d13, d14, d4, d6);
6080        tessellator.addVertexWithUV(d10, d12, d14, d4, d6);
6081        tessellator.addVertexWithUV(d11, d12, d14, d5, d6);
6082        tessellator.addVertexWithUV(d11, d12, d15, d5, d7);
6083        tessellator.addVertexWithUV(d10, d12, d15, d4, d7);
6084        d4 = (double)icon.getInterpolatedU(12.0D);
6085        d5 = (double)icon.getMaxU();
6086        d6 = (double)icon.getMinV();
6087        d7 = (double)icon.getInterpolatedV(4.0D);
6088        d8 = 8.0D;
6089        d9 = 0.0D;
6090        double d16;
6091
6092        switch (i1)
6093        {
6094            case 0:
6095                d8 = 8.0D;
6096                d9 = 12.0D;
6097                d16 = d4;
6098                d4 = d5;
6099                d5 = d16;
6100                break;
6101            case 1:
6102                d8 = 0.0D;
6103                d9 = 8.0D;
6104                break;
6105            case 2:
6106                d8 = 8.0D;
6107                d9 = 0.0D;
6108                break;
6109            case 3:
6110                d8 = 12.0D;
6111                d9 = 8.0D;
6112                d16 = d4;
6113                d4 = d5;
6114                d5 = d16;
6115        }
6116
6117        d10 = (double)par2 + d8 / 16.0D;
6118        d11 = (double)par2 + (d8 + 4.0D) / 16.0D;
6119        d12 = (double)par3 + 0.75D;
6120        d13 = (double)par3 + 1.0D;
6121        d14 = (double)par4 + d9 / 16.0D;
6122        d15 = (double)par4 + (d9 + 4.0D) / 16.0D;
6123
6124        if (i1 != 2 && i1 != 0)
6125        {
6126            if (i1 == 1 || i1 == 3)
6127            {
6128                tessellator.addVertexWithUV(d11, d12, d14, d4, d7);
6129                tessellator.addVertexWithUV(d10, d12, d14, d5, d7);
6130                tessellator.addVertexWithUV(d10, d13, d14, d5, d6);
6131                tessellator.addVertexWithUV(d11, d13, d14, d4, d6);
6132                tessellator.addVertexWithUV(d10, d12, d14, d5, d7);
6133                tessellator.addVertexWithUV(d11, d12, d14, d4, d7);
6134                tessellator.addVertexWithUV(d11, d13, d14, d4, d6);
6135                tessellator.addVertexWithUV(d10, d13, d14, d5, d6);
6136            }
6137        }
6138        else
6139        {
6140            tessellator.addVertexWithUV(d10, d12, d14, d5, d7);
6141            tessellator.addVertexWithUV(d10, d12, d15, d4, d7);
6142            tessellator.addVertexWithUV(d10, d13, d15, d4, d6);
6143            tessellator.addVertexWithUV(d10, d13, d14, d5, d6);
6144            tessellator.addVertexWithUV(d10, d12, d15, d4, d7);
6145            tessellator.addVertexWithUV(d10, d12, d14, d5, d7);
6146            tessellator.addVertexWithUV(d10, d13, d14, d5, d6);
6147            tessellator.addVertexWithUV(d10, d13, d15, d4, d6);
6148        }
6149
6150        return true;
6151    }
6152
6153    /**
6154     * Renders beacon block
6155     */
6156    public boolean renderBlockBeacon(BlockBeacon par1BlockBeacon, int par2, int par3, int par4)
6157    {
6158        float f = 0.1875F;
6159        this.setOverrideBlockTexture(this.getBlockIcon(Block.obsidian));
6160        this.setRenderBounds(0.125D, 0.0062500000931322575D, 0.125D, 0.875D, (double)f, 0.875D);
6161        this.renderStandardBlock(par1BlockBeacon, par2, par3, par4);
6162        this.setOverrideBlockTexture(this.getBlockIcon(Block.glass));
6163        this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
6164        this.renderStandardBlock(par1BlockBeacon, par2, par3, par4);
6165        this.setOverrideBlockTexture(par1BlockBeacon.func_94446_i());
6166        this.setRenderBounds(0.1875D, (double)f, 0.1875D, 0.8125D, 0.875D, 0.8125D);
6167        this.renderStandardBlock(par1BlockBeacon, par2, par3, par4);
6168        this.clearOverrideBlockTexture();
6169        return true;
6170    }
6171
6172    /**
6173     * Renders a cactus block at the given coordinates
6174     */
6175    public boolean renderBlockCactus(Block par1Block, int par2, int par3, int par4)
6176    {
6177        int l = par1Block.colorMultiplier(this.blockAccess, par2, par3, par4);
6178        float f = (float)(l >> 16 & 255) / 255.0F;
6179        float f1 = (float)(l >> 8 & 255) / 255.0F;
6180        float f2 = (float)(l & 255) / 255.0F;
6181
6182        if (EntityRenderer.anaglyphEnable)
6183        {
6184            float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F;
6185            float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F;
6186            float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F;
6187            f = f3;
6188            f1 = f4;
6189            f2 = f5;
6190        }
6191
6192        return this.renderBlockCactusImpl(par1Block, par2, par3, par4, f, f1, f2);
6193    }
6194
6195    /**
6196     * Render block cactus implementation
6197     */
6198    public boolean renderBlockCactusImpl(Block par1Block, int par2, int par3, int par4, float par5, float par6, float par7)
6199    {
6200        Tessellator tessellator = Tessellator.instance;
6201        boolean flag = false;
6202        float f3 = 0.5F;
6203        float f4 = 1.0F;
6204        float f5 = 0.8F;
6205        float f6 = 0.6F;
6206        float f7 = f3 * par5;
6207        float f8 = f4 * par5;
6208        float f9 = f5 * par5;
6209        float f10 = f6 * par5;
6210        float f11 = f3 * par6;
6211        float f12 = f4 * par6;
6212        float f13 = f5 * par6;
6213        float f14 = f6 * par6;
6214        float f15 = f3 * par7;
6215        float f16 = f4 * par7;
6216        float f17 = f5 * par7;
6217        float f18 = f6 * par7;
6218        float f19 = 0.0625F;
6219        int l = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4);
6220
6221        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0))
6222        {
6223            tessellator.setBrightness(this.renderMinY > 0.0D ? l : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4));
6224            tessellator.setColorOpaque_F(f7, f11, f15);
6225            this.renderBottomFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0));
6226            flag = true;
6227        }
6228
6229        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1))
6230        {
6231            tessellator.setBrightness(this.renderMaxY < 1.0D ? l : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4));
6232            tessellator.setColorOpaque_F(f8, f12, f16);
6233            this.renderTopFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1));
6234            flag = true;
6235        }
6236
6237        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 - 1, 2))
6238        {
6239            tessellator.setBrightness(this.renderMinZ > 0.0D ? l : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1));
6240            tessellator.setColorOpaque_F(f9, f13, f17);
6241            tessellator.addTranslation(0.0F, 0.0F, f19);
6242            this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 2));
6243            tessellator.addTranslation(0.0F, 0.0F, -f19);
6244            flag = true;
6245        }
6246
6247        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 + 1, 3))
6248        {
6249            tessellator.setBrightness(this.renderMaxZ < 1.0D ? l : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1));
6250            tessellator.setColorOpaque_F(f9, f13, f17);
6251            tessellator.addTranslation(0.0F, 0.0F, -f19);
6252            this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3));
6253            tessellator.addTranslation(0.0F, 0.0F, f19);
6254            flag = true;
6255        }
6256
6257        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 - 1, par3, par4, 4))
6258        {
6259            tessellator.setBrightness(this.renderMinX > 0.0D ? l : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4));
6260            tessellator.setColorOpaque_F(f10, f14, f18);
6261            tessellator.addTranslation(f19, 0.0F, 0.0F);
6262            this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 4));
6263            tessellator.addTranslation(-f19, 0.0F, 0.0F);
6264            flag = true;
6265        }
6266
6267        if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 + 1, par3, par4, 5))
6268        {
6269            tessellator.setBrightness(this.renderMaxX < 1.0D ? l : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4));
6270            tessellator.setColorOpaque_F(f10, f14, f18);
6271            tessellator.addTranslation(-f19, 0.0F, 0.0F);
6272            this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 5));
6273            tessellator.addTranslation(f19, 0.0F, 0.0F);
6274            flag = true;
6275        }
6276
6277        return flag;
6278    }
6279
6280    public boolean renderBlockFence(BlockFence par1BlockFence, int par2, int par3, int par4)
6281    {
6282        boolean flag = false;
6283        float f = 0.375F;
6284        float f1 = 0.625F;
6285        this.setRenderBounds((double)f, 0.0D, (double)f, (double)f1, 1.0D, (double)f1);
6286        this.renderStandardBlock(par1BlockFence, par2, par3, par4);
6287        flag = true;
6288        boolean flag1 = false;
6289        boolean flag2 = false;
6290
6291        if (par1BlockFence.canConnectFenceTo(this.blockAccess, par2 - 1, par3, par4) || par1BlockFence.canConnectFenceTo(this.blockAccess, par2 + 1, par3, par4))
6292        {
6293            flag1 = true;
6294        }
6295
6296        if (par1BlockFence.canConnectFenceTo(this.blockAccess, par2, par3, par4 - 1) || par1BlockFence.canConnectFenceTo(this.blockAccess, par2, par3, par4 + 1))
6297        {
6298            flag2 = true;
6299        }
6300
6301        boolean flag3 = par1BlockFence.canConnectFenceTo(this.blockAccess, par2 - 1, par3, par4);
6302        boolean flag4 = par1BlockFence.canConnectFenceTo(this.blockAccess, par2 + 1, par3, par4);
6303        boolean flag5 = par1BlockFence.canConnectFenceTo(this.blockAccess, par2, par3, par4 - 1);
6304        boolean flag6 = par1BlockFence.canConnectFenceTo(this.blockAccess, par2, par3, par4 + 1);
6305
6306        if (!flag1 && !flag2)
6307        {
6308            flag1 = true;
6309        }
6310
6311        f = 0.4375F;
6312        f1 = 0.5625F;
6313        float f2 = 0.75F;
6314        float f3 = 0.9375F;
6315        float f4 = flag3 ? 0.0F : f;
6316        float f5 = flag4 ? 1.0F : f1;
6317        float f6 = flag5 ? 0.0F : f;
6318        float f7 = flag6 ? 1.0F : f1;
6319
6320        if (flag1)
6321        {
6322            this.setRenderBounds((double)f4, (double)f2, (double)f, (double)f5, (double)f3, (double)f1);
6323            this.renderStandardBlock(par1BlockFence, par2, par3, par4);
6324            flag = true;
6325        }
6326
6327        if (flag2)
6328        {
6329            this.setRenderBounds((double)f, (double)f2, (double)f6, (double)f1, (double)f3, (double)f7);
6330            this.renderStandardBlock(par1BlockFence, par2, par3, par4);
6331            flag = true;
6332        }
6333
6334        f2 = 0.375F;
6335        f3 = 0.5625F;
6336
6337        if (flag1)
6338        {
6339            this.setRenderBounds((double)f4, (double)f2, (double)f, (double)f5, (double)f3, (double)f1);
6340            this.renderStandardBlock(par1BlockFence, par2, par3, par4);
6341            flag = true;
6342        }
6343
6344        if (flag2)
6345        {
6346            this.setRenderBounds((double)f, (double)f2, (double)f6, (double)f1, (double)f3, (double)f7);
6347            this.renderStandardBlock(par1BlockFence, par2, par3, par4);
6348            flag = true;
6349        }
6350
6351        par1BlockFence.setBlockBoundsBasedOnState(this.blockAccess, par2, par3, par4);
6352        return flag;
6353    }
6354
6355    /**
6356     * Renders wall block
6357     */
6358    public boolean renderBlockWall(BlockWall par1BlockWall, int par2, int par3, int par4)
6359    {
6360        boolean flag = par1BlockWall.canConnectWallTo(this.blockAccess, par2 - 1, par3, par4);
6361        boolean flag1 = par1BlockWall.canConnectWallTo(this.blockAccess, par2 + 1, par3, par4);
6362        boolean flag2 = par1BlockWall.canConnectWallTo(this.blockAccess, par2, par3, par4 - 1);
6363        boolean flag3 = par1BlockWall.canConnectWallTo(this.blockAccess, par2, par3, par4 + 1);
6364        boolean flag4 = flag2 && flag3 && !flag && !flag1;
6365        boolean flag5 = !flag2 && !flag3 && flag && flag1;
6366        boolean flag6 = this.blockAccess.isAirBlock(par2, par3 + 1, par4);
6367
6368        if ((flag4 || flag5) && flag6)
6369        {
6370            if (flag4)
6371            {
6372                this.setRenderBounds(0.3125D, 0.0D, 0.0D, 0.6875D, 0.8125D, 1.0D);
6373                this.renderStandardBlock(par1BlockWall, par2, par3, par4);
6374            }
6375            else
6376            {
6377                this.setRenderBounds(0.0D, 0.0D, 0.3125D, 1.0D, 0.8125D, 0.6875D);
6378                this.renderStandardBlock(par1BlockWall, par2, par3, par4);
6379            }
6380        }
6381        else
6382        {
6383            this.setRenderBounds(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D);
6384            this.renderStandardBlock(par1BlockWall, par2, par3, par4);
6385
6386            if (flag)
6387            {
6388                this.setRenderBounds(0.0D, 0.0D, 0.3125D, 0.25D, 0.8125D, 0.6875D);
6389                this.renderStandardBlock(par1BlockWall, par2, par3, par4);
6390            }
6391
6392            if (flag1)
6393            {
6394                this.setRenderBounds(0.75D, 0.0D, 0.3125D, 1.0D, 0.8125D, 0.6875D);
6395                this.renderStandardBlock(par1BlockWall, par2, par3, par4);
6396            }
6397
6398            if (flag2)
6399            {
6400                this.setRenderBounds(0.3125D, 0.0D, 0.0D, 0.6875D, 0.8125D, 0.25D);
6401                this.renderStandardBlock(par1BlockWall, par2, par3, par4);
6402            }
6403
6404            if (flag3)
6405            {
6406                this.setRenderBounds(0.3125D, 0.0D, 0.75D, 0.6875D, 0.8125D, 1.0D);
6407                this.renderStandardBlock(par1BlockWall, par2, par3, par4);
6408            }
6409        }
6410
6411        par1BlockWall.setBlockBoundsBasedOnState(this.blockAccess, par2, par3, par4);
6412        return true;
6413    }
6414
6415    public boolean renderBlockDragonEgg(BlockDragonEgg par1BlockDragonEgg, int par2, int par3, int par4)
6416    {
6417        boolean flag = false;
6418        int l = 0;
6419
6420        for (int i1 = 0; i1 < 8; ++i1)
6421        {
6422            byte b0 = 0;
6423            byte b1 = 1;
6424
6425            if (i1 == 0)
6426            {
6427                b0 = 2;
6428            }
6429
6430            if (i1 == 1)
6431            {
6432                b0 = 3;
6433            }
6434
6435            if (i1 == 2)
6436            {
6437                b0 = 4;
6438            }
6439
6440            if (i1 == 3)
6441            {
6442                b0 = 5;
6443                b1 = 2;
6444            }
6445
6446            if (i1 == 4)
6447            {
6448                b0 = 6;
6449                b1 = 3;
6450            }
6451
6452            if (i1 == 5)
6453            {
6454                b0 = 7;
6455                b1 = 5;
6456            }
6457
6458            if (i1 == 6)
6459            {
6460                b0 = 6;
6461                b1 = 2;
6462            }
6463
6464            if (i1 == 7)
6465            {
6466                b0 = 3;
6467            }
6468
6469            float f = (float)b0 / 16.0F;
6470            float f1 = 1.0F - (float)l / 16.0F;
6471            float f2 = 1.0F - (float)(l + b1) / 16.0F;
6472            l += b1;
6473            this.setRenderBounds((double)(0.5F - f), (double)f2, (double)(0.5F - f), (double)(0.5F + f), (double)f1, (double)(0.5F + f));
6474            this.renderStandardBlock(par1BlockDragonEgg, par2, par3, par4);
6475        }
6476
6477        flag = true;
6478        this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
6479        return flag;
6480    }
6481
6482    /**
6483     * Render block fence gate
6484     */
6485    public boolean renderBlockFenceGate(BlockFenceGate par1BlockFenceGate, int par2, int par3, int par4)
6486    {
6487        boolean flag = true;
6488        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
6489        boolean flag1 = BlockFenceGate.isFenceGateOpen(l);
6490        int i1 = BlockDirectional.getDirection(l);
6491        float f = 0.375F;
6492        float f1 = 0.5625F;
6493        float f2 = 0.75F;
6494        float f3 = 0.9375F;
6495        float f4 = 0.3125F;
6496        float f5 = 1.0F;
6497
6498        if ((i1 == 2 || i1 == 0) && this.blockAccess.getBlockId(par2 - 1, par3, par4) == Block.cobblestoneWall.blockID && this.blockAccess.getBlockId(par2 + 1, par3, par4) == Block.cobblestoneWall.blockID || (i1 == 3 || i1 == 1) && this.blockAccess.getBlockId(par2, par3, par4 - 1) == Block.cobblestoneWall.blockID && this.blockAccess.getBlockId(par2, par3, par4 + 1) == Block.cobblestoneWall.blockID)
6499        {
6500            f -= 0.1875F;
6501            f1 -= 0.1875F;
6502            f2 -= 0.1875F;
6503            f3 -= 0.1875F;
6504            f4 -= 0.1875F;
6505            f5 -= 0.1875F;
6506        }
6507
6508        this.renderAllFaces = true;
6509        float f6;
6510        float f7;
6511        float f8;
6512        float f9;
6513
6514        if (i1 != 3 && i1 != 1)
6515        {
6516            f6 = 0.0F;
6517            f8 = 0.125F;
6518            f7 = 0.4375F;
6519            f9 = 0.5625F;
6520            this.setRenderBounds((double)f6, (double)f4, (double)f7, (double)f8, (double)f5, (double)f9);
6521            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6522            f6 = 0.875F;
6523            f8 = 1.0F;
6524            this.setRenderBounds((double)f6, (double)f4, (double)f7, (double)f8, (double)f5, (double)f9);
6525            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6526        }
6527        else
6528        {
6529            this.uvRotateTop = 1;
6530            f6 = 0.4375F;
6531            f8 = 0.5625F;
6532            f7 = 0.0F;
6533            f9 = 0.125F;
6534            this.setRenderBounds((double)f6, (double)f4, (double)f7, (double)f8, (double)f5, (double)f9);
6535            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6536            f7 = 0.875F;
6537            f9 = 1.0F;
6538            this.setRenderBounds((double)f6, (double)f4, (double)f7, (double)f8, (double)f5, (double)f9);
6539            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6540            this.uvRotateTop = 0;
6541        }
6542
6543        if (flag1)
6544        {
6545            if (i1 == 2 || i1 == 0)
6546            {
6547                this.uvRotateTop = 1;
6548            }
6549
6550            if (i1 == 3)
6551            {
6552                this.setRenderBounds(0.8125D, (double)f, 0.0D, 0.9375D, (double)f3, 0.125D);
6553                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6554                this.setRenderBounds(0.8125D, (double)f, 0.875D, 0.9375D, (double)f3, 1.0D);
6555                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6556                this.setRenderBounds(0.5625D, (double)f, 0.0D, 0.8125D, (double)f1, 0.125D);
6557                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6558                this.setRenderBounds(0.5625D, (double)f, 0.875D, 0.8125D, (double)f1, 1.0D);
6559                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6560                this.setRenderBounds(0.5625D, (double)f2, 0.0D, 0.8125D, (double)f3, 0.125D);
6561                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6562                this.setRenderBounds(0.5625D, (double)f2, 0.875D, 0.8125D, (double)f3, 1.0D);
6563                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6564            }
6565            else if (i1 == 1)
6566            {
6567                this.setRenderBounds(0.0625D, (double)f, 0.0D, 0.1875D, (double)f3, 0.125D);
6568                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6569                this.setRenderBounds(0.0625D, (double)f, 0.875D, 0.1875D, (double)f3, 1.0D);
6570                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6571                this.setRenderBounds(0.1875D, (double)f, 0.0D, 0.4375D, (double)f1, 0.125D);
6572                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6573                this.setRenderBounds(0.1875D, (double)f, 0.875D, 0.4375D, (double)f1, 1.0D);
6574                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6575                this.setRenderBounds(0.1875D, (double)f2, 0.0D, 0.4375D, (double)f3, 0.125D);
6576                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6577                this.setRenderBounds(0.1875D, (double)f2, 0.875D, 0.4375D, (double)f3, 1.0D);
6578                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6579            }
6580            else if (i1 == 0)
6581            {
6582                this.setRenderBounds(0.0D, (double)f, 0.8125D, 0.125D, (double)f3, 0.9375D);
6583                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6584                this.setRenderBounds(0.875D, (double)f, 0.8125D, 1.0D, (double)f3, 0.9375D);
6585                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6586                this.setRenderBounds(0.0D, (double)f, 0.5625D, 0.125D, (double)f1, 0.8125D);
6587                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6588                this.setRenderBounds(0.875D, (double)f, 0.5625D, 1.0D, (double)f1, 0.8125D);
6589                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6590                this.setRenderBounds(0.0D, (double)f2, 0.5625D, 0.125D, (double)f3, 0.8125D);
6591                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6592                this.setRenderBounds(0.875D, (double)f2, 0.5625D, 1.0D, (double)f3, 0.8125D);
6593                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6594            }
6595            else if (i1 == 2)
6596            {
6597                this.setRenderBounds(0.0D, (double)f, 0.0625D, 0.125D, (double)f3, 0.1875D);
6598                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6599                this.setRenderBounds(0.875D, (double)f, 0.0625D, 1.0D, (double)f3, 0.1875D);
6600                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6601                this.setRenderBounds(0.0D, (double)f, 0.1875D, 0.125D, (double)f1, 0.4375D);
6602                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6603                this.setRenderBounds(0.875D, (double)f, 0.1875D, 1.0D, (double)f1, 0.4375D);
6604                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6605                this.setRenderBounds(0.0D, (double)f2, 0.1875D, 0.125D, (double)f3, 0.4375D);
6606                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6607                this.setRenderBounds(0.875D, (double)f2, 0.1875D, 1.0D, (double)f3, 0.4375D);
6608                this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6609            }
6610        }
6611        else if (i1 != 3 && i1 != 1)
6612        {
6613            f6 = 0.375F;
6614            f8 = 0.5F;
6615            f7 = 0.4375F;
6616            f9 = 0.5625F;
6617            this.setRenderBounds((double)f6, (double)f, (double)f7, (double)f8, (double)f3, (double)f9);
6618            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6619            f6 = 0.5F;
6620            f8 = 0.625F;
6621            this.setRenderBounds((double)f6, (double)f, (double)f7, (double)f8, (double)f3, (double)f9);
6622            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6623            f6 = 0.625F;
6624            f8 = 0.875F;
6625            this.setRenderBounds((double)f6, (double)f, (double)f7, (double)f8, (double)f1, (double)f9);
6626            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6627            this.setRenderBounds((double)f6, (double)f2, (double)f7, (double)f8, (double)f3, (double)f9);
6628            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6629            f6 = 0.125F;
6630            f8 = 0.375F;
6631            this.setRenderBounds((double)f6, (double)f, (double)f7, (double)f8, (double)f1, (double)f9);
6632            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6633            this.setRenderBounds((double)f6, (double)f2, (double)f7, (double)f8, (double)f3, (double)f9);
6634            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6635        }
6636        else
6637        {
6638            this.uvRotateTop = 1;
6639            f6 = 0.4375F;
6640            f8 = 0.5625F;
6641            f7 = 0.375F;
6642            f9 = 0.5F;
6643            this.setRenderBounds((double)f6, (double)f, (double)f7, (double)f8, (double)f3, (double)f9);
6644            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6645            f7 = 0.5F;
6646            f9 = 0.625F;
6647            this.setRenderBounds((double)f6, (double)f, (double)f7, (double)f8, (double)f3, (double)f9);
6648            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6649            f7 = 0.625F;
6650            f9 = 0.875F;
6651            this.setRenderBounds((double)f6, (double)f, (double)f7, (double)f8, (double)f1, (double)f9);
6652            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6653            this.setRenderBounds((double)f6, (double)f2, (double)f7, (double)f8, (double)f3, (double)f9);
6654            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6655            f7 = 0.125F;
6656            f9 = 0.375F;
6657            this.setRenderBounds((double)f6, (double)f, (double)f7, (double)f8, (double)f1, (double)f9);
6658            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6659            this.setRenderBounds((double)f6, (double)f2, (double)f7, (double)f8, (double)f3, (double)f9);
6660            this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4);
6661        }
6662
6663        this.renderAllFaces = false;
6664        this.uvRotateTop = 0;
6665        this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
6666        return flag;
6667    }
6668
6669    public boolean renderBlockHopper(BlockHopper par1BlockHopper, int par2, int par3, int par4)
6670    {
6671        Tessellator tessellator = Tessellator.instance;
6672        tessellator.setBrightness(par1BlockHopper.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
6673        float f = 1.0F;
6674        int l = par1BlockHopper.colorMultiplier(this.blockAccess, par2, par3, par4);
6675        float f1 = (float)(l >> 16 & 255) / 255.0F;
6676        float f2 = (float)(l >> 8 & 255) / 255.0F;
6677        float f3 = (float)(l & 255) / 255.0F;
6678
6679        if (EntityRenderer.anaglyphEnable)
6680        {
6681            float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
6682            float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
6683            float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
6684            f1 = f4;
6685            f2 = f5;
6686            f3 = f6;
6687        }
6688
6689        tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
6690        return this.renderBlockHopperMetadata(par1BlockHopper, par2, par3, par4, this.blockAccess.getBlockMetadata(par2, par3, par4), false);
6691    }
6692
6693    public boolean renderBlockHopperMetadata(BlockHopper par1BlockHopper, int par2, int par3, int par4, int par5, boolean par6)
6694    {
6695        Tessellator tessellator = Tessellator.instance;
6696        int i1 = BlockHopper.getDirectionFromMetadata(par5);
6697        double d0 = 0.625D;
6698        this.setRenderBounds(0.0D, d0, 0.0D, 1.0D, 1.0D, 1.0D);
6699
6700        if (par6)
6701        {
6702            tessellator.startDrawingQuads();
6703            tessellator.setNormal(0.0F, -1.0F, 0.0F);
6704            this.renderBottomFace(par1BlockHopper, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockHopper, 0, par5));
6705            tessellator.draw();
6706            tessellator.startDrawingQuads();
6707            tessellator.setNormal(0.0F, 1.0F, 0.0F);
6708            this.renderTopFace(par1BlockHopper, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockHopper, 1, par5));
6709            tessellator.draw();
6710            tessellator.startDrawingQuads();
6711            tessellator.setNormal(0.0F, 0.0F, -1.0F);
6712            this.renderEastFace(par1BlockHopper, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockHopper, 2, par5));
6713            tessellator.draw();
6714            tessellator.startDrawingQuads();
6715            tessellator.setNormal(0.0F, 0.0F, 1.0F);
6716            this.renderWestFace(par1BlockHopper, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockHopper, 3, par5));
6717            tessellator.draw();
6718            tessellator.startDrawingQuads();
6719            tessellator.setNormal(-1.0F, 0.0F, 0.0F);
6720            this.renderNorthFace(par1BlockHopper, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockHopper, 4, par5));
6721            tessellator.draw();
6722            tessellator.startDrawingQuads();
6723            tessellator.setNormal(1.0F, 0.0F, 0.0F);
6724            this.renderSouthFace(par1BlockHopper, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockHopper, 5, par5));
6725            tessellator.draw();
6726        }
6727        else
6728        {
6729            this.renderStandardBlock(par1BlockHopper, par2, par3, par4);
6730        }
6731
6732        float f;
6733
6734        if (!par6)
6735        {
6736            tessellator.setBrightness(par1BlockHopper.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4));
6737            float f1 = 1.0F;
6738            int j1 = par1BlockHopper.colorMultiplier(this.blockAccess, par2, par3, par4);
6739            f = (float)(j1 >> 16 & 255) / 255.0F;
6740            float f2 = (float)(j1 >> 8 & 255) / 255.0F;
6741            float f3 = (float)(j1 & 255) / 255.0F;
6742
6743            if (EntityRenderer.anaglyphEnable)
6744            {
6745                float f4 = (f * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
6746                float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F;
6747                float f6 = (f * 30.0F + f3 * 70.0F) / 100.0F;
6748                f = f4;
6749                f2 = f5;
6750                f3 = f6;
6751            }
6752
6753            tessellator.setColorOpaque_F(f1 * f, f1 * f2, f1 * f3);
6754        }
6755
6756        Icon icon = BlockHopper.getHopperIcon("hopper");
6757        Icon icon1 = BlockHopper.getHopperIcon("hopper_inside");
6758        f = 0.125F;
6759
6760        if (par6)
6761        {
6762            tessellator.startDrawingQuads();
6763            tessellator.setNormal(1.0F, 0.0F, 0.0F);
6764            this.renderSouthFace(par1BlockHopper, (double)(-1.0F + f), 0.0D, 0.0D, icon);
6765            tessellator.draw();
6766            tessellator.startDrawingQuads();
6767            tessellator.setNormal(-1.0F, 0.0F, 0.0F);
6768            this.renderNorthFace(par1BlockHopper, (double)(1.0F - f), 0.0D, 0.0D, icon);
6769            tessellator.draw();
6770            tessellator.startDrawingQuads();
6771            tessellator.setNormal(0.0F, 0.0F, 1.0F);
6772            this.renderWestFace(par1BlockHopper, 0.0D, 0.0D, (double)(-1.0F + f), icon);
6773            tessellator.draw();
6774            tessellator.startDrawingQuads();
6775            tessellator.setNormal(0.0F, 0.0F, -1.0F);
6776            this.renderEastFace(par1BlockHopper, 0.0D, 0.0D, (double)(1.0F - f), icon);
6777            tessellator.draw();
6778            tessellator.startDrawingQuads();
6779            tessellator.setNormal(0.0F, 1.0F, 0.0F);
6780            this.renderTopFace(par1BlockHopper, 0.0D, -1.0D + d0, 0.0D, icon1);
6781            tessellator.draw();
6782        }
6783        else
6784        {
6785            this.renderSouthFace(par1BlockHopper, (double)((float)par2 - 1.0F + f), (double)par3, (double)par4, icon);
6786            this.renderNorthFace(par1BlockHopper, (double)((float)par2 + 1.0F - f), (double)par3, (double)par4, icon);
6787            this.renderWestFace(par1BlockHopper, (double)par2, (double)par3, (double)((float)par4 - 1.0F + f), icon);
6788            this.renderEastFace(par1BlockHopper, (double)par2, (double)par3, (double)((float)par4 + 1.0F - f), icon);
6789            this.renderTopFace(par1BlockHopper, (double)par2, (double)((float)par3 - 1.0F) + d0, (double)par4, icon1);
6790        }
6791
6792        this.setOverrideBlockTexture(icon);
6793        double d1 = 0.25D;
6794        double d2 = 0.25D;
6795        this.setRenderBounds(d1, d2, d1, 1.0D - d1, d0 - 0.002D, 1.0D - d1);
6796
6797        if (par6)
6798        {
6799            tessellator.startDrawingQuads();
6800            tessellator.setNormal(1.0F, 0.0F, 0.0F);
6801            this.renderSouthFace(par1BlockHopper, 0.0D, 0.0D, 0.0D, icon);
6802            tessellator.draw();
6803            tessellator.startDrawingQuads();
6804            tessellator.setNormal(-1.0F, 0.0F, 0.0F);
6805            this.renderNorthFace(par1BlockHopper, 0.0D, 0.0D, 0.0D, icon);
6806            tessellator.draw();
6807            tessellator.startDrawingQuads();
6808            tessellator.setNormal(0.0F, 0.0F, 1.0F);
6809            this.renderWestFace(par1BlockHopper, 0.0D, 0.0D, 0.0D, icon);
6810            tessellator.draw();
6811            tessellator.startDrawingQuads();
6812            tessellator.setNormal(0.0F, 0.0F, -1.0F);
6813            this.renderEastFace(par1BlockHopper, 0.0D, 0.0D, 0.0D, icon);
6814            tessellator.draw();
6815            tessellator.startDrawingQuads();
6816            tessellator.setNormal(0.0F, 1.0F, 0.0F);
6817            this.renderTopFace(par1BlockHopper, 0.0D, 0.0D, 0.0D, icon);
6818            tessellator.draw();
6819            tessellator.startDrawingQuads();
6820            tessellator.setNormal(0.0F, -1.0F, 0.0F);
6821            this.renderBottomFace(par1BlockHopper, 0.0D, 0.0D, 0.0D, icon);
6822            tessellator.draw();
6823        }
6824        else
6825        {
6826            this.renderStandardBlock(par1BlockHopper, par2, par3, par4);
6827        }
6828
6829        if (!par6)
6830        {
6831            double d3 = 0.375D;
6832            double d4 = 0.25D;
6833            this.setOverrideBlockTexture(icon);
6834
6835            if (i1 == 0)
6836            {
6837                this.setRenderBounds(d3, 0.0D, d3, 1.0D - d3, 0.25D, 1.0D - d3);
6838                this.renderStandardBlock(par1BlockHopper, par2, par3, par4);
6839            }
6840
6841            if (i1 == 2)
6842            {
6843                this.setRenderBounds(d3, d2, 0.0D, 1.0D - d3, d2 + d4, d1);
6844                this.renderStandardBlock(par1BlockHopper, par2, par3, par4);
6845            }
6846
6847            if (i1 == 3)
6848            {
6849                this.setRenderBounds(d3, d2, 1.0D - d1, 1.0D - d3, d2 + d4, 1.0D);
6850                this.renderStandardBlock(par1BlockHopper, par2, par3, par4);
6851            }
6852
6853            if (i1 == 4)
6854            {
6855                this.setRenderBounds(0.0D, d2, d3, d1, d2 + d4, 1.0D - d3);
6856                this.renderStandardBlock(par1BlockHopper, par2, par3, par4);
6857            }
6858
6859            if (i1 == 5)
6860            {
6861                this.setRenderBounds(1.0D - d1, d2, d3, 1.0D, d2 + d4, 1.0D - d3);
6862                this.renderStandardBlock(par1BlockHopper, par2, par3, par4);
6863            }
6864        }
6865
6866        this.clearOverrideBlockTexture();
6867        return true;
6868    }
6869
6870    /**
6871     * Renders a stair block at the given coordinates
6872     */
6873    public boolean renderBlockStairs(BlockStairs par1BlockStairs, int par2, int par3, int par4)
6874    {
6875        par1BlockStairs.func_82541_d(this.blockAccess, par2, par3, par4);
6876        this.setRenderBoundsFromBlock(par1BlockStairs);
6877        this.renderStandardBlock(par1BlockStairs, par2, par3, par4);
6878        boolean flag = par1BlockStairs.func_82542_g(this.blockAccess, par2, par3, par4);
6879        this.setRenderBoundsFromBlock(par1BlockStairs);
6880        this.renderStandardBlock(par1BlockStairs, par2, par3, par4);
6881
6882        if (flag && par1BlockStairs.func_82544_h(this.blockAccess, par2, par3, par4))
6883        {
6884            this.setRenderBoundsFromBlock(par1BlockStairs);
6885            this.renderStandardBlock(par1BlockStairs, par2, par3, par4);
6886        }
6887
6888        return true;
6889    }
6890
6891    /**
6892     * Renders a door block at the given coordinates
6893     */
6894    public boolean renderBlockDoor(Block par1Block, int par2, int par3, int par4)
6895    {
6896        Tessellator tessellator = Tessellator.instance;
6897        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
6898
6899        if ((l & 8) != 0)
6900        {
6901            if (this.blockAccess.getBlockId(par2, par3 - 1, par4) != par1Block.blockID)
6902            {
6903                return false;
6904            }
6905        }
6906        else if (this.blockAccess.getBlockId(par2, par3 + 1, par4) != par1Block.blockID)
6907        {
6908            return false;
6909        }
6910
6911        boolean flag = false;
6912        float f = 0.5F;
6913        float f1 = 1.0F;
6914        float f2 = 0.8F;
6915        float f3 = 0.6F;
6916        int i1 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4);
6917        tessellator.setBrightness(this.renderMinY > 0.0D ? i1 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4));
6918        tessellator.setColorOpaque_F(f, f, f);
6919        this.renderBottomFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0));
6920        flag = true;
6921        tessellator.setBrightness(this.renderMaxY < 1.0D ? i1 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4));
6922        tessellator.setColorOpaque_F(f1, f1, f1);
6923        this.renderTopFace(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1));
6924        flag = true;
6925        tessellator.setBrightness(this.renderMinZ > 0.0D ? i1 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1));
6926        tessellator.setColorOpaque_F(f2, f2, f2);
6927        Icon icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 2);
6928        this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, icon);
6929        flag = true;
6930        this.flipTexture = false;
6931        tessellator.setBrightness(this.renderMaxZ < 1.0D ? i1 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1));
6932        tessellator.setColorOpaque_F(f2, f2, f2);
6933        icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3);
6934        this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, icon);
6935        flag = true;
6936        this.flipTexture = false;
6937        tessellator.setBrightness(this.renderMinX > 0.0D ? i1 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4));
6938        tessellator.setColorOpaque_F(f3, f3, f3);
6939        icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 4);
6940        this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, icon);
6941        flag = true;
6942        this.flipTexture = false;
6943        tessellator.setBrightness(this.renderMaxX < 1.0D ? i1 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4));
6944        tessellator.setColorOpaque_F(f3, f3, f3);
6945        icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 5);
6946        this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, icon);
6947        flag = true;
6948        this.flipTexture = false;
6949        return flag;
6950    }
6951
6952    /**
6953     * Renders the given texture to the bottom face of the block. Args: block, x, y, z, texture
6954     */
6955    public void renderBottomFace(Block par1Block, double par2, double par4, double par6, Icon par8Icon)
6956    {
6957        Tessellator tessellator = Tessellator.instance;
6958
6959        if (this.hasOverrideBlockTexture())
6960        {
6961            par8Icon = this.overrideBlockTexture;
6962        }
6963
6964        double d3 = (double)par8Icon.getInterpolatedU(this.renderMinX * 16.0D);
6965        double d4 = (double)par8Icon.getInterpolatedU(this.renderMaxX * 16.0D);
6966        double d5 = (double)par8Icon.getInterpolatedV(this.renderMinZ * 16.0D);
6967        double d6 = (double)par8Icon.getInterpolatedV(this.renderMaxZ * 16.0D);
6968
6969        if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D)
6970        {
6971            d3 = (double)par8Icon.getMinU();
6972            d4 = (double)par8Icon.getMaxU();
6973        }
6974
6975        if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D)
6976        {
6977            d5 = (double)par8Icon.getMinV();
6978            d6 = (double)par8Icon.getMaxV();
6979        }
6980
6981        double d7 = d4;
6982        double d8 = d3;
6983        double d9 = d5;
6984        double d10 = d6;
6985
6986        if (this.uvRotateBottom == 2)
6987        {
6988            d3 = (double)par8Icon.getInterpolatedU(this.renderMinZ * 16.0D);
6989            d5 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxX * 16.0D);
6990            d4 = (double)par8Icon.getInterpolatedU(this.renderMaxZ * 16.0D);
6991            d6 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinX * 16.0D);
6992            d9 = d5;
6993            d10 = d6;
6994            d7 = d3;
6995            d8 = d4;
6996            d5 = d6;
6997            d6 = d9;
6998        }
6999        else if (this.uvRotateBottom == 1)
7000        {
7001            d3 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D);
7002            d5 = (double)par8Icon.getInterpolatedV(this.renderMinX * 16.0D);
7003            d4 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinZ * 16.0D);
7004            d6 = (double)par8Icon.getInterpolatedV(this.renderMaxX * 16.0D);
7005            d7 = d4;
7006            d8 = d3;
7007            d3 = d4;
7008            d4 = d8;
7009            d9 = d6;
7010            d10 = d5;
7011        }
7012        else if (this.uvRotateBottom == 3)
7013        {
7014            d3 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinX * 16.0D);
7015            d4 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxX * 16.0D);
7016            d5 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinZ * 16.0D);
7017            d6 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D);
7018            d7 = d4;
7019            d8 = d3;
7020            d9 = d5;
7021            d10 = d6;
7022        }
7023
7024        double d11 = par2 + this.renderMinX;
7025        double d12 = par2 + this.renderMaxX;
7026        double d13 = par4 + this.renderMinY;
7027        double d14 = par6 + this.renderMinZ;
7028        double d15 = par6 + this.renderMaxZ;
7029
7030        if (this.enableAO)
7031        {
7032            tessellator.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft);
7033            tessellator.setBrightness(this.brightnessTopLeft);
7034            tessellator.addVertexWithUV(d11, d13, d15, d8, d10);
7035            tessellator.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft);
7036            tessellator.setBrightness(this.brightnessBottomLeft);
7037            tessellator.addVertexWithUV(d11, d13, d14, d3, d5);
7038            tessellator.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight);
7039            tessellator.setBrightness(this.brightnessBottomRight);
7040            tessellator.addVertexWithUV(d12, d13, d14, d7, d9);
7041            tessellator.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight);
7042            tessellator.setBrightness(this.brightnessTopRight);
7043            tessellator.addVertexWithUV(d12, d13, d15, d4, d6);
7044        }
7045        else
7046        {
7047            tessellator.addVertexWithUV(d11, d13, d15, d8, d10);
7048            tessellator.addVertexWithUV(d11, d13, d14, d3, d5);
7049            tessellator.addVertexWithUV(d12, d13, d14, d7, d9);
7050            tessellator.addVertexWithUV(d12, d13, d15, d4, d6);
7051        }
7052    }
7053
7054    /**
7055     * Renders the given texture to the top face of the block. Args: block, x, y, z, texture
7056     */
7057    public void renderTopFace(Block par1Block, double par2, double par4, double par6, Icon par8Icon)
7058    {
7059        Tessellator tessellator = Tessellator.instance;
7060
7061        if (this.hasOverrideBlockTexture())
7062        {
7063            par8Icon = this.overrideBlockTexture;
7064        }
7065
7066        double d3 = (double)par8Icon.getInterpolatedU(this.renderMinX * 16.0D);
7067        double d4 = (double)par8Icon.getInterpolatedU(this.renderMaxX * 16.0D);
7068        double d5 = (double)par8Icon.getInterpolatedV(this.renderMinZ * 16.0D);
7069        double d6 = (double)par8Icon.getInterpolatedV(this.renderMaxZ * 16.0D);
7070
7071        if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D)
7072        {
7073            d3 = (double)par8Icon.getMinU();
7074            d4 = (double)par8Icon.getMaxU();
7075        }
7076
7077        if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D)
7078        {
7079            d5 = (double)par8Icon.getMinV();
7080            d6 = (double)par8Icon.getMaxV();
7081        }
7082
7083        double d7 = d4;
7084        double d8 = d3;
7085        double d9 = d5;
7086        double d10 = d6;
7087
7088        if (this.uvRotateTop == 1)
7089        {
7090            d3 = (double)par8Icon.getInterpolatedU(this.renderMinZ * 16.0D);
7091            d5 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxX * 16.0D);
7092            d4 = (double)par8Icon.getInterpolatedU(this.renderMaxZ * 16.0D);
7093            d6 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinX * 16.0D);
7094            d9 = d5;
7095            d10 = d6;
7096            d7 = d3;
7097            d8 = d4;
7098            d5 = d6;
7099            d6 = d9;
7100        }
7101        else if (this.uvRotateTop == 2)
7102        {
7103            d3 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D);
7104            d5 = (double)par8Icon.getInterpolatedV(this.renderMinX * 16.0D);
7105            d4 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinZ * 16.0D);
7106            d6 = (double)par8Icon.getInterpolatedV(this.renderMaxX * 16.0D);
7107            d7 = d4;
7108            d8 = d3;
7109            d3 = d4;
7110            d4 = d8;
7111            d9 = d6;
7112            d10 = d5;
7113        }
7114        else if (this.uvRotateTop == 3)
7115        {
7116            d3 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinX * 16.0D);
7117            d4 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxX * 16.0D);
7118            d5 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinZ * 16.0D);
7119            d6 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D);
7120            d7 = d4;
7121            d8 = d3;
7122            d9 = d5;
7123            d10 = d6;
7124        }
7125
7126        double d11 = par2 + this.renderMinX;
7127        double d12 = par2 + this.renderMaxX;
7128        double d13 = par4 + this.renderMaxY;
7129        double d14 = par6 + this.renderMinZ;
7130        double d15 = par6 + this.renderMaxZ;
7131
7132        if (this.enableAO)
7133        {
7134            tessellator.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft);
7135            tessellator.setBrightness(this.brightnessTopLeft);
7136            tessellator.addVertexWithUV(d12, d13, d15, d4, d6);
7137            tessellator.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft);
7138            tessellator.setBrightness(this.brightnessBottomLeft);
7139            tessellator.addVertexWithUV(d12, d13, d14, d7, d9);
7140            tessellator.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight);
7141            tessellator.setBrightness(this.brightnessBottomRight);
7142            tessellator.addVertexWithUV(d11, d13, d14, d3, d5);
7143            tessellator.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight);
7144            tessellator.setBrightness(this.brightnessTopRight);
7145            tessellator.addVertexWithUV(d11, d13, d15, d8, d10);
7146        }
7147        else
7148        {
7149            tessellator.addVertexWithUV(d12, d13, d15, d4, d6);
7150            tessellator.addVertexWithUV(d12, d13, d14, d7, d9);
7151            tessellator.addVertexWithUV(d11, d13, d14, d3, d5);
7152            tessellator.addVertexWithUV(d11, d13, d15, d8, d10);
7153        }
7154    }
7155
7156    /**
7157     * Renders the given texture to the east (z-negative) face of the block.  Args: block, x, y, z, texture
7158     */
7159    public void renderEastFace(Block par1Block, double par2, double par4, double par6, Icon par8Icon)
7160    {
7161        Tessellator tessellator = Tessellator.instance;
7162
7163        if (this.hasOverrideBlockTexture())
7164        {
7165            par8Icon = this.overrideBlockTexture;
7166        }
7167
7168        double d3 = (double)par8Icon.getInterpolatedU(this.renderMinX * 16.0D);
7169        double d4 = (double)par8Icon.getInterpolatedU(this.renderMaxX * 16.0D);
7170        double d5 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxY * 16.0D);
7171        double d6 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinY * 16.0D);
7172        double d7;
7173
7174        if (this.flipTexture)
7175        {
7176            d7 = d3;
7177            d3 = d4;
7178            d4 = d7;
7179        }
7180
7181        if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D)
7182        {
7183            d3 = (double)par8Icon.getMinU();
7184            d4 = (double)par8Icon.getMaxU();
7185        }
7186
7187        if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D)
7188        {
7189            d5 = (double)par8Icon.getMinV();
7190            d6 = (double)par8Icon.getMaxV();
7191        }
7192
7193        d7 = d4;
7194        double d8 = d3;
7195        double d9 = d5;
7196        double d10 = d6;
7197
7198        if (this.uvRotateEast == 2)
7199        {
7200            d3 = (double)par8Icon.getInterpolatedU(this.renderMinY * 16.0D);
7201            d5 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinX * 16.0D);
7202            d4 = (double)par8Icon.getInterpolatedU(this.renderMaxY * 16.0D);
7203            d6 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxX * 16.0D);
7204            d9 = d5;
7205            d10 = d6;
7206            d7 = d3;
7207            d8 = d4;
7208            d5 = d6;
7209            d6 = d9;
7210        }
7211        else if (this.uvRotateEast == 1)
7212        {
7213            d3 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxY * 16.0D);
7214            d5 = (double)par8Icon.getInterpolatedV(this.renderMaxX * 16.0D);
7215            d4 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinY * 16.0D);
7216            d6 = (double)par8Icon.getInterpolatedV(this.renderMinX * 16.0D);
7217            d7 = d4;
7218            d8 = d3;
7219            d3 = d4;
7220            d4 = d8;
7221            d9 = d6;
7222            d10 = d5;
7223        }
7224        else if (this.uvRotateEast == 3)
7225        {
7226            d3 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinX * 16.0D);
7227            d4 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxX * 16.0D);
7228            d5 = (double)par8Icon.getInterpolatedV(this.renderMaxY * 16.0D);
7229            d6 = (double)par8Icon.getInterpolatedV(this.renderMinY * 16.0D);
7230            d7 = d4;
7231            d8 = d3;
7232            d9 = d5;
7233            d10 = d6;
7234        }
7235
7236        double d11 = par2 + this.renderMinX;
7237        double d12 = par2 + this.renderMaxX;
7238        double d13 = par4 + this.renderMinY;
7239        double d14 = par4 + this.renderMaxY;
7240        double d15 = par6 + this.renderMinZ;
7241
7242        if (this.enableAO)
7243        {
7244            tessellator.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft);
7245            tessellator.setBrightness(this.brightnessTopLeft);
7246            tessellator.addVertexWithUV(d11, d14, d15, d7, d9);
7247            tessellator.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft);
7248            tessellator.setBrightness(this.brightnessBottomLeft);
7249            tessellator.addVertexWithUV(d12, d14, d15, d3, d5);
7250            tessellator.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight);
7251            tessellator.setBrightness(this.brightnessBottomRight);
7252            tessellator.addVertexWithUV(d12, d13, d15, d8, d10);
7253            tessellator.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight);
7254            tessellator.setBrightness(this.brightnessTopRight);
7255            tessellator.addVertexWithUV(d11, d13, d15, d4, d6);
7256        }
7257        else
7258        {
7259            tessellator.addVertexWithUV(d11, d14, d15, d7, d9);
7260            tessellator.addVertexWithUV(d12, d14, d15, d3, d5);
7261            tessellator.addVertexWithUV(d12, d13, d15, d8, d10);
7262            tessellator.addVertexWithUV(d11, d13, d15, d4, d6);
7263        }
7264    }
7265
7266    /**
7267     * Renders the given texture to the west (z-positive) face of the block.  Args: block, x, y, z, texture
7268     */
7269    public void renderWestFace(Block par1Block, double par2, double par4, double par6, Icon par8Icon)
7270    {
7271        Tessellator tessellator = Tessellator.instance;
7272
7273        if (this.hasOverrideBlockTexture())
7274        {
7275            par8Icon = this.overrideBlockTexture;
7276        }
7277
7278        double d3 = (double)par8Icon.getInterpolatedU(this.renderMinX * 16.0D);
7279        double d4 = (double)par8Icon.getInterpolatedU(this.renderMaxX * 16.0D);
7280        double d5 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxY * 16.0D);
7281        double d6 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinY * 16.0D);
7282        double d7;
7283
7284        if (this.flipTexture)
7285        {
7286            d7 = d3;
7287            d3 = d4;
7288            d4 = d7;
7289        }
7290
7291        if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D)
7292        {
7293            d3 = (double)par8Icon.getMinU();
7294            d4 = (double)par8Icon.getMaxU();
7295        }
7296
7297        if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D)
7298        {
7299            d5 = (double)par8Icon.getMinV();
7300            d6 = (double)par8Icon.getMaxV();
7301        }
7302
7303        d7 = d4;
7304        double d8 = d3;
7305        double d9 = d5;
7306        double d10 = d6;
7307
7308        if (this.uvRotateWest == 1)
7309        {
7310            d3 = (double)par8Icon.getInterpolatedU(this.renderMinY * 16.0D);
7311            d6 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinX * 16.0D);
7312            d4 = (double)par8Icon.getInterpolatedU(this.renderMaxY * 16.0D);
7313            d5 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxX * 16.0D);
7314            d9 = d5;
7315            d10 = d6;
7316            d7 = d3;
7317            d8 = d4;
7318            d5 = d6;
7319            d6 = d9;
7320        }
7321        else if (this.uvRotateWest == 2)
7322        {
7323            d3 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxY * 16.0D);
7324            d5 = (double)par8Icon.getInterpolatedV(this.renderMinX * 16.0D);
7325            d4 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinY * 16.0D);
7326            d6 = (double)par8Icon.getInterpolatedV(this.renderMaxX * 16.0D);
7327            d7 = d4;
7328            d8 = d3;
7329            d3 = d4;
7330            d4 = d8;
7331            d9 = d6;
7332            d10 = d5;
7333        }
7334        else if (this.uvRotateWest == 3)
7335        {
7336            d3 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinX * 16.0D);
7337            d4 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxX * 16.0D);
7338            d5 = (double)par8Icon.getInterpolatedV(this.renderMaxY * 16.0D);
7339            d6 = (double)par8Icon.getInterpolatedV(this.renderMinY * 16.0D);
7340            d7 = d4;
7341            d8 = d3;
7342            d9 = d5;
7343            d10 = d6;
7344        }
7345
7346        double d11 = par2 + this.renderMinX;
7347        double d12 = par2 + this.renderMaxX;
7348        double d13 = par4 + this.renderMinY;
7349        double d14 = par4 + this.renderMaxY;
7350        double d15 = par6 + this.renderMaxZ;
7351
7352        if (this.enableAO)
7353        {
7354            tessellator.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft);
7355            tessellator.setBrightness(this.brightnessTopLeft);
7356            tessellator.addVertexWithUV(d11, d14, d15, d3, d5);
7357            tessellator.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft);
7358            tessellator.setBrightness(this.brightnessBottomLeft);
7359            tessellator.addVertexWithUV(d11, d13, d15, d8, d10);
7360            tessellator.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight);
7361            tessellator.setBrightness(this.brightnessBottomRight);
7362            tessellator.addVertexWithUV(d12, d13, d15, d4, d6);
7363            tessellator.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight);
7364            tessellator.setBrightness(this.brightnessTopRight);
7365            tessellator.addVertexWithUV(d12, d14, d15, d7, d9);
7366        }
7367        else
7368        {
7369            tessellator.addVertexWithUV(d11, d14, d15, d3, d5);
7370            tessellator.addVertexWithUV(d11, d13, d15, d8, d10);
7371            tessellator.addVertexWithUV(d12, d13, d15, d4, d6);
7372            tessellator.addVertexWithUV(d12, d14, d15, d7, d9);
7373        }
7374    }
7375
7376    /**
7377     * Renders the given texture to the north (x-negative) face of the block.  Args: block, x, y, z, texture
7378     */
7379    public void renderNorthFace(Block par1Block, double par2, double par4, double par6, Icon par8Icon)
7380    {
7381        Tessellator tessellator = Tessellator.instance;
7382
7383        if (this.hasOverrideBlockTexture())
7384        {
7385            par8Icon = this.overrideBlockTexture;
7386        }
7387
7388        double d3 = (double)par8Icon.getInterpolatedU(this.renderMinZ * 16.0D);
7389        double d4 = (double)par8Icon.getInterpolatedU(this.renderMaxZ * 16.0D);
7390        double d5 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxY * 16.0D);
7391        double d6 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinY * 16.0D);
7392        double d7;
7393
7394        if (this.flipTexture)
7395        {
7396            d7 = d3;
7397            d3 = d4;
7398            d4 = d7;
7399        }
7400
7401        if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D)
7402        {
7403            d3 = (double)par8Icon.getMinU();
7404            d4 = (double)par8Icon.getMaxU();
7405        }
7406
7407        if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D)
7408        {
7409            d5 = (double)par8Icon.getMinV();
7410            d6 = (double)par8Icon.getMaxV();
7411        }
7412
7413        d7 = d4;
7414        double d8 = d3;
7415        double d9 = d5;
7416        double d10 = d6;
7417
7418        if (this.uvRotateNorth == 1)
7419        {
7420            d3 = (double)par8Icon.getInterpolatedU(this.renderMinY * 16.0D);
7421            d5 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D);
7422            d4 = (double)par8Icon.getInterpolatedU(this.renderMaxY * 16.0D);
7423            d6 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinZ * 16.0D);
7424            d9 = d5;
7425            d10 = d6;
7426            d7 = d3;
7427            d8 = d4;
7428            d5 = d6;
7429            d6 = d9;
7430        }
7431        else if (this.uvRotateNorth == 2)
7432        {
7433            d3 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxY * 16.0D);
7434            d5 = (double)par8Icon.getInterpolatedV(this.renderMinZ * 16.0D);
7435            d4 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinY * 16.0D);
7436            d6 = (double)par8Icon.getInterpolatedV(this.renderMaxZ * 16.0D);
7437            d7 = d4;
7438            d8 = d3;
7439            d3 = d4;
7440            d4 = d8;
7441            d9 = d6;
7442            d10 = d5;
7443        }
7444        else if (this.uvRotateNorth == 3)
7445        {
7446            d3 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinZ * 16.0D);
7447            d4 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D);
7448            d5 = (double)par8Icon.getInterpolatedV(this.renderMaxY * 16.0D);
7449            d6 = (double)par8Icon.getInterpolatedV(this.renderMinY * 16.0D);
7450            d7 = d4;
7451            d8 = d3;
7452            d9 = d5;
7453            d10 = d6;
7454        }
7455
7456        double d11 = par2 + this.renderMinX;
7457        double d12 = par4 + this.renderMinY;
7458        double d13 = par4 + this.renderMaxY;
7459        double d14 = par6 + this.renderMinZ;
7460        double d15 = par6 + this.renderMaxZ;
7461
7462        if (this.enableAO)
7463        {
7464            tessellator.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft);
7465            tessellator.setBrightness(this.brightnessTopLeft);
7466            tessellator.addVertexWithUV(d11, d13, d15, d7, d9);
7467            tessellator.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft);
7468            tessellator.setBrightness(this.brightnessBottomLeft);
7469            tessellator.addVertexWithUV(d11, d13, d14, d3, d5);
7470            tessellator.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight);
7471            tessellator.setBrightness(this.brightnessBottomRight);
7472            tessellator.addVertexWithUV(d11, d12, d14, d8, d10);
7473            tessellator.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight);
7474            tessellator.setBrightness(this.brightnessTopRight);
7475            tessellator.addVertexWithUV(d11, d12, d15, d4, d6);
7476        }
7477        else
7478        {
7479            tessellator.addVertexWithUV(d11, d13, d15, d7, d9);
7480            tessellator.addVertexWithUV(d11, d13, d14, d3, d5);
7481            tessellator.addVertexWithUV(d11, d12, d14, d8, d10);
7482            tessellator.addVertexWithUV(d11, d12, d15, d4, d6);
7483        }
7484    }
7485
7486    /**
7487     * Renders the given texture to the south (x-positive) face of the block.  Args: block, x, y, z, texture
7488     */
7489    public void renderSouthFace(Block par1Block, double par2, double par4, double par6, Icon par8Icon)
7490    {
7491        Tessellator tessellator = Tessellator.instance;
7492
7493        if (this.hasOverrideBlockTexture())
7494        {
7495            par8Icon = this.overrideBlockTexture;
7496        }
7497
7498        double d3 = (double)par8Icon.getInterpolatedU(this.renderMinZ * 16.0D);
7499        double d4 = (double)par8Icon.getInterpolatedU(this.renderMaxZ * 16.0D);
7500        double d5 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxY * 16.0D);
7501        double d6 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinY * 16.0D);
7502        double d7;
7503
7504        if (this.flipTexture)
7505        {
7506            d7 = d3;
7507            d3 = d4;
7508            d4 = d7;
7509        }
7510
7511        if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D)
7512        {
7513            d3 = (double)par8Icon.getMinU();
7514            d4 = (double)par8Icon.getMaxU();
7515        }
7516
7517        if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D)
7518        {
7519            d5 = (double)par8Icon.getMinV();
7520            d6 = (double)par8Icon.getMaxV();
7521        }
7522
7523        d7 = d4;
7524        double d8 = d3;
7525        double d9 = d5;
7526        double d10 = d6;
7527
7528        if (this.uvRotateSouth == 2)
7529        {
7530            d3 = (double)par8Icon.getInterpolatedU(this.renderMinY * 16.0D);
7531            d5 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinZ * 16.0D);
7532            d4 = (double)par8Icon.getInterpolatedU(this.renderMaxY * 16.0D);
7533            d6 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D);
7534            d9 = d5;
7535            d10 = d6;
7536            d7 = d3;
7537            d8 = d4;
7538            d5 = d6;
7539            d6 = d9;
7540        }
7541        else if (this.uvRotateSouth == 1)
7542        {
7543            d3 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxY * 16.0D);
7544            d5 = (double)par8Icon.getInterpolatedV(this.renderMaxZ * 16.0D);
7545            d4 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinY * 16.0D);
7546            d6 = (double)par8Icon.getInterpolatedV(this.renderMinZ * 16.0D);
7547            d7 = d4;
7548            d8 = d3;
7549            d3 = d4;
7550            d4 = d8;
7551            d9 = d6;
7552            d10 = d5;
7553        }
7554        else if (this.uvRotateSouth == 3)
7555        {
7556            d3 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinZ * 16.0D);
7557            d4 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D);
7558            d5 = (double)par8Icon.getInterpolatedV(this.renderMaxY * 16.0D);
7559            d6 = (double)par8Icon.getInterpolatedV(this.renderMinY * 16.0D);
7560            d7 = d4;
7561            d8 = d3;
7562            d9 = d5;
7563            d10 = d6;
7564        }
7565
7566        double d11 = par2 + this.renderMaxX;
7567        double d12 = par4 + this.renderMinY;
7568        double d13 = par4 + this.renderMaxY;
7569        double d14 = par6 + this.renderMinZ;
7570        double d15 = par6 + this.renderMaxZ;
7571
7572        if (this.enableAO)
7573        {
7574            tessellator.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft);
7575            tessellator.setBrightness(this.brightnessTopLeft);
7576            tessellator.addVertexWithUV(d11, d12, d15, d8, d10);
7577            tessellator.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft);
7578            tessellator.setBrightness(this.brightnessBottomLeft);
7579            tessellator.addVertexWithUV(d11, d12, d14, d4, d6);
7580            tessellator.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight);
7581            tessellator.setBrightness(this.brightnessBottomRight);
7582            tessellator.addVertexWithUV(d11, d13, d14, d7, d9);
7583            tessellator.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight);
7584            tessellator.setBrightness(this.brightnessTopRight);
7585            tessellator.addVertexWithUV(d11, d13, d15, d3, d5);
7586        }
7587        else
7588        {
7589            tessellator.addVertexWithUV(d11, d12, d15, d8, d10);
7590            tessellator.addVertexWithUV(d11, d12, d14, d4, d6);
7591            tessellator.addVertexWithUV(d11, d13, d14, d7, d9);
7592            tessellator.addVertexWithUV(d11, d13, d15, d3, d5);
7593        }
7594    }
7595
7596    /**
7597     * Is called to render the image of a block on an inventory, as a held item, or as a an item on the ground
7598     */
7599    public void renderBlockAsItem(Block par1Block, int par2, float par3)
7600    {
7601        Tessellator tessellator = Tessellator.instance;
7602        boolean flag = par1Block.blockID == Block.grass.blockID;
7603
7604        if (par1Block == Block.dispenser || par1Block == Block.dropper || par1Block == Block.furnaceIdle)
7605        {
7606            par2 = 3;
7607        }
7608
7609        int j;
7610        float f1;
7611        float f2;
7612        float f3;
7613
7614        if (this.useInventoryTint)
7615        {
7616            j = par1Block.getRenderColor(par2);
7617
7618            if (flag)
7619            {
7620                j = 16777215;
7621            }
7622
7623            f1 = (float)(j >> 16 & 255) / 255.0F;
7624            f2 = (float)(j >> 8 & 255) / 255.0F;
7625            f3 = (float)(j & 255) / 255.0F;
7626            GL11.glColor4f(f1 * par3, f2 * par3, f3 * par3, 1.0F);
7627        }
7628
7629        j = par1Block.getRenderType();
7630        this.setRenderBoundsFromBlock(par1Block);
7631        int k;
7632
7633        if (j != 0 && j != 31 && j != 39 && j != 16 && j != 26)
7634        {
7635            if (j == 1)
7636            {
7637                tessellator.startDrawingQuads();
7638                tessellator.setNormal(0.0F, -1.0F, 0.0F);
7639                this.drawCrossedSquares(par1Block, par2, -0.5D, -0.5D, -0.5D, 1.0F);
7640                tessellator.draw();
7641            }
7642            else if (j == 19)
7643            {
7644                tessellator.startDrawingQuads();
7645                tessellator.setNormal(0.0F, -1.0F, 0.0F);
7646                par1Block.setBlockBoundsForItemRender();
7647                this.renderBlockStemSmall(par1Block, par2, this.renderMaxY, -0.5D, -0.5D, -0.5D);
7648                tessellator.draw();
7649            }
7650            else if (j == 23)
7651            {
7652                tessellator.startDrawingQuads();
7653                tessellator.setNormal(0.0F, -1.0F, 0.0F);
7654                par1Block.setBlockBoundsForItemRender();
7655                tessellator.draw();
7656            }
7657            else if (j == 13)
7658            {
7659                par1Block.setBlockBoundsForItemRender();
7660                GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
7661                f1 = 0.0625F;
7662                tessellator.startDrawingQuads();
7663                tessellator.setNormal(0.0F, -1.0F, 0.0F);
7664                this.renderBottomFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 0));
7665                tessellator.draw();
7666                tessellator.startDrawingQuads();
7667                tessellator.setNormal(0.0F, 1.0F, 0.0F);
7668                this.renderTopFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 1));
7669                tessellator.draw();
7670                tessellator.startDrawingQuads();
7671                tessellator.setNormal(0.0F, 0.0F, -1.0F);
7672                tessellator.addTranslation(0.0F, 0.0F, f1);
7673                this.renderEastFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 2));
7674                tessellator.addTranslation(0.0F, 0.0F, -f1);
7675                tessellator.draw();
7676                tessellator.startDrawingQuads();
7677                tessellator.setNormal(0.0F, 0.0F, 1.0F);
7678                tessellator.addTranslation(0.0F, 0.0F, -f1);
7679                this.renderWestFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 3));
7680                tessellator.addTranslation(0.0F, 0.0F, f1);
7681                tessellator.draw();
7682                tessellator.startDrawingQuads();
7683                tessellator.setNormal(-1.0F, 0.0F, 0.0F);
7684                tessellator.addTranslation(f1, 0.0F, 0.0F);
7685                this.renderNorthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 4));
7686                tessellator.addTranslation(-f1, 0.0F, 0.0F);
7687                tessellator.draw();
7688                tessellator.startDrawingQuads();
7689                tessellator.setNormal(1.0F, 0.0F, 0.0F);
7690                tessellator.addTranslation(-f1, 0.0F, 0.0F);
7691                this.renderSouthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 5));
7692                tessellator.addTranslation(f1, 0.0F, 0.0F);
7693                tessellator.draw();
7694                GL11.glTranslatef(0.5F, 0.5F, 0.5F);
7695            }
7696            else if (j == 22)
7697            {
7698                GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
7699                GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
7700                ChestItemRenderHelper.instance.renderChest(par1Block, par2, par3);
7701                GL11.glEnable(GL12.GL_RESCALE_NORMAL);
7702            }
7703            else if (j == 6)
7704            {
7705                tessellator.startDrawingQuads();
7706                tessellator.setNormal(0.0F, -1.0F, 0.0F);
7707                this.renderBlockCropsImpl(par1Block, par2, -0.5D, -0.5D, -0.5D);
7708                tessellator.draw();
7709            }
7710            else if (j == 2)
7711            {
7712                tessellator.startDrawingQuads();
7713                tessellator.setNormal(0.0F, -1.0F, 0.0F);
7714                this.renderTorchAtAngle(par1Block, -0.5D, -0.5D, -0.5D, 0.0D, 0.0D, 0);
7715                tessellator.draw();
7716            }
7717            else if (j == 10)
7718            {
7719                for (k = 0; k < 2; ++k)
7720                {
7721                    if (k == 0)
7722                    {
7723                        this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.5D);
7724                    }
7725
7726                    if (k == 1)
7727                    {
7728                        this.setRenderBounds(0.0D, 0.0D, 0.5D, 1.0D, 0.5D, 1.0D);
7729                    }
7730
7731                    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
7732                    tessellator.startDrawingQuads();
7733                    tessellator.setNormal(0.0F, -1.0F, 0.0F);
7734                    this.renderBottomFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 0));
7735                    tessellator.draw();
7736                    tessellator.startDrawingQuads();
7737                    tessellator.setNormal(0.0F, 1.0F, 0.0F);
7738                    this.renderTopFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 1));
7739                    tessellator.draw();
7740                    tessellator.startDrawingQuads();
7741                    tessellator.setNormal(0.0F, 0.0F, -1.0F);
7742                    this.renderEastFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 2));
7743                    tessellator.draw();
7744                    tessellator.startDrawingQuads();
7745                    tessellator.setNormal(0.0F, 0.0F, 1.0F);
7746                    this.renderWestFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 3));
7747                    tessellator.draw();
7748                    tessellator.startDrawingQuads();
7749                    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
7750                    this.renderNorthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 4));
7751                    tessellator.draw();
7752                    tessellator.startDrawingQuads();
7753                    tessellator.setNormal(1.0F, 0.0F, 0.0F);
7754                    this.renderSouthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 5));
7755                    tessellator.draw();
7756                    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
7757                }
7758            }
7759            else if (j == 27)
7760            {
7761                k = 0;
7762                GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
7763                tessellator.startDrawingQuads();
7764
7765                for (int l = 0; l < 8; ++l)
7766                {
7767                    byte b0 = 0;
7768                    byte b1 = 1;
7769
7770                    if (l == 0)
7771                    {
7772                        b0 = 2;
7773                    }
7774
7775                    if (l == 1)
7776                    {
7777                        b0 = 3;
7778                    }
7779
7780                    if (l == 2)
7781                    {
7782                        b0 = 4;
7783                    }
7784
7785                    if (l == 3)
7786                    {
7787                        b0 = 5;
7788                        b1 = 2;
7789                    }
7790
7791                    if (l == 4)
7792                    {
7793                        b0 = 6;
7794                        b1 = 3;
7795                    }
7796
7797                    if (l == 5)
7798                    {
7799                        b0 = 7;
7800                        b1 = 5;
7801                    }
7802
7803                    if (l == 6)
7804                    {
7805                        b0 = 6;
7806                        b1 = 2;
7807                    }
7808
7809                    if (l == 7)
7810                    {
7811                        b0 = 3;
7812                    }
7813
7814                    float f4 = (float)b0 / 16.0F;
7815                    float f5 = 1.0F - (float)k / 16.0F;
7816                    float f6 = 1.0F - (float)(k + b1) / 16.0F;
7817                    k += b1;
7818                    this.setRenderBounds((double)(0.5F - f4), (double)f6, (double)(0.5F - f4), (double)(0.5F + f4), (double)f5, (double)(0.5F + f4));
7819                    tessellator.setNormal(0.0F, -1.0F, 0.0F);
7820                    this.renderBottomFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 0));
7821                    tessellator.setNormal(0.0F, 1.0F, 0.0F);
7822                    this.renderTopFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 1));
7823                    tessellator.setNormal(0.0F, 0.0F, -1.0F);
7824                    this.renderEastFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 2));
7825                    tessellator.setNormal(0.0F, 0.0F, 1.0F);
7826                    this.renderWestFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 3));
7827                    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
7828                    this.renderNorthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 4));
7829                    tessellator.setNormal(1.0F, 0.0F, 0.0F);
7830                    this.renderSouthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 5));
7831                }
7832
7833                tessellator.draw();
7834                GL11.glTranslatef(0.5F, 0.5F, 0.5F);
7835                this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
7836            }
7837            else if (j == 11)
7838            {
7839                for (k = 0; k < 4; ++k)
7840                {
7841                    f2 = 0.125F;
7842
7843                    if (k == 0)
7844                    {
7845                        this.setRenderBounds((double)(0.5F - f2), 0.0D, 0.0D, (double)(0.5F + f2), 1.0D, (double)(f2 * 2.0F));
7846                    }
7847
7848                    if (k == 1)
7849                    {
7850                        this.setRenderBounds((double)(0.5F - f2), 0.0D, (double)(1.0F - f2 * 2.0F), (double)(0.5F + f2), 1.0D, 1.0D);
7851                    }
7852
7853                    f2 = 0.0625F;
7854
7855                    if (k == 2)
7856                    {
7857                        this.setRenderBounds((double)(0.5F - f2), (double)(1.0F - f2 * 3.0F), (double)(-f2 * 2.0F), (double)(0.5F + f2), (double)(1.0F - f2), (double)(1.0F + f2 * 2.0F));
7858                    }
7859
7860                    if (k == 3)
7861                    {
7862                        this.setRenderBounds((double)(0.5F - f2), (double)(0.5F - f2 * 3.0F), (double)(-f2 * 2.0F), (double)(0.5F + f2), (double)(0.5F - f2), (double)(1.0F + f2 * 2.0F));
7863                    }
7864
7865                    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
7866                    tessellator.startDrawingQuads();
7867                    tessellator.setNormal(0.0F, -1.0F, 0.0F);
7868                    this.renderBottomFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 0));
7869                    tessellator.draw();
7870                    tessellator.startDrawingQuads();
7871                    tessellator.setNormal(0.0F, 1.0F, 0.0F);
7872                    this.renderTopFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 1));
7873                    tessellator.draw();
7874                    tessellator.startDrawingQuads();
7875                    tessellator.setNormal(0.0F, 0.0F, -1.0F);
7876                    this.renderEastFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 2));
7877                    tessellator.draw();
7878                    tessellator.startDrawingQuads();
7879                    tessellator.setNormal(0.0F, 0.0F, 1.0F);
7880                    this.renderWestFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 3));
7881                    tessellator.draw();
7882                    tessellator.startDrawingQuads();
7883                    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
7884                    this.renderNorthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 4));
7885                    tessellator.draw();
7886                    tessellator.startDrawingQuads();
7887                    tessellator.setNormal(1.0F, 0.0F, 0.0F);
7888                    this.renderSouthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 5));
7889                    tessellator.draw();
7890                    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
7891                }
7892
7893                this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
7894            }
7895            else if (j == 21)
7896            {
7897                for (k = 0; k < 3; ++k)
7898                {
7899                    f2 = 0.0625F;
7900
7901                    if (k == 0)
7902                    {
7903                        this.setRenderBounds((double)(0.5F - f2), 0.30000001192092896D, 0.0D, (double)(0.5F + f2), 1.0D, (double)(f2 * 2.0F));
7904                    }
7905
7906                    if (k == 1)
7907                    {
7908                        this.setRenderBounds((double)(0.5F - f2), 0.30000001192092896D, (double)(1.0F - f2 * 2.0F), (double)(0.5F + f2), 1.0D, 1.0D);
7909                    }
7910
7911                    f2 = 0.0625F;
7912
7913                    if (k == 2)
7914                    {
7915                        this.setRenderBounds((double)(0.5F - f2), 0.5D, 0.0D, (double)(0.5F + f2), (double)(1.0F - f2), 1.0D);
7916                    }
7917
7918                    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
7919                    tessellator.startDrawingQuads();
7920                    tessellator.setNormal(0.0F, -1.0F, 0.0F);
7921                    this.renderBottomFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 0));
7922                    tessellator.draw();
7923                    tessellator.startDrawingQuads();
7924                    tessellator.setNormal(0.0F, 1.0F, 0.0F);
7925                    this.renderTopFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 1));
7926                    tessellator.draw();
7927                    tessellator.startDrawingQuads();
7928                    tessellator.setNormal(0.0F, 0.0F, -1.0F);
7929                    this.renderEastFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 2));
7930                    tessellator.draw();
7931                    tessellator.startDrawingQuads();
7932                    tessellator.setNormal(0.0F, 0.0F, 1.0F);
7933                    this.renderWestFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 3));
7934                    tessellator.draw();
7935                    tessellator.startDrawingQuads();
7936                    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
7937                    this.renderNorthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 4));
7938                    tessellator.draw();
7939                    tessellator.startDrawingQuads();
7940                    tessellator.setNormal(1.0F, 0.0F, 0.0F);
7941                    this.renderSouthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 5));
7942                    tessellator.draw();
7943                    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
7944                }
7945            }
7946            else if (j == 32)
7947            {
7948                for (k = 0; k < 2; ++k)
7949                {
7950                    if (k == 0)
7951                    {
7952                        this.setRenderBounds(0.0D, 0.0D, 0.3125D, 1.0D, 0.8125D, 0.6875D);
7953                    }
7954
7955                    if (k == 1)
7956                    {
7957                        this.setRenderBounds(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D);
7958                    }
7959
7960                    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
7961                    tessellator.startDrawingQuads();
7962                    tessellator.setNormal(0.0F, -1.0F, 0.0F);
7963                    this.renderBottomFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 0, par2));
7964                    tessellator.draw();
7965                    tessellator.startDrawingQuads();
7966                    tessellator.setNormal(0.0F, 1.0F, 0.0F);
7967                    this.renderTopFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 1, par2));
7968                    tessellator.draw();
7969                    tessellator.startDrawingQuads();
7970                    tessellator.setNormal(0.0F, 0.0F, -1.0F);
7971                    this.renderEastFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 2, par2));
7972                    tessellator.draw();
7973                    tessellator.startDrawingQuads();
7974                    tessellator.setNormal(0.0F, 0.0F, 1.0F);
7975                    this.renderWestFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 3, par2));
7976                    tessellator.draw();
7977                    tessellator.startDrawingQuads();
7978                    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
7979                    this.renderNorthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 4, par2));
7980                    tessellator.draw();
7981                    tessellator.startDrawingQuads();
7982                    tessellator.setNormal(1.0F, 0.0F, 0.0F);
7983                    this.renderSouthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 5, par2));
7984                    tessellator.draw();
7985                    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
7986                }
7987
7988                this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
7989            }
7990            else if (j == 35)
7991            {
7992                GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
7993                this.renderBlockAnvilOrient((BlockAnvil)par1Block, 0, 0, 0, par2, true);
7994                GL11.glTranslatef(0.5F, 0.5F, 0.5F);
7995            }
7996            else if (j == 34)
7997            {
7998                for (k = 0; k < 3; ++k)
7999                {
8000                    if (k == 0)
8001                    {
8002                        this.setRenderBounds(0.125D, 0.0D, 0.125D, 0.875D, 0.1875D, 0.875D);
8003                        this.setOverrideBlockTexture(this.getBlockIcon(Block.obsidian));
8004                    }
8005                    else if (k == 1)
8006                    {
8007                        this.setRenderBounds(0.1875D, 0.1875D, 0.1875D, 0.8125D, 0.875D, 0.8125D);
8008                        this.setOverrideBlockTexture(Block.beacon.func_94446_i());
8009                    }
8010                    else if (k == 2)
8011                    {
8012                        this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
8013                        this.setOverrideBlockTexture(this.getBlockIcon(Block.glass));
8014                    }
8015
8016                    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
8017                    tessellator.startDrawingQuads();
8018                    tessellator.setNormal(0.0F, -1.0F, 0.0F);
8019                    this.renderBottomFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 0, par2));
8020                    tessellator.draw();
8021                    tessellator.startDrawingQuads();
8022                    tessellator.setNormal(0.0F, 1.0F, 0.0F);
8023                    this.renderTopFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 1, par2));
8024                    tessellator.draw();
8025                    tessellator.startDrawingQuads();
8026                    tessellator.setNormal(0.0F, 0.0F, -1.0F);
8027                    this.renderEastFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 2, par2));
8028                    tessellator.draw();
8029                    tessellator.startDrawingQuads();
8030                    tessellator.setNormal(0.0F, 0.0F, 1.0F);
8031                    this.renderWestFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 3, par2));
8032                    tessellator.draw();
8033                    tessellator.startDrawingQuads();
8034                    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
8035                    this.renderNorthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 4, par2));
8036                    tessellator.draw();
8037                    tessellator.startDrawingQuads();
8038                    tessellator.setNormal(1.0F, 0.0F, 0.0F);
8039                    this.renderSouthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 5, par2));
8040                    tessellator.draw();
8041                    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
8042                }
8043
8044                this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
8045                this.clearOverrideBlockTexture();
8046            }
8047            else if (j == 38)
8048            {
8049                GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
8050                this.renderBlockHopperMetadata((BlockHopper)par1Block, 0, 0, 0, 0, true);
8051                GL11.glTranslatef(0.5F, 0.5F, 0.5F);
8052            }
8053            else
8054            {
8055                FMLRenderAccessLibrary.renderInventoryBlock(this, par1Block, par2, j);
8056            }
8057        }
8058        else
8059        {
8060            if (j == 16)
8061            {
8062                par2 = 1;
8063            }
8064
8065            par1Block.setBlockBoundsForItemRender();
8066            this.setRenderBoundsFromBlock(par1Block);
8067            GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
8068            GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
8069            tessellator.startDrawingQuads();
8070            tessellator.setNormal(0.0F, -1.0F, 0.0F);
8071            this.renderBottomFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 0, par2));
8072            tessellator.draw();
8073
8074            if (flag && this.useInventoryTint)
8075            {
8076                k = par1Block.getRenderColor(par2);
8077                f2 = (float)(k >> 16 & 255) / 255.0F;
8078                f3 = (float)(k >> 8 & 255) / 255.0F;
8079                float f7 = (float)(k & 255) / 255.0F;
8080                GL11.glColor4f(f2 * par3, f3 * par3, f7 * par3, 1.0F);
8081            }
8082
8083            tessellator.startDrawingQuads();
8084            tessellator.setNormal(0.0F, 1.0F, 0.0F);
8085            this.renderTopFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 1, par2));
8086            tessellator.draw();
8087
8088            if (flag && this.useInventoryTint)
8089            {
8090                GL11.glColor4f(par3, par3, par3, 1.0F);
8091            }
8092
8093            tessellator.startDrawingQuads();
8094            tessellator.setNormal(0.0F, 0.0F, -1.0F);
8095            this.renderEastFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 2, par2));
8096            tessellator.draw();
8097            tessellator.startDrawingQuads();
8098            tessellator.setNormal(0.0F, 0.0F, 1.0F);
8099            this.renderWestFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 3, par2));
8100            tessellator.draw();
8101            tessellator.startDrawingQuads();
8102            tessellator.setNormal(-1.0F, 0.0F, 0.0F);
8103            this.renderNorthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 4, par2));
8104            tessellator.draw();
8105            tessellator.startDrawingQuads();
8106            tessellator.setNormal(1.0F, 0.0F, 0.0F);
8107            this.renderSouthFace(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 5, par2));
8108            tessellator.draw();
8109            GL11.glTranslatef(0.5F, 0.5F, 0.5F);
8110        }
8111    }
8112
8113    /**
8114     * Checks to see if the item's render type indicates that it should be rendered as a regular block or not.
8115     */
8116    public static boolean renderItemIn3d(int par0)
8117    {
8118        switch (par0)
8119        {
8120        case 0: return true;
8121        case 31: return true ;
8122        case 39: return true ;
8123        case 13: return true ;
8124        case 10: return true ;
8125        case 11: return true ;
8126        case 27: return true ;
8127        case 22: return true ;
8128        case 21: return true ;
8129        case 16: return true ;
8130        case 26: return true ;
8131        case 32: return true ;
8132        case 34: return true ;
8133        case 35: return true ;
8134        default: return FMLRenderAccessLibrary.renderItemAsFull3DBlock(par0);
8135        }
8136
8137    }
8138
8139    public Icon getBlockIcon(Block par1Block, IBlockAccess par2IBlockAccess, int par3, int par4, int par5, int par6)
8140    {
8141        return this.getIconSafe(par1Block.getBlockTexture(par2IBlockAccess, par3, par4, par5, par6));
8142    }
8143
8144    public Icon getBlockIconFromSideAndMetadata(Block par1Block, int par2, int par3)
8145    {
8146        return this.getIconSafe(par1Block.getIcon(par2, par3));
8147    }
8148
8149    public Icon getBlockIconFromSide(Block par1Block, int par2)
8150    {
8151        return this.getIconSafe(par1Block.getBlockTextureFromSide(par2));
8152    }
8153
8154    public Icon getBlockIcon(Block par1Block)
8155    {
8156        return this.getIconSafe(par1Block.getBlockTextureFromSide(1));
8157    }
8158
8159    public Icon getIconSafe(Icon par1Icon)
8160    {
8161        return par1Icon == null ? this.minecraftRB.renderEngine.getMissingIcon(0) : par1Icon;
8162    }
8163}