mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
Correctly shoot arrows with the spawnArrow Method. Fixes BUKKIT-3116
This commit is contained in:
parent
9973e7cdec
commit
090c1a60bd
@ -304,10 +304,13 @@ public class CraftWorld implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Arrow spawnArrow(Location loc, Vector velocity, float speed, float spread) {
|
public Arrow spawnArrow(Location loc, Vector velocity, float speed, float spread) {
|
||||||
|
Validate.notNull(loc, "Can not spawn arrow with a null location");
|
||||||
|
Validate.notNull(velocity, "Can not spawn arrow with a null velocity");
|
||||||
|
|
||||||
EntityArrow arrow = new EntityArrow(world);
|
EntityArrow arrow = new EntityArrow(world);
|
||||||
arrow.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
|
arrow.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), loc.getPitch(), loc.getYaw());
|
||||||
world.addEntity(arrow);
|
|
||||||
arrow.shoot(velocity.getX(), velocity.getY(), velocity.getZ(), speed, spread);
|
arrow.shoot(velocity.getX(), velocity.getY(), velocity.getZ(), speed, spread);
|
||||||
|
world.addEntity(arrow);
|
||||||
return (Arrow) arrow.getBukkitEntity();
|
return (Arrow) arrow.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user