mirror of
https://github.com/Minestom/Minestom.git
synced 2024-07-07 11:54:59 +02: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) {
|
synchronized (entitiesLock) {
|
||||||
Set<Entity> entities = getEntitiesInChunk(chunkIndex);
|
Set<Entity> entities = getEntitiesInChunk(chunkIndex);
|
||||||
entities.add(entity);
|
entities.add(entity);
|
||||||
this.chunkEntities.put(chunkIndex, entities);
|
|
||||||
|
|
||||||
this.entities.add(entity);
|
this.entities.add(entity);
|
||||||
if (entity instanceof Player) {
|
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());
|
final long chunkIndex = ChunkUtils.getChunkIndex(chunk.getChunkX(), chunk.getChunkZ());
|
||||||
Set<Entity> entities = getEntitiesInChunk(chunkIndex);
|
Set<Entity> entities = getEntitiesInChunk(chunkIndex);
|
||||||
entities.remove(entity);
|
entities.remove(entity);
|
||||||
if (entities.isEmpty()) {
|
|
||||||
this.chunkEntities.remove(chunkIndex);
|
|
||||||
} else {
|
|
||||||
this.chunkEntities.put(chunkIndex, entities);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.entities.remove(entity);
|
this.entities.remove(entity);
|
||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user