From cd4e4914b603747c1b023e083672e0584a34cd7e Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 00:07:23 -0600 Subject: [PATCH] EAR: Fix bug with teleporting entities [17:53:15] had a reproduceable issue of losing entities on teleport, now resolved https://hub.spigotmc.org/stash/projects/SPIGOT/repos/spigot/pull-requests/52/overview diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index b3c29ca..cf58f74 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -118,9 +118,17 @@ public abstract class Entity implements ICommandListener { private static final DataWatcherObject aA = DataWatcher.a(Entity.class, DataWatcherRegistry.h); private static final DataWatcherObject aB = DataWatcher.a(Entity.class, DataWatcherRegistry.h); public boolean aa; - public int ab; - public int ac; - public int ad; + // Paper start - EAR: Fix bug with teleporting entities + public boolean isAddedToChunk() { + int chunkX = MathHelper.floor(locX / 16.0D); + int chunkY = MathHelper.floor(locY / 16.0D); + int chunkZ = MathHelper.floor(locZ / 16.0D); + return aa && getChunkX() == chunkX && getChunkY() == chunkY || getChunkZ() == chunkZ; + } + public int ab; public int getChunkX() { return ab; } + public int ac; public int getChunkY() { return ac; } + public int ad; public int getChunkZ() { return ad; } + // Paper end public boolean ah; public boolean impulse; public int portalCooldown; diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java index 731efb8..75941ec 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -224,7 +224,7 @@ public class ActivationRange SpigotTimings.checkIfActiveTimer.startTiming(); // Never safe to skip fireworks or entities not yet added to chunk // PAIL: inChunk - if ( !entity.aa || entity instanceof EntityFireworks ) { + if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks ) { // Paper - EAR: Fix bug with teleporting entities SpigotTimings.checkIfActiveTimer.stopTiming(); return true; } -- 2.7.2