Search in sources :

Example 1 with PacketTime

use of io.xol.chunkstories.api.net.packets.PacketTime in project chunkstories by Hugobros3.

the class WorldServer method tick.

@Override
public void tick() {
    processIncommingPackets();
    super.tick();
    // Update client tracking
    Iterator<Player> playersIterator = this.getPlayers();
    while (playersIterator.hasNext()) {
        Player player = playersIterator.next();
        // System.out.println("client: "+client);
        if (player.hasSpawned()) {
            // Update whatever he sees
            ((ServerPlayer) player).updateTrackedEntities();
        }
        // Update time & weather
        PacketTime packetTime = new PacketTime(this);
        packetTime.time = this.getTime();
        packetTime.overcastFactor = this.getWeather();
        player.pushPacket(packetTime);
    }
    virtualServerSoundManager.update();
    // TODO this should work per-world
    this.getServer().getHandler().flushAll();
}
Also used : PacketTime(io.xol.chunkstories.api.net.packets.PacketTime) Player(io.xol.chunkstories.api.player.Player) ServerPlayer(io.xol.chunkstories.server.player.ServerPlayer) ServerPlayer(io.xol.chunkstories.server.player.ServerPlayer)

Aggregations

PacketTime (io.xol.chunkstories.api.net.packets.PacketTime)1 Player (io.xol.chunkstories.api.player.Player)1 ServerPlayer (io.xol.chunkstories.server.player.ServerPlayer)1