Search in sources :

Example 1 with InventoryPipeType

use of gregtech.common.pipelike.inventory.InventoryPipeType 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);
        }
    }
}
Also used : InventoryPipeType(gregtech.common.pipelike.inventory.InventoryPipeType) TileEntityInventoryPipe(gregtech.common.pipelike.inventory.tile.TileEntityInventoryPipe) EnumFacing(net.minecraft.util.EnumFacing) Vector3(codechicken.lib.vec.Vector3) CCRenderState(codechicken.lib.render.CCRenderState) Cuboid6(codechicken.lib.vec.Cuboid6) Vec3d(net.minecraft.util.math.Vec3d) BlockInventoryPipe(gregtech.common.pipelike.inventory.BlockInventoryPipe) IconTransformation(codechicken.lib.vec.uv.IconTransformation)

Example 2 with InventoryPipeType

use of gregtech.common.pipelike.inventory.InventoryPipeType in project GregTech by GregTechCE.

the class InvPipeRenderer method registerIcons.

public void registerIcons(TextureMap map) {
    this.jointTextureSprite = map.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/inv_pipe/joint"));
    this.pipeTextureSprite = map.registerSprite(new ResourceLocation(GTValues.MODID, "blocks/inv_pipe/pipe"));
    InventoryPipeType pipeType = InventoryPipeType.NORMAL;
    float thickness = pipeType.getThickness();
    double height = (1.0f - thickness) / 2.0f;
    CCModel connectionModel = ShapeModelGenerator.generateModel(3, height, thickness / 3.0f, height);
    CCModel fullBlockModel = ShapeModelGenerator.generateModel(3, 1.0f, thickness / 3.0f, height);
    this.fullBlockVariants = ShapeModelGenerator.generateFullBlockVariants(fullBlockModel);
    this.connectionModels = ShapeModelGenerator.generateRotatedVariants(connectionModel);
}
Also used : InventoryPipeType(gregtech.common.pipelike.inventory.InventoryPipeType) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) CCModel(codechicken.lib.render.CCModel)

Aggregations

InventoryPipeType (gregtech.common.pipelike.inventory.InventoryPipeType)2 CCModel (codechicken.lib.render.CCModel)1 CCRenderState (codechicken.lib.render.CCRenderState)1 Cuboid6 (codechicken.lib.vec.Cuboid6)1 Vector3 (codechicken.lib.vec.Vector3)1 IconTransformation (codechicken.lib.vec.uv.IconTransformation)1 BlockInventoryPipe (gregtech.common.pipelike.inventory.BlockInventoryPipe)1 TileEntityInventoryPipe (gregtech.common.pipelike.inventory.tile.TileEntityInventoryPipe)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 EnumFacing (net.minecraft.util.EnumFacing)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 Vec3d (net.minecraft.util.math.Vec3d)1