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);
}
}
}
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);
}
Aggregations