-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
CraftBukkit version git-Spigot-b5a13e6-a05df28 (MC: 1.16.2) (Implementing API version 1.16.2-R0.1-SNAPSHOT)
-
Yes
For both 1.15 and 1.16, LootContext#build is unusable because it always errors out. No matter what LootTable or LootContext parameters given, it always fails to pass the IllegalArgumentException. Even using the default loot tables will cause this.
Could not pass event ChunkLoadEvent to SpellforgedRPG v0.0.1 org.bukkit.event.EventException: null at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:319) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at net.minecraft.server.v1_16_R2.Chunk.loadCallback(Chunk.java:517) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at net.minecraft.server.v1_16_R2.PlayerChunk.lambda$13(PlayerChunk.java:384) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at net.minecraft.server.v1_16_R2.PlayerChunkMap$CallbackExecutor.run(PlayerChunkMap.java:98) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at net.minecraft.server.v1_16_R2.ChunkProviderServer$a.executeNext(ChunkProviderServer.java:567) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at net.minecraft.server.v1_16_R2.ChunkProviderServer.runTasks(ChunkProviderServer.java:261) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at net.minecraft.server.v1_16_R2.MinecraftServer.ba(MinecraftServer.java:950) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at net.minecraft.server.v1_16_R2.MinecraftServer.executeNext(MinecraftServer.java:934) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at net.minecraft.server.v1_16_R2.IAsyncTaskHandler.awaitTasks(SourceFile:127) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at net.minecraft.server.v1_16_R2.MinecraftServer.sleepForTick(MinecraftServer.java:918) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at net.minecraft.server.v1_16_R2.MinecraftServer.w(MinecraftServer.java:850) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at net.minecraft.server.v1_16_R2.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at java.lang.Thread.run(Unknown Source) [?:1.8.0_201] Caused by: java.lang.IllegalArgumentException: Missing required parameters: [<parameter minecraft:killer_entity>, <parameter minecraft:last_damage_player>, <parameter minecraft:block_entity>, <parameter minecraft:direct_killer_entity>, <parameter minecraft:damage_source>, <parameter minecraft:block_state>, <parameter minecraft:tool>, <parameter minecraft:origin>, <parameter minecraft:this_entity>, <parameter minecraft:explosion_radius>] at net.minecraft.server.v1_16_R2.LootTableInfo$Builder.build(SourceFile:208) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at org.bukkit.craftbukkit.v1_16_R2.CraftLootTable.convertContext(CraftLootTable.java:114) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at org.bukkit.craftbukkit.v1_16_R2.CraftLootTable.fillInventory(CraftLootTable.java:60) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] at me.Novalescent.items.loot.LootChest.replenish(LootChest.java:36) ~[?:?] at me.Novalescent.items.loot.LootListener.onChunkLoad(LootListener.java:86) ~[?:?] at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source) ~[?:?] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201] at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:315) ~[spigot.jar:git-Spigot-b5a13e6-a05df28] ... 15 more
The following patch can be inputted, which will resolve all issues related to LootContext#build():
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.j index 260d54b30..ad218c826 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java @@ -101,9 +101,6 @@ public class CraftLootTable implements org.bukkit.loot.LootTable { // SPIGOT-5603 - Avoid IllegalArgumentException in LootTableInfo#build() LootContextParameterSet.a nmsBuilder = new LootContextParameterSet.a(); // PAIL rename Builder - for (LootContextParameter<?> param : getHandle().getLootContextParameterSet().a()) { // PAIL rename required - nmsBuilder.a(param); // PAIL rename addRequired - } for (LootContextParameter<?> param : getHandle().getLootContextParameterSet().b()) { // PAIL rename optional if (!getHandle().getLootContextParameterSet().a().contains(param)) { // PAIL rename required nmsBuilder.b(param); // PAIL rename addOptional