13
0
geforkt von Mirrors/Paper

Fixup advancement patch (#9745)

Dieser Commit ist enthalten in:
Jake Potrebic 2023-09-22 16:03:34 -07:00
Ursprung 15183b44de
Commit e6ae21d0c8

Datei anzeigen

@ -120,9 +120,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public net.kyori.adventure.text.Component displayName() {
+ return this.handle.value().display()
+ .map(d -> io.papermc.paper.adventure.PaperAdventure.asAdventure(net.minecraft.advancements.Advancement.decorateName(d)))
+ .orElseGet(() -> net.kyori.adventure.text.Component.text(this.handle.id().toString()));
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(net.minecraft.advancements.Advancement.name(this.handle));
+ }
+
+ @Override
@ -135,10 +133,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public Collection<org.bukkit.advancement.Advancement> getChildren() {
+ final var children = com.google.common.collect.ImmutableList.<org.bukkit.advancement.Advancement>builder();
+ final var advancementNode = net.minecraft.server.MinecraftServer.getServer().getAdvancements().tree().get(this.handle);
+ final com.google.common.collect.ImmutableList.Builder<org.bukkit.advancement.Advancement> children = com.google.common.collect.ImmutableList.<org.bukkit.advancement.Advancement>builder();
+ final net.minecraft.advancements.AdvancementNode advancementNode = net.minecraft.server.MinecraftServer.getServer().getAdvancements().tree().get(this.handle);
+ if (advancementNode != null) {
+ for (final var child : advancementNode.children()) {
+ for (final net.minecraft.advancements.AdvancementNode child : advancementNode.children()) {
+ children.add(child.holder().toBukkit());
+ }
}
@ -148,7 +146,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- return new CraftAdvancementDisplay(this.handle.value().display().get());
+ @Override
+ public org.bukkit.advancement.Advancement getRoot() {
+ final var advancementNode = net.minecraft.server.MinecraftServer.getServer().getAdvancements().tree().get(this.handle);
+ final net.minecraft.advancements.AdvancementNode advancementNode = net.minecraft.server.MinecraftServer.getServer().getAdvancements().tree().get(this.handle);
+ return java.util.Objects.requireNonNull(advancementNode, "could not find internal advancement node for advancement " + this.handle.id()).root().holder().toBukkit();
}
+ // Paper end