geforkt von Mirrors/Paper
4e958e229f
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: zml <zml@stellardrift.ca> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
38 Zeilen
1.7 KiB
Diff
38 Zeilen
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 2b2f5a8ac100c93b4c17d808b19a8252ed175760..bdb6f9bf3477f85859e3f0dd761e2e895f1a8e2b 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");
|