Fix painting variant builder (#11660)

This commit is contained in:
Lulu13022002
2024-11-24 20:12:08 +01:00
parent bbe32f42f0
commit 8e2102c70b
6 changed files with 79 additions and 137 deletions

View File

@@ -8,45 +8,25 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftArt.java b/src/main/java/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftArt.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftArt.java
@@ -0,0 +0,0 @@ public class CraftArt implements Art, Handleable<PaintingVariant> {
private final NamespacedKey key;
private final PaintingVariant paintingVariant;
+ private final net.kyori.adventure.text.@org.jspecify.annotations.Nullable Component adventureTitle; // Paper - name and author components, assetId key
+ private final net.kyori.adventure.text.@org.jspecify.annotations.Nullable Component adventureAuthor; // Paper - name and author components, assetId key
+ private final net.kyori.adventure.key.@org.jspecify.annotations.NonNull Key adventureAssetId; // Paper - name and author components, assetId key
private final String name;
private final int ordinal;
@@ -0,0 +0,0 @@ public class CraftArt implements Art, Handleable<PaintingVariant> {
this.name = key.toString();
}
this.ordinal = CraftArt.count++;
+ this.adventureTitle = paintingVariant.title().map(io.papermc.paper.adventure.PaperAdventure::asAdventure).orElse(null); // Paper - name and author components, assetId key
+ this.adventureAuthor = paintingVariant.author().map(io.papermc.paper.adventure.PaperAdventure::asAdventure).orElse(null); // Paper - name and author components, assetId key
+ this.adventureAssetId = io.papermc.paper.adventure.PaperAdventure.asAdventure(paintingVariant.assetId()); // Paper - name and author components, assetId key
}
@Override
@@ -0,0 +0,0 @@ public class CraftArt implements Art, Handleable<PaintingVariant> {
return this.paintingVariant.height();
}
+ // Paper start - name and author components, assetId key
+ // Paper start - Expand Art API
+ @Override
+ public net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component title() {
+ return this.adventureTitle;
+ public net.kyori.adventure.text.Component title() {
+ return this.paintingVariant.title().map(io.papermc.paper.adventure.PaperAdventure::asAdventure).orElse(null);
+ }
+
+ @Override
+ public net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component author() {
+ return this.adventureAuthor;
+ public net.kyori.adventure.text.Component author() {
+ return this.paintingVariant.author().map(io.papermc.paper.adventure.PaperAdventure::asAdventure).orElse(null);
+ }
+
+ public net.kyori.adventure.key.@org.jspecify.annotations.NonNull Key assetId() {
+ return this.adventureAssetId;
+ public net.kyori.adventure.key.Key assetId() {
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.paintingVariant.assetId());
+ }
+ // Paper end - name and author components, assetId key
+ // Paper end - Expand Art API
+
@Override
public int getId() {