      {
          int var5 = MathHelper.abs_int(par2 - this.worldInfo.getSpawnX());
          int var6 = MathHelper.abs_int(par4 - this.worldInfo.getSpawnZ());
-@@ -587,7 +611,7 @@
+@@ -587,7 +624,7 @@
              var6 = var5;
          }
  

 
                 if (this.checkChunksExist(var4.xCoord - var5, var4.yCoord - var5, var4.zCoord - var5, var4.xCoord + var5, var4.yCoord + var5, var4.zCoord + var5))
                 {
@@ -559,15 +566,27 @@
     public List getAllTileEntityInBox(int par1, int par2, int par3, int par4, int par5, int par6)
     {
         ArrayList var7 = new ArrayList();

     }
 
     public boolean areAllPlayersAsleep()
@@ -253,6 +261,14 @@
         int var1 = 0;
         int var2 = 0;
         Iterator var3 = this.activeChunkSet.iterator();
+
+        doneChunks.retainAll(activeChunkSet);
+        if (doneChunks.size() == activeChunkSet.size())
+        {
+            doneChunks.clear();
+        }
+
+        final long time = -System.currentTimeMillis();
 
         while (var3.hasNext())
         {
@@ -263,14 +279,16 @@
             Chunk var7 = this.getChunkFromChunkCoords(var4.chunkXPos, var4.chunkZPos);
             this.moodSoundAndLightCheck(var5, var6, var7);
             this.theProfiler.endStartSection("tickChunk");
-            var7.updateSkylight();
+            if (System.currentTimeMillis() + time <= 4 && doneChunks.add(var4)) { //Limits and evenly distributes the lighting update time
+                var7.updateSkylight();
+            }
             this.theProfiler.endStartSection("thunder");
             int var8;
             int var9;
             int var10;
             int var11;
 
