Search in sources :

Example 6 with BlockColors

use of net.minecraft.client.renderer.color.BlockColors in project Gaia-Dimension by Andromander.

the class ClientEvents method registerItemColors.

@SubscribeEvent
public static void registerItemColors(ColorHandlerEvent.Item e) {
    BlockColors blocks = e.getBlockColors();
    ItemColors items = e.getItemColors();
    items.registerItemColorHandler((stack, tintIndex) -> blocks.colorMultiplier(((ItemBlock) stack.getItem()).getBlock().getDefaultState(), null, null, tintIndex), GDBlocks.glitter_grass, GDBlocks.crystal_growth, GDBlocks.murky_grass, GDBlocks.aura_shoot, GDBlocks.soft_grass);
}
Also used : ItemColors(net.minecraft.client.renderer.color.ItemColors) BlockColors(net.minecraft.client.renderer.color.BlockColors) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 7 with BlockColors

use of net.minecraft.client.renderer.color.BlockColors in project MorePlanets by SteveKunG.

the class ClientProxyMP method registerInitRendering.

@Override
public void registerInitRendering() {
    BlockColors color = Minecraft.getMinecraft().getBlockColors();
    ItemModelRenderer.init();
    TileEntityRenderer.init();
    ClientRegisterHelper.registerBlockColor((state, world, pos, tint) -> world != null && pos != null ? BiomeColorHelper.getGrassColorAtPos(world, pos) : ColorizerGrass.getGrassColor(0.5D, 1.0D), FronosBlocks.FRONOS_GRASS);
    ClientRegisterHelper.registerBlockColor((state, world, pos, tint) -> ColorHelper.rgbToDecimal(120, 85, 190), DionaBlocks.LARGE_INFECTED_CRYSTALLIZE);
    ClientRegisterHelper.registerBlockColor((state, world, pos, tint) -> ColorHelper.rgbToDecimal(50, 101, 236), NibiruBlocks.MULTALIC_CRYSTAL);
    ClientRegisterHelper.registerBlockColor((state, world, pos, tint) -> ColorHelper.rgbToDecimal(50, 101, 236), NibiruBlocks.MULTALIC_CRYSTAL_BLOCK);
    ClientRegisterHelper.registerBlockColor((state, world, pos, tint) -> ColorHelper.rgbToDecimal(143, 55, 33), NibiruBlocks.INFECTED_MELON_STEM);
    ClientRegisterHelper.registerItemColor((itemStack, tintIndex) -> color.colorMultiplier(((ItemBlock) itemStack.getItem()).getBlock().getStateFromMeta(itemStack.getMetadata()), null, null, tintIndex), FronosBlocks.FRONOS_GRASS);
    ClientRegisterHelper.registerItemColor((itemStack, tintIndex) -> ColorHelper.rgbToDecimal(50, 101, 236), NibiruBlocks.MULTALIC_CRYSTAL_BLOCK);
    ClientRegisterHelper.registerItemColor((itemStack, tintIndex) -> itemStack.hasTagCompound() && tintIndex == 1 ? itemStack.getTagCompound().getInteger("Color") : -1, MPItems.CAPSULE);
}
Also used : BlockColors(net.minecraft.client.renderer.color.BlockColors)

Example 8 with BlockColors

use of net.minecraft.client.renderer.color.BlockColors in project Ceramics by KnightMiner.

the class ClientProxy method init.

