mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
SPIGOT-7601: Add AbstractArrow#getItem
By: md_5 <git@md-5.net>
This commit is contained in:
parent
7afeda6ff8
commit
064114e718
1 changed files with 14 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue