Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.5] Couldn't parse loot modifier error


Recommended Posts

I was wondering if anyone knows what is causing this error / how to fix it.

 

The full error:

Quote

[22:52:10] [Render thread/ERROR] [ne.mi.co.lo.LootModifierManager/]: Couldn't parse loot modifier enchantment_enchancements:midas_modifier
java.lang.NullPointerException: null
    at net.minecraftforge.common.loot.LootModifierManager.deserializeModifier(LootModifierManager.java:127) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading}
    at net.minecraftforge.common.loot.LootModifierManager.lambda$apply$0(LootModifierManager.java:115) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading}
    at java.util.ArrayList.forEach(ArrayList.java:1259) ~[?:1.8.0_271] {}
    at net.minecraftforge.common.loot.LootModifierManager.apply(LootModifierManager.java:113) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading}
    at net.minecraftforge.common.loot.LootModifierManager.apply(LootModifierManager.java:54) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading}
    at net.minecraft.client.resources.ReloadListener.lambda$reload$1(ReloadListener.java:14) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading}
    at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:670) ~[?:1.8.0_271] {}
    at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:646) ~[?:1.8.0_271] {}
    at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:456) ~[?:1.8.0_271] {}
    at net.minecraft.resources.AsyncReloader.lambda$null$3(AsyncReloader.java:66) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading}
    at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:139) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading}
    at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:109) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.util.concurrent.ThreadTaskExecutor.driveUntil(ThreadTaskExecutor.java:122) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.client.Minecraft.reloadDatapacks(Minecraft.java:1910) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.loadWorld(Minecraft.java:1762) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.loadWorld(Minecraft.java:1728) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screen.WorldSelectionList$Entry.func_214443_e(WorldSelectionList.java:364) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screen.WorldSelectionList$Entry.func_214438_a(WorldSelectionList.java:273) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screen.WorldSelectionList$Entry.mouseClicked(WorldSelectionList.java:225) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.widget.list.AbstractList.mouseClicked(AbstractList.java:309) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.INestedGuiEventHandler.mouseClicked(INestedGuiEventHandler.java:31) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.MouseHelper.lambda$mouseButtonCallback$0(MouseHelper.java:92) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:427) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.MouseHelper.mouseButtonCallback(MouseHelper.java:90) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.MouseHelper.lambda$null$4(MouseHelper.java:185) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(ThreadTaskExecutor.java:86) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.client.MouseHelper.lambda$registerCallbacks$5(MouseHelper.java:184) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
    at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10] {}
    at org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:3174) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
    at com.mojang.blaze3d.systems.RenderSystem.limitDisplayFPS(RenderSystem.java:112) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1025) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:612) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] {}
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] {}
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] {}
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] {}
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.5-36.0.22_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {}

 

The modifier JSON:

{
  "type": "enchantment_enhancements:midas_modifier",
  "conditions": [
    {
      "condition": "minecraft:match_tool",
      "predicate": {
        "enchantments": [
          {
            "enchantment": "enchantment_enhancements:midas",
            "levels": {
              "min": 1
            }
          }
        ]
      }
    }
  ],
  "curseItem": "minecraft:gold_nugget"
}

 

How I'm registering the modifier serializer:

package com.isensehostility.enchantment_enhancements.registries;

import com.isensehostility.enchantment_enhancements.EnchantmentEnhancements;
import com.isensehostility.enchantment_enhancements.loot_modifiers.MidasEnchantmentModifier;
import net.minecraftforge.common.loot.GlobalLootModifierSerializer;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.IForgeRegistry;

