net.minecraft.client.renderer.color.BlockColors Java Examples

The following examples show how to use net.minecraft.client.renderer.color.BlockColors. 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 vote down vote up
@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 vote down vote up
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 vote down vote up
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);
		}
	}
}
 
Example #4
Source File: CCBlockRendererDispatcher.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
public CCBlockRendererDispatcher(BlockRendererDispatcher parent, BlockColors blockColours) {
    super(parent.getBlockModelShapes(), blockColours);
    parentDispatcher = parent;
    this.blockModelRenderer = parent.blockModelRenderer;
    this.fluidRenderer = parent.fluidRenderer;
    this.blockModelShapes = parent.blockModelShapes;
}
 
Example #5
Source File: BlockModelRendererSchematic.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
public BlockModelRendererSchematic(BlockColors blockColorsIn)
{
    super(blockColorsIn);

    this.blockColors = blockColorsIn;
}