use of net.minecraft.client.renderer.color.BlockColors in project Witchworks by Um-Mitternacht.
the class ClientProxy method init.
@Override
public void init(FMLInitializationEvent event) {
BlockColors blocks = Minecraft.getMinecraft().getBlockColors();
//Block Colors
blocks.registerBlockColorHandler(new BlockCandleColorHandler(), ModBlocks.CANDLE_LARGE, ModBlocks.CANDLE_MEDIUM, ModBlocks.CANDLE_SMALL);
ItemColors items = Minecraft.getMinecraft().getItemColors();
//Item Colors
items.registerItemColorHandler(new ItemCandleColorHandler(), Item.getItemFromBlock(ModBlocks.CANDLE_LARGE), 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);
NetworkRegistry.INSTANCE.registerGuiHandler(WitchWorks.instance, new GuiHandler());
}
use of net.minecraft.client.renderer.color.BlockColors in project ForestryMC by ForestryMC.
the class BlockGreenhouse method colorMultiplier.
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("deprecation")
public int colorMultiplier(IBlockState blockState, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
if (pos == null || world == null) {
return 16777215;
}
ItemStack camouflageStack = getCamouflageBlock(world, pos);
if (tintIndex == ModelCamouflaged.OVERLAY_COLOR_INDEX + 1) {
BlockGreenhouseType type = getGreenhouseType(blockState);
if (type == BlockGreenhouseType.SCREEN) {
IGreenhouseControllerInternal controller = MultiblockUtil.getController(world, pos, IGreenhouseComponent.class);
if (controller == null || !controller.isAssembled()) {
return 16777215;
}
IClimateContainer container = controller.getClimateContainer();
IClimateState state = container.getState();
return ClimateUtil.getColor(EnumTemperature.getFromValue(state.getTemperature()));
} else if (type == BlockGreenhouseType.BORDER_CENTER) {
boolean isClosed = true;
IGreenhouseControllerInternal controller = MultiblockUtil.getController(world, pos, IGreenhouseComponent.class);
if (controller == null || !controller.isAssembled()) {
isClosed = false;
} else {
IGreenhouseProvider manager = controller.getProvider();
isClosed = manager.isClosed();
}
return isClosed ? 1356406 : 12197655;
}
} else if (tintIndex < ModelCamouflaged.OVERLAY_COLOR_INDEX && !camouflageStack.isEmpty()) {
Block block = Block.getBlockFromItem(camouflageStack.getItem());
if (block != Blocks.AIR) {
IBlockState camouflageState = block.getStateFromMeta(camouflageStack.getItemDamage());
BlockColors blockColors = Minecraft.getMinecraft().getBlockColors();
int color = blockColors.colorMultiplier(camouflageState, world, pos, tintIndex);
if (color != -1) {
return color;
}
}
}
return 16777215;
}
use of net.minecraft.client.renderer.color.BlockColors in project Cavern2 by kegare.
the class Cavern method registerItemColors.
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void registerItemColors(ColorHandlerEvent.Item event) {
ItemColors itemColors = event.getItemColors();
BlockColors blockColors = event.getBlockColors();
CaveBlocks.registerItemBlockColors(blockColors, itemColors);
}
use of net.minecraft.client.renderer.color.BlockColors in project Binnie by ForestryMC.
the class ModelManager method registerItemAndBlockColors.
@SideOnly(Side.CLIENT)
public void registerItemAndBlockColors() {
Minecraft minecraft = Minecraft.getMinecraft();
BlockColors blockColors = minecraft.getBlockColors();
for (IColoredBlock blockColor : blockColorList) {
if (blockColor instanceof Block) {
blockColors.registerBlockColorHandler(ColoredBlockBlockColor.INSTANCE, (Block) blockColor);
}
}
ItemColors itemColors = minecraft.getItemColors();
for (IColoredItem itemColor : itemColorList) {
if (itemColor instanceof Item) {
itemColors.registerItemColorHandler(ColoredItemItemColor.INSTANCE, (Item) itemColor);
}
}
}
use of net.minecraft.client.renderer.color.BlockColors in project MorePlanets by SteveKunG.
the class ClientProxyMP method init.
@Override
public void init(FMLInitializationEvent event) {
BlockColors color = Minecraft.getMinecraft().getBlockColors();
ItemModelRenderer.init();
TileEntityRenderer.init();
ClientRegistryUtils.registerBlockColor((state, world, pos, tint) -> world != null && pos != null ? BiomeColorHelper.getGrassColorAtPos(world, pos) : ColorUtils.rgbToDecimal(124, 173, 38), MPBlocks.FRONOS_GRASS_BLOCK);
ClientRegistryUtils.registerBlockColor((state, world, pos, tint) -> ColorUtils.rgbToDecimal(120, 85, 190), MPBlocks.INFECTED_PURLONITE_CRYSTAL);
ClientRegistryUtils.registerBlockColor((state, world, pos, tint) -> ColorUtils.rgbToDecimal(50, 101, 236), MPBlocks.MULTALIC_CRYSTAL);
ClientRegistryUtils.registerBlockColor((state, world, pos, tint) -> ColorUtils.rgbToDecimal(50, 101, 236), MPBlocks.MULTALIC_CRYSTAL_BLOCK);
ClientRegistryUtils.registerBlockColor((state, world, pos, tint) -> ColorUtils.rgbToDecimal(143, 55, 33), MPBlocks.INFECTED_MELON_STEM);
ClientRegistryUtils.registerBlockColor((state, world, pos, tint) -> world != null && pos != null ? BiomeColorHelper.getGrassColorAtPos(world, pos) : ColorUtils.rgbToDecimal(124, 173, 38), MPBlocks.FRONOS_GRASS);
ClientRegistryUtils.registerBlockColor((state, world, pos, tint) -> world != null && pos != null ? BiomeColorHelper.getGrassColorAtPos(world, pos) : ColorUtils.rgbToDecimal(124, 173, 38), MPBlocks.FRONOS_TALL_GRASS);
ClientRegistryUtils.registerItemColor((itemStack, tintIndex) -> color.colorMultiplier(((ItemBlock) itemStack.getItem()).getBlock().getDefaultState(), null, null, tintIndex), MPBlocks.FRONOS_GRASS_BLOCK);
ClientRegistryUtils.registerItemColor((itemStack, tintIndex) -> ColorUtils.rgbToDecimal(50, 101, 236), MPBlocks.MULTALIC_CRYSTAL_BLOCK);
ClientRegistryUtils.registerItemColor((itemStack, tintIndex) -> tintIndex == 1 ? ItemCapsule.CapsuleType.INFECTED_SPORE.getColor() : -1, MPItems.INFECTED_SPORE_PROTECTION_CAPSULE);
ClientRegistryUtils.registerItemColor((itemStack, tintIndex) -> tintIndex == 1 ? ItemCapsule.CapsuleType.DARK_ENERGY.getColor() : -1, MPItems.DARK_ENERGY_PROTECTION_CAPSULE);
ClientRegistryUtils.registerItemColor((itemStack, tintIndex) -> color.colorMultiplier(((ItemBlock) itemStack.getItem()).getBlock().getDefaultState(), null, null, tintIndex), MPBlocks.FRONOS_GRASS);
ClientRegistryUtils.registerItemColor((itemStack, tintIndex) -> color.colorMultiplier(((ItemBlock) itemStack.getItem()).getBlock().getDefaultState(), null, null, tintIndex), MPBlocks.FRONOS_TALL_GRASS);
}
Aggregations