Paper/Spigot-Server-Patches/0516-Expose-Arrow-getItemStack.patch
2020-06-26 21:57:36 -07:00

38 Zeilen
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nesaak <52047222+Nesaak@users.noreply.github.com>
Date: Sat, 23 May 2020 10:31:11 -0400
Subject: [PATCH] Expose Arrow getItemStack
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index c552962a9a2c8dac6794ef6698943c7d91ea45c4..6195a45e30d9a9d76e24fbc2493020917a8b87b9 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -520,6 +520,8 @@ public abstract class EntityArrow extends IProjectile {
}
}
+ public ItemStack getOriginalItemStack() { return getItemStack(); } // Paper - OBFHelper
+
protected abstract ItemStack getItemStack();
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
index cf40d62492dc207815487d6f64e7d11892adc09b..5a0a78d7edead8712090dfb9c53ff904abf5b118 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
@@ -102,6 +102,13 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
getHandle().fromPlayer = EntityArrow.PickupStatus.a(status.ordinal());
}
+ // Paper start
+ @Override
+ public org.bukkit.craftbukkit.inventory.CraftItemStack getItemStack() {
+ return org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(getHandle().getOriginalItemStack());
+ }
+ //Paper end
+
@Override
public void setTicksLived(int value) {
super.setTicksLived(value);