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