Fix Entity Teleportation and cancel velocity if teleported
Uses correct setPositionRotation for Entity teleporting instead of setLocation as this is how Vanilla teleports entities. Cancel any pending motion when teleported.
This commit is contained in:
@@ -241,7 +241,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
}
|
||||
|
||||
// entity.setLocation() throws no event, and so cannot be cancelled
|
||||
this.entity.absMoveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
entity.moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); // Paper - use proper moveTo, as per vanilla teleporting
|
||||
// SPIGOT-619: Force sync head rotation also
|
||||
this.entity.setYHeadRot(location.getYaw());
|
||||
|
||||
|
||||
@@ -603,6 +603,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
}
|
||||
|
||||
((AbstractHurtingProjectile) launch).projectileSource = this;
|
||||
launch.preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported
|
||||
launch.moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
} else if (LlamaSpit.class.isAssignableFrom(projectile)) {
|
||||
Location location = this.getEyeLocation();
|
||||
|
||||
Reference in New Issue
Block a user