diff --git a/patches/api/0480-Item-stack-name-tooltip-API.patch b/patches/api/0480-Item-stack-name-tooltip-API.patch index 1eb91def4a..6c190f4881 100644 --- a/patches/api/0480-Item-stack-name-tooltip-API.patch +++ b/patches/api/0480-Item-stack-name-tooltip-API.patch @@ -5,21 +5,30 @@ Subject: [PATCH] Item stack name tooltip API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 7c56182acaf827f4b1a986a61cea8e9960604c98..f7d0d7937e86a4a1b51fc2105f072f40ae623396 100644 +index 7c56182acaf827f4b1a986a61cea8e9960604c98..9da64bc368b1eac55fad336f58619509542dd5e1 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3855,6 +3855,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -3855,6 +3855,23 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM boolean isChunkSent(long chunkKey); // Paper end ++ // Paper start - Item stack name tooltip API + /** -+ * Checks whether the currently held item is displaying the item name tooltip on the client. ++ * Checks whether the currently held item is assumed to be displaying the item name tooltip on the client. + * However, this behavior can be changed via the Accessibility Settings, which can lead to inaccuracies. + * Keep in mind that this assumes default settings and is prone to break. + * @return true if it is showing with default settings, false if not. + */ -+ boolean isItemNameTooltipShown(); // Paper - Item stack name tooltip API ++ boolean isItemNameTooltipEstimatedToBeVisible(); + ++ /** ++ * Gets the last timestamp when the player has changed their selected item stack in their hotbar. ++ * This time is measured using {@link net.minecraft.Util#getMillis}. ++ * @return The last timestamp, or zero, if the player hasn't changed selected item stacks. ++ */ ++ long getLastItemStackChangeTime(); ++ ++ // Paper end - Item stack name tooltip API @NotNull @Override Spigot spigot(); diff --git a/patches/server/1036-Item-stack-name-tooltip-API.patch b/patches/server/1036-Item-stack-name-tooltip-API.patch index 7147a5acc0..40e050ff47 100644 --- a/patches/server/1036-Item-stack-name-tooltip-API.patch +++ b/patches/server/1036-Item-stack-name-tooltip-API.patch @@ -42,10 +42,10 @@ index 9d1e68c09fa7093cf0f6fa636f90cb15a44cbb38..4384869b79539c9e424b20bd656b6716 + // Paper end - Item stack name tooltip API } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d01b45a48d412e3cb591acee101730704574448a..61d9885d87d8a8662b7bde787598db54d0522c14 100644 +index d01b45a48d412e3cb591acee101730704574448a..52a985b95d8c6a35f7df52979b7fab84ad673e98 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -3554,4 +3554,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3554,4 +3554,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { ((ca.spottedleaf.moonrise.patches.chunk_system.player.ChunkSystemServerPlayer)this.getHandle()) .moonrise$getViewDistanceHolder().setSendViewDistance(viewDistance); } @@ -54,9 +54,14 @@ index d01b45a48d412e3cb591acee101730704574448a..61d9885d87d8a8662b7bde787598db54 + private static final long DEFAULT_ITEM_TOOLTIP_DURATION_MS = 40 * 50; + + @Override -+ public boolean isItemNameTooltipShown() { ++ public long getLastItemStackChangeTime() { ++ return this.getHandle().getLastItemStackChangeTime(); ++ } ++ ++ @Override ++ public boolean isItemNameTooltipEstimatedToBeVisible() { + long currentTime = net.minecraft.Util.getMillis(); -+ long lastItemStackChange = this.getHandle().getLastItemStackChangeTime(); ++ long lastItemStackChange = this.getLastItemStackChangeTime(); + return currentTime - lastItemStackChange < DEFAULT_ITEM_TOOLTIP_DURATION_MS; + } + // Paper end - Item stack name tooltip API