use of gregtech.common.pipelike.inventory.tile.TileEntityInventoryPipe in project GregTech by GregTechCE.
the class InvPipeRenderer method handleRenderBlockDamage.
@Override
public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, BufferBuilder buffer) {
CCRenderState renderState = CCRenderState.instance();
renderState.reset();
renderState.bind(buffer);
renderState.setPipeline(new Vector3(new Vec3d(pos)).translation(), new IconTransformation(sprite));
BlockInventoryPipe block = (BlockInventoryPipe) state.getBlock();
TileEntityInventoryPipe tileEntity = (TileEntityInventoryPipe) block.getPipeTileEntity(world, pos);
if (tileEntity == null) {
return;
}
InventoryPipeType pipeType = tileEntity.getPipeType();
if (pipeType == null) {
return;
}
float thickness = pipeType.getThickness();
int connectedSidesMask = block.getActualConnections(tileEntity, world);
Cuboid6 baseBox = BlockPipe.getSideBox(null, thickness);
BlockRenderer.renderCuboid(renderState, baseBox, 0);
for (EnumFacing renderSide : EnumFacing.VALUES) {
if ((connectedSidesMask & (1 << renderSide.getIndex())) > 0) {
Cuboid6 sideBox = BlockPipe.getSideBox(renderSide, thickness);
BlockRenderer.renderCuboid(renderState, sideBox, 0);
}
}
}
use of gregtech.common.pipelike.inventory.tile.TileEntityInventoryPipe in project GregTech by GregTechCE.
the class InvPipeRenderer method renderBlock.
@Override
public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) {
CCRenderState renderState = CCRenderState.instance();
renderState.reset();
renderState.bind(buffer);
renderState.setBrightness(world, pos);
IVertexOperation[] pipeline = { new Translation(pos) };
BlockInventoryPipe block = (BlockInventoryPipe) state.getBlock();
TileEntityInventoryPipe tileEntity = (TileEntityInventoryPipe) block.getPipeTileEntity(world, pos);
if (tileEntity == null) {
return false;
}
int paintingColor = tileEntity.getInsulationColor();
int connectedSidesMask = block.getActualConnections(tileEntity, world);
BlockRenderLayer renderLayer = MinecraftForgeClient.getRenderLayer();
if (renderLayer == BlockRenderLayer.SOLID) {
renderPipe(renderState, pipeline, paintingColor, connectedSidesMask);
}
ICoverable coverable = tileEntity.getCoverableImplementation();
coverable.renderCovers(renderState, new Matrix4().translate(pos.getX(), pos.getY(), pos.getZ()), renderLayer);
return true;
}
Aggregations