27 lines
		
	
	
	
		
			1,001 B
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			1,001 B
		
	
	
	
		
			Java
		
	
	
	
	
	
| 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.level.Level;
 | |
| import org.jetbrains.annotations.Nullable;
 | |
| 
 | |
| public class ArrowItem extends Item implements ProjectileItem {
 | |
| 	public ArrowItem(Item.Properties properties) {
 | |
| 		super(properties);
 | |
| 	}
 | |
| 
 | |
| 	public AbstractArrow createArrow(Level level, ItemStack ammo, LivingEntity shooter, @Nullable ItemStack weapon) {
 | |
| 		return new Arrow(level, shooter, ammo.copyWithCount(1), weapon);
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public Projectile asProjectile(Level level, Position pos, ItemStack stack, Direction direction) {
 | |
| 		Arrow arrow = new Arrow(level, pos.x(), pos.y(), pos.z(), stack.copyWithCount(1), null);
 | |
| 		arrow.pickup = AbstractArrow.Pickup.ALLOWED;
 | |
| 		return arrow;
 | |
| 	}
 | |
| }
 |