mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 08:17:44 +01:00
SPIGOT-7601: Add AbstractArrow#getItem
By: md_5 <git@md-5.net>
This commit is contained in:
parent
7afeda6ff8
commit
064114e718
@ -5,8 +5,10 @@ import net.minecraft.core.BlockPosition;
|
|||||||
import net.minecraft.world.entity.projectile.EntityArrow;
|
import net.minecraft.world.entity.projectile.EntityArrow;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.AbstractArrow;
|
import org.bukkit.entity.AbstractArrow;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.projectiles.ProjectileSource;
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
|
|
||||||
public class CraftArrow extends AbstractProjectile implements AbstractArrow {
|
public class CraftArrow extends AbstractProjectile implements AbstractArrow {
|
||||||
@ -118,6 +120,18 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
|
|||||||
getHandle().setShotFromCrossbow(shotFromCrossbow);
|
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
|
@Override
|
||||||
public EntityArrow getHandle() {
|
public EntityArrow getHandle() {
|
||||||
return (EntityArrow) entity;
|
return (EntityArrow) entity;
|
||||||
|
Loading…
Reference in New Issue
Block a user