13
0
geforkt von Mirrors/Paper

fix UnsafeValues#loadAdvancement doesn't recalculate position (#9846)

Dieser Commit ist enthalten in:
caramel 2023-10-29 08:13:33 +09:00
Ursprung f48bd30f89
Commit 1dcda2491e

Datei anzeigen

@ -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);