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.

When to create Block instances, and not only [1.18.2]

Featured Replies

Posted

Hello there,

I started porting my mod from 1.18.1 to 1.18.2, and what I encountered during startup is that while creating block instances (new Block, etc.) I got an error from Block#67:

   private final Holder.Reference<Block> builtInRegistryHolder = Registry.BLOCK.createIntrusiveHolder(this);

What is says is that "Registry is already frozen":

Caused by: java.lang.IllegalStateException: Registry is already frozen
	at net.minecraftforge.registries.NamespacedHolderHelper.createIntrusiveHolder(NamespacedHolderHelper.java:177) ~[forge-1.18.2-40.1.52_mapped_official_1.18.2-recomp.jar%2375%2382!/:?] {re:classloading}
	at net.minecraftforge.registries.NamespacedDefaultedWrapper.createIntrusiveHolder(NamespacedDefaultedWrapper.java:205) ~[forge-1.18.2-40.1.52_mapped_official_1.18.2-recomp.jar%2375%2382!/:?] {re:classloading}
	at net.minecraftforge.registries.NamespacedDefaultedWrapper.createIntrusiveHolder(NamespacedDefaultedWrapper.java:33) ~[forge-1.18.2-40.1.52_mapped_official_1.18.2-recomp.jar%2375%2382!/:?] {re:classloading}
	at net.minecraft.world.level.block.Block.<init>(Block.java:67) ~[forge-1.18.2-40.1.52_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B}
	at net.matez.wildnature.common.objects.blocks.setup.WNBlock.<init>(WNBlock.java:57) ~[%2381!/:?] {re:classloading}
	at net.matez.wildnature.common.objects.blocks.basic.WNRotatedPillarBlock.<init>(WNRotatedPillarBlock.java:26) ~[%2381!/:?] {re:classloading}
	at net.matez.wildnature.common.objects.blocks.wood.building.WNLogBlock.<init>(WNLogBlock.java:38) ~[%2381!/:?] {re:classloading}
	at net.matez.wildnature.common.registry.blocks.WNBlocks.lambda$static$0(WNBlocks.java:94) ~[%2381!/:?] {re:classloading}
	at net.matez.wildnature.common.registry.blocks.WNBlocks.register(WNBlocks.java:1283) ~[%2381!/:?] {re:classloading}
	at net.matez.wildnature.common.registry.blocks.WNBlocks.<clinit>(WNBlocks.java:86) ~[%2381!/:?] {re:classloading}
	at net.matez.wildnature.common.registry.blockentities.WNBlockEntities.lambda$static$0(WNBlockEntities.java:37) ~[%2381!/:?] {re:classloading}
	at net.matez.wildnature.common.registry.blockentities.WNBlockEntities.register(WNBlockEntities.java:62) ~[%2381!/:?] {re:classloading}
	at net.matez.wildnature.common.registry.blockentities.WNBlockEntities.<clinit>(WNBlockEntities.java:35) ~[%2381!/:?] {re:classloading}
	at net.matez.wildnature.client.registry.blockentities.WNBlockEntityRenderers.<clinit>(WNBlockEntityRenderers.java:26) ~[%2381!/:?] {re:classloading}
	at java.lang.Class.forName0(Native Method) ~[?:?] {}
	at java.lang.Class.forName(Class.java:375) ~[?:?] {}
	at net.matez.wildnature.common.objects.initializer.Initializer.<init>(Initializer.java:37) ~[%2381!/:?] {re:classloading}
	at net.matez.wildnature.setup.WildNature.<init>(WildNature.java:62) ~[%2381!/:?] {re:classloading}

I think it will also occur with other things like BlockEntities, Entities and other.

I create these blocks during FMLConstructModEvent process. It worked fine in 1.18.1, now it doesn't. Where should I do it?
Thanks.


PS. Somehow my old forge forum account is blocked. Too bad.

Edited by matez
post scriptum

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.