testserver/Spigot-Server-Patches/0503-Expose-Arrow-getItemSt...

37 lines
1.7 KiB
Diff
Raw Normal View History

2020-05-22 17:56:24 +00:00
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 93084633d487684fb598038d148670fe6a00b3ed..402684ee2a42eefc843df663a1f3af9a8a66a0bb 100644
2020-05-22 17:56:24 +00:00
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -520,6 +520,7 @@ public abstract class EntityArrow extends IProjectile {
2020-05-22 17:56:24 +00:00
}
}
+ public final ItemStack getOriginalItemStack() { return getItemStack(); } // Paper - OBFHELPER - exists purely due to overrides all as protected and dont want to change them all
2020-05-22 17:56:24 +00:00
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 ddaa10704188a5a6862bcff783e492c19f4929e5..f310dccff5a11a2694faeabf017b0104362e38f7 100644
2020-05-22 17:56:24 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
@@ -103,6 +103,13 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
2020-05-22 17:56:24 +00:00
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);