Make loaded entity list logic more consistent (#3301)
When adding/removing to a chunk, we need to also look at editing the loaded entity list. Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
@@ -10,6 +10,30 @@ diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/m
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||||
|
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||||
|
entity.chunkZ = this.loc.z;
|
||||||
|
this.entities.add(entity); // Paper - per chunk entity list
|
||||||
|
this.entitySlices[k].add(entity); if (entity.hardCollides()) this.hardCollidingEntities[k].add(entity); // Paper - optimise hard colliding entities
|
||||||
|
+ // Paper start - world loaded entity list
|
||||||
|
+ if (this.loadedTicketLevel) {
|
||||||
|
+ ((WorldServer)this.world).loadedEntities.add(entity);
|
||||||
|
+ } else {
|
||||||
|
+ ((WorldServer)this.world).loadedEntities.remove(entity);
|
||||||
|
+ }
|
||||||
|
+ // Paper end - world loaded entity list
|
||||||
|
// Paper start
|
||||||
|
if (entity instanceof EntityItem) {
|
||||||
|
itemCounts[k]++;
|
||||||
|
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||||
|
if (entity.hardCollides()) this.hardCollidingEntities[i].remove(entity); if (!this.entitySlices[i].remove(entity)) { // Paper - optimise hard colliding entities
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
+ // Paper start - world loaded entity list
|
||||||
|
+ ((WorldServer)this.world).loadedEntities.remove(entity);
|
||||||
|
+ // Paper end - world loaded entity list
|
||||||
|
if (entity instanceof EntityItem) {
|
||||||
|
itemCounts[i]--;
|
||||||
|
} else if (entity instanceof IInventory) {
|
||||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||||
this.setNeighbourLoaded(0, 0, this);
|
this.setNeighbourLoaded(0, 0, this);
|
||||||
this.loadedTicketLevel = true;
|
this.loadedTicketLevel = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user