use of gregtech.api.block.machines.BlockMachine in project GregTech by GregTechCE.
the class MetaBlocks method init.
public static void init() {
MACHINE = new BlockMachine();
MACHINE.setRegistryName("machine");
CABLE = new BlockCable(64, 2, 0);
CABLE.setRegistryName("cable");
BOILER_CASING = new BlockBoilerCasing();
BOILER_CASING.setRegistryName("boiler_casing");
METAL_CASING = new BlockMetalCasing();
METAL_CASING.setRegistryName("metal_casing");
TURBINE_CASING = new BlockTurbineCasing();
TURBINE_CASING.setRegistryName("turbine_casing");
MACHINE_CASING = new BlockMachineCasing();
MACHINE_CASING.setRegistryName("machine_casing");
MUTLIBLOCK_CASING = new BlockMultiblockCasing();
MUTLIBLOCK_CASING.setRegistryName("multiblock_casing");
WIRE_COIL = new BlockWireCoil();
WIRE_COIL.setRegistryName("wire_coil");
WARNING_SIGN = new BlockWarningSign();
WARNING_SIGN.setRegistryName("warning_sign");
GRANITE = new BlockGranite();
GRANITE.setRegistryName("granite");
BLACK_GRANITE = new StoneType(12, "black_granite", OrePrefix.oreBlackgranite, Materials.GraniteBlack, "gregtech:blocks/stones/granite/granite_black_stone", () -> GRANITE.withVariant(GraniteVariant.BLACK_GRANITE, ChiselingVariant.NORMAL), state -> state.getBlock() instanceof BlockGranite && ((BlockGranite) state.getBlock()).getVariant(state) == GraniteVariant.BLACK_GRANITE);
RED_GRANITE = new StoneType(13, "red_granite", OrePrefix.oreRedgranite, Materials.GraniteRed, "gregtech:blocks/stones/granite/granite_red_stone", () -> GRANITE.withVariant(GraniteVariant.RED_GRANITE, ChiselingVariant.NORMAL), state -> state.getBlock() instanceof BlockGranite && ((BlockGranite) state.getBlock()).getVariant(state) == GraniteVariant.RED_GRANITE);
MINERAL = new BlockMineral();
MINERAL.setRegistryName("mineral");
MARBLE = new StoneType(14, "marble", OrePrefix.oreMarble, Materials.Marble, "gregtech:blocks/stones/marble/marble_stone", () -> MINERAL.withVariant(MineralVariant.MARBLE, ChiselingVariant.NORMAL), state -> state.getBlock() instanceof BlockMineral && ((BlockMineral) state.getBlock()).getVariant(state) == BlockMineral.MineralVariant.MARBLE);
BASALT = new StoneType(15, "basalt", OrePrefix.oreBasalt, Materials.Basalt, "gregtech:blocks/stones/basalt/basalt_stone", () -> MINERAL.withVariant(MineralVariant.BASALT, ChiselingVariant.NORMAL), state -> state.getBlock() instanceof BlockMineral && ((BlockMineral) state.getBlock()).getVariant(state) == BlockMineral.MineralVariant.BASALT);
CONCRETE = new BlockConcrete();
CONCRETE.setRegistryName("concrete");
COMPRESSED = new HashMap<>();
ORES = new ArrayList<>();
StoneType.init();
Material[] materialBuffer = new Material[16];
Arrays.fill(materialBuffer, Materials._NULL);
int generationIndex = 0;
for (Material material : Material.MATERIAL_REGISTRY.getObjectsWithIds()) {
if (material instanceof DustMaterial) {
int id = Material.MATERIAL_REGISTRY.getIDForObject(material);
int index = id / 16;
if (index > generationIndex) {
createCompressedBlock(materialBuffer, generationIndex);
Arrays.fill(materialBuffer, Materials._NULL);
}
if (!OrePrefix.block.isIgnored(material)) {
materialBuffer[id % 16] = material;
generationIndex = index;
}
if (material.hasFlag(DustMaterial.MatFlags.GENERATE_ORE)) {
createOreBlock((DustMaterial) material);
}
}
}
createCompressedBlock(materialBuffer, generationIndex);
}
use of gregtech.api.block.machines.BlockMachine in project GregTech by GregTechCE.
the class MetaTileEntityRenderer method handleRenderBlockDamage.
@Override
public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, BufferBuilder buffer) {
BlockMachine blockMachine = ((BlockMachine) state.getBlock());
Collection<AxisAlignedBB> boxes = blockMachine.getSelectedBoundingBoxes(world, pos, state);
List<Cuboid6> cuboid6List = boxes.stream().map(aabb -> new Cuboid6(aabb).subtract(pos)).collect(Collectors.toList());
CCRenderState renderState = CCRenderState.instance();
renderState.reset();
renderState.bind(buffer);
IVertexOperation[] pipeline = new IVertexOperation[2];
pipeline[0] = new Translation(pos);
pipeline[1] = new IconTransformation(sprite);
BlockFace blockFace = blockFaces.get();
for (Cuboid6 boundingBox : cuboid6List) {
for (EnumFacing face : EnumFacing.VALUES) {
blockFace.loadCuboidFace(boundingBox, face.getIndex());
renderState.setPipeline(blockFace, 0, blockFace.verts.length, pipeline);
renderState.render();
}
}
}
Aggregations