Search in sources :

Example 1 with TileEntityCompressedIronBlock

use of me.desht.pneumaticcraft.common.tileentity.TileEntityCompressedIronBlock in project pnc-repressurized by TeamPneumatic.

the class BlockColorHandler method registerColorHandlers.

public static void registerColorHandlers() {
    final IBlockColor heatColor = (state, blockAccess, pos, tintIndex) -> {
        if (blockAccess != null && pos != null) {
            TileEntity te = blockAccess.getTileEntity(pos);
            int heatLevel = 10;
            if (te instanceof TileEntityCompressedIronBlock) {
                heatLevel = ((TileEntityCompressedIronBlock) te).getHeatLevel();
            } else if (te instanceof TileEntityVortexTube) {
                switch(tintIndex) {
                    case 0:
                        heatLevel = ((TileEntityVortexTube) te).getHotHeatLevel();
                        break;
                    case 1:
                        heatLevel = ((TileEntityVortexTube) te).getColdHeatLevel();
                        break;
                }
            }
            double[] color = TileEntityCompressedIronBlock.getColorForHeatLevel(heatLevel);
            return 0xFF000000 + ((int) (color[0] * 255) << 16) + ((int) (color[1] * 255) << 8) + (int) (color[2] * 255);
        }
        return 0xFFFFFFFF;
    };
    Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(heatColor, Blockss.COMPRESSED_IRON, Blockss.HEAT_SINK, Blockss.VORTEX_TUBE);
    final IBlockColor uvLightBoxLampColor = (state, blockAccess, pos, tintIndex) -> {
        if (blockAccess != null && pos != null) {
            TileEntity te = blockAccess.getTileEntity(pos);
            if (te instanceof TileEntityUVLightBox) {
                return ((TileEntityUVLightBox) te).areLightsOn ? 0xFF4000FF : 0xFFAFAFE4;
            }
        }
        return 0xFFAFAFE4;
    };
    Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(uvLightBoxLampColor, Blockss.UV_LIGHT_BOX);
    final IBlockColor camoColor = (state, worldIn, pos, tintIndex) -> {
        if (pos == null || worldIn == null)
            return 0xffffff;
        TileEntity te = worldIn.getTileEntity(pos);
        if (te instanceof ICamouflageableTE && ((ICamouflageableTE) te).getCamouflage() != null) {
            return Minecraft.getMinecraft().getBlockColors().colorMultiplier(((ICamouflageableTE) te).getCamouflage(), te.getWorld(), pos, tintIndex);
        } else {
            return 0xffffff;
        }
    };
    for (Block b : Blockss.blocks) {
        if (b instanceof BlockPneumaticCraftCamo) {
            Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(camoColor, b);
        }
    }
}
Also used : ICamouflageableTE(me.desht.pneumaticcraft.common.tileentity.ICamouflageableTE) TileEntityVortexTube(me.desht.pneumaticcraft.common.tileentity.TileEntityVortexTube) Block(net.minecraft.block.Block) Minecraft(net.minecraft.client.Minecraft) Side(net.minecraftforge.fml.relauncher.Side) IBlockColor(net.minecraft.client.renderer.color.IBlockColor) TileEntity(net.minecraft.tileentity.TileEntity) TileEntityCompressedIronBlock(me.desht.pneumaticcraft.common.tileentity.TileEntityCompressedIronBlock) TileEntityUVLightBox(me.desht.pneumaticcraft.common.tileentity.TileEntityUVLightBox) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) TileEntity(net.minecraft.tileentity.TileEntity) TileEntityCompressedIronBlock(me.desht.pneumaticcraft.common.tileentity.TileEntityCompressedIronBlock) IBlockColor(net.minecraft.client.renderer.color.IBlockColor) TileEntityUVLightBox(me.desht.pneumaticcraft.common.tileentity.TileEntityUVLightBox) TileEntityVortexTube(me.desht.pneumaticcraft.common.tileentity.TileEntityVortexTube) Block(net.minecraft.block.Block) TileEntityCompressedIronBlock(me.desht.pneumaticcraft.common.tileentity.TileEntityCompressedIronBlock) ICamouflageableTE(me.desht.pneumaticcraft.common.tileentity.ICamouflageableTE)

Aggregations

ICamouflageableTE (me.desht.pneumaticcraft.common.tileentity.ICamouflageableTE)1 TileEntityCompressedIronBlock (me.desht.pneumaticcraft.common.tileentity.TileEntityCompressedIronBlock)1 TileEntityUVLightBox (me.desht.pneumaticcraft.common.tileentity.TileEntityUVLightBox)1 TileEntityVortexTube (me.desht.pneumaticcraft.common.tileentity.TileEntityVortexTube)1 Block (net.minecraft.block.Block)1 Minecraft (net.minecraft.client.Minecraft)1 IBlockColor (net.minecraft.client.renderer.color.IBlockColor)1 TileEntity (net.minecraft.tileentity.TileEntity)1 Side (net.minecraftforge.fml.relauncher.Side)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1