Option for plants and blocks to colorize by foliage color.

Published by aidanete on
Status
Migrated
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 :)

Hello,

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

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

		@Override
		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:

@Override
	public void init(FMLInitializationEvent event) {
		MCreatorUNplantLotusBottom.TintedBlockColors.registerBlockColors();
	}
}

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=)

SO now is the function in MCreater called Block Tint. Can i change this Tint Color by Procedure?

Wish Great Day

PlayTics