public void tick()
    {
        if (this.getWorldInfo().isHardcoreModeEnabled() && this.difficultySetting < 3)
        {
            this.difficultySetting = 3;
        }

        this.worldProvider.worldChunkMgr.cleanupCache();
        this.updateWeather();
        long var2;

        if (this.isAllPlayersFullyAsleep())
        {
            boolean var1 = false;

            if (this.spawnHostileMobs && this.difficultySetting >= 1)
            {
                ;
            }

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

        Profiler.startSection("mobSpawner");
        SpawnerAnimals.performSpawning(this, this.spawnHostileMobs, this.spawnPeacefulMobs && this.worldInfo.getWorldTime() % 400L == 0L);
        Profiler.endStartSection("chunkSource");
        this.chunkProvider.unload100OldestChunks();
        int var4 = this.calculateSkylightSubtracted(1.0F);

        if (var4 != this.skylightSubtracted)
        {
            this.skylightSubtracted = var4;
        }

        var2 = this.worldInfo.getWorldTime() + 1L;

        if (var2 % (long)this.autosavePeriod == 0L)
        {
            Profiler.endStartSection("save");
            this.saveWorld(false, (IProgressUpdate)null);
        }

        this.worldInfo.setWorldTime(var2);
        Profiler.endStartSection("tickPending");
        this.tickUpdates(false);
        Profiler.endStartSection("tickTiles");
        this.tickBlocksAndAmbiance();
        Profiler.endStartSection("village");
        this.villageCollectionObj.tick();
        this.villageSiegeObj.tick();
        Profiler.endSection();
    }