Paper/Spigot-Server-Patches/0219-ItemStack-getMaxItemUseDuration.patch
Mariell Hoversholm 654b792caf Updated Upstream (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

CraftBukkit Changes:
a339310c #755: Fix NPE when calling getInventory() for virtual EnderChests
2577f9bf Increase outdated build delay
1dabfdc8 #754: Fix pre-1.16 serialized SkullMeta being broken on 1.16+, losing textures
2020-09-27 11:04:51 -04:00

38 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 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 74de67380094261cb93264d760ddbbbd5cce8220..1a28e6f20340920c35bcd87a0dbfdcd745c79706 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -552,6 +552,7 @@ public final class ItemStack {
this.getItem().b(this, world, entityhuman);
}
+ public int getItemUseMaxDuration() { return k(); } // Paper - OBFHELPER
public int k() {
return this.getItem().e_(this);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index 9913d0136841dac35b6649cb1afbe1e93b36bf4c..d315a102a5ae2a79189b39c3b534b8fd733cc9e4 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -174,6 +174,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");