Call checkSpawns from World instead of from Player

This commit is contained in:
Melledy
2022-04-25 14:12:35 -07:00
Unverified
parent 080fdeeef6
commit 2b75cda6df
4 changed files with 52 additions and 21 deletions
+10 -1
View File
@@ -37,6 +37,7 @@ import emu.grasscutter.server.packet.send.PacketWorldPlayerInfoNotify;
import emu.grasscutter.server.packet.send.PacketWorldPlayerRTTNotify;
import emu.grasscutter.utils.Position;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
public class World implements Iterable<GenshinPlayer> {
@@ -58,11 +59,13 @@ public class World implements Iterable<GenshinPlayer> {
public World(GenshinPlayer player, boolean isMultiplayer) {
this.owner = player;
this.players = Collections.synchronizedList(new ArrayList<>());
this.scenes = new Int2ObjectOpenHashMap<>();
this.scenes = Int2ObjectMaps.synchronize(new Int2ObjectOpenHashMap<>());
this.levelEntityId = getNextEntityId(EntityIdType.MPLEVEL);
this.worldLevel = player.getWorldLevel();
this.isMultiplayer = isMultiplayer;
this.owner.getServer().registerWorld(this);
}
public GenshinPlayer getHost() {
@@ -273,6 +276,12 @@ public class World implements Iterable<GenshinPlayer> {
}
}
public void onTick() {
for (GenshinScene scene : this.getScenes().values()) {
scene.onTick();
}
}
public void close() {
}