mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 21:19:00 +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,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();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user