PaperMC/Spigot-Server-Patches/EAR-Fix-bug-with-teleporting-entities.patch

47 lines
2.5 KiB
Diff
Raw Normal View History

2015-12-23 01:22:36 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
2016-03-01 00:09:49 +01:00
Date: Thu, 3 Mar 2016 00:07:23 -0600
2015-12-23 01:22:36 +01:00
Subject: [PATCH] EAR: Fix bug with teleporting entities
[17:53:15] <Aikar> 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
2016-03-01 00:09:49 +01:00
private static final DataWatcherObject<Boolean> aA = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
private static final DataWatcherObject<Boolean> 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
2015-12-23 01:22:36 +01:00
+ public boolean isAddedToChunk() {
+ int chunkX = MathHelper.floor(locX / 16.0D);
+ int chunkY = MathHelper.floor(locY / 16.0D);
+ int chunkZ = MathHelper.floor(locZ / 16.0D);
2016-03-01 00:09:49 +01:00
+ return aa && getChunkX() == chunkX && getChunkY() == chunkY || getChunkZ() == chunkZ;
2015-12-23 01:22:36 +01:00
+ }
2016-03-01 00:09:49 +01:00
+ 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
2015-12-23 01:22:36 +01:00
public boolean ah;
2016-03-01 00:09:49 +01:00
public boolean impulse;
2015-12-23 01:22:36 +01:00
public int portalCooldown;
2016-03-01 00:09:49 +01:00
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -0,0 +0,0 @@ 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;
}
2015-12-23 01:22:36 +01:00
--