From 064114e7182c0235ec1a8f1fea74832ddd2d2762 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 30 Mar 2024 12:17:57 +1100 Subject: [PATCH] SPIGOT-7601: Add AbstractArrow#getItem By: md_5 --- .../org/bukkit/craftbukkit/entity/CraftArrow.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java index bc2b09d507..582a8536fa 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java @@ -5,8 +5,10 @@ import net.minecraft.core.BlockPosition; import net.minecraft.world.entity.projectile.EntityArrow; import org.bukkit.block.Block; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.entity.AbstractArrow; import org.bukkit.entity.Entity; +import org.bukkit.inventory.ItemStack; import org.bukkit.projectiles.ProjectileSource; public class CraftArrow extends AbstractProjectile implements AbstractArrow { @@ -118,6 +120,18 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow { getHandle().setShotFromCrossbow(shotFromCrossbow); } + @Override + public ItemStack getItem() { + return CraftItemStack.asBukkitCopy(getHandle().pickupItemStack); + } + + @Override + public void setItem(ItemStack item) { + Preconditions.checkArgument(item != null, "ItemStack cannot be null"); + + getHandle().pickupItemStack = CraftItemStack.asNMSCopy(item); + } + @Override public EntityArrow getHandle() { return (EntityArrow) entity;