Jump to content

[1.18.2]Global Loot Modifier for multiple block at once [SOLVED]


inuripse

Recommended Posts

Hi! My global loot modifier is running for a leave at once at the moment.

But I want to change the loot table of all minecraft leaves, then I used the alternative condition:

{
  "condition": "minecraft:alternative",
  "terms": [
    {
      "condition": "forge:loot_table_id",
      "loot_table_id": "minecraft:blocks/dark_oak_leaves"
    },
    {
      "condition": "forge:loot_table_id",
      "loot_table_id": "minecraft:blocks/birch_leaves"
    },
    {
      "condition": "forge:loot_table_id",
      "loot_table_id": "minecraft:blocks/oak_leaves"
    }
    etc...
  ]
}

But I want this global modifier to modify loot tables of leaves from other mods where there is leaves placed in "leaves" tag by other modders. 

(this is my question, is it possible to do this and how to use tag in this case please)

Then I tried a lot of different options in the json file but I can't figure it out :/

Then I finally tried this two options:

1-

{
  "condition": "minecraft:block_state_property",
  "predicate": {
    "tags" : [
      {
        "tag": "#minecraft:leaves"
      }
    ]
  }
}

2-

{
  "condition": "minecraft:block_state_property",
  "tag": "#minecraft:leaves"
}

 

But I got this error message.

Quote

[15:32:09] [Render thread/ERROR] [ne.mi.co.lo.LootModifierManager/]: Couldn't parse loot modifier naturerain:birch_leaves_glm
com.google.gson.JsonSyntaxException: Missing block, expected to find a string
    at net.minecraft.util.GsonHelper.getAsString(GsonHelper.java:108) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading}
    at net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition$Serializer.deserialize(LootItemBlockStatePropertyCondition.java:83) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading}
    at net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition$Serializer.deserialize(LootItemBlockStatePropertyCondition.java:70) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading}
    at net.minecraft.world.level.storage.loot.GsonAdapterFactory$JsonAdapter.deserialize(GsonAdapterFactory.java:113) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading}
    at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) ~[gson-2.8.9.jar%2343!/:?] {}
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41) ~[gson-2.8.9.jar%2343!/:?] {}
    at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72) ~[gson-2.8.9.jar%2343!/:?] {}
    at com.google.gson.Gson.fromJson(Gson.java:963) ~[gson-2.8.9.jar%2343!/:?] {}
    at com.google.gson.Gson.fromJson(Gson.java:1034) ~[gson-2.8.9.jar%2343!/:?] {}
    at com.google.gson.Gson.fromJson(Gson.java:1006) ~[gson-2.8.9.jar%2343!/:?] {}
    at net.minecraftforge.common.loot.LootModifierManager.deserializeModifier(LootModifierManager.java:115) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2378%2385!/:?] {re:classloading}
    at net.minecraftforge.common.loot.LootModifierManager.lambda$apply$0(LootModifierManager.java:101) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2378%2385!/:?] {re:classloading}
    at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?] {}
    at net.minecraftforge.common.loot.LootModifierManager.apply(LootModifierManager.java:99) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2378%2385!/:?] {re:classloading}
    at net.minecraftforge.common.loot.LootModifierManager.apply(LootModifierManager.java:40) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2378%2385!/:?] {re:classloading}
    at net.minecraft.server.packs.resources.SimplePreparableReloadListener.lambda$reload$1(SimplePreparableReloadListener.java:12) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading}
    at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?] {}
    at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {}
    at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:65) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading}
    at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:146) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:22) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading}
    at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:116) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:129) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.client.Minecraft.makeWorldStem(Minecraft.java:2128) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.doLoadLevel(Minecraft.java:1955) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.loadLevel(Minecraft.java:1919) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screens.worldselection.WorldSelectionList$WorldListEntry.loadWorld(WorldSelectionList.java:473) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screens.worldselection.WorldSelectionList$WorldListEntry.joinWorld(WorldSelectionList.java:330) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] {}
    at net.minecraft.client.gui.screens.worldselection.SelectWorldScreen.lambda$init$3(SelectWorldScreen.java:57) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.components.Button.onPress(Button.java:29) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.components.AbstractButton.onClick(AbstractButton.java:17) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.components.AbstractWidget.mouseClicked(AbstractWidget.java:111) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.components.events.ContainerEventHandler.mouseClicked(ContainerEventHandler.java:31) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.MouseHandler.lambda$onPress$0(MouseHandler.java:93) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screens.Screen.wrapScreenError(Screen.java:528) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.MouseHandler.onPress(MouseHandler.java:90) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.MouseHandler.lambda$setup$4(MouseHandler.java:195) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.client.MouseHandler.lambda$setup$5(MouseHandler.java:194) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar%2357!/:build 10] {}
    at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar%2363!/:build 10] {}
    at org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:3174) ~[lwjgl-glfw-3.2.2.jar%2357!/:build 10] {}
    at com.mojang.blaze3d.systems.RenderSystem.limitDisplayFPS(RenderSystem.java:187) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1096) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:669) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:205) ~[forge-1.18.2-40.1.73_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2379!/:?] {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:24) ~[fmlloader-1.18.2-40.1.73.jar%230!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.3.jar%2311!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.3.jar%2311!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.3.jar%2311!/:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.3.jar%2311!/:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.3.jar%2311!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.3.jar%2311!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.3.jar%2311!/:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?] {}
 

 

Edited by inuripse
Link to comment
Share on other sites

Ok ! I was stuck on the deserialize method of the Serializer of my LootItemCondition and search for help and found this [1.18.2] Method for iterating over blocks belonging to a tag

https://forums.minecraftforge.net/topic/113816-1182-method-for-iterating-over-blocks-belonging-to-a-tag/#comment-505993

I just completed what I was missing and it runs. 

Link to comment
Share on other sites

  • inuripse changed the title to [1.18.2]Global Loot Modifier for multiple block at once [SOLVED]

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.