aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0442-ItemStack-Tooltip-API.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/api/0442-ItemStack-Tooltip-API.patch')
-rw-r--r--patches/api/0442-ItemStack-Tooltip-API.patch28
1 files changed, 15 insertions, 13 deletions
diff --git a/patches/api/0442-ItemStack-Tooltip-API.patch b/patches/api/0442-ItemStack-Tooltip-API.patch
index 3265b3b09a..4af91c3ade 100644
--- a/patches/api/0442-ItemStack-Tooltip-API.patch
+++ b/patches/api/0442-ItemStack-Tooltip-API.patch
@@ -6,20 +6,21 @@ Subject: [PATCH] ItemStack Tooltip API
diff --git a/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContext.java b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContext.java
new file mode 100644
-index 0000000000000000000000000000000000000000..39ac768b3c5148544cb1aaf2c817e661f6856f64
+index 0000000000000000000000000000000000000000..7e16f2645e956cbac8d0fc75ba8209f67fd1835c
--- /dev/null
+++ b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContext.java
-@@ -0,0 +1,75 @@
+@@ -0,0 +1,76 @@
+package io.papermc.paper.inventory.tooltip;
+
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.Contract;
-+import org.jetbrains.annotations.NotNull;
++import org.jspecify.annotations.NullMarked;
+
+/**
+ * Context for computing itemstack tooltips via
+ * {@link org.bukkit.inventory.ItemStack#computeTooltipLines(TooltipContext, Player)}
+ */
++@NullMarked
+public interface TooltipContext {
+
+ /**
@@ -31,7 +32,7 @@ index 0000000000000000000000000000000000000000..39ac768b3c5148544cb1aaf2c817e661
+ * @return a new context
+ */
+ @Contract("_, _ -> new")
-+ static @NotNull TooltipContext create(final boolean advanced, final boolean creative) {
++ static TooltipContext create(final boolean advanced, final boolean creative) {
+ return new TooltipContextImpl(advanced, creative);
+ }
+
@@ -41,7 +42,7 @@ index 0000000000000000000000000000000000000000..39ac768b3c5148544cb1aaf2c817e661
+ * @return a new context
+ */
+ @Contract("-> new")
-+ static @NotNull TooltipContext create() {
++ static TooltipContext create() {
+ return new TooltipContextImpl(false, false);
+ }
+
@@ -74,7 +75,7 @@ index 0000000000000000000000000000000000000000..39ac768b3c5148544cb1aaf2c817e661
+ * @return a new context
+ */
+ @Contract("-> new")
-+ @NotNull TooltipContext asAdvanced();
++ TooltipContext asAdvanced();
+
+ /**
+ * Returns a new context with {@link #isCreative()}
@@ -83,27 +84,28 @@ index 0000000000000000000000000000000000000000..39ac768b3c5148544cb1aaf2c817e661
+ * @return a new context
+ */
+ @Contract("-> new")
-+ @NotNull TooltipContext asCreative();
++ TooltipContext asCreative();
+}
diff --git a/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java
new file mode 100644
-index 0000000000000000000000000000000000000000..c9c0ce750f93ae55e0b2d322a738919474d2d5dd
+index 0000000000000000000000000000000000000000..a649b90dfac6000c01579a48234a11383c731439
--- /dev/null
+++ b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java
-@@ -0,0 +1,16 @@
+@@ -0,0 +1,17 @@
+package io.papermc.paper.inventory.tooltip;
+
-+import org.jetbrains.annotations.NotNull;
++import org.jspecify.annotations.NullMarked;
+
++@NullMarked
+record TooltipContextImpl(boolean isAdvanced, boolean isCreative) implements TooltipContext {
+
+ @Override
-+ public @NotNull TooltipContext asCreative() {
++ public TooltipContext asCreative() {
+ return new TooltipContextImpl(this.isAdvanced, true);
+ }
+
+ @Override
-+ public @NotNull TooltipContext asAdvanced() {
++ public TooltipContext asAdvanced() {
+ return new TooltipContextImpl(true, this.isCreative);
+ }
+}
@@ -119,7 +121,7 @@ index 141d5a964cc299284aecd4d34d57008a32f94247..31217b38e769f97801fa1afefeb223d1
+ @NotNull java.util.List<net.kyori.adventure.text.Component> computeTooltipLines(@NotNull ItemStack itemStack, @NotNull io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, @Nullable org.bukkit.entity.Player player); // Paper - expose itemstack tooltip lines
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
-index 43b8823d4af93febbd60d1b16b406a665373bacd..268baface3b58fba4f7c8a4d3f1b370fa1d26cee 100644
+index e6c69a54e0c1dc511fe5769f869dcecb13e04ed3..49390979cc0c68b8e719f2a2ce9e7d193c747959 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -1124,4 +1124,21 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat