Made ender pearls use the player's yaw and pitch. Fixes BUKKIT-1056

Dieser Commit ist enthalten in:
EvilSeph 2012-03-11 00:10:01 -05:00
Ursprung 49ff166d15
Commit 2aad49eecc

Datei anzeigen

@ -1,9 +1,12 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.Location;
// CraftBukkit end
public class EntityEnderPearl extends EntityProjectile { public class EntityEnderPearl extends EntityProjectile {
@ -37,9 +40,12 @@ public class EntityEnderPearl extends EntityProjectile {
if (this.shooter instanceof EntityPlayer) { if (this.shooter instanceof EntityPlayer) {
CraftPlayer player = (CraftPlayer) this.shooter.bukkitEntity; CraftPlayer player = (CraftPlayer) this.shooter.bukkitEntity;
teleport = player.isOnline() && player.getWorld() == getBukkitEntity().getWorld(); teleport = player.isOnline() && player.getWorld() == getBukkitEntity().getWorld();
Location location = getBukkitEntity().getLocation();
location.setPitch(player.getLocation().getPitch());
location.setYaw(player.getLocation().getYaw());
if (teleport) { 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); Bukkit.getPluginManager().callEvent(teleEvent);
teleport = !teleEvent.isCancelled(); teleport = !teleEvent.isCancelled();
} }