commit
23ad66a3ed
1 changed files with 73 additions and 10 deletions
|
@ -78,6 +78,45 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void renderAllFaceExeptAxe(RenderBlocks renderblocks, Block block, Icon icon, int x, int y, int z, char axe) {
|
||||||
|
float minX = (float) block.getBlockBoundsMinX();
|
||||||
|
float minY = (float) block.getBlockBoundsMinY();
|
||||||
|
float minZ = (float) block.getBlockBoundsMinZ();
|
||||||
|
float maxX = (float) block.getBlockBoundsMaxX();
|
||||||
|
float maxY = (float) block.getBlockBoundsMaxY();
|
||||||
|
float maxZ = (float) block.getBlockBoundsMaxZ();
|
||||||
|
if (axe != 'x') {
|
||||||
|
renderTwoWayXFace(renderblocks, block, icon, x, y, z, minY, minZ, maxY, maxZ, minX);
|
||||||
|
renderTwoWayXFace(renderblocks, block, icon, x, y, z, minY, minZ, maxY, maxZ, maxX);
|
||||||
|
}
|
||||||
|
if (axe != 'y') {
|
||||||
|
renderTwoWayYFace(renderblocks, block, icon, x, y, z, minX, minZ, maxX, maxZ, minY);
|
||||||
|
renderTwoWayYFace(renderblocks, block, icon, x, y, z, minX, minZ, maxX, maxZ, maxY);
|
||||||
|
}
|
||||||
|
if (axe != 'z') {
|
||||||
|
renderTwoWayZFace(renderblocks, block, icon, x, y, z, minX, minY, maxX, maxY, minZ);
|
||||||
|
renderTwoWayZFace(renderblocks, block, icon, x, y, z, minX, minY, maxX, maxY, maxZ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderTwoWayXFace(RenderBlocks renderblocks, Block block, Icon icon, int xCoord, int yCoord, int zCoord, float minY, float minZ, float maxY, float maxZ, float x) {
|
||||||
|
block.setBlockBounds(x, minY, minZ, x, maxY, maxZ);
|
||||||
|
renderblocks.setRenderBoundsFromBlock(block);
|
||||||
|
renderblocks.renderStandardBlock(block, xCoord, yCoord, zCoord);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderTwoWayYFace(RenderBlocks renderblocks, Block block, Icon icon, int xCoord, int yCoord, int zCoord, float minX, float minZ, float maxX, float maxZ, float y) {
|
||||||
|
block.setBlockBounds(minX, y, minZ, maxX, y, maxZ);
|
||||||
|
renderblocks.setRenderBoundsFromBlock(block);
|
||||||
|
renderblocks.renderStandardBlock(block, xCoord, yCoord, zCoord);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderTwoWayZFace(RenderBlocks renderblocks, Block block, Icon icon, int xCoord, int yCoord, int zCoord, float minX, float minY, float maxX, float maxY, float z) {
|
||||||
|
block.setBlockBounds(minX, minY, z, maxX, maxY, z);
|
||||||
|
renderblocks.setRenderBoundsFromBlock(block);
|
||||||
|
renderblocks.renderStandardBlock(block, xCoord, yCoord, zCoord);
|
||||||
|
}
|
||||||
|
|
||||||
public void renderPipe(RenderBlocks renderblocks, IBlockAccess iblockaccess, Block block, IPipeRenderState renderState, int x, int y, int z) {
|
public void renderPipe(RenderBlocks renderblocks, IBlockAccess iblockaccess, Block block, IPipeRenderState renderState, int x, int y, int z) {
|
||||||
|
|
||||||
float minSize = Utils.pipeMinPos;
|
float minSize = Utils.pipeMinPos;
|
||||||
|
@ -88,54 +127,78 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
||||||
if (icons == null)
|
if (icons == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.UNKNOWN));
|
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.UNKNOWN));
|
||||||
block.setBlockBounds(minSize, minSize, minSize, maxSize, maxSize, maxSize);
|
|
||||||
renderblocks.setRenderBoundsFromBlock(block);
|
boolean west = false;
|
||||||
renderblocks.renderStandardBlock(block, x, y, z);
|
boolean east = false;
|
||||||
|
boolean down = false;
|
||||||
|
boolean up = false;
|
||||||
|
boolean north = false;
|
||||||
|
boolean south = false;
|
||||||
|
|
||||||
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.WEST)) {
|
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.WEST)) {
|
||||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.WEST));
|
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.WEST));
|
||||||
block.setBlockBounds(0.0F, minSize, minSize, minSize, maxSize, maxSize);
|
block.setBlockBounds(0.0F, minSize, minSize, minSize, maxSize, maxSize);
|
||||||
renderblocks.setRenderBoundsFromBlock(block);
|
renderblocks.setRenderBoundsFromBlock(block);
|
||||||
renderblocks.renderStandardBlock(block, x, y, z);
|
renderAllFaceExeptAxe(renderblocks, block, state.currentTexture, x, y, z, 'x');
|
||||||
|
west = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.EAST)) {
|
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.EAST)) {
|
||||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.EAST));
|
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.EAST));
|
||||||
block.setBlockBounds(maxSize, minSize, minSize, 1.0F, maxSize, maxSize);
|
block.setBlockBounds(maxSize, minSize, minSize, 1.0F, maxSize, maxSize);
|
||||||
renderblocks.setRenderBoundsFromBlock(block);
|
renderblocks.setRenderBoundsFromBlock(block);
|
||||||
renderblocks.renderStandardBlock(block, x, y, z);
|
renderAllFaceExeptAxe(renderblocks, block, state.currentTexture, x, y, z, 'x');
|
||||||
|
east = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.DOWN)) {
|
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.DOWN)) {
|
||||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.DOWN));
|
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.DOWN));
|
||||||
block.setBlockBounds(minSize, 0.0F, minSize, maxSize, minSize, maxSize);
|
block.setBlockBounds(minSize, 0.0F, minSize, maxSize, minSize, maxSize);
|
||||||
renderblocks.setRenderBoundsFromBlock(block);
|
renderblocks.setRenderBoundsFromBlock(block);
|
||||||
renderblocks.renderStandardBlock(block, x, y, z);
|
renderAllFaceExeptAxe(renderblocks, block, state.currentTexture, x, y, z, 'y');
|
||||||
|
down = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.UP)) {
|
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.UP)) {
|
||||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.UP));
|
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.UP));
|
||||||
block.setBlockBounds(minSize, maxSize, minSize, maxSize, 1.0F, maxSize);
|
block.setBlockBounds(minSize, maxSize, minSize, maxSize, 1.0F, maxSize);
|
||||||
renderblocks.setRenderBoundsFromBlock(block);
|
renderblocks.setRenderBoundsFromBlock(block);
|
||||||
renderblocks.renderStandardBlock(block, x, y, z);
|
renderAllFaceExeptAxe(renderblocks, block, state.currentTexture, x, y, z, 'y');
|
||||||
|
up = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.NORTH)) {
|
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.NORTH)) {
|
||||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.NORTH));
|
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.NORTH));
|
||||||
block.setBlockBounds(minSize, minSize, 0.0F, maxSize, maxSize, minSize);
|
block.setBlockBounds(minSize, minSize, 0.0F, maxSize, maxSize, minSize);
|
||||||
renderblocks.setRenderBoundsFromBlock(block);
|
renderblocks.setRenderBoundsFromBlock(block);
|
||||||
renderblocks.renderStandardBlock(block, x, y, z);
|
renderAllFaceExeptAxe(renderblocks, block, state.currentTexture, x, y, z, 'z');
|
||||||
|
north = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.SOUTH)) {
|
if (state.pipeConnectionMatrix.isConnected(ForgeDirection.SOUTH)) {
|
||||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.SOUTH));
|
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.SOUTH));
|
||||||
block.setBlockBounds(minSize, minSize, maxSize, maxSize, maxSize, 1.0F);
|
block.setBlockBounds(minSize, minSize, maxSize, maxSize, maxSize, 1.0F);
|
||||||
renderblocks.setRenderBoundsFromBlock(block);
|
renderblocks.setRenderBoundsFromBlock(block);
|
||||||
renderblocks.renderStandardBlock(block, x, y, z);
|
renderAllFaceExeptAxe(renderblocks, block, state.currentTexture, x, y, z, 'z');
|
||||||
|
south = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
block.setBlockBounds(minSize, minSize, minSize, maxSize, maxSize, maxSize);
|
||||||
|
renderblocks.setRenderBoundsFromBlock(block);
|
||||||
|
if (!west)
|
||||||
|
renderTwoWayXFace(renderblocks, block, state.currentTexture, x, y, z, minSize, minSize, maxSize, maxSize, minSize);
|
||||||
|
if (!east)
|
||||||
|
renderTwoWayXFace(renderblocks, block, state.currentTexture, x, y, z, minSize, minSize, maxSize, maxSize, maxSize);
|
||||||
|
if (!down)
|
||||||
|
renderTwoWayYFace(renderblocks, block, state.currentTexture, x, y, z, minSize, minSize, maxSize, maxSize, minSize);
|
||||||
|
if (!up)
|
||||||
|
renderTwoWayYFace(renderblocks, block, state.currentTexture, x, y, z, minSize, minSize, maxSize, maxSize, maxSize);
|
||||||
|
if (!north)
|
||||||
|
renderTwoWayZFace(renderblocks, block, state.currentTexture, x, y, z, minSize, minSize, maxSize, maxSize, minSize);
|
||||||
|
if (!south)
|
||||||
|
renderTwoWayZFace(renderblocks, block, state.currentTexture, x, y, z, minSize, minSize, maxSize, maxSize, maxSize);
|
||||||
|
|
||||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
if (state.wireMatrix.hasWire(WireColor.Red)) {
|
if (state.wireMatrix.hasWire(WireColor.Red)) {
|
||||||
|
|
Loading…
Reference in a new issue