@Override /** Override to provide custom icons. */ protected Icon getUniqueIcon(Block block, int side, Icon icon) { if (isSideSloped) { Slope slope = Slope.slopesList[BlockProperties.getData(TE)]; int metadata = BlockProperties.getCoverMetadata(TE, coverRendering); /* Uncovered sloped oblique faces use triangular frame icons. */ if (!BlockProperties.hasCover(TE, 6)) { if (slope.type.equals(Type.OBLIQUE_INT)) { icon = slope.isPositive ? IconRegistry.icon_slope_oblique_pt_low : IconRegistry.icon_slope_oblique_pt_high; } else if (slope.type.equals(Type.OBLIQUE_EXT)) { icon = slope.isPositive ? IconRegistry.icon_slope_oblique_pt_high : IconRegistry.icon_slope_oblique_pt_low; } } /* For directional blocks, make sure sloped icons match regardless of side. */ if (BlockProperties.blockRotates(TE.worldObj, block, TE.xCoord, TE.yCoord, TE.zCoord)) { if (metadata % 8 == 0) { icon = block.getIcon(slope.isPositive ? 1 : 0, metadata); } else { icon = block.getIcon(2, metadata); } } else if (block instanceof BlockDirectional && !slope.type.equals(Type.WEDGE_Y)) { icon = block.getBlockTextureFromSide(1); } } return icon; }
@Override /** Renders slope. */ public boolean renderBaseBlock(Block block, int x, int y, int z) { Slope slope = Slope.slopesList[BlockProperties.getData(TE)]; renderBlocks.enableAO = getEnableAO(block); setRenderBoundsAndRelight(block, SIDE_ALL, 0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); populateOffsetLighting(block, x, y, z); /* Render sloped faces. */ isSideSloped = true; switch (slope.type) { case WEDGE_XZ: prepareHorizontalWedge(block, slope, x, y, z); break; case WEDGE_Y: prepareVerticalWedge(block, slope, x, y, z); break; case WEDGE_INT: prepareWedgeIntCorner(block, slope, x, y, z); break; case WEDGE_EXT: prepareWedgeExtCorner(block, slope, x, y, z); break; case OBLIQUE_INT: prepareObliqueIntCorner(block, slope, x, y, z); break; case OBLIQUE_EXT: prepareObliqueExtCorner(block, slope, x, y, z); break; case PYRAMID: preparePyramid(block, slope, x, y, z); break; default: // PRISM TYPES preparePrism(block, slope, x, y, z); break; } isSideSloped = false; /* Render non-sloped faces. */ /* BOTTOM FACE */ if (slope.hasSide(ForgeDirection.DOWN) && srcBlock.shouldSideBeRendered(renderBlocks.blockAccess, x, y - 1, z, DOWN)) { prepareFaceYNeg(block, slope, x, y, z); } /* TOP FACE */ if (slope.hasSide(ForgeDirection.UP) && srcBlock.shouldSideBeRendered(renderBlocks.blockAccess, x, y + 1, z, UP)) { prepareFaceYPos(block, slope, x, y, z); } /* NORTH FACE */ if (slope.hasSide(ForgeDirection.NORTH) && srcBlock.shouldSideBeRendered(renderBlocks.blockAccess, x, y, z - 1, NORTH)) { prepareFaceZNeg(block, slope, x, y, z); } /* SOUTH FACE */ if (slope.hasSide(ForgeDirection.SOUTH) && srcBlock.shouldSideBeRendered(renderBlocks.blockAccess, x, y, z + 1, SOUTH)) { prepareFaceZPos(block, slope, x, y, z); } /* WEST FACE */ if (slope.hasSide(ForgeDirection.WEST) && srcBlock.shouldSideBeRendered(renderBlocks.blockAccess, x - 1, y, z, WEST)) { prepareFaceXNeg(block, slope, x, y, z); } /* EAST FACE */ if (slope.hasSide(ForgeDirection.EAST) && srcBlock.shouldSideBeRendered(renderBlocks.blockAccess, x + 1, y, z, EAST)) { prepareFaceXPos(block, slope, x, y, z); } RenderHelper.startDrawing(QUADS); renderBlocks.enableAO = false; return true; }
@Override /** Renders side. */ protected void renderBaseSide(int x, int y, int z, int side, Icon icon) { int slopeID = BlockProperties.getData(TE); switch (renderID) { case NORMAL_YN: RenderHelper.renderFaceYNeg(renderBlocks, x, y, z, icon); break; case NORMAL_YP: RenderHelper.renderFaceYPos(renderBlocks, x, y, z, icon); break; case NORMAL_ZN: RenderHelper.renderFaceZNeg(renderBlocks, x, y, z, icon); break; case NORMAL_ZP: RenderHelper.renderFaceZPos(renderBlocks, x, y, z, icon); break; case NORMAL_XN: RenderHelper.renderFaceXNeg(renderBlocks, x, y, z, icon); break; case NORMAL_XP: RenderHelper.renderFaceXPos(renderBlocks, x, y, z, icon); break; case TRIANGLE_XN: HelperTriangle.renderFaceXNeg(renderBlocks, x, y, z, icon); break; case TRIANGLE_XP: HelperTriangle.renderFaceXPos(renderBlocks, x, y, z, icon); break; case TRIANGLE_ZN: HelperTriangle.renderFaceZNeg(renderBlocks, x, y, z, icon); break; case TRIANGLE_ZP: HelperTriangle.renderFaceZPos(renderBlocks, x, y, z, icon); break; case WEDGE_YN: HelperOrthoWedge.renderFaceYNeg(renderBlocks, slopeID, x, y, z, icon); break; case WEDGE_YP: HelperOrthoWedge.renderFaceYPos(renderBlocks, slopeID, x, y, z, icon); break; case WEDGE_SLOPED_ZN: HelperOblWedge.renderSlopeZNeg(renderBlocks, slopeID, x, y, z, icon); break; case WEDGE_ZN: HelperOrthoWedge.renderFaceZNeg(renderBlocks, slopeID, x, y, z, icon); break; case WEDGE_SLOPED_ZP: HelperOblWedge.renderSlopeZPos(renderBlocks, slopeID, x, y, z, icon); break; case WEDGE_ZP: HelperOrthoWedge.renderFaceZPos(renderBlocks, slopeID, x, y, z, icon); break; case WEDGE_SLOPED_XN: HelperOblWedge.renderSlopeXNeg(renderBlocks, slopeID, x, y, z, icon); break; case WEDGE_XN: HelperOrthoWedge.renderFaceXNeg(renderBlocks, slopeID, x, y, z, icon); break; case WEDGE_SLOPED_XP: HelperOblWedge.renderSlopeXPos(renderBlocks, slopeID, x, y, z, icon); break; case WEDGE_XP: HelperOrthoWedge.renderFaceXPos(renderBlocks, slopeID, x, y, z, icon); break; case WEDGE_CORNER_SLOPED_ZN: HelperCorner.renderSlopeZNeg(renderBlocks, slopeID, x, y, z, icon); break; case WEDGE_CORNER_SLOPED_ZP: HelperCorner.renderSlopeZPos(renderBlocks, slopeID, x, y, z, icon); break; case WEDGE_CORNER_SLOPED_XN: HelperCorner.renderSlopeXNeg(renderBlocks, slopeID, x, y, z, icon); break; case WEDGE_CORNER_SLOPED_XP: HelperCorner.renderSlopeXPos(renderBlocks, slopeID, x, y, z, icon); break; case OBL_CORNER_SLOPED_YN: HelperOblique.renderSlopeYNeg(renderBlocks, slopeID, x, y, z, icon); break; case OBL_CORNER_SLOPED_YP: HelperOblique.renderSlopeYPos(renderBlocks, slopeID, x, y, z, icon); break; case PYR_YZNN: HelperPyramid.renderFaceYNegZNeg(renderBlocks, x, y, z, icon); break; case PYR_YZNP: HelperPyramid.renderFaceYNegZPos(renderBlocks, x, y, z, icon); break; case PYR_YXNN: HelperPyramid.renderFaceYNegXNeg(renderBlocks, x, y, z, icon); break; case PYR_YXNP: HelperPyramid.renderFaceYNegXPos(renderBlocks, x, y, z, icon); break; case PYR_YZPN: HelperPyramid.renderFaceYPosZNeg(renderBlocks, x, y, z, icon); break; case PYR_YZPP: HelperPyramid.renderFaceYPosZPos(renderBlocks, x, y, z, icon); break; case PYR_YXPN: HelperPyramid.renderFaceYPosXNeg(renderBlocks, x, y, z, icon); break; case PYR_YXPP: HelperPyramid.renderFaceYPosXPos(renderBlocks, x, y, z, icon); break; case PRISM_NORTH_XN: HelperPrism.renderNorthFaceXNeg(renderBlocks, x, y, z, icon); break; case PRISM_NORTH_XP: HelperPrism.renderNorthFaceXPos(renderBlocks, x, y, z, icon); break; case PRISM_SOUTH_XN: HelperPrism.renderSouthFaceXNeg(renderBlocks, x, y, z, icon); break; case PRISM_SOUTH_XP: HelperPrism.renderSouthFaceXPos(renderBlocks, x, y, z, icon); break; case PRISM_WEST_ZN: HelperPrism.renderWestFaceZNeg(renderBlocks, x, y, z, icon); break; case PRISM_WEST_ZP: HelperPrism.renderWestFaceZPos(renderBlocks, x, y, z, icon); break; case PRISM_EAST_ZN: HelperPrism.renderEastFaceZNeg(renderBlocks, x, y, z, icon); break; case PRISM_EAST_ZP: HelperPrism.renderEastFaceZPos(renderBlocks, x, y, z, icon); break; case PRISM_WEDGE_ZN: HelperPrism.renderSlopeZNeg(renderBlocks, x, y, z, icon); break; case PRISM_WEDGE_ZP: HelperPrism.renderSlopeZPos(renderBlocks, x, y, z, icon); break; case PRISM_WEDGE_XN: HelperPrism.renderSlopeXNeg(renderBlocks, x, y, z, icon); break; case PRISM_WEDGE_XP: HelperPrism.renderSlopeXPos(renderBlocks, x, y, z, icon); break; } }