Search in sources :

Example 6 with ICoverable

use of gregtech.api.cover.ICoverable 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;
}
Also used : IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) ICoverable(gregtech.api.cover.ICoverable) Translation(codechicken.lib.vec.Translation) TileEntityInventoryPipe(gregtech.common.pipelike.inventory.tile.TileEntityInventoryPipe) BlockRenderLayer(net.minecraft.util.BlockRenderLayer) CCRenderState(codechicken.lib.render.CCRenderState) BlockInventoryPipe(gregtech.common.pipelike.inventory.BlockInventoryPipe) Matrix4(codechicken.lib.vec.Matrix4)

Aggregations

ICoverable (gregtech.api.cover.ICoverable)6 CCRenderState (codechicken.lib.render.CCRenderState)3 IVertexOperation (codechicken.lib.render.pipeline.IVertexOperation)3 Matrix4 (codechicken.lib.vec.Matrix4)3 Translation (codechicken.lib.vec.Translation)3 BlockRenderLayer (net.minecraft.util.BlockRenderLayer)3 Material (gregtech.api.unification.material.type.Material)2 ItemStack (net.minecraft.item.ItemStack)2 TileEntity (net.minecraft.tileentity.TileEntity)2 EnumFacing (net.minecraft.util.EnumFacing)2 IndexedCuboid6 (codechicken.lib.raytracer.IndexedCuboid6)1 PrimaryBoxData (gregtech.api.cover.ICoverable.PrimaryBoxData)1 BlockCable (gregtech.common.pipelike.cable.BlockCable)1 Insulation (gregtech.common.pipelike.cable.Insulation)1 ItemBlockCable (gregtech.common.pipelike.cable.ItemBlockCable)1 TileEntityCable (gregtech.common.pipelike.cable.tile.TileEntityCable)1 BlockFluidPipe (gregtech.common.pipelike.fluidpipe.BlockFluidPipe)1 FluidPipeType (gregtech.common.pipelike.fluidpipe.FluidPipeType)1 ItemBlockFluidPipe (gregtech.common.pipelike.fluidpipe.ItemBlockFluidPipe)1 TileEntityFluidPipe (gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipe)1