use of gregtech.common.pipelike.cable.tile.TileEntityCable in project GregTech by GregTechCE.
the class CableRenderer 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) };
BlockCable blockCable = (BlockCable) state.getBlock();
TileEntityCable tileEntityCable = (TileEntityCable) blockCable.getPipeTileEntity(world, pos);
if (tileEntityCable == null)
return false;
int paintingColor = tileEntityCable.getInsulationColor();
int connectedSidesMask = blockCable.getActualConnections(tileEntityCable, world);
Insulation insulation = tileEntityCable.getPipeType();
Material material = tileEntityCable.getPipeMaterial();
if (insulation != null && material != null) {
BlockRenderLayer renderLayer = MinecraftForgeClient.getRenderLayer();
if (renderLayer == BlockRenderLayer.CUTOUT) {
renderCableBlock(material, insulation, paintingColor, renderState, pipeline, connectedSidesMask);
}
ICoverable coverable = tileEntityCable.getCoverableImplementation();
coverable.renderCovers(renderState, new Matrix4().translate(pos.getX(), pos.getY(), pos.getZ()), renderLayer);
}
return true;
}
use of gregtech.common.pipelike.cable.tile.TileEntityCable in project GregTech by GregTechCE.
the class CableRenderer method getParticleTexture.
public Pair<TextureAtlasSprite, Integer> getParticleTexture(IPipeTile<Insulation, WireProperties> tileEntity) {
if (tileEntity == null) {
return Pair.of(TextureUtils.getMissingSprite(), 0xFFFFFF);
}
Material material = ((TileEntityCable) tileEntity).getPipeMaterial();
Insulation insulation = tileEntity.getPipeType();
if (material == null || insulation == null) {
return Pair.of(TextureUtils.getMissingSprite(), 0xFFFFFF);
}
TextureAtlasSprite atlasSprite;
int particleColor;
if (insulation.insulationLevel == -1) {
atlasSprite = wireTexture;
particleColor = material.materialRGB;
} else {
atlasSprite = insulationTextures[5];
particleColor = tileEntity.getInsulationColor();
}
return Pair.of(atlasSprite, particleColor);
}
use of gregtech.common.pipelike.cable.tile.TileEntityCable in project GregTech by GregTechCE.
the class RoutePath method burnCablesInPath.
public boolean burnCablesInPath(World world, long voltage, long amperage) {
for (BlockPos blockPos : path.keySet()) {
WireProperties wireProperties = path.get(blockPos);
if (voltage > wireProperties.voltage || amperage > wireProperties.amperage) {
TileEntity tileEntity = world.getTileEntity(blockPos);
if (tileEntity instanceof TileEntityCable) {
world.setBlockToAir(blockPos);
world.setBlockState(blockPos, Blocks.FIRE.getDefaultState());
if (!world.isRemote) {
((WorldServer) world).spawnParticle(EnumParticleTypes.SMOKE_LARGE, blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5, 5 + world.rand.nextInt(3), 0.0, 0.0, 0.0, 0.1);
}
}
}
}
return true;
}
Aggregations