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

Hello, it has been a while since I last posted here for help.

I am currently trying to get an instance of a vanilla biome from the Forge registry. However, I am getting the error "Registry Object not present".

Can someone tell me what I am doing incorrectly here?

 

Code: (assume the string "name" is set to "minecraft:the_void" for testing purposes. The output log indicates this biome is entered into the Forge registry.)

/**
* Return a registered biome using its resource location name.
*/
public static Biome getBiomeFromName(String name)
{
	RegistryObject<Biome> biome = RegistryObject.of(new ResourceLocation(name), ForgeRegistries.BIOMES);
	return biome.get();
}

 

Error:

[23:28:06] [Server thread/ERROR] [ne.mi.ev.EventBus/EVENTBUS]: Exception caught during firing event: Registry Object not present: minecraft:the_void
	Index: 1
	Listeners:
		0: NORMAL
		1: ASM: class planetoids.event.WorldEvents onWorldLoaded(Lnet/minecraftforge/event/world/WorldEvent$Load;)V
java.lang.NullPointerException: Registry Object not present: minecraft:the_void
	at java.base/java.util.Objects.requireNonNull(Objects.java:348)
	at net.minecraftforge.fml.RegistryObject.get(RegistryObject.java:120)
	at planetoids.PlanetoidsUtil.getBiomeFromName(PlanetoidsUtil.java:25)
	at planetoids.PlanetoidType.<init>(PlanetoidType.java:31)
	at planetoids.PlanetoidType.initPlanetoidTypes(PlanetoidType.java:43)
	at planetoids.event.WorldEvents.onWorldLoaded(WorldEvents.java:24)
	at net.minecraftforge.eventbus.ASMEventHandler_1_WorldEvents_onWorldLoaded_Load.invoke(.dynamic)
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:297)
	at net.minecraft.server.MinecraftServer.func_240787_a_(MinecraftServer.java:386)
	at net.minecraft.server.MinecraftServer.func_240800_l__(MinecraftServer.java:315)
	at net.minecraft.server.integrated.IntegratedServer.init(IntegratedServer.java:63)
	at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:642)
	at net.minecraft.server.MinecraftServer.lambda$startServer$0(MinecraftServer.java:233)
	at java.base/java.lang.Thread.run(Thread.java:832)

[23:28:06] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception
java.lang.NullPointerException: Registry Object not present: minecraft:the_void
	at java.util.Objects.requireNonNull(Objects.java:348) ~[?:?] {}
	at net.minecraftforge.fml.RegistryObject.get(RegistryObject.java:120) ~[forge-1.16.4-35.1.15_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading}
	at planetoids.PlanetoidsUtil.getBiomeFromName(PlanetoidsUtil.java:25) ~[main/:?] {re:classloading}
	at planetoids.PlanetoidType.<init>(PlanetoidType.java:31) ~[main/:?] {re:classloading}
	at planetoids.PlanetoidType.initPlanetoidTypes(PlanetoidType.java:43) ~[main/:?] {re:classloading}
	at planetoids.event.WorldEvents.onWorldLoaded(WorldEvents.java:24) ~[main/:?] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_1_WorldEvents_onWorldLoaded_Load.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-3.0.5-service.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:297) ~[eventbus-3.0.5-service.jar:?] {}
	at net.minecraft.server.MinecraftServer.func_240787_a_(MinecraftServer.java:386) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.func_240800_l__(MinecraftServer.java:315) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.integrated.IntegratedServer.init(IntegratedServer.java:63) ~[forge:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:642) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$startServer$0(MinecraftServer.java:233) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:832) [?:?] {}
[23:28:06] [Server thread/FATAL] [ne.mi.co.ForgeMod/]: Preparing crash report with UUID adb0f1bf-a81e-40a9-aeda-4bf55a6b0029

 

Edited by nanorover59

  • Author

Update: I found out how to do this.

 

/**
 * Return a registered biome using its resource location name.
 */
public static Biome getBiomeFromName(String name)
{
	return ForgeRegistries.BIOMES.getValue(new ResourceLocation(name));
}

 

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.