public void tick() {
        this.updateWeather();
        long var2;
        if (this.isAllPlayersFullyAsleep()) {
            boolean var1 = false;
            if (this.spawnHostileMobs && this.difficultySetting >= 1) {
                var1 = SpawnerAnimals.performSleepSpawning(this, this.playerEntities);
            }

            if (!var1) {
                var2 = this.worldInfo.getWorldTime() + 24000L;
                this.worldInfo.setWorldTime(var2 - var2 % 24000L);
                this.wakeUpAllPlayers();
            }
        }

        SpawnerAnimals.performSpawning(this, this.spawnHostileMobs, this.spawnPeacefulMobs);
        this.chunkProvider.unload100OldestChunks();
        int var4 = this.calculateSkylightSubtracted(1.0F);
        if (var4 != this.skylightSubtracted) {
            this.skylightSubtracted = var4;

            for (int var5 = 0; var5 < this.worldAccesses.size(); ++var5) {
                ((IWorldAccess) this.worldAccesses.get(var5)).updateAllRenderers();
            }
        }

        var2 = this.worldInfo.getWorldTime() + 1L;
        if (var2 % (long) this.autosavePeriod == 0L) {
            this.saveWorld(false, (IProgressUpdate) null);
        }

        this.worldInfo.setWorldTime(var2);
        this.tickUpdates(false);
        this.updateBlocksAndPlayCaveSounds();
    }