use of net.minecraft.client.renderer.color.BlockColors in project Cavern2 by kegare.
the class Cavern method registerBlockColors.
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void registerBlockColors(ColorHandlerEvent.Block event) {
BlockColors colors = event.getBlockColors();
CaveBlocks.registerBlockColors(colors);
}
use of net.minecraft.client.renderer.color.BlockColors in project HorsePower by GoryMoon.
the class ColorGetter method getBlockColors.
private static List<Color> getBlockColors(ItemStack itemStack, Block block, int colorCount) {
final int meta = itemStack.getMetadata();
IBlockState blockState;
try {
blockState = block.getStateFromMeta(meta);
} catch (RuntimeException ignored) {
blockState = block.getDefaultState();
} catch (LinkageError ignored) {
blockState = block.getDefaultState();
}
final BlockColors blockColors = Minecraft.getMinecraft().getBlockColors();
final int renderColor = blockColors.colorMultiplier(blockState, null, null, 0);
final TextureAtlasSprite textureAtlasSprite = getTextureAtlasSprite(blockState);
if (textureAtlasSprite == null) {
return Collections.emptyList();
}
return getColors(textureAtlasSprite, renderColor, colorCount);
}
use of net.minecraft.client.renderer.color.BlockColors in project ForestryMC 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 ForestryMC by ForestryMC.
the class BlockClimatiser method colorMultiplier.
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("deprecation")
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
if (pos == null || worldIn == null) {
return 0xffffff;
}
ItemStack camouflageStack = getCamouflageBlock(worldIn, pos);
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, worldIn, pos, tintIndex);
if (color != -1) {
return color;
}
}
}
return 0xffffff;
}
use of net.minecraft.client.renderer.color.BlockColors in project Geolosys by oitsjustjose.
the class BlockColorInit method registerBlockColors.
@SubscribeEvent
public static void registerBlockColors(ColorHandlerEvent.Block evt) {
BlockColors blockColors = evt.getBlockColors();
blockColors.register((unknown, lightReader, pos, unknown2) -> lightReader != null && pos != null ? BiomeColors.getGrassColor(lightReader, pos) : GrassColors.get(0.5D, 1.0D), ModBlocks.getInstance().peat);
blockColors.register((unknown, lightReader, pos, unknown2) -> lightReader != null && pos != null ? BiomeColors.getGrassColor(lightReader, pos) : GrassColors.get(0.5D, 1.0D), ModBlocks.getInstance().rhododendron);
}
Aggregations