Paper/Spigot-Server-Patches/0261-ItemStack-getMaxItemUseDuration.patch
Aikar 458aa79f63
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
451bd74e Use gson for decoding version command

CraftBukkit Changes:
51100db8 SPIGOT-4678: Fix placing signs in certain circumstances
2019-03-24 12:33:39 -04:00

41 lines
1.6 KiB
Diff

From bedaa9f8ea67d7a73e1bfcb46d013931abc193f0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 5 Jun 2018 23:00:29 -0400
Subject: [PATCH] ItemStack#getMaxItemUseDuration
Allows you to determine how long it takes to use a usable/consumable item
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 886ec71866..ecab15b45a 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -533,6 +533,7 @@ public final class ItemStack {
this.getItem().b(this, world, entityhuman);
}
+ public int getItemUseMaxDuration() { return k(); } // Paper - OBFHELPER
public int k() {
return this.getItem().c(this);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index 284630f74e..1282ee3995 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -183,6 +183,13 @@ public final class CraftItemStack extends ItemStack {
return (handle == null) ? Material.AIR.getMaxStackSize() : handle.getItem().getMaxStackSize();
}
+ // Paper start
+ @Override
+ public int getMaxItemUseDuration() {
+ return handle == null ? 0 : handle.getItemUseMaxDuration();
+ }
+ // Paper end
+
@Override
public void addUnsafeEnchantment(Enchantment ench, int level) {
Validate.notNull(ench, "Cannot add null enchantment");
--
2.21.0