Jump to content

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


matez

Recommended Posts

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
Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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