Jump to content

[1.19.2] Block tintindex ????


perromercenary00

Recommended Posts

hi 

i made this some time ago i want the terrain around mi villages and dungeons leveled whit slabs 
the trouble here is the grass slab ! ist gray not green and breaks the look of the terrain 
i know is something to do whit tintindex but idont have idea of how to get the tinindex from the grass for the bioma to later apply it to the slab json model 

 

i found very old post but that code is not compatible anymore 

####################################

* actually i need the link to documentation where explains how to do this 

* how to get the current biome color for grass an pass it to my custome slab model  

 

i got this theory of mine  i think i dont find relevant information on google becoze this is not called "color blocks" or "biome colors" but exist under some other especific obscure term that also is not "color provider" 

 

Thank you for your help .

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

adding someting more i manage to find an example i found where they regiter the color index for egg

 

package net.minecraftforge.common;

	@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = "forge", bus = Mod.EventBusSubscriber.Bus.MOD)
	private static class ColorRegisterHandler
	{
	@SubscribeEvent(priority = EventPriority.HIGHEST)
	public static void registerSpawnEggColors(RegisterColorHandlersEvent.Item event)
	{
	MOD_EGGS.forEach(egg ->
	event.getItemColors().register((stack, layer) -> egg.getColor(layer), egg)
	);
	}
	}
	

 

 

and begin testin thigs 

this dont works also the Systemout is anywhere to be seen in the console when the games fires 

	package mercblk.event;
	import mercblk.blocks.BlockInit;
import mercblk.blocks.ModBlockColor;
import net.minecraft.client.color.block.BlockColor;
import net.minecraftforge.client.event.RegisterColorHandlersEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.api.distmarker.Dist;
	//@Mod.EventBusSubscriber(Dist.CLIENT)
//@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
//@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = "forge", bus = Mod.EventBusSubscriber.Bus.MOD)
public class RegisterColors {
    @SubscribeEvent(priority = EventPriority.HIGHEST)
    
    public void registerBlockColors(RegisterColorHandlersEvent.Block event) {
        
        final BlockColor INSTANCE = new ModBlockColor();
        event.getBlockColors().register(INSTANCE, BlockInit.GRASS_SLAB.get());
        System.out.println("\n#RegisterColorHandlersEvent#\n");
    }
    
}

 

im coping code from here is the closest to 1.19.2 i been find 

 

in this post says the problem was the render type in  the lient setup the main looks like this 

	@SubscribeEvent
	public static void onClientSetup(FMLClientSetupEvent event){
	     ItemBlockRenderTypes.setRenderLayer(BlockInit.GRASS_SLAB.get(), RenderType.cutout());
	}
	

 

the json model looks like this 

	{ "parent": "block/block",
	"ambientocclusion": "true",
	"render_type": "cutout",
	"elements": [
	{ "from": [ 0, 0, 0 ],
	"to": [ 16, 8, 16 ],
	"faces": {
	"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down" },
	"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top", "cullface": "up", "tintindex": 0 },
	"north": { "uv": [ 0, 0, 16, 8 ], "texture": "#side", "cullface": "north" },
	"south": { "uv": [ 0, 0, 16, 8 ], "texture": "#side", "cullface": "south" },
	"west": { "uv": [ 0, 0, 16, 8 ], "texture": "#side", "cullface": "west" },
	"east": { "uv": [ 0, 0, 16, 8 ], "texture": "#side", "cullface": "east" }
	}
	},
	{ "from": [ 0, 0, 0 ],
	"to": [ 16, 8, 16 ],
	"faces": {
	"north": { "uv": [ 0, 0, 16, 8 ], "texture": "#overlay", "tintindex": 0, "cullface": "north" },
	"south": { "uv": [ 0, 0, 16, 8 ], "texture": "#overlay", "tintindex": 0, "cullface": "south" },
	"west": { "uv": [ 0, 0, 16, 8 ], "texture": "#overlay", "tintindex": 0, "cullface": "west" },
	"east": { "uv": [ 0, 0, 16, 8 ], "texture": "#overlay", "tintindex": 0, "cullface": "east" }
	}
	}
	]
	}
	

 

 

an the slab looks like this

2023-03-06-22-04-09.png

this has two slabs gray color and a vainilla grass block in the middle just for reference propourses 

 

Can you help me to pinpoint the reason why it tintindex dint works ?

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

this little thing of here 

 

	@SubscribeEvent
	public void registerBlockColors(RegisterColorHandlersEvent.Block event) {
	//final BlockColor INSTANCE = new ModBlockColor();
	event.getBlockColors().register( new ModBlockColor() , BlockInit.GRASS_SLAB.get());
	System.out.println("\n#RegisterColorHandlersEvent#\n");
	}
	

 

where it goes ? 

 

Link to comment
Share on other sites

I wondered how to do this too a couple days ago.

 

I dont know the exact code off the top of my head but I figured out how by looking at the source code of mods that add new leaf blocks like biome mods. For example I looked at biomes o plentys source code.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.