aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/1070-Expanded-Art-API.patch
blob: a088282574f870d6d7d5cfd8125bff2a9d3c6865 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kokiriglade <60290002+celerry@users.noreply.github.com>
Date: Sat, 23 Nov 2024 18:58:49 +0000
Subject: [PATCH] Expanded Art API


diff --git a/src/main/java/org/bukkit/craftbukkit/CraftArt.java b/src/main/java/org/bukkit/craftbukkit/CraftArt.java
index 40af940193d0df66bbcdcf5f46132e304016a4d7..932118f5e5bfc765c852acaf21f9721d8fa5fb6a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftArt.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftArt.java
@@ -42,6 +42,9 @@ 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;
 
@@ -58,6 +61,9 @@ 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
@@ -75,6 +81,22 @@ public class CraftArt implements Art, Handleable<PaintingVariant> {
         return this.paintingVariant.height();
     }
 
+    // Paper start - name and author components, assetId key
+    @Override
+    public net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component title() {
+        return this.adventureTitle;
+    }
+
+    @Override
+    public net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component author() {
+        return this.adventureAuthor;
+    }
+
+    public net.kyori.adventure.key.@org.jspecify.annotations.NonNull Key assetId() {
+        return this.adventureAssetId;
+    }
+    // Paper end - name and author components, assetId key
+
     @Override
     public int getId() {
         return CraftRegistry.getMinecraftRegistry(Registries.PAINTING_VARIANT).getId(this.paintingVariant);