Jump to content

[1.19.1] Custom Datapack not loading


DaqEm

Recommended Posts

Hi, I'm trying to create custom datapack support for my 5x5 workbench. But when I add a json file to: 'resourses > data > jobsplus (modid) > custom_recipes' and I load a world, it says I need to try safe mode and gives me te following error:

P.S. when I remove the file in 'custom_recipes' or when I comment out the line in 'EventAddReloadListener':

event.addListener(ModRecipeManager.instance);

The world loads without a problem.

 

Spoiler

[13:34:33] [Render thread/WARN] [minecraft/WorldOpenFlows]: Failed to load datapacks, can't proceed with server load
java.util.concurrent.ExecutionException: java.lang.NullPointerException: Cannot invoke "com.google.gson.Gson.getAdapter(java.lang.Class)" because "p_13781_" is null
    at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396) ~[?:?] {}
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073) ~[?:?] {}
    at net.minecraft.client.gui.screens.worldselection.WorldOpenFlows.loadWorldStem(WorldOpenFlows.java:131) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screens.worldselection.WorldOpenFlows.loadWorldStem(WorldOpenFlows.java:109) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screens.worldselection.WorldOpenFlows.doLoadLevel(WorldOpenFlows.java:148) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screens.worldselection.WorldOpenFlows.doLoadLevel(WorldOpenFlows.java:136) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screens.worldselection.WorldOpenFlows.loadLevel(WorldOpenFlows.java:58) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screens.worldselection.WorldSelectionList$WorldListEntry.loadWorld(WorldSelectionList.java:586) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screens.worldselection.WorldSelectionList$WorldListEntry.joinWorld(WorldSelectionList.java:448) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screens.worldselection.WorldSelectionList$WorldListEntry.mouseClicked(WorldSelectionList.java:375) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.components.AbstractSelectionList.mouseClicked(AbstractSelectionList.java:336) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.components.events.ContainerEventHandler.mouseClicked(ContainerEventHandler.java:28) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.MouseHandler.lambda$onPress$0(MouseHandler.java:88) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screens.Screen.wrapScreenError(Screen.java:522) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.MouseHandler.onPress(MouseHandler.java:85) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.MouseHandler.lambda$setup$4(MouseHandler.java:185) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.client.MouseHandler.lambda$setup$5(MouseHandler.java:184) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:43) ~[lwjgl-glfw-3.3.1.jar%23162!/:build 7] {}
    at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.3.1.jar%23168!/:build 7] {}
    at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3403) ~[lwjgl-glfw-3.3.1.jar%23162!/:build 7] {}
    at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:164) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at com.mojang.blaze3d.platform.Window.updateDisplay(Window.java:337) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1140) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:697) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.run(Main.java:212) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:51) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
    at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19.1-42.0.9.jar%2395!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {}
Caused by: java.lang.NullPointerException: Cannot invoke "com.google.gson.Gson.getAdapter(java.lang.Class)" because "p_13781_" is null
    at net.minecraft.util.GsonHelper.fromJson(GsonHelper.java:425) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading}
    at net.minecraft.util.GsonHelper.fromJson(GsonHelper.java:464) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading}
    at net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener.prepare(SimpleJsonResourceReloadListener.java:43) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading}
    at net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener.prepare(SimpleJsonResourceReloadListener.java:16) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading}
    at net.minecraft.server.packs.resources.SimplePreparableReloadListener.lambda$reload$0(SimplePreparableReloadListener.java:10) ~[forge-1.19.1-42.0.9_mapped_official_1.19.1-recomp.jar%23183!/:?] {re:classloading}
    at java.util.concurrent.CompletableFuture$AsyncSupply.run$$$capture(CompletableFuture.java:1768) ~[?:?] {}
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java) ~[?:?] {}
    at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ~[?:?] {}
    at java.util.concurrent.ForkJoinTask.doExec$$$capture(ForkJoinTask.java:373) ~[?:?] {}
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java) ~[?:?] {}
    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) ~[?:?] {}

 

debug.log:

https://gist.github.com/DAQEM/6e09bc9d51cd2fb72265116b1982f843

 

ReloadListener:

@Mod.EventBusSubscriber(modid = JobsPlus.MOD_ID)
public class EventAddReloadListener {

    @SubscribeEvent
    public static void dataLoading(AddReloadListenerEvent event) {
        event.addListener(ModRecipeManager.instance);
    }
}

 

ModRecipeManeger:

public class ModRecipeManager extends SimpleJsonResourceReloadListener {

    public static final ModRecipeManager instance = new ModRecipeManager();
    private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();

    public ModRecipeManager() {
        super(GSON, "custom_recipes");
    }

    @Override
    protected void apply(Map<ResourceLocation, JsonElement> jsonElementMap, ResourceManager p_10794_, ProfilerFiller p_10795_) {
    }
}

 

File in 'resources > data > jobsplus > custom_recipes':

{
  "id": "jobsplus:exp_jar",
  "key": {
    "A": {
      "item": "minecraft:glass"
    },
    "B": {
      "item": "minecraft:emerald"
    },
    "C": {
      "item": "minecraft:oak_planks"
    }
  },
  "pattern": [
    "     ",
    " CCC ",
    " ABA ",
    " AAA ",
    "     "
  ],
  "requiredLevel": 10
}

 

Any help is greatly appriciated! Thank you!

Link to comment
Share on other sites

public static final ModRecipeManager instance = new ModRecipeManager(); // What is the value of GSON here?
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();

 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Thank you @warjort. Moving GSON to the top resolved the issue.

New ModRecipeManager class:

public class ModRecipeManager extends SimpleJsonResourceReloadListener {

	private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
    public static final ModRecipeManager instance = new ModRecipeManager();

    public ModRecipeManager() {
        super(GSON, "custom_recipes");
    }

    @Override
    protected void apply(Map<ResourceLocation, JsonElement> jsonElementMap, ResourceManager p_10794_, ProfilerFiller p_10795_) {
    }
}

 

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.