40 lines
1.3 KiB
Java
40 lines
1.3 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* org.jspecify.annotations.Nullable
|
|
*/
|
|
package net.minecraft.world.item;
|
|
|
|
import net.minecraft.core.Direction;
|
|
import net.minecraft.core.Position;
|
|
import net.minecraft.world.entity.LivingEntity;
|
|
import net.minecraft.world.entity.projectile.AbstractArrow;
|
|
import net.minecraft.world.entity.projectile.Arrow;
|
|
import net.minecraft.world.entity.projectile.Projectile;
|
|
import net.minecraft.world.item.Item;
|
|
import net.minecraft.world.item.ItemStack;
|
|
import net.minecraft.world.item.ProjectileItem;
|
|
import net.minecraft.world.level.Level;
|
|
import org.jspecify.annotations.Nullable;
|
|
|
|
public class ArrowItem
|
|
extends Item
|
|
implements ProjectileItem {
|
|
public ArrowItem(Item.Properties properties) {
|
|
super(properties);
|
|
}
|
|
|
|
public AbstractArrow createArrow(Level level, ItemStack itemStack, LivingEntity owner, @Nullable ItemStack firedFromWeapon) {
|
|
return new Arrow(level, owner, itemStack.copyWithCount(1), firedFromWeapon);
|
|
}
|
|
|
|
@Override
|
|
public Projectile asProjectile(Level level, Position position, ItemStack itemStack, Direction direction) {
|
|
Arrow arrow = new Arrow(level, position.x(), position.y(), position.z(), itemStack.copyWithCount(1), null);
|
|
arrow.pickup = AbstractArrow.Pickup.ALLOWED;
|
|
return arrow;
|
|
}
|
|
}
|
|
|