mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: 8ce3dd5f [CI-SKIP] Fix Mojang API Brigadier dep - THIS IS NOT A NEW BUILD 00d760a5 Fix build due to spigot changing the build timestamp process 842e040c Updated Upstream (Bukkit/CraftBukkit/Spigot) c03260a2 Add getter and setter for villager's numberOfRestocksToday (#3231) fe366fbe null check tracker for entity metadata update - Fixes #3070 fdf41b74 Implement Brigadier Mojang API e0ea2e0e Entity Activation Range 2.0! Major improvements to restoring behavior 10396d28 Fix Tracking Range mismatch on Vehicle/Passenger checks
46 lines
1.9 KiB
Diff
46 lines
1.9 KiB
Diff
From 301bd8817bb0f8d018ec49bba53191ed155acd56 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Tue, 11 Feb 2020 21:56:48 -0600
|
|
Subject: [PATCH] Implement EntityMoveEvent
|
|
|
|
---
|
|
.../java/net/minecraft/server/EntityLiving.java | 15 +++++++++++++++
|
|
1 file changed, 15 insertions(+)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index d6751e3cc..08ae190b0 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -17,6 +17,7 @@ import java.util.Random;
|
|
import java.util.Set;
|
|
import java.util.UUID;
|
|
import javax.annotation.Nullable;
|
|
+import net.pl3x.purpur.event.entity.EntityMoveEvent; // Purpur
|
|
import org.apache.commons.lang3.tuple.Pair;
|
|
|
|
// CraftBukkit start
|
|
@@ -2648,6 +2649,20 @@ public abstract class EntityLiving extends Entity {
|
|
|
|
this.collideNearby();
|
|
this.world.getMethodProfiler().exit();
|
|
+ // Purpur start
|
|
+ if (EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0) {
|
|
+ if (lastX != locX() || lastY != locY() || lastZ != locZ() || lastYaw != yaw || lastPitch != pitch) {
|
|
+ Location from = new Location(world.getWorld(), lastX, lastY, lastZ, lastYaw, lastPitch);
|
|
+ Location to = new Location (world.getWorld(), locX(), locY(), locZ(), yaw, pitch);
|
|
+ EntityMoveEvent event = new EntityMoveEvent(getBukkitLivingEntity(), from, to.clone());
|
|
+ if (!event.callEvent()) {
|
|
+ setLocation(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch());
|
|
+ } else if (!to.equals(event.getTo())) {
|
|
+ setLocation(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Purpur end
|
|
}
|
|
|
|
private void n() {
|
|
--
|
|
2.24.0
|
|
|