From 0f71d4bcab3d50413daf7c2117374d2c6a522590 Mon Sep 17 00:00:00 2001
From: TwoLeggedCat <80929284+TwoLeggedCat@users.noreply.github.com>
Date: Sat, 8 May 2021 03:25:30 -0500
Subject: [PATCH] Add new methods from PlayerMoveEvent to EntityMoveEvent
 (#5591)

---
 Spigot-API-Patches/EntityMoveEvent.patch | 45 ++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/Spigot-API-Patches/EntityMoveEvent.patch b/Spigot-API-Patches/EntityMoveEvent.patch
index 6d323ee255..5feea6ff8f 100644
--- a/Spigot-API-Patches/EntityMoveEvent.patch
+++ b/Spigot-API-Patches/EntityMoveEvent.patch
@@ -89,6 +89,51 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +        this.to = to;
 +    }
 +
++    /**
++     * Check if the entity has changed position (even within the same block) in the event
++     *
++     * @return whether the entity has changed position or not
++     */
++    public boolean hasChangedPosition() {
++        return hasExplicitlyChangedPosition() || !from.getWorld().equals(to.getWorld());
++    }
++
++    /**
++     * Check if the entity has changed position (even within the same block) in the event, disregarding a possible world change
++     *
++     * @return whether the entity has changed position or not
++     */
++    public boolean hasExplicitlyChangedPosition() {
++        return from.getX() != to.getX() || from.getY() != to.getY() || from.getZ() != to.getZ();
++    }
++
++    /**
++     * Check if the entity has moved to a new block in the event
++     *
++     * @return whether the entity has moved to a new block or not
++     */
++    public boolean hasChangedBlock() {
++        return hasExplicitlyChangedBlock() || !from.getWorld().equals(to.getWorld());
++    }
++
++    /**
++     * Check if the entity has moved to a new block in the event, disregarding a possible world change
++     *
++     * @return whether the entity has moved to a new block or not
++     */
++    public boolean hasExplicitlyChangedBlock() {
++        return from.getBlockX() != to.getBlockX() || from.getBlockY() != to.getBlockY() || from.getBlockZ() != to.getBlockZ();
++    }
++
++    /**
++     * Check if the entity has changed orientation in the event
++     *
++     * @return whether the entity has changed orientation or not
++     */
++    public boolean hasChangedOrientation() {
++        return from.getPitch() != to.getPitch() || from.getYaw() != to.getYaw();
++    }
++
 +    private void validateLocation(@NotNull Location loc) {
 +        Preconditions.checkArgument(loc != null, "Cannot use null location!");
 +        Preconditions.checkArgument(loc.getWorld() != null, "Cannot use null location with null world!");