use of gregtech.common.pipelike.cable.Insulation in project GregTech by GregTechCE.
the class MetaBlocks method registerOreDict.
public static void registerOreDict() {
OreDictUnifier.registerOre(new ItemStack(LOG, 1, GTValues.W), OrePrefix.log, Materials.Wood);
OreDictUnifier.registerOre(new ItemStack(LEAVES, 1, GTValues.W), "treeLeaves");
OreDictUnifier.registerOre(new ItemStack(SAPLING, 1, GTValues.W), "treeSapling");
GameRegistry.addSmelting(LOG, new ItemStack(Items.COAL, 1, 1), 0.15F);
for (Entry<DustMaterial, BlockCompressed> entry : COMPRESSED.entrySet()) {
DustMaterial material = entry.getKey();
BlockCompressed block = entry.getValue();
ItemStack itemStack = block.getItem(material);
OreDictUnifier.registerOre(itemStack, OrePrefix.block, material);
}
for (Entry<SolidMaterial, BlockFrame> entry : FRAMES.entrySet()) {
SolidMaterial material = entry.getKey();
BlockFrame block = entry.getValue();
for (int i = 0; i < 16; i++) {
ItemStack itemStack = new ItemStack(block, 1, i);
OreDictUnifier.registerOre(itemStack, OrePrefix.frameGt, material);
}
}
for (BlockOre blockOre : ORES) {
DustMaterial material = blockOre.material;
for (StoneType stoneType : blockOre.STONE_TYPE.getAllowedValues()) {
if (stoneType == null)
continue;
ItemStack normalStack = blockOre.getItem(blockOre.getDefaultState().withProperty(blockOre.STONE_TYPE, stoneType));
OreDictUnifier.registerOre(normalStack, stoneType.processingPrefix, material);
}
}
for (Material pipeMaterial : CABLE.getEnabledMaterials()) {
for (Insulation insulation : Insulation.values()) {
ItemStack itemStack = CABLE.getItem(insulation, pipeMaterial);
OreDictUnifier.registerOre(itemStack, insulation.getOrePrefix(), pipeMaterial);
}
}
for (Material pipeMaterial : FLUID_PIPE.getEnabledMaterials()) {
for (FluidPipeType fluidPipeType : FluidPipeType.values()) {
ItemStack itemStack = FLUID_PIPE.getItem(fluidPipeType, pipeMaterial);
OreDictUnifier.registerOre(itemStack, fluidPipeType.getOrePrefix(), pipeMaterial);
}
}
}
use of gregtech.common.pipelike.cable.Insulation in project GregTech by GregTechCE.
the class CableRenderer method renderItem.
@Override
public void renderItem(ItemStack rawItemStack, TransformType transformType) {
ItemStack stack = ModCompatibility.getRealItemStack(rawItemStack);
if (!(stack.getItem() instanceof ItemBlockCable)) {
return;
}
GlStateManager.enableBlend();
CCRenderState renderState = CCRenderState.instance();
renderState.reset();
renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
BlockCable blockCable = (BlockCable) ((ItemBlockCable) stack.getItem()).getBlock();
Insulation insulation = blockCable.getItemPipeType(stack);
Material material = blockCable.getItemMaterial(stack);
if (insulation != null && material != null) {
renderCableBlock(material, insulation, IPipeTile.DEFAULT_INSULATION_COLOR, renderState, new IVertexOperation[0], 1 << EnumFacing.SOUTH.getIndex() | 1 << EnumFacing.NORTH.getIndex() | 1 << (6 + EnumFacing.SOUTH.getIndex()) | 1 << (6 + EnumFacing.NORTH.getIndex()));
}
renderState.draw();
GlStateManager.disableBlend();
}
use of gregtech.common.pipelike.cable.Insulation 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.Insulation in project GregTech by GregTechCE.
the class CableRenderer 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));
BlockCable blockCable = (BlockCable) state.getBlock();
IPipeTile<Insulation, WireProperties> tileEntityCable = blockCable.getPipeTileEntity(world, pos);
if (tileEntityCable == null) {
return;
}
Insulation insulation = tileEntityCable.getPipeType();
if (insulation == null) {
return;
}
float thickness = insulation.getThickness();
int connectedSidesMask = blockCable.getActualConnections(tileEntityCable, world);
Cuboid6 baseBox = BlockCable.getSideBox(null, thickness);
BlockRenderer.renderCuboid(renderState, baseBox, 0);
for (EnumFacing renderSide : EnumFacing.VALUES) {
if ((connectedSidesMask & (1 << renderSide.getIndex())) > 0) {
Cuboid6 sideBox = BlockCable.getSideBox(renderSide, thickness);
BlockRenderer.renderCuboid(renderState, sideBox, 0);
}
}
}
use of gregtech.common.pipelike.cable.Insulation 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);
}
Aggregations