mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-26 02:57:37 +01:00
Reduce chunk Map operation
This commit is contained in:
parent
74b8674a15
commit
892c1d5806
@ -930,7 +930,6 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
||||
synchronized (entitiesLock) {
|
||||
Set<Entity> entities = getEntitiesInChunk(chunkIndex);
|
||||
entities.add(entity);
|
||||
this.chunkEntities.put(chunkIndex, entities);
|
||||
|
||||
this.entities.add(entity);
|
||||
if (entity instanceof Player) {
|
||||
@ -958,11 +957,6 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
||||
final long chunkIndex = ChunkUtils.getChunkIndex(chunk.getChunkX(), chunk.getChunkZ());
|
||||
Set<Entity> entities = getEntitiesInChunk(chunkIndex);
|
||||
entities.remove(entity);
|
||||
if (entities.isEmpty()) {
|
||||
this.chunkEntities.remove(chunkIndex);
|
||||
} else {
|
||||
this.chunkEntities.put(chunkIndex, entities);
|
||||
}
|
||||
|
||||
this.entities.remove(entity);
|
||||
if (entity instanceof Player) {
|
||||
|
Loading…
Reference in New Issue
Block a user