Automatically set the new instance of an entity when adding it to an instance

This commit is contained in:
jglrxavpok 2020-05-01 23:32:25 +02:00
parent 9b465830e0
commit 2fd7f2b310

View File

@ -274,6 +274,8 @@ public abstract class Instance implements BlockModifier, DataContainer {
lastInstance.removeEntity(entity); // If entity is in another instance, remove it from there and add it to this lastInstance.removeEntity(entity); // If entity is in another instance, remove it from there and add it to this
} }
entity.setInstance(this);
long[] visibleChunksEntity = ChunkUtils.getChunksInRange(entity.getPosition(), MinecraftServer.ENTITY_VIEW_DISTANCE); long[] visibleChunksEntity = ChunkUtils.getChunksInRange(entity.getPosition(), MinecraftServer.ENTITY_VIEW_DISTANCE);
boolean isPlayer = entity instanceof Player; boolean isPlayer = entity instanceof Player;