Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.