Option for plants and blocks to colorize by foliage color.

Published by aidanete on Mon, 10/07/2019 - 14:16
Upvotes: 31
Issue description

I've searched for this on the tracker and I didn't find anything, but maybe there is something like this in the forums, I don't know really.

MCreator actually needs a way to color plants and blocks (or some sides of blocks) by the grass color, just like the top of grass blocks and the full "oak leaves" block, tall_grass, ferns, and so on.

I've also trying to search how to do this in the code editor but I didn't find anything minimally related.

So, that's my suggestion. Also, a way to do this right now will be awesome.

Thank you :D


Issue comments

We have been asked to do this before but did not manage yet. I will keep this ticket open as there are no tickets like this yet as you said.

Hi Klemen.

There is mod that contain such items as biome crystal and few biome blocks whose work like as described above. This mod is called R**d*m T*i**s and its on MIT licence. Maybe reading a source code will help you to understand, how it's work.

Itchier actually is a way to do this without going into some of the nitty gritty code. In 1.12.2 at least it is done through the model. If you have access to the leaf and grass blocks you will be able to see what is done to change color based on the foliage or grass color variations. 

The code that changes the color for vanilla blocks seems to be in BlockColors.java. It applies a color multiplier on the model based on block state, block pos, world and a "tint index" value, which is located in the block model.

The ticket is open and we plan this. Thanks for the code example, although it is for 1.7.2 so I hope it is still relevant :)


I've made the same stuff for a block, that should be colored in water colors (currently I'm using it for the plant growing in water).It is based on your colorizer implementation.It works well=)

Here are the peaces of code I changed:

in the block class

		public MapColor getMapColor(IBlockState state, IBlockAccess blockAccess, BlockPos pos) {
			return MapColor.WATER;
	public static class TintedBlockColors implements IBlockColor {
		public static final IBlockColor INSTANCE = new TintedBlockColors();

		public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
			return worldIn != null && pos != null ? BiomeColorHelper.getWaterColorAtPos(worldIn, pos) : -1;

		public static void registerBlockColors() {
			// DEBUG
			System.out.println("Registering block color handler (water)");
			Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(INSTANCE, block);

and registered colors, creating "custom element" - so it will not be deleted automatically, as from the ClientProxy, in it's initialization stage like this:

	public void init(FMLInitializationEvent event) {

The custom block model has tintindexes set to 1 on the sides of the "water" part .

Maybe that will be useful for someone looking for water colors=)

Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.