Multitude of changes to attempt to fix #1199

This commit is contained in:
Aikar 2018-07-12 16:42:56 -04:00
parent 7754b35d8f
commit eb1140acce
12 changed files with 42 additions and 23 deletions

View file

@ -96,7 +96,7 @@ index e5b5e9887..e3781f3a8 100644
} }
} }
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index b79bf70f0..b1536e1c5 100644 index b79bf70f0..33ae73890 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java --- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -0,0 +0,0 @@ import net.minecraft.server.EntityFireball; @@ -0,0 +0,0 @@ import net.minecraft.server.EntityFireball;
@ -141,11 +141,25 @@ index b79bf70f0..b1536e1c5 100644
{ {
EntityAnimal animal = (EntityAnimal) entity; EntityAnimal animal = (EntityAnimal) entity;
@@ -0,0 +0,0 @@ public class ActivationRange @@ -0,0 +0,0 @@ public class ActivationRange
int x = MathHelper.floor( entity.locX ); {
int z = MathHelper.floor( entity.locZ ); // Never safe to skip fireworks or entities not yet added to chunk
// PAIL: inChunk - boolean under datawatchers
- if ( !entity.aa || entity instanceof EntityFireworks ) {
+ if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks ) { // Paper (use obf helper)
return true;
}
@@ -0,0 +0,0 @@ public class ActivationRange
{
isActive = false;
}
- int x = MathHelper.floor( entity.locX );
- int z = MathHelper.floor( entity.locZ );
+ //int x = MathHelper.floor( entity.locX ); // Paper
+ //int z = MathHelper.floor( entity.locZ ); // Paper
// Make sure not on edge of unloaded chunk // Make sure not on edge of unloaded chunk
- Chunk chunk = entity.world.getChunkIfLoaded( x >> 4, z >> 4 ); - Chunk chunk = entity.world.getChunkIfLoaded( x >> 4, z >> 4 );
+ Chunk chunk = entity.getCurrentChunk(); // Paper + Chunk chunk = entity.getChunkAtLocation(); // Paper
if ( isActive && !( chunk != null && chunk.areNeighborsLoaded( 1 ) ) ) if ( isActive && !( chunk != null && chunk.areNeighborsLoaded( 1 ) ) )
{ {
isActive = false; isActive = false;

View file

@ -22,7 +22,7 @@ index 3e80825f7..4a94fd5a6 100644
this.a(entity, entity.ac); this.a(entity, entity.ac);
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index c0816b9f8..33ac57e6b 100644 index c0816b9f8..52adee880 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
@ -37,7 +37,7 @@ index c0816b9f8..33ac57e6b 100644
this.getChunkAt(k, j).b(e); this.getChunkAt(k, j).b(e);
- } - }
+ }*/ + }*/
+ Chunk chunk = e.getCurrentChunk(); + Chunk chunk = e.isAddedToChunk() ? e.getCurrentChunk() : null;
+ if (chunk != null) chunk.removeEntity(e); + if (chunk != null) chunk.removeEntity(e);
} }
@ -56,7 +56,7 @@ index c0816b9f8..33ac57e6b 100644
this.getChunkAt(j, l).b(entity); this.getChunkAt(j, l).b(entity);
- } - }
+ }*/ + }*/
+ Chunk chunk = entity.getCurrentChunk(); + Chunk chunk = entity.isAddedToChunk() ? entity.getCurrentChunk() : null;
+ if (chunk != null) chunk.removeEntity(entity); + if (chunk != null) chunk.removeEntity(entity);
+ // Paper end + // Paper end

View file

@ -37,7 +37,7 @@ index ec9a87239..b08274d93 100644
if (scoreboard.addPlayerToTeam(s2, s)) { if (scoreboard.addPlayerToTeam(s2, s)) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index a4c5b780c..c620667e0 100644 index 158ee9e37..0e761997c 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Don't allow entities to ride themselves - #572
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 64e566d3a..f75d57c30 100644 index e4b45f2c7..8fbef57cc 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper

View file

@ -7,7 +7,7 @@ Had some issue with this in past, and this is the vanilla logic.
Potentially an old CB change that's no longer needed. Potentially an old CB change that's no longer needed.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 843cb3a61..89ea217b9 100644 index b3eea4337..13035574e 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper

View file

@ -24,7 +24,7 @@ index 0094d1a87..4da846719 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 9d7fe97ce..c7513622e 100644 index 05aad7dd0..bee8e632a 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Entity Origin API
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index c7513622e..72efe282b 100644 index bee8e632a..7f66f7579 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper

View file

@ -19,7 +19,7 @@ index abc1aabdd..6ea608ba9 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 89ea217b9..437ae2fa3 100644 index 13035574e..8f47ffd47 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper

View file

@ -32,7 +32,7 @@ index 067cb233e..06acdaaf0 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index e860e9c6a..a52cd0728 100644 index b6b4b581b..e77a3b2ab 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper

View file

@ -22,7 +22,7 @@ requirement, but plugins (such as my own) use this method to
trigger a "reload" of the entity on the client. trigger a "reload" of the entity on the client.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 9f2db9025..a96cdcbc6 100644 index b61927c99..eff84f812 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper

View file

@ -81,7 +81,7 @@ index 4bbebb25a..68008fe6a 100644
} }
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 3a8902bf1..f7750a05c 100644 index 3a8902bf1..f140d5e28 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -91,15 +91,20 @@ index 3a8902bf1..f7750a05c 100644
+ private java.lang.ref.WeakReference<Chunk> currentChunk = null; + private java.lang.ref.WeakReference<Chunk> currentChunk = null;
+ public Chunk getCurrentChunk() { + public Chunk getCurrentChunk() {
+ final Chunk chunk = currentChunk != null ? currentChunk.get() : null; + final Chunk chunk = currentChunk != null ? currentChunk.get() : null;
+ final int cx = getChunkX(); + return chunk != null && chunk.isLoaded() ? chunk : null;
+ final int cz = getChunkZ();
+ if (chunk != null && chunk.isLoaded() && chunk.locX == cx && chunk.locZ == cz) {
+ return chunk;
+ }
+ return world.getChunkIfLoaded(cx, cz);
+ } + }
+ public void setCurrentChunk(Chunk chunk) { + public void setCurrentChunk(Chunk chunk) {
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null; + this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
+ }
+ public Chunk getCurrentChunkAt(int x, int z) {
+ if (getChunkX() == x && getChunkZ() == z) {
+ return getCurrentChunk();
+ } else {
+ return world.getChunkIfLoaded(x, z);
+ }
+ }
+ public Chunk getChunkAtLocation() {
+ return getCurrentChunkAt((int)Math.floor(locX) >> 4, (int)Math.floor(locZ) >> 4);
+ } + }
public final MinecraftKey entityKey = EntityTypes.getKey(this); public final MinecraftKey entityKey = EntityTypes.getKey(this);
public final String entityKeyString = entityKey != null ? entityKey.toString() : null; public final String entityKeyString = entityKey != null ? entityKey.toString() : null;

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Vehicle Event Cancellation Changes
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 437ae2fa3..17ec10c26 100644 index 8f47ffd47..41fca4118 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper