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.

RustedSkies

Members
  • Joined

  • Last visited

  1. 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!
  2. How would I go about making the class client only, and making it fire after the registry events are? I've tried putting @Onlyin(Dist.CLIENT) like the vanilla BlockColors class did to no avail.
  3. RustedSkies joined the community
  4. I've been trying to make a mod with a grass block slab but I keep getting an error saying "Registry Object not present: mod:grass_slab" when I try to do the coloring. RegistryHandler: public class RegistryHandler { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MyMod.MOD_ID); public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MyMod.MOD_ID); public static void init() { BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); ColorHandler.init(); } public static final RegistryObject<Block> GRASS_SLAB = BLOCKS.register("grass_slab", () -> new SlabBlock(Block.Properties.create(Material.EARTH).hardnessAndResistance(0.5f, 0.5f).sound(SoundType.GROUND).harvestLevel(0).harvestTool(ToolType.SHOVEL))); public static final RegistryObject<Item> GRASS_SLAB_ITEM = ITEMS.register("grass_slab", () -> new BlockItem(GRASS_SLAB.get(), new Item.Properties().group(ItemGroup.BUILDING_BLOCKS))); } ColorHandler: 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()); // Line 16 return colorhandler; } public void register(IBlockColor blockColor, Block... blocksIn) { for(Block block : blocksIn) { this.colors.put(block.delegate, blockColor); } } } And this is the crash report: A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace: at java.util.Objects.requireNonNull(Objects.java:290) ~[?:1.8.0_275] {} -- MOD mod -- Details: Mod File: main Failure message: Mod (mod) has failed to load correctly java.lang.NullPointerException: Registry Object not present: mod:grass_slab Mod Version: NONE Mod Issue URL: http://my.issue.tracker/ Exception message: java.lang.NullPointerException: Registry Object not present: mod:grass_slab Stacktrace: at java.util.Objects.requireNonNull(Objects.java:290) ~[?:1.8.0_275] {} at net.minecraftforge.fml.RegistryObject.get(RegistryObject.java:120) ~[forge:?] {re:classloading} at dev.rustedskies.mod.utils.ColorHandler.init(ColorHandler.java:16) ~[?:?] {re:classloading} at dev.rustedskies.mod.utils.RegistryHandler.init(RegistryHandler.java:25) ~[?:?] {re:classloading} at dev.rustedskies.mod.MyMod.<init>(MyMod.java:42) ~[?:?] {re:classloading} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_275] {} at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_275] {} at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_275] {} at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_275] {} at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_275] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[forge:35.1] {re:classloading} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[forge:?] {re:classloading} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1640) ~[?:1.8.0_275] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1632) ~[?:1.8.0_275] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[?:1.8.0_275] {} at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[?:1.8.0_275] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) ~[?:1.8.0_275] {} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) ~[?:1.8.0_275] {} I've tried everything to get this to work, but I just can't figure it out. Thank you!

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.