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

Hi,

I have begun to port my mod from 1.18.1 to 1.18.2 and my custom JSON recipe system is stopping me from loading the game up at the moment. Everything worked in 1.18.1, but I know that the minor version change actually had major changes behind the scenes, so Im wondering if anyone knows what my issue is.

CraftingManager.java

Spoiler

package com.tcn.dimensionalpocketsii.core.management;

import com.tcn.cosmoslibrary.CosmosLibrary;
import com.tcn.cosmoslibrary.common.runtime.CosmosRuntimeHelper;
import com.tcn.dimensionalpocketsii.DimensionalPockets;
import com.tcn.dimensionalpocketsii.core.crafting.UpgradeStationRecipe;

import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;

@Mod.EventBusSubscriber(modid = DimensionalPockets.MOD_ID, bus = EventBusSubscriber.Bus.MOD)
public class CraftingManager {

    public static final RecipeSerializer<UpgradeStationRecipe> RECIPE_SERIALIZER_UPGRADE_STATION = new UpgradeStationRecipe.Serializer();
    public static final RecipeType<UpgradeStationRecipe> RECIPE_TYPE_UPGRADE_STATION = RecipeType.register(DimensionalPockets.MOD_ID + ":upgrading");
    
    @SubscribeEvent
    public static void onRecipeSerializerRegistry(final RegistryEvent.Register<RecipeSerializer<?>> event) {
        event.getRegistry().registerAll(
            CosmosRuntimeHelper.setupString(DimensionalPockets.MOD_ID, "upgrading", RECIPE_SERIALIZER_UPGRADE_STATION)
        );

        CosmosLibrary.CONSOLE.startup("RecipeSerializer<?> Registration complete.");
    }
}

I am assuming that Mojang has locked the vanilla Recipe Type system, but I cannot seem to find an alternative.

Crash Report (Snippet):

Spoiler

[21:46:55] [modloading-worker-0/ERROR] [ne.mi.fm.ja.FMLModContainer/LOADING]: Failed to register automatic subscribers. ModID: dimensionalpocketsii, class com.tcn.dimensionalpocketsii.DimensionalPockets
java.lang.ExceptionInInitializerError: null
    at java.lang.Class.forName0(Native Method) ~[?:?] {}
    at java.lang.Class.forName(Class.java:467) ~[?:?] {}
    at net.minecraftforge.fml.javafmlmod.AutomaticEventSubscriber.lambda$inject$6(AutomaticEventSubscriber.java:61) ~[javafmllanguage-1.18.2-40.1.0.jar%2377!/:?] {}
    at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?] {}
    at net.minecraftforge.fml.javafmlmod.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:48) ~[javafmllanguage-1.18.2-40.1.0.jar%2377!/:?] {}
    at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:77) ~[javafmllanguage-1.18.2-40.1.0.jar%2377!/:?] {}
    at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:106) ~[fmlcore-1.18.2-40.1.0.jar%2379!/:?] {}
    at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) [?:?] {}
    at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) [?:?] {}
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) [?:?] {}
    at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) [?:?] {}
    at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) [?:?] {}
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) [?:?] {}
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) [?:?] {}
Caused by: java.lang.IllegalStateException: Registry is already frozen (trying to add key ResourceKey[minecraft:recipe_type / dimensionalpocketsii:upgrading])
    at net.minecraft.core.MappedRegistry.validateWrite(MappedRegistry.java:78) ~[forge-1.18.2-40.1.0_mapped_official_1.18.2.jar%2376!/:?] {re:classloading}
    at net.minecraft.core.MappedRegistry.registerMapping(MappedRegistry.java:87) ~[forge-1.18.2-40.1.0_mapped_official_1.18.2.jar%2376!/:?] {re:classloading}
    at net.minecraft.core.MappedRegistry.registerMapping(MappedRegistry.java:83) ~[forge-1.18.2-40.1.0_mapped_official_1.18.2.jar%2376!/:?] {re:classloading}
    at net.minecraft.core.MappedRegistry.register(MappedRegistry.java:129) ~[forge-1.18.2-40.1.0_mapped_official_1.18.2.jar%2376!/:?] {re:classloading}
    at net.minecraft.core.Registry.register(Registry.java:564) ~[forge-1.18.2-40.1.0_mapped_official_1.18.2.jar%2376!/:?] {re:classloading}
    at net.minecraft.core.Registry.register(Registry.java:560) ~[forge-1.18.2-40.1.0_mapped_official_1.18.2.jar%2376!/:?] {re:classloading}
    at net.minecraft.world.item.crafting.RecipeType.register(RecipeType.java:20) ~[forge-1.18.2-40.1.0_mapped_official_1.18.2.jar%2376!/:?] {re:classloading}
    at com.tcn.dimensionalpocketsii.core.management.CraftingManager.<clinit>(CraftingManager.java:19) ~[%2380!/:1.18.1-5.1.1.60-universal] {re:classloading}
    ... 14 more
[21:46:55] [modloading-worker-0/DEBUG] [ne.mi.fm.co.ConfigTracker/CONFIG]: Config file jei-server.toml for jei tracking

 

Ive been out of the scene for a few months, so am not in the loop with major changes, so go easy :) Thanks in advance

  • Author
51 minutes ago, diesieben07 said:

Use DeferredRegister for all registrations.

Note that your registration was already incorrect in 1.18.1 and before.

 

Okay thanks, I need to wrap my head around this new system. Do I use this for *literally* everything? MenuTypes, BlockEntityTypes etc?

15 hours ago, Zeher_Monkey said:

Do I use this for *literally* everything? MenuTypes, BlockEntityTypes etc?

yes of course

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.