From 913467791a9c8e268dcfbde2bb9ac8c375442858 Mon Sep 17 00:00:00 2001 From: Techcable Date: Tue, 16 Jun 2020 13:31:54 -0700 Subject: [PATCH] Make `enableTreasureMaps` apply to shipwreck loot generation Fixes #3480 Previously it only controlled whether villagers could trade treasure maps. Now it should apply to loot generated in treasure maps. We don't unregister treasure maps from the loot table, since this option is per-world and the table is global. Instead I just replaced the implementation with a NOP. --- ...figurable-Cartographer-Treasure-Maps.patch | 20 +++++++++++++++++++ Spigot-Server-Patches/MC-Dev-fixes.patch | 13 ++++++++++++ 2 files changed, 33 insertions(+) diff --git a/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch b/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch index 840cb6d9c..3fb5cf3a4 100644 --- a/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch +++ b/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch @@ -27,6 +27,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } } +diff --git a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java ++++ b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java +@@ -0,0 +0,0 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional + + if (blockposition != null) { + WorldServer worldserver = loottableinfo.c(); ++ // Paper start ++ if (!worldserver.paperConfig.enableTreasureMaps) { ++ /* ++ * NOTE: I fear users will just get a plain map as their "treasure" ++ * This is preferable to disrespecting the config. ++ */ ++ return itemstack; ++ } ++ // Paper end + BlockPosition blockposition1 = worldserver.a(this.d, blockposition, this.g, this.h); + + if (blockposition1 != null) { diff --git a/src/main/java/net/minecraft/server/VillagerTrades.java b/src/main/java/net/minecraft/server/VillagerTrades.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/VillagerTrades.java diff --git a/Spigot-Server-Patches/MC-Dev-fixes.patch b/Spigot-Server-Patches/MC-Dev-fixes.patch index 7077217a0..bd7131209 100644 --- a/Spigot-Server-Patches/MC-Dev-fixes.patch +++ b/Spigot-Server-Patches/MC-Dev-fixes.patch @@ -428,6 +428,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.b(); this.g.set(false); })); +diff --git a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java ++++ b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java +@@ -0,0 +0,0 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional + } + + public void a(JsonObject jsonobject, LootItemFunctionExplorationMap lootitemfunctionexplorationmap, JsonSerializationContext jsonserializationcontext) { +- super.a(jsonobject, (LootItemFunctionConditional) lootitemfunctionexplorationmap, jsonserializationcontext); ++ super.a(jsonobject, lootitemfunctionexplorationmap, jsonserializationcontext); // Paper - decompile fix + if (!lootitemfunctionexplorationmap.d.equals("Buried_Treasure")) { + jsonobject.add("destination", jsonserializationcontext.serialize(lootitemfunctionexplorationmap.d)); + } diff --git a/src/main/java/net/minecraft/server/LootSelectorEntry.java b/src/main/java/net/minecraft/server/LootSelectorEntry.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/LootSelectorEntry.java