@Mod.EventBusSubscriber(modid = EnchantmentEnhancements.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class SerializerRegistry {

   @SubscribeEvent
   public static void registerModifierSerializers(final RegistryEvent.Register< GlobalLootModifierSerializer<?>> event) {
      IForgeRegistry<GlobalLootModifierSerializer<?>> registry = event.getRegistry();
      register(registry, new MidasEnchantmentModifier.Serializer(), "midas_modifier");
   }

   private static void register(IForgeRegistry<GlobalLootModifierSerializer<?>> registry, GlobalLootModifierSerializer<?> serializer, String name) {
      registry.register(serializer.setRegistryName(EnchantmentEnhancements.locate(name)));
   }
}

 

The modifier itself:

package com.isensehostility.enchantment_enhancements.loot_modifiers;

import com.google.gson.JsonObject;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.LootContext;
import net.minecraft.loot.conditions.ILootCondition;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.loot.GlobalLootModifierSerializer;
import net.minecraftforge.common.loot.LootModifier;
import net.minecraftforge.registries.ForgeRegistries;

import javax.annotation.Nonnull;
import java.util.List;

public class MidasEnchantmentModifier extends LootModifier {
    private final Item curseItem;

    public MidasEnchantmentModifier(ILootCondition[] conditionsIn, Item nugget) {
        super(conditionsIn);
        this.curseItem = nugget;
    }

    @Nonnull
    @Override
    public List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context) {
        generatedLoot.add(new ItemStack(curseItem));
        return generatedLoot;
    }

    public static class Serializer extends GlobalLootModifierSerializer<MidasEnchantmentModifier> {
        @Override
        public MidasEnchantmentModifier read(ResourceLocation name, JsonObject object, ILootCondition[] conditionsIn) {
            Item gold_nugget = ForgeRegistries.ITEMS.getValue(new ResourceLocation(JSONUtils.getString(object, "curseItem")));
            return new MidasEnchantmentModifier(conditionsIn, gold_nugget);
        }

        @Override
        public JsonObject write(MidasEnchantmentModifier instance) {
            return null;
        }
    }
}

 

I thought I did everything correctly, but clearly that is not the case. Any help is appreciated.

Link to post
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.

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



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I added a network channel, but how can i know if the channel exist on the client side ?  By the way I can't find the way to get the current server IP in 1.16.5, can you help me with that please ? 
    • I want to make texture pack and I have a problem with models. I want to make sides of diamond armor logner, can anybody help me? When i change this in layers, and render my texture pack it just turning to mess.
    • Experienced modders, I come to you with hat in hand and request if you could share with me your thoughts and suggestions for a direction I should take on implementing a feature in my mod. First, the concept. What I would like to achieve is to provide the end user a json config file in which they can place a list of biomes and provide some addition details/criteria to apply to the world generation about those biomes. The first I would like to achieve is applying a min and max distance that a biome can spawn at from the center of the world. For example, if they wanted to make sure that desert biome was never any closer to 0, 0 then say 200 blocks they could have that in the json and then the world would skip desert as an allowed biome whenever the player is generating terrain before 200 blocks out. So far I have been able to implement my own WorldType and BiomeProvider and strong arm the getBiomeNoise function to check the distance loaded in from center against the value loaded in from the config file and just wholesale swap it for a different hardcoded biome choice, but obvious that brute force attack is not ideal at all. So I have two questions maybe you can offer advise about: 1. I would actually like this feature to allow whatever the existing generation algorithm is to do its things and just make this one additional criteria check, but obviously this seems unlikely. I have been reading up on Mixins but I am not sure yet if this will let me achieve my goals or if I even SHOULD go that route. 2. What do you think is a better strategy for replacing the chosen biome with a new one? Look for the closest neighbor biome and go that route? Whats the best way to do that?   Thanks ahead of time for anyone who even bothered to read this lol.
    • Yeah, I changed the JAVA_HOME variable to the path of my JDK (C:\Program Files\Java\jdk1.8.0_281) and it worked. Thanks.
    • use NetworkHooks#openGui look how minecraft create container, but basically you need the container and a screen tutorials are not the best solution to learn something, read the forge docs and look here in the forum, then try to create a container, if you have problems creating it you can still ask
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.