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

37 lines
1.7 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>
Date: Tue, 22 Dec 2015 18:16:11 -0600
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 {
protected DataWatcher datawatcher;
private double ar;
private double as;
- public boolean ad; public boolean isAddedToChunk() { return ad; } // Spigot // PAIL
- public int ae;
- public int af;
- public int ag;
+ public boolean ad;
+ // PaperSpigot 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 ad && getChunkX() == chunkX && getChunkY() == chunkY || getChunkZ() == chunkZ;
+ }
+ public int ae; public int getChunkX() { return ae; } // PAIL
+ public int af; public int getChunkY() { return af; } // PAIL
+ public int ag; public int getChunkZ() { return ag; } // PAIL
+ // PaperSpigot end
public boolean ah;
public boolean ai;
public int portalCooldown;
--