blob: 4d2e7bdf0d30caa2e59c99c95830884fb62d6180 [file] [log] [blame] [raw]
package net.lightstone.world;
import java.util.Collection;
import net.lightstone.io.ChunkIoService;
import net.lightstone.model.ChunkManager;
import net.lightstone.model.Entity;
import net.lightstone.model.EntityManager;
import net.lightstone.model.Player;
import net.lightstone.model.Position;
public class World {
private final Position spawnPosition = new Position(0, 63, 0);
private final ChunkManager chunks;
private final EntityManager entities = new EntityManager();
public World(ChunkIoService service, WorldGenerator generator) {
chunks = new ChunkManager(service, generator);
}
public void pulse() {
for (Entity entity : entities)
entity.pulse();
for (Entity entity : entities)
entity.reset();
}
public ChunkManager getChunks() {
return chunks;
}
public EntityManager getEntities() {
return entities;
}
public Collection<Player> getPlayers() {
return entities.getAll(Player.class);
}
public Position getSpawnPosition() {
return spawnPosition;
}
}