mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-17 18:47:40 +01:00
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:
parent
d2a300598c
commit
f1b980c22f
1 changed files with 24 additions and 0 deletions
|
@ -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
|
||||
--- a/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 {
|
||||
this.setNeighbourLoaded(0, 0, this);
|
||||
this.loadedTicketLevel = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue