mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 04:02:50 +01:00
Made ender pearls use the player's yaw and pitch. Fixes BUKKIT-1056
This commit is contained in:
parent
49ff166d15
commit
2aad49eecc
1 changed files with 7 additions and 1 deletions
|
@ -1,9 +1,12 @@
|
|||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.Location;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityEnderPearl extends EntityProjectile {
|
||||
|
||||
|
@ -37,9 +40,12 @@ public class EntityEnderPearl extends EntityProjectile {
|
|||
if (this.shooter instanceof EntityPlayer) {
|
||||
CraftPlayer player = (CraftPlayer) this.shooter.bukkitEntity;
|
||||
teleport = player.isOnline() && player.getWorld() == getBukkitEntity().getWorld();
|
||||
Location location = getBukkitEntity().getLocation();
|
||||
location.setPitch(player.getLocation().getPitch());
|
||||
location.setYaw(player.getLocation().getYaw());
|
||||
|
||||
if (teleport) {
|
||||
teleEvent = new PlayerTeleportEvent(player, player.getLocation(), getBukkitEntity().getLocation(), PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
|
||||
teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
|
||||
Bukkit.getPluginManager().callEvent(teleEvent);
|
||||
teleport = !teleEvent.isCancelled();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue