Files
Purpur/patches/server/0020-EntityMoveEvent.patch
William Blake Galbreath dc49efe49a Update to 1.16.3
Upstream has released updates that appears to apply and compile correctly

Paper Changes:
7d85344e (1.16.3) Missed some fixes to include in commit
64ed4298 (FIRST 1.16.3): Update Paper to 1.16.3
fa9c5e0f (FINAL 1.16.2) Improve Entity Activation Range passenger behavior
6fda3fd0 (FINAL 1.16.2) Improve Timings support for Active vs Inactive vs Passengers
794e6baf Add additional open container api to HumanEntity
44e822f7 Fix block data exception when cancelling PortalCreateEvent (#4199)
2020-09-10 21:09:14 -05:00

32 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 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] EntityMoveEvent
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index baf35465b..84e4c754a 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2802,6 +2802,20 @@ public abstract class EntityLiving extends Entity {
this.collideNearby();
this.world.getMethodProfiler().exit();
+ // Purpur start
+ if (net.pl3x.purpur.event.entity.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);
+ net.pl3x.purpur.event.entity.EntityMoveEvent event = new net.pl3x.purpur.event.entity.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
if (!this.world.isClientSide && this.dN() && this.aF()) {
this.damageEntity(DamageSource.DROWN, 1.0F);
}