From 1dcda2491eeac70738fdff1983831d78f99f8f27 Mon Sep 17 00:00:00 2001 From: caramel Date: Sun, 29 Oct 2023 08:13:33 +0900 Subject: [PATCH] fix UnsafeValues#loadAdvancement doesn't recalculate position (#9846) --- .../server/Fix-UnsafeValues-loadAdvancement.patch | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/patches/server/Fix-UnsafeValues-loadAdvancement.patch b/patches/server/Fix-UnsafeValues-loadAdvancement.patch index efaec7b3ae..2a33703fbc 100644 --- a/patches/server/Fix-UnsafeValues-loadAdvancement.patch +++ b/patches/server/Fix-UnsafeValues-loadAdvancement.patch @@ -22,7 +22,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + mapBuilder.put(minecraftkey, holder); + + MinecraftServer.getServer().getAdvancements().advancements = mapBuilder.build(); -+ MinecraftServer.getServer().getAdvancements().tree().addAll(List.of(holder)); ++ final net.minecraft.advancements.AdvancementTree tree = MinecraftServer.getServer().getAdvancements().tree(); ++ tree.addAll(List.of(holder)); ++ ++ // recalculate advancement position ++ final net.minecraft.advancements.AdvancementNode node = tree.get(minecraftkey); ++ if (node != null) { ++ final net.minecraft.advancements.AdvancementNode root = node.root(); ++ if (root.holder().value().display().isPresent()) { ++ net.minecraft.advancements.TreeNodePosition.run(root); ++ } ++ } + // Paper end - Fix throw UnsupportedOperationException Advancement bukkit = Bukkit.getAdvancement(key);