/** Renders any block requiring crossed squares such as reeds, flowers, and mushrooms */ public static boolean renderPlantCrossedSquares( RenderBlocks renderBlocks, Block block, int metadata, int x, int y, int z, float scale, boolean flipped) { Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y, z)); Icon icon = FlowerPotHandler.getPlantIcon(new ItemStack(block, 1, metadata)); setPlantColor(block, x, y, z); double uMin = icon.getMinU(); double vMin = icon.getMinV(); double uMax = icon.getMaxU(); double vMax = icon.getMaxV(); double rotation = 0.45D * scale; double xMin = x + 0.5D - rotation; double xMax = x + 0.5D + rotation; double zMin = z + 0.5D - rotation; double zMax = z + 0.5D + rotation; if (flipped) { double temp = vMin; vMin = vMax; vMax = temp; } tessellator.addVertexWithUV(xMin, y + (double) scale, zMin, uMin, vMin); tessellator.addVertexWithUV(xMin, y + 0.0D, zMin, uMin, vMax); tessellator.addVertexWithUV(xMax, y + 0.0D, zMax, uMax, vMax); tessellator.addVertexWithUV(xMax, y + (double) scale, zMax, uMax, vMin); tessellator.addVertexWithUV(xMax, y + (double) scale, zMax, uMin, vMin); tessellator.addVertexWithUV(xMax, y + 0.0D, zMax, uMin, vMax); tessellator.addVertexWithUV(xMin, y + 0.0D, zMin, uMax, vMax); tessellator.addVertexWithUV(xMin, y + (double) scale, zMin, uMax, vMin); tessellator.addVertexWithUV(xMin, y + (double) scale, zMax, uMin, vMin); tessellator.addVertexWithUV(xMin, y + 0.0D, zMax, uMin, vMax); tessellator.addVertexWithUV(xMax, y + 0.0D, zMin, uMax, vMax); tessellator.addVertexWithUV(xMax, y + (double) scale, zMin, uMax, vMin); tessellator.addVertexWithUV(xMax, y + (double) scale, zMin, uMin, vMin); tessellator.addVertexWithUV(xMax, y + 0.0D, zMin, uMin, vMax); tessellator.addVertexWithUV(xMin, y + 0.0D, zMax, uMax, vMax); tessellator.addVertexWithUV(xMin, y + (double) scale, zMax, uMax, vMin); return true; }
/** Renders thin-profile crossed squares (reeds, vine-type blocks). */ public static void renderPlantThinCrossedSquares( RenderBlocks renderBlocks, Block block, int metadata, int x, int y, int z, boolean flipped) { Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y, z)); Icon icon = FlowerPotHandler.getPlantIcon(new ItemStack(block, 1, metadata)); setPlantColor(block, x, y, z); double uMin = icon.getInterpolatedU(0.0D); double uMax = icon.getInterpolatedU(4.0D); double vMin = icon.getInterpolatedV(16.0D); double vMax = icon.getInterpolatedV(0.0D); double rotatedScaleFactor = 0.45D * 0.375F; double xMin = x + 0.5D - rotatedScaleFactor; double xMax = x + 0.5D + rotatedScaleFactor; double zMin = z + 0.5D - rotatedScaleFactor; double zMax = z + 0.5D + rotatedScaleFactor; if (flipped) { double temp = vMin; vMin = vMax; vMax = temp; } tessellator.addVertexWithUV(xMin, y + 0.75D, zMin, uMin, vMax); tessellator.addVertexWithUV(xMin, y + 0.0D, zMin, uMin, vMin); tessellator.addVertexWithUV(x + 0.5D, y + 0.0D, z + 0.5D, uMax, vMin); tessellator.addVertexWithUV(x + 0.5D, y + 0.75D, z + 0.5D, uMax, vMax); tessellator.addVertexWithUV(xMax, y + 0.75D, zMin, uMin, vMax); tessellator.addVertexWithUV(xMax, y + 0.0D, zMin, uMin, vMin); tessellator.addVertexWithUV(x + 0.5D, y + 0.0D, z + 0.5D, uMax, vMin); tessellator.addVertexWithUV(x + 0.5D, y + 0.75D, z + 0.5D, uMax, vMax); tessellator.addVertexWithUV(xMax, y + 0.75D, zMax, uMin, vMax); tessellator.addVertexWithUV(xMax, y + 0.0D, zMax, uMin, vMin); tessellator.addVertexWithUV(x + 0.5D, y + 0.0D, z + 0.5D, uMax, vMin); tessellator.addVertexWithUV(x + 0.5D, y + 0.75D, z + 0.5D, uMax, vMax); tessellator.addVertexWithUV(xMin, y + 0.75D, zMax, uMin, vMax); tessellator.addVertexWithUV(xMin, y + 0.0D, zMax, uMin, vMin); tessellator.addVertexWithUV(x + 0.5D, y + 0.0D, z + 0.5D, uMax, vMin); tessellator.addVertexWithUV(x + 0.5D, y + 0.75D, z + 0.5D, uMax, vMax); uMin = icon.getInterpolatedU(12.0D); uMax = icon.getInterpolatedU(16.0D); tessellator.addVertexWithUV(x + 0.5D, y + 0.75D, z + 0.5D, uMin, vMax); tessellator.addVertexWithUV(x + 0.5D, y + 0.0D, z + 0.5D, uMin, vMin); tessellator.addVertexWithUV(xMin, y + 0.0D, zMin, uMax, vMin); tessellator.addVertexWithUV(xMin, y + 0.75D, zMin, uMax, vMax); tessellator.addVertexWithUV(x + 0.5D, y + 0.75D, z + 0.5D, uMin, vMax); tessellator.addVertexWithUV(x + 0.5D, y + 0.0D, z + 0.5D, uMin, vMin); tessellator.addVertexWithUV(xMax, y + 0.0D, zMin, uMax, vMin); tessellator.addVertexWithUV(xMax, y + 0.75D, zMin, uMax, vMax); tessellator.addVertexWithUV(x + 0.5D, y + 0.75D, z + 0.5D, uMin, vMax); tessellator.addVertexWithUV(x + 0.5D, y + 0.0D, z + 0.5D, uMin, vMin); tessellator.addVertexWithUV(xMax, y + 0.0D, zMax, uMax, vMin); tessellator.addVertexWithUV(xMax, y + 0.75D, zMax, uMax, vMax); tessellator.addVertexWithUV(x + 0.5D, y + 0.75D, z + 0.5D, uMin, vMax); tessellator.addVertexWithUV(x + 0.5D, y + 0.0D, z + 0.5D, uMin, vMin); tessellator.addVertexWithUV(xMin, y + 0.0D, zMax, uMax, vMin); tessellator.addVertexWithUV(xMin, y + 0.75D, zMax, uMax, vMax); }