Posted January 28, 20214 yr I've been trying to make a grass block slab, so I've looked at the vanilla BlockColors class and put that into my mod. When I run my mod, the sides of the slab are black besides the overlay, and the grass parts are still gray. ColorHandler Class: public class ColorHandler { private final java.util.Map<net.minecraftforge.registries.IRegistryDelegate<Block>, IBlockColor> colors = new java.util.HashMap<>(); public static ColorHandler init() { ColorHandler colorhandler = new ColorHandler(); colorhandler.register((state, reader, pos, color) -> { return reader != null && pos != null ? BiomeColors.getGrassColor(reader, pos) : GrassColors.get(0.5D, 1.0D); }, RegistryHandler.GRASS_SLAB.get()); return colorhandler; } public void register(IBlockColor blockColor, Block... blocksIn) { for(Block block : blocksIn) { this.colors.put(block.delegate, blockColor); } } } RegisterColors Class, which has been registered to the mod event bus: @Mod.EventBusSubscriber(Dist.CLIENT) public class RegisterColors { @SubscribeEvent public static void registerBlockColors(final ColorHandlerEvent.Block event) { ColorHandler.init(); } } Also the grass_slab.json model: { "parent": "block/block", "textures": { "particle": "block/dirt", "bottom": "block/dirt", "top": "block/grass_block_top", "side": "block/grass_block_side", "overlay": "block/grass_block_side_overlay" }, "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, 8, 16, 16 ], "texture": "#side", "cullface": "north" }, "south": { "uv": [ 0, 8, 16, 16 ], "texture": "#side", "cullface": "south" }, "west": { "uv": [ 0, 8, 16, 16 ], "texture": "#side", "cullface": "west" }, "east": { "uv": [ 0, 8, 16, 16 ], "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" } } } ] } Thank you!
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.