@Override
public void init() {
    final BlockColors blockColors = minecraft.getBlockColors();
    // porcelain colors
    if (Config.porcelainEnabled) {
        Block[] blocks;
        if (Config.barrelEnabled) {
            blocks = new Block[] { Ceramics.porcelain, Ceramics.porcelainBarrel, Ceramics.porcelainBarrelExtension };
        } else {
            blocks = new Block[] { Ceramics.porcelain };
        }
        blockColors.registerBlockColorHandler((state, access, pos, tintIndex) -> state.getValue(BlockStained.COLOR).getColor(), blocks);
        minecraft.getItemColors().registerItemColorHandler((stack, tintIndex) -> {
            @SuppressWarnings("deprecation") IBlockState iblockstate = ((ItemBlock) stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata());
            return blockColors.colorMultiplier(iblockstate, null, null, tintIndex);
        }, blocks);
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) Block(net.minecraft.block.Block) ItemBlock(net.minecraft.item.ItemBlock) BlockColors(net.minecraft.client.renderer.color.BlockColors)

Example 9 with BlockColors

use of net.minecraft.client.renderer.color.BlockColors in project Bewitchment by Um-Mitternacht.

the class ClientProxy method init.

@Override
public void init(FMLInitializationEvent event) {
    Keybinds.registerKeys();
    BlockColors blocks = Minecraft.getMinecraft().getBlockColors();
    // Block Colors
    blocks.registerBlockColorHandler(new BlockCandleColorHandler(), ModBlocks.candle_medium, ModBlocks.candle_small, ModBlocks.candle_medium_lit, ModBlocks.candle_small_lit);
    blocks.registerBlockColorHandler(new IBlockColor() {

        @Override
        public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
            EnumGlyphType type = state.getValue(BlockCircleGlyph.TYPE);
            switch(type) {
                case ENDER:
                    return 0x770077;
                case GOLDEN:
                    return 0xe3dc3c;
                case NETHER:
                    return 0xbb0000;
                default:
                case NORMAL:
                    return 0xFFFFFF;
                case ANY:
                    // A green one should never happen!
                    return 0x00FF00;
            }
        }
    }, ModBlocks.ritual_glyphs);
    blocks.registerBlockColorHandler(new IBlockColor() {

        @Override
        public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
            if (tintIndex == 1) {
                return Color.HSBtoRGB((pos.getX() + pos.getY() + pos.getZ()) % 50 / 50f, 0.4f, 1f);
            }
            return -1;
        }
    }, ModBlocks.crystal_ball);
    ItemColors items = Minecraft.getMinecraft().getItemColors();
    // Item Colors
    items.registerItemColorHandler(new ItemCandleColorHandler(), Item.getItemFromBlock(ModBlocks.candle_medium), Item.getItemFromBlock(ModBlocks.candle_small));
    items.registerItemColorHandler(new BrewItemColorHandler(), ModItems.brew_phial_drink, ModItems.brew_phial_splash, ModItems.brew_phial_linger);
    items.registerItemColorHandler(new IItemColor() {

        @Override
        public int colorMultiplier(ItemStack stack, int tintIndex) {
            if (tintIndex == 0) {
                ISpell s = ItemSpellPage.getSpellFromItemStack(stack);
                if (s != null)
                    return s.getColor();
            }
            return -1;
        }
    }, ModItems.spell_page);
    NetworkRegistry.INSTANCE.registerGuiHandler(Bewitchment.instance, new GuiHandler());
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) ISpell(com.bewitchment.api.spell.ISpell) IBlockAccess(net.minecraft.world.IBlockAccess) GuiHandler(com.bewitchment.common.core.net.GuiHandler) BlockColors(net.minecraft.client.renderer.color.BlockColors) IItemColor(net.minecraft.client.renderer.color.IItemColor) IBlockColor(net.minecraft.client.renderer.color.IBlockColor) ItemColors(net.minecraft.client.renderer.color.ItemColors) EnumGlyphType(com.bewitchment.api.ritual.EnumGlyphType) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack)

Example 10 with BlockColors

use of net.minecraft.client.renderer.color.BlockColors in project BuildCraft by BuildCraft.

the class PluggableFacade method getBlockColor.

@Override
@SideOnly(Side.CLIENT)
public int getBlockColor(int tintIndex) {
    FacadePhasedState state = states.phasedStates[activeState];
    BlockColors colours = Minecraft.getMinecraft().getBlockColors();
    return colours.colorMultiplier(state.stateInfo.state, holder.getPipeWorld(), holder.getPipePos(), tintIndex);
}
Also used : IFacadePhasedState(buildcraft.api.facades.IFacadePhasedState) BlockColors(net.minecraft.client.renderer.color.BlockColors) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

BlockColors (net.minecraft.client.renderer.color.BlockColors)17 ItemColors (net.minecraft.client.renderer.color.ItemColors)7 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)7 Block (net.minecraft.block.Block)5 IBlockState (net.minecraft.block.state.IBlockState)5 IColoredBlock (forestry.core.blocks.IColoredBlock)4 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)4 ItemStack (net.minecraft.item.ItemStack)3 IColoredItem (forestry.core.items.IColoredItem)2 Minecraft (net.minecraft.client.Minecraft)2 IItemColor (net.minecraft.client.renderer.color.IItemColor)2 Item (net.minecraft.item.Item)2 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)2 GDBiomeBase (androsa.gaiadimension.biomes.GDBiomeBase)1 IFacadePhasedState (buildcraft.api.facades.IFacadePhasedState)1 EnumGlyphType (com.bewitchment.api.ritual.EnumGlyphType)1 ISpell (com.bewitchment.api.spell.ISpell)1 GuiHandler (com.bewitchment.common.core.net.GuiHandler)1 ModBlocks (com.oitsjustjose.geolosys.common.blocks.ModBlocks)1 BlockCandleColorHandler (com.witchworks.client.handler.BlockCandleColorHandler)1