mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 08:57:35 +01:00
Fixup advancement patch (#9745)
This commit is contained in:
parent
6af97e11b6
commit
915bb9220e
@ -96,10 +96,10 @@ index a6ea13198a2de14d57472681b5a2b30baf3c4280..11b26d14b863075d776884544629cdd2
|
|||||||
public DisplayInfo(ItemStack icon, Component title, Component description, @Nullable ResourceLocation background, FrameType frame, boolean showToast, boolean announceToChat, boolean hidden) {
|
public DisplayInfo(ItemStack icon, Component title, Component description, @Nullable ResourceLocation background, FrameType frame, boolean showToast, boolean announceToChat, boolean hidden) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java
|
||||||
index 52baf818579a6841b77ff80e42f4f1b9f635ea08..3321445645514769ff494f90090f22241fffbc44 100644
|
index 52baf818579a6841b77ff80e42f4f1b9f635ea08..bd640e0d8d796ee114ff787def7e07edbeffc0a5 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java
|
--- a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java
|
||||||
@@ -29,12 +29,49 @@ public class CraftAdvancement implements org.bukkit.advancement.Advancement {
|
@@ -29,12 +29,47 @@ public class CraftAdvancement implements org.bukkit.advancement.Advancement {
|
||||||
return Collections.unmodifiableCollection(this.handle.value().criteria().keySet());
|
return Collections.unmodifiableCollection(this.handle.value().criteria().keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,9 +120,7 @@ index 52baf818579a6841b77ff80e42f4f1b9f635ea08..3321445645514769ff494f90090f2224
|
|||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public net.kyori.adventure.text.Component displayName() {
|
+ public net.kyori.adventure.text.Component displayName() {
|
||||||
+ return this.handle.value().display()
|
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(net.minecraft.advancements.Advancement.name(this.handle));
|
||||||
+ .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()));
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
@ -135,10 +133,10 @@ index 52baf818579a6841b77ff80e42f4f1b9f635ea08..3321445645514769ff494f90090f2224
|
|||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public Collection<org.bukkit.advancement.Advancement> getChildren() {
|
+ public Collection<org.bukkit.advancement.Advancement> getChildren() {
|
||||||
+ final var children = com.google.common.collect.ImmutableList.<org.bukkit.advancement.Advancement>builder();
|
+ final com.google.common.collect.ImmutableList.Builder<org.bukkit.advancement.Advancement> 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 net.minecraft.advancements.AdvancementNode advancementNode = net.minecraft.server.MinecraftServer.getServer().getAdvancements().tree().get(this.handle);
|
||||||
+ if (advancementNode != null) {
|
+ if (advancementNode != null) {
|
||||||
+ for (final var child : advancementNode.children()) {
|
+ for (final net.minecraft.advancements.AdvancementNode child : advancementNode.children()) {
|
||||||
+ children.add(child.holder().toBukkit());
|
+ children.add(child.holder().toBukkit());
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
@ -148,7 +146,7 @@ index 52baf818579a6841b77ff80e42f4f1b9f635ea08..3321445645514769ff494f90090f2224
|
|||||||
- return new CraftAdvancementDisplay(this.handle.value().display().get());
|
- return new CraftAdvancementDisplay(this.handle.value().display().get());
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public org.bukkit.advancement.Advancement getRoot() {
|
+ 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();
|
+ return java.util.Objects.requireNonNull(advancementNode, "could not find internal advancement node for advancement " + this.handle.id()).root().holder().toBukkit();
|
||||||
}
|
}
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
Loading…
Reference in New Issue
Block a user