3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00
Paper/Spigot-Server-Patches/0055-EAR-Fix-bug-with-teleporting-entities.patch

63 Zeilen
2.8 KiB
Diff

From 1d3116bd0f65f50f5b1fbfffa4d042cbc85cbb98 Mon Sep 17 00:00:00 2001
2016-03-01 00:09:49 +01:00
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 00:07:23 -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
2016-03-31 02:50:23 +02:00
index 782abd6..359e18e 100644
2016-03-01 00:09:49 +01:00
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
2016-03-25 05:59:37 +01:00
@@ -119,9 +119,17 @@ 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
+ 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/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index bffa3ac..1a1f082 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1623,7 +1623,7 @@ public abstract class World implements IBlockAccess {
byte b0 = 32;
// Spigot start
- if (!org.spigotmc.ActivationRange.checkIfActive(entity)) {
+ if (flag && !org.spigotmc.ActivationRange.checkIfActive(entity)) {
entity.ticksLived++;
entity.inactiveTick();
} else {
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
2016-03-25 05:59:37 +01:00
index f0d3a19..a1bd1a6 100644
2016-03-01 00:09:49 +01:00
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
2016-03-25 05:59:37 +01:00
@@ -249,7 +249,7 @@ public class ActivationRange
{
2016-03-01 00:09:49 +01:00
// 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
return true;
}
2016-03-25 05:59:37 +01:00
2016-03-01 00:09:49 +01:00
--
2016-03-31 02:50:23 +02:00
2.8.0
2016-03-01 00:09:49 +01:00