use of net.minecraft.client.renderer.Tessellator in project MineFactoryReloaded by powercrystals.
the class FactoryGlassPaneRenderer method renderWorldBlock.
@Override
public boolean renderWorldBlock(IBlockAccess blockAccess, int x, int y, int z, Block tile, int modelId, RenderBlocks renderer) {
BlockFactoryGlassPane block = (BlockFactoryGlassPane) tile;
int worldHeight = blockAccess.getHeight();
int metadata = blockAccess.getBlockMetadata(x, y, z);
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(tile.getMixedBrightnessForBlock(blockAccess, x, y, z));
int color = block.getRenderColor(metadata);
float red = (color >> 16 & 255) / 255.0F;
float green = (color >> 8 & 255) / 255.0F;
float blue = (color & 255) / 255.0F;
if (EntityRenderer.anaglyphEnable) {
float anaglyphRed = (red * 30.0F + green * 59.0F + blue * 11.0F) / 100.0F;
float anaglyphGreen = (red * 30.0F + green * 70.0F) / 100.0F;
float anaglyphBlue = (red * 30.0F + blue * 70.0F) / 100.0F;
red = anaglyphRed;
green = anaglyphGreen;
blue = anaglyphBlue;
}
Icon iconGlass, iconStreaks, iconSide, iconOverlaySouth, iconOverlayWest;
if (renderer.hasOverrideBlockTexture()) {
iconGlass = iconStreaks = iconSide = iconOverlaySouth = iconOverlayWest = renderer.overrideBlockTexture;
} else {
iconGlass = block.getIcon(0, metadata);
iconStreaks = block.getIcon(0, 16 | metadata);
iconSide = block.getSideTextureIndex();
iconOverlaySouth = block.getBlockOverlayTexture(blockAccess, x, y, z, 2);
iconOverlayWest = block.getBlockOverlayTexture(blockAccess, x, y, z, 5);
}
double minXGlass = iconGlass.getMinU();
double midXGlass = iconGlass.getInterpolatedU(8.0D);
double maxXGlass = iconGlass.getMaxU();
double minYGlass = iconGlass.getMinV();
double maxYGlass = iconGlass.getMaxV();
double minXStreaks = iconStreaks.getMinU();
double midXStreaks = iconStreaks.getInterpolatedU(8.0D);
double maxXStreaks = iconStreaks.getMaxU();
double minYStreaks = iconStreaks.getMinV();
double maxYStreaks = iconStreaks.getMaxV();
double minXSide = iconSide.getInterpolatedU(7.0D);
double maxXSide = iconSide.getInterpolatedU(9.0D);
double minYSide = iconSide.getMinV();
double midYSide = iconSide.getInterpolatedV(8.0D);
double maxYSide = iconSide.getMaxV();
double minXSouth = iconOverlaySouth.getMinU();
double midXSouth = iconOverlaySouth.getInterpolatedU(8.0D);
double maxXSouth = iconOverlaySouth.getMaxU();
double minYSouth = iconOverlaySouth.getMinV();
double maxYSouth = iconOverlaySouth.getMaxV();
double minXWest = iconOverlayWest.getMinU();
double midXWest = iconOverlayWest.getInterpolatedU(8.0D);
double maxXWest = iconOverlayWest.getMaxU();
double minYWest = iconOverlayWest.getMinV();
double maxYWest = iconOverlayWest.getMaxV();
double xMin = x;
double xMid = x + 0.5D;
double xMax = x + 1;
double zMin = z;
double zMid = z + 0.5D;
double zMax = z + 1;
double yMin = y;
double yMax = y + 1;
double vertSideZOffset = 0.001D;
double vertSideXOffset = 0.002D;
double negSideZOffset = xMid - 0.0625D;
double posSideZOffset = xMid + 0.0625D;
double negSideXOffset = zMid - 0.0625D;
double posSideXOffset = zMid + 0.0625D;
boolean connectedNegZ = block.canThisFactoryPaneConnectToThisBlockID(blockAccess.getBlockId(x, y, z - 1));
boolean connectedPosZ = block.canThisFactoryPaneConnectToThisBlockID(blockAccess.getBlockId(x, y, z + 1));
boolean connectedNegX = block.canThisFactoryPaneConnectToThisBlockID(blockAccess.getBlockId(x - 1, y, z));
boolean connectedPosX = block.canThisFactoryPaneConnectToThisBlockID(blockAccess.getBlockId(x + 1, y, z));
boolean renderTop = y >= worldHeight || block.shouldSideBeRendered(blockAccess, x, y + 1, z, 1);
boolean renderBottom = y <= 0 || block.shouldSideBeRendered(blockAccess, x, y - 1, z, 0);
if ((!connectedNegX || !connectedPosX) && (connectedNegX || connectedPosX || connectedNegZ || connectedPosZ)) {
if (connectedNegX && !connectedPosX) {
tessellator.setColorOpaque_F(red, green, blue);
tessellator.addVertexWithUV(xMin, yMax, zMid, minXGlass, minYGlass);
tessellator.addVertexWithUV(xMin, yMin, zMid, minXGlass, maxYGlass);
tessellator.addVertexWithUV(xMid, yMin, zMid, midXGlass, maxYGlass);
tessellator.addVertexWithUV(xMid, yMax, zMid, midXGlass, minYGlass);
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.addVertexWithUV(xMin, yMax, zMid, minXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMin, yMin, zMid, minXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMid, yMin, zMid, midXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMid, yMax, zMid, midXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMin, yMax, zMid, minXSouth, minYSouth);
tessellator.addVertexWithUV(xMin, yMin, zMid, minXSouth, maxYSouth);
tessellator.addVertexWithUV(xMid, yMin, zMid, midXSouth, maxYSouth);
tessellator.addVertexWithUV(xMid, yMax, zMid, midXSouth, minYSouth);
if (!connectedPosZ && !connectedNegZ) {
tessellator.addVertexWithUV(xMid, yMax, posSideXOffset, minXSide, minYSide);
tessellator.addVertexWithUV(xMid, yMin, posSideXOffset, minXSide, maxYSide);
tessellator.addVertexWithUV(xMid, yMin, negSideXOffset, maxXSide, maxYSide);
tessellator.addVertexWithUV(xMid, yMax, negSideXOffset, maxXSide, minYSide);
}
if (renderTop) {
tessellator.addVertexWithUV(xMin, yMax + vertSideXOffset, posSideXOffset, maxXSide, midYSide);
tessellator.addVertexWithUV(xMid, yMax + vertSideXOffset, posSideXOffset, maxXSide, maxYSide);
tessellator.addVertexWithUV(xMid, yMax + vertSideXOffset, negSideXOffset, minXSide, maxYSide);
tessellator.addVertexWithUV(xMin, yMax + vertSideXOffset, negSideXOffset, minXSide, midYSide);
}
if (renderBottom) {
tessellator.addVertexWithUV(xMin, yMin - vertSideXOffset, posSideXOffset, maxXSide, midYSide);
tessellator.addVertexWithUV(xMid, yMin - vertSideXOffset, posSideXOffset, maxXSide, maxYSide);
tessellator.addVertexWithUV(xMid, yMin - vertSideXOffset, negSideXOffset, minXSide, maxYSide);
tessellator.addVertexWithUV(xMin, yMin - vertSideXOffset, negSideXOffset, minXSide, midYSide);
}
} else if (!connectedNegX && connectedPosX) {
tessellator.setColorOpaque_F(red, green, blue);
tessellator.addVertexWithUV(xMid, yMax, zMid, midXGlass, minYGlass);
tessellator.addVertexWithUV(xMid, yMin, zMid, midXGlass, maxYGlass);
tessellator.addVertexWithUV(xMax, yMin, zMid, maxXGlass, maxYGlass);
tessellator.addVertexWithUV(xMax, yMax, zMid, maxXGlass, minYGlass);
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.addVertexWithUV(xMid, yMax, zMid, midXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMid, yMin, zMid, midXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMax, yMin, zMid, maxXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMax, yMax, zMid, maxXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMid, yMax, zMid, midXSouth, minYSouth);
tessellator.addVertexWithUV(xMid, yMin, zMid, midXSouth, maxYSouth);
tessellator.addVertexWithUV(xMax, yMin, zMid, maxXSouth, maxYSouth);
tessellator.addVertexWithUV(xMax, yMax, zMid, maxXSouth, minYSouth);
if (!connectedPosZ && !connectedNegZ) {
tessellator.addVertexWithUV(xMid, yMax, negSideXOffset, minXSide, minYSide);
tessellator.addVertexWithUV(xMid, yMin, negSideXOffset, minXSide, maxYSide);
tessellator.addVertexWithUV(xMid, yMin, posSideXOffset, maxXSide, maxYSide);
tessellator.addVertexWithUV(xMid, yMax, posSideXOffset, maxXSide, minYSide);
}
if (renderTop) {
tessellator.addVertexWithUV(xMid, yMax + vertSideXOffset, posSideXOffset, maxXSide, minYSide);
tessellator.addVertexWithUV(xMax, yMax + vertSideXOffset, posSideXOffset, maxXSide, midYSide);
tessellator.addVertexWithUV(xMax, yMax + vertSideXOffset, negSideXOffset, minXSide, midYSide);
tessellator.addVertexWithUV(xMid, yMax + vertSideXOffset, negSideXOffset, minXSide, minYSide);
}
if (renderBottom) {
tessellator.addVertexWithUV(xMid, yMin - vertSideXOffset, posSideXOffset, maxXSide, minYSide);
tessellator.addVertexWithUV(xMax, yMin - vertSideXOffset, posSideXOffset, maxXSide, midYSide);
tessellator.addVertexWithUV(xMax, yMin - vertSideXOffset, negSideXOffset, minXSide, midYSide);
tessellator.addVertexWithUV(xMid, yMin - vertSideXOffset, negSideXOffset, minXSide, minYSide);
}
}
} else {
tessellator.setColorOpaque_F(red, green, blue);
tessellator.addVertexWithUV(xMin, yMax, zMid, minXGlass, minYGlass);
tessellator.addVertexWithUV(xMin, yMin, zMid, minXGlass, maxYGlass);
tessellator.addVertexWithUV(xMax, yMin, zMid, maxXGlass, maxYGlass);
tessellator.addVertexWithUV(xMax, yMax, zMid, maxXGlass, minYGlass);
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.addVertexWithUV(xMin, yMax, zMid, minXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMin, yMin, zMid, minXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMax, yMin, zMid, maxXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMax, yMax, zMid, maxXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMin, yMax, zMid, minXSouth, minYSouth);
tessellator.addVertexWithUV(xMin, yMin, zMid, minXSouth, maxYSouth);
tessellator.addVertexWithUV(xMax, yMin, zMid, maxXSouth, maxYSouth);
tessellator.addVertexWithUV(xMax, yMax, zMid, maxXSouth, minYSouth);
if (!connectedPosX && !connectedNegX) {
tessellator.addVertexWithUV(xMin, yMax, negSideXOffset, minXSide, minYSide);
tessellator.addVertexWithUV(xMin, yMin, negSideXOffset, minXSide, maxYSide);
tessellator.addVertexWithUV(xMin, yMin, posSideXOffset, maxXSide, maxYSide);
tessellator.addVertexWithUV(xMin, yMax, posSideXOffset, maxXSide, minYSide);
tessellator.addVertexWithUV(xMax, yMax, negSideXOffset, minXSide, minYSide);
tessellator.addVertexWithUV(xMax, yMin, negSideXOffset, minXSide, maxYSide);
tessellator.addVertexWithUV(xMax, yMin, posSideXOffset, maxXSide, maxYSide);
tessellator.addVertexWithUV(xMax, yMax, posSideXOffset, maxXSide, minYSide);
}
if (renderTop) {
tessellator.addVertexWithUV(xMin, yMax + vertSideXOffset, posSideXOffset, maxXSide, maxYSide);
tessellator.addVertexWithUV(xMax, yMax + vertSideXOffset, posSideXOffset, maxXSide, minYSide);
tessellator.addVertexWithUV(xMax, yMax + vertSideXOffset, negSideXOffset, minXSide, minYSide);
tessellator.addVertexWithUV(xMin, yMax + vertSideXOffset, negSideXOffset, minXSide, maxYSide);
}
if (renderBottom) {
tessellator.addVertexWithUV(xMin, yMin - vertSideXOffset, posSideXOffset, maxXSide, maxYSide);
tessellator.addVertexWithUV(xMax, yMin - vertSideXOffset, posSideXOffset, maxXSide, minYSide);
tessellator.addVertexWithUV(xMax, yMin - vertSideXOffset, negSideXOffset, minXSide, minYSide);
tessellator.addVertexWithUV(xMin, yMin - vertSideXOffset, negSideXOffset, minXSide, maxYSide);
}
}
if ((!connectedNegZ || !connectedPosZ) && (connectedNegX || connectedPosX || connectedNegZ || connectedPosZ)) {
if (connectedNegZ && !connectedPosZ) {
tessellator.setColorOpaque_F(red, green, blue);
tessellator.addVertexWithUV(xMid, yMax, zMin, minXGlass, minYGlass);
tessellator.addVertexWithUV(xMid, yMin, zMin, minXGlass, maxYGlass);
tessellator.addVertexWithUV(xMid, yMin, zMid, midXGlass, maxYGlass);
tessellator.addVertexWithUV(xMid, yMax, zMid, midXGlass, minYGlass);
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.addVertexWithUV(xMid, yMax, zMin, minXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMid, yMin, zMin, minXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMid, yMin, zMid, midXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMid, yMax, zMid, midXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMid, yMax, zMin, minXWest, minYWest);
tessellator.addVertexWithUV(xMid, yMin, zMin, minXWest, maxYWest);
tessellator.addVertexWithUV(xMid, yMin, zMid, midXWest, maxYWest);
tessellator.addVertexWithUV(xMid, yMax, zMid, midXWest, minYWest);
if (!connectedPosX && !connectedNegX) {
tessellator.addVertexWithUV(negSideZOffset, yMax, zMid, minXSide, minYSide);
tessellator.addVertexWithUV(negSideZOffset, yMin, zMid, minXSide, maxYSide);
tessellator.addVertexWithUV(posSideZOffset, yMin, zMid, maxXSide, maxYSide);
tessellator.addVertexWithUV(posSideZOffset, yMax, zMid, maxXSide, minYSide);
}
if (renderTop) {
tessellator.addVertexWithUV(negSideZOffset, yMax + vertSideZOffset, zMin, maxXSide, minYSide);
tessellator.addVertexWithUV(negSideZOffset, yMax + vertSideZOffset, zMid, maxXSide, midYSide);
tessellator.addVertexWithUV(posSideZOffset, yMax + vertSideZOffset, zMid, minXSide, midYSide);
tessellator.addVertexWithUV(posSideZOffset, yMax + vertSideZOffset, zMin, minXSide, minYSide);
}
if (renderBottom) {
tessellator.addVertexWithUV(negSideZOffset, yMin - vertSideZOffset, zMin, maxXSide, minYSide);
tessellator.addVertexWithUV(negSideZOffset, yMin - vertSideZOffset, zMid, maxXSide, midYSide);
tessellator.addVertexWithUV(posSideZOffset, yMin - vertSideZOffset, zMid, minXSide, midYSide);
tessellator.addVertexWithUV(posSideZOffset, yMin - vertSideZOffset, zMin, minXSide, minYSide);
}
} else if (!connectedNegZ && connectedPosZ) {
tessellator.setColorOpaque_F(red, green, blue);
tessellator.addVertexWithUV(xMid, yMax, zMid, midXGlass, minYGlass);
tessellator.addVertexWithUV(xMid, yMin, zMid, midXGlass, maxYGlass);
tessellator.addVertexWithUV(xMid, yMin, zMax, maxXGlass, maxYGlass);
tessellator.addVertexWithUV(xMid, yMax, zMax, maxXGlass, minYGlass);
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.addVertexWithUV(xMid, yMax, zMid, midXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMid, yMin, zMid, midXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMid, yMin, zMax, maxXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMid, yMax, zMax, maxXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMid, yMax, zMid, midXWest, minYWest);
tessellator.addVertexWithUV(xMid, yMin, zMid, midXWest, maxYWest);
tessellator.addVertexWithUV(xMid, yMin, zMax, maxXWest, maxYWest);
tessellator.addVertexWithUV(xMid, yMax, zMax, maxXWest, minYWest);
if (!connectedPosX && !connectedNegX) {
tessellator.addVertexWithUV(posSideZOffset, yMax, zMid, minXSide, minYSide);
tessellator.addVertexWithUV(posSideZOffset, yMin, zMid, minXSide, maxYSide);
tessellator.addVertexWithUV(negSideZOffset, yMin, zMid, maxXSide, maxYSide);
tessellator.addVertexWithUV(negSideZOffset, yMax, zMid, maxXSide, minYSide);
}
if (renderTop) {
tessellator.addVertexWithUV(negSideZOffset, yMax + vertSideZOffset, zMid, minXSide, midYSide);
tessellator.addVertexWithUV(negSideZOffset, yMax + vertSideZOffset, zMax, minXSide, maxYSide);
tessellator.addVertexWithUV(posSideZOffset, yMax + vertSideZOffset, zMax, maxXSide, maxYSide);
tessellator.addVertexWithUV(posSideZOffset, yMax + vertSideZOffset, zMid, maxXSide, midYSide);
}
if (renderBottom) {
tessellator.addVertexWithUV(negSideZOffset, yMin - vertSideZOffset, zMid, minXSide, midYSide);
tessellator.addVertexWithUV(negSideZOffset, yMin - vertSideZOffset, zMax, minXSide, maxYSide);
tessellator.addVertexWithUV(posSideZOffset, yMin - vertSideZOffset, zMax, maxXSide, maxYSide);
tessellator.addVertexWithUV(posSideZOffset, yMin - vertSideZOffset, zMid, maxXSide, midYSide);
}
}
} else {
tessellator.setColorOpaque_F(red, green, blue);
tessellator.addVertexWithUV(xMid, yMax, zMin, minXGlass, minYGlass);
tessellator.addVertexWithUV(xMid, yMin, zMin, minXGlass, maxYGlass);
tessellator.addVertexWithUV(xMid, yMin, zMax, maxXGlass, maxYGlass);
tessellator.addVertexWithUV(xMid, yMax, zMax, maxXGlass, minYGlass);
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.addVertexWithUV(xMid, yMax, zMin, minXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMid, yMin, zMin, minXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMid, yMin, zMax, maxXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMid, yMax, zMax, maxXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMid, yMax, zMin, minXWest, minYWest);
tessellator.addVertexWithUV(xMid, yMin, zMin, minXWest, maxYWest);
tessellator.addVertexWithUV(xMid, yMin, zMax, maxXWest, maxYWest);
tessellator.addVertexWithUV(xMid, yMax, zMax, maxXWest, minYWest);
if (!connectedPosZ && !connectedNegZ) {
tessellator.addVertexWithUV(negSideZOffset, yMax, zMin, minXSide, minYSide);
tessellator.addVertexWithUV(negSideZOffset, yMin, zMin, minXSide, maxYSide);
tessellator.addVertexWithUV(posSideZOffset, yMin, zMin, maxXSide, maxYSide);
tessellator.addVertexWithUV(posSideZOffset, yMax, zMin, maxXSide, minYSide);
tessellator.addVertexWithUV(posSideZOffset, yMax, zMax, minXSide, minYSide);
tessellator.addVertexWithUV(posSideZOffset, yMin, zMax, minXSide, maxYSide);
tessellator.addVertexWithUV(negSideZOffset, yMin, zMax, maxXSide, maxYSide);
tessellator.addVertexWithUV(negSideZOffset, yMax, zMax, maxXSide, minYSide);
}
if (renderTop) {
tessellator.addVertexWithUV(posSideZOffset, yMax + vertSideZOffset, zMax, maxXSide, maxYSide);
tessellator.addVertexWithUV(posSideZOffset, yMax + vertSideZOffset, zMin, maxXSide, minYSide);
tessellator.addVertexWithUV(negSideZOffset, yMax + vertSideZOffset, zMin, minXSide, minYSide);
tessellator.addVertexWithUV(negSideZOffset, yMax + vertSideZOffset, zMax, minXSide, maxYSide);
}
// TODO: fix slightly awkward rendering when pane on top/bottom doesn't connect on both sides
if (renderBottom) {
tessellator.addVertexWithUV(posSideZOffset, yMin - vertSideZOffset, zMax, maxXSide, maxYSide);
tessellator.addVertexWithUV(posSideZOffset, yMin - vertSideZOffset, zMin, maxXSide, minYSide);
tessellator.addVertexWithUV(negSideZOffset, yMin - vertSideZOffset, zMin, minXSide, minYSide);
tessellator.addVertexWithUV(negSideZOffset, yMin - vertSideZOffset, zMax, minXSide, maxYSide);
}
}
return true;
}
use of net.minecraft.client.renderer.Tessellator in project MineFactoryReloaded by powercrystals.
the class FactoryGlassRenderer method renderWorldBlock.
@Override
public boolean renderWorldBlock(IBlockAccess blockAccess, int x, int y, int z, Block tile, int modelId, RenderBlocks renderer) {
if (renderer.hasOverrideBlockTexture()) {
// usually: block is being broken
renderer.renderFaceYNeg(tile, x, y, z, null);
renderer.renderFaceYPos(tile, x, y, z, null);
renderer.renderFaceZNeg(tile, x, y, z, null);
renderer.renderFaceZPos(tile, x, y, z, null);
renderer.renderFaceXNeg(tile, x, y, z, null);
renderer.renderFaceXPos(tile, x, y, z, null);
return true;
}
BlockFactoryGlass block = (BlockFactoryGlass) tile;
int worldHeight = blockAccess.getHeight();
int metadata = blockAccess.getBlockMetadata(x, y, z);
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(blockAccess, x, y, z));
int color = block.getRenderColor(metadata);
float red = (color >> 16 & 255) / 255.0F;
float green = (color >> 8 & 255) / 255.0F;
float blue = (color & 255) / 255.0F;
if (EntityRenderer.anaglyphEnable) {
float anaglyphRed = (red * 30.0F + green * 59.0F + blue * 11.0F) / 100.0F;
float anaglyphGreen = (red * 30.0F + green * 70.0F) / 100.0F;
float anaglyphBlue = (red * 30.0F + blue * 70.0F) / 100.0F;
red = anaglyphRed;
green = anaglyphGreen;
blue = anaglyphBlue;
}
Icon iconGlass, iconStreaks, iconOverlayTop, iconOverlaySouth, iconOverlayWest;
iconGlass = block.getIcon(0, metadata);
iconStreaks = block.getIcon(0, 16 | metadata);
iconOverlayTop = block.getBlockOverlayTexture(blockAccess, x, y, z, 1);
iconOverlaySouth = block.getBlockOverlayTexture(blockAccess, x, y, z, 2);
iconOverlayWest = block.getBlockOverlayTexture(blockAccess, x, y, z, 5);
double minXGlass = iconGlass.getMinU();
double maxXGlass = iconGlass.getMaxU();
double minYGlass = iconGlass.getMinV();
double maxYGlass = iconGlass.getMaxV();
double minXStreaks = iconStreaks.getMinU();
double maxXStreaks = iconStreaks.getMaxU();
double minYStreaks = iconStreaks.getMinV();
double maxYStreaks = iconStreaks.getMaxV();
double minXSouth = iconOverlaySouth.getMinU();
double maxXSouth = iconOverlaySouth.getMaxU();
double minYSouth = iconOverlaySouth.getMinV();
double maxYSouth = iconOverlaySouth.getMaxV();
double minXWest = iconOverlayWest.getMinU();
double maxXWest = iconOverlayWest.getMaxU();
double minYWest = iconOverlayWest.getMinV();
double maxYWest = iconOverlayWest.getMaxV();
double minXTop = iconOverlayTop.getMinU();
double maxXTop = iconOverlayTop.getMaxU();
double minYTop = iconOverlayTop.getMinV();
double maxYTop = iconOverlayTop.getMaxV();
double xMin = x, xMax = x + 1;
double yMin = y, yMax = y + 1;
double zMin = z, zMax = z + 1;
boolean renderAll = renderer.renderAllFaces;
boolean[] renderSide = { renderAll || y <= 0 || block.shouldSideBeRendered(blockAccess, x, y - 1, z, 0), renderAll || y >= worldHeight || block.shouldSideBeRendered(blockAccess, x, y + 1, z, 1), renderAll || block.shouldSideBeRendered(blockAccess, x, y, z - 1, 2), renderAll || block.shouldSideBeRendered(blockAccess, x, y, z + 1, 3), renderAll || block.shouldSideBeRendered(blockAccess, x - 1, y, z, 4), renderAll || block.shouldSideBeRendered(blockAccess, x + 1, y, z, 5) };
if (renderSide[1]) {
// UP
tessellator.setColorOpaque_F(red, green, blue);
tessellator.addVertexWithUV(xMin, yMax, zMin, minXGlass, minYGlass);
tessellator.addVertexWithUV(xMin, yMax, zMax, minXGlass, maxYGlass);
tessellator.addVertexWithUV(xMax, yMax, zMax, maxXGlass, maxYGlass);
tessellator.addVertexWithUV(xMax, yMax, zMin, maxXGlass, minYGlass);
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.addVertexWithUV(xMin, yMax, zMin, minXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMin, yMax, zMax, minXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMax, yMax, zMax, maxXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMax, yMax, zMin, maxXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMin, yMax, zMin, minXTop, minYTop);
tessellator.addVertexWithUV(xMin, yMax, zMax, minXTop, maxYTop);
tessellator.addVertexWithUV(xMax, yMax, zMax, maxXTop, maxYTop);
tessellator.addVertexWithUV(xMax, yMax, zMin, maxXTop, minYTop);
}
if (renderSide[0]) {
// DOWN
tessellator.setColorOpaque_F(red, green, blue);
tessellator.addVertexWithUV(xMin, yMin, zMax, minXGlass, maxYGlass);
tessellator.addVertexWithUV(xMin, yMin, zMin, minXGlass, minYGlass);
tessellator.addVertexWithUV(xMax, yMin, zMin, maxXGlass, minYGlass);
tessellator.addVertexWithUV(xMax, yMin, zMax, maxXGlass, maxYGlass);
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.addVertexWithUV(xMin, yMin, zMax, minXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMin, yMin, zMin, minXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMax, yMin, zMin, maxXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMax, yMin, zMax, maxXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMin, yMin, zMax, minXTop, maxYTop);
tessellator.addVertexWithUV(xMin, yMin, zMin, minXTop, minYTop);
tessellator.addVertexWithUV(xMax, yMin, zMin, maxXTop, minYTop);
tessellator.addVertexWithUV(xMax, yMin, zMax, maxXTop, maxYTop);
}
if (renderSide[2]) {
tessellator.setColorOpaque_F(red, green, blue);
tessellator.addVertexWithUV(xMax, yMax, zMin, maxXGlass, minYGlass);
tessellator.addVertexWithUV(xMax, yMin, zMin, maxXGlass, maxYGlass);
tessellator.addVertexWithUV(xMin, yMin, zMin, minXGlass, maxYGlass);
tessellator.addVertexWithUV(xMin, yMax, zMin, minXGlass, minYGlass);
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.addVertexWithUV(xMax, yMax, zMin, maxXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMax, yMin, zMin, maxXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMin, yMin, zMin, minXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMin, yMax, zMin, minXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMax, yMax, zMin, maxXSouth, minYSouth);
tessellator.addVertexWithUV(xMax, yMin, zMin, maxXSouth, maxYSouth);
tessellator.addVertexWithUV(xMin, yMin, zMin, minXSouth, maxYSouth);
tessellator.addVertexWithUV(xMin, yMax, zMin, minXSouth, minYSouth);
}
if (renderSide[3]) {
tessellator.setColorOpaque_F(red, green, blue);
tessellator.addVertexWithUV(xMin, yMax, zMax, minXGlass, minYGlass);
tessellator.addVertexWithUV(xMin, yMin, zMax, minXGlass, maxYGlass);
tessellator.addVertexWithUV(xMax, yMin, zMax, maxXGlass, maxYGlass);
tessellator.addVertexWithUV(xMax, yMax, zMax, maxXGlass, minYGlass);
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.addVertexWithUV(xMin, yMax, zMax, minXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMin, yMin, zMax, minXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMax, yMin, zMax, maxXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMax, yMax, zMax, maxXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMin, yMax, zMax, minXSouth, minYSouth);
tessellator.addVertexWithUV(xMin, yMin, zMax, minXSouth, maxYSouth);
tessellator.addVertexWithUV(xMax, yMin, zMax, maxXSouth, maxYSouth);
tessellator.addVertexWithUV(xMax, yMax, zMax, maxXSouth, minYSouth);
}
if (renderSide[4]) {
tessellator.setColorOpaque_F(red, green, blue);
tessellator.addVertexWithUV(xMin, yMin, zMax, maxXGlass, maxYGlass);
tessellator.addVertexWithUV(xMin, yMax, zMax, maxXGlass, minYGlass);
tessellator.addVertexWithUV(xMin, yMax, zMin, minXGlass, minYGlass);
tessellator.addVertexWithUV(xMin, yMin, zMin, minXGlass, maxYGlass);
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.addVertexWithUV(xMin, yMin, zMax, maxXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMin, yMax, zMax, maxXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMin, yMax, zMin, minXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMin, yMin, zMin, minXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMin, yMin, zMax, maxXWest, maxYWest);
tessellator.addVertexWithUV(xMin, yMax, zMax, maxXWest, minYWest);
tessellator.addVertexWithUV(xMin, yMax, zMin, minXWest, minYWest);
tessellator.addVertexWithUV(xMin, yMin, zMin, minXWest, maxYWest);
}
if (renderSide[5]) {
tessellator.setColorOpaque_F(red, green, blue);
tessellator.addVertexWithUV(xMax, yMin, zMin, minXGlass, maxYGlass);
tessellator.addVertexWithUV(xMax, yMax, zMin, minXGlass, minYGlass);
tessellator.addVertexWithUV(xMax, yMax, zMax, maxXGlass, minYGlass);
tessellator.addVertexWithUV(xMax, yMin, zMax, maxXGlass, maxYGlass);
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.addVertexWithUV(xMax, yMin, zMin, minXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMax, yMax, zMin, minXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMax, yMax, zMax, maxXStreaks, minYStreaks);
tessellator.addVertexWithUV(xMax, yMin, zMax, maxXStreaks, maxYStreaks);
tessellator.addVertexWithUV(xMax, yMin, zMin, minXWest, maxYWest);
tessellator.addVertexWithUV(xMax, yMax, zMin, minXWest, minYWest);
tessellator.addVertexWithUV(xMax, yMax, zMax, maxXWest, minYWest);
tessellator.addVertexWithUV(xMax, yMin, zMax, maxXWest, maxYWest);
}
return true;
}
use of net.minecraft.client.renderer.Tessellator in project MineFactoryReloaded by powercrystals.
the class VineScaffoldRenderer method renderInventoryBlock.
@Override
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
Tessellator tessellator = Tessellator.instance;
block.setBlockBoundsForItemRender();
renderer.setRenderBoundsFromBlock(block);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1.0F, 0.0F);
renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1.0F);
renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
use of net.minecraft.client.renderer.Tessellator in project MineFactoryReloaded by powercrystals.
the class EntityNeedleRenderer method renderNeedle.
public void renderNeedle(EntityNeedle needle, double par2, double par4, double par6, float par8, float par9) {
this.loadTexture("/item/arrows.png");
GL11.glPushMatrix();
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
GL11.glRotatef(needle.prevRotationYaw + (needle.rotationYaw - needle.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(needle.prevRotationPitch + (needle.rotationPitch - needle.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
Tessellator tessellator = Tessellator.instance;
byte b0 = 0;
double f2 = 0.0D;
double f3 = 0.5D;
double f4 = (0 + b0 * 10) / 32.0D;
double f5 = (5 + b0 * 10) / 32.0D;
double f6 = 0.0D;
double f7 = 0.15625D;
double f8 = (5 + b0 * 10) / 32.0D;
double f9 = (10 + b0 * 10) / 32.0D;
float f10 = 0.01F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
GL11.glScalef(f10, f10, f10);
GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
GL11.glNormal3f(f10, 0.0F, 0.0F);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f8);
tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f8);
tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f9);
tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f9);
tessellator.draw();
GL11.glNormal3f(-f10, 0.0F, 0.0F);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f8);
tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f8);
tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f9);
tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f9);
tessellator.draw();
for (int i = 0; i < 4; ++i) {
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, f10);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, f2, f4);
tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, f3, f4);
tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, f3, f5);
tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, f2, f5);
tessellator.draw();
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
use of net.minecraft.client.renderer.Tessellator in project MineFactoryReloaded by powercrystals.
the class EntitySafariNetRenderer method doRender.
@Override
public void doRender(Entity entity, double x, double y, double z, float par8, float par9) {
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y, (float) z);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(0.5F, 0.5F, 0.5F);
this.loadTexture("/gui/items.png");
Tessellator var10 = Tessellator.instance;
this.renderItemInFlight(var10, ((EntitySafariNet) entity).getIcon());
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
Aggregations