Java Code Examples for net.minecraft.client.renderer.color.BlockColors#registerBlockColorHandler()
The following examples show how to use
net.minecraft.client.renderer.color.BlockColors#registerBlockColorHandler() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClientProxy.java From customstuff4 with GNU General Public License v3.0 | 6 votes |
@Override public void setBlockBiomeTint(Block block, IntFunction<BlockTint> tintTypeForSubtype) { if (!(block instanceof CSBlock)) return; BlockColors blockColors = Minecraft.getMinecraft().getBlockColors(); CSBlock csBlock = (CSBlock) block; blockColors.registerBlockColorHandler( (state, worldIn, pos, tintIndex) -> { if (worldIn == null || pos == null) return ColorizerFoliage.getFoliageColorBasic(); return tintTypeForSubtype.apply(csBlock.getSubtype(state)).getMultiplier(worldIn, pos); /*if (tintType == BiomeTintType.FOLIAGE) return BiomeColorHelper.getFoliageColorAtPos(worldIn, pos); if (tintType == BiomeTintType.GRASS) return BiomeColorHelper.getGrassColorAtPos(worldIn, pos); if (tintType == BiomeTintType.WATER) return BiomeColorHelper.getWaterColorAtPos(worldIn, pos); return -1;*/ }, block); }
Example 2
Source File: Foliage.java From CommunityMod with GNU Lesser General Public License v2.1 | 5 votes |
private static void registerExtendedBlockColor(BlockColors bc, IExtendedBlockColor extColor, Block... blocks) { Map<IRegistryDelegate<Block>, IBlockColor> internalMap = ObfuscationReflectionHelper.getPrivateValue(BlockColors.class, bc, "blockColorMap"); //forge-added field in 1.12, no srg name available //TODO someone test this in obf lol for(Block b : blocks) { IRegistryDelegate<Block> delegate = b.delegate; IBlockColor regularColor = internalMap.get(delegate); bc.registerBlockColorHandler(((state, world, pos, tintIndex) -> extColor.colorMultiplierExt(regularColor, state, world, pos, tintIndex)), b); } }
Example 3
Source File: GTProxyClient.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
public static void registerTintedBlocks() { GTColorBlock colors = new GTColorBlock(); BlockColors registry = Minecraft.getMinecraft().getBlockColors(); for (Block block : Block.REGISTRY) { if (block instanceof IGTColorBlock) { registry.registerBlockColorHandler(colors, block); } } }