忽视亮度计算,直接卸载区块
This commit is contained in:
		@@ -18,15 +18,11 @@
 | 
			
		||||
 public class Chunk
 | 
			
		||||
 {
 | 
			
		||||
     private static final Logger logger = LogManager.getLogger();
 | 
			
		||||
@@ -62,8 +73,42 @@
 | 
			
		||||
@@ -62,8 +73,38 @@
 | 
			
		||||
     public int heightMapMinimum;
 | 
			
		||||
     public long inhabitedTime;
 | 
			
		||||
     private int queuedLightChecks;
 | 
			
		||||
+    public gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot (Cauldron protected -> public)
 | 
			
		||||
+    // PaperSpigot start - Asynchronous light updates
 | 
			
		||||
+    public java.util.concurrent.atomic.AtomicInteger pendingLightUpdates = new java.util.concurrent.atomic.AtomicInteger();
 | 
			
		||||
+    public long lightUpdateTime;
 | 
			
		||||
+    // PaperSpigot end
 | 
			
		||||
+    public int lastAccessedTick; // Cauldron track last time the chunk was accessed
 | 
			
		||||
     private static final String __OBFID = "CL_00000373";
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +57,7 @@
 | 
			
		||||
     public Chunk(World p_i1995_1_, int p_i1995_2_, int p_i1995_3_)
 | 
			
		||||
     {
 | 
			
		||||
         this.storageArrays = new ExtendedBlockStorage[16];
 | 
			
		||||
@@ -80,13 +125,22 @@
 | 
			
		||||
@@ -80,13 +121,22 @@
 | 
			
		||||
 
 | 
			
		||||
         for (int k = 0; k < this.entityLists.length; ++k)
 | 
			
		||||
         {
 | 
			
		||||
@@ -85,7 +81,7 @@
 | 
			
		||||
     public Chunk(World p_i45446_1_, Block[] p_i45446_2_, int p_i45446_3_, int p_i45446_4_)
 | 
			
		||||
     {
 | 
			
		||||
         this(p_i45446_1_, p_i45446_3_, p_i45446_4_);
 | 
			
		||||
@@ -512,10 +566,10 @@
 | 
			
		||||
@@ -512,10 +562,10 @@
 | 
			
		||||
 
 | 
			
		||||
             if (extendedblockstorage != null)
 | 
			
		||||
             {
 | 
			
		||||
@@ -99,7 +95,7 @@
 | 
			
		||||
                 catch (Throwable throwable)
 | 
			
		||||
                 {
 | 
			
		||||
                     CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting block");
 | 
			
		||||
@@ -529,7 +583,7 @@
 | 
			
		||||
@@ -529,7 +579,7 @@
 | 
			
		||||
                         }
 | 
			
		||||
                     });
 | 
			
		||||
                     throw new ReportedException(crashreport);
 | 
			
		||||
@@ -108,7 +104,7 @@
 | 
			
		||||
             }
 | 
			
		||||
         }
 | 
			
		||||
 
 | 
			
		||||
@@ -589,9 +643,10 @@
 | 
			
		||||
@@ -589,9 +639,10 @@
 | 
			
		||||
 
 | 
			
		||||
             if (!this.worldObj.isRemote)
 | 
			
		||||
             {
 | 
			
		||||
@@ -120,7 +116,7 @@
 | 
			
		||||
             extendedblockstorage.func_150818_a(p_150807_1_, p_150807_2_ & 15, p_150807_3_, p_150807_4_);
 | 
			
		||||
             extendedblockstorage.setExtBlockMetadata(p_150807_1_, p_150807_2_ & 15, p_150807_3_, p_150807_5_); // This line duplicates the one below, so breakBlock fires with valid worldstate
 | 
			
		||||
 
 | 
			
		||||
@@ -777,8 +832,20 @@
 | 
			
		||||
@@ -777,8 +828,20 @@
 | 
			
		||||
 
 | 
			
		||||
         if (i != this.xPosition || j != this.zPosition)
 | 
			
		||||
         {
 | 
			
		||||
@@ -143,7 +139,7 @@
 | 
			
		||||
         }
 | 
			
		||||
 
 | 
			
		||||
         int k = MathHelper.floor_double(p_76612_1_.posY / 16.0D);
 | 
			
		||||
@@ -799,6 +866,26 @@
 | 
			
		||||
@@ -799,6 +862,26 @@
 | 
			
		||||
         p_76612_1_.chunkCoordY = k;
 | 
			
		||||
         p_76612_1_.chunkCoordZ = this.zPosition;
 | 
			
		||||
         this.entityLists[k].add(p_76612_1_);
 | 
			
		||||
@@ -170,7 +166,7 @@
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     public void removeEntity(Entity p_76622_1_)
 | 
			
		||||
@@ -819,6 +906,26 @@
 | 
			
		||||
@@ -819,6 +902,26 @@
 | 
			
		||||
         }
 | 
			
		||||
 
 | 
			
		||||
         this.entityLists[p_76608_2_].remove(p_76608_1_);
 | 
			
		||||
@@ -197,7 +193,7 @@
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     public boolean canBlockSeeTheSky(int p_76619_1_, int p_76619_2_, int p_76619_3_)
 | 
			
		||||
@@ -874,9 +981,23 @@
 | 
			
		||||
@@ -874,9 +977,23 @@
 | 
			
		||||
         p_150812_4_.xCoord = this.xPosition * 16 + p_150812_1_;
 | 
			
		||||
         p_150812_4_.yCoord = p_150812_2_;
 | 
			
		||||
         p_150812_4_.zCoord = this.zPosition * 16 + p_150812_3_;
 | 
			
		||||
@@ -222,7 +218,7 @@
 | 
			
		||||
         {
 | 
			
		||||
             if (this.chunkTileEntityMap.containsKey(chunkposition))
 | 
			
		||||
             {
 | 
			
		||||
@@ -886,6 +1007,16 @@
 | 
			
		||||
@@ -886,6 +1003,16 @@
 | 
			
		||||
             p_150812_4_.validate();
 | 
			
		||||
             this.chunkTileEntityMap.put(chunkposition, p_150812_4_);
 | 
			
		||||
         }
 | 
			
		||||
@@ -239,7 +235,7 @@
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     public void removeTileEntity(int p_150805_1_, int p_150805_2_, int p_150805_3_)
 | 
			
		||||
@@ -936,6 +1067,21 @@
 | 
			
		||||
@@ -936,6 +1063,21 @@
 | 
			
		||||
 
 | 
			
		||||
         for (int i = 0; i < this.entityLists.length; ++i)
 | 
			
		||||
         {
 | 
			
		||||
@@ -261,7 +257,7 @@
 | 
			
		||||
             this.worldObj.unloadEntities(this.entityLists[i]);
 | 
			
		||||
         }
 | 
			
		||||
         MinecraftForge.EVENT_BUS.post(new ChunkEvent.Unload(this));
 | 
			
		||||
@@ -961,7 +1107,7 @@
 | 
			
		||||
@@ -961,7 +1103,7 @@
 | 
			
		||||
             {
 | 
			
		||||
                 Entity entity1 = (Entity)list1.get(l);
 | 
			
		||||
 
 | 
			
		||||
@@ -270,7 +266,7 @@
 | 
			
		||||
                 {
 | 
			
		||||
                     p_76588_3_.add(entity1);
 | 
			
		||||
                     Entity[] aentity = entity1.getParts();
 | 
			
		||||
@@ -998,7 +1144,7 @@
 | 
			
		||||
@@ -998,7 +1140,7 @@
 | 
			
		||||
             {
 | 
			
		||||
                 Entity entity = (Entity)list1.get(l);
 | 
			
		||||
 
 | 
			
		||||
@@ -279,7 +275,7 @@
 | 
			
		||||
                 {
 | 
			
		||||
                     p_76618_3_.add(entity);
 | 
			
		||||
                 }
 | 
			
		||||
@@ -1015,7 +1161,7 @@
 | 
			
		||||
@@ -1015,7 +1157,7 @@
 | 
			
		||||
                 return true;
 | 
			
		||||
             }
 | 
			
		||||
         }
 | 
			
		||||
@@ -288,7 +284,7 @@
 | 
			
		||||
         {
 | 
			
		||||
             return true;
 | 
			
		||||
         }
 | 
			
		||||
@@ -1025,7 +1171,7 @@
 | 
			
		||||
@@ -1025,7 +1167,7 @@
 | 
			
		||||
 
 | 
			
		||||
     public Random getRandomWithSeed(long p_76617_1_)
 | 
			
		||||
     {
 | 
			
		||||
@@ -297,7 +293,7 @@
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     public boolean isEmpty()
 | 
			
		||||
@@ -1035,6 +1181,7 @@
 | 
			
		||||
@@ -1035,6 +1177,7 @@
 | 
			
		||||
 
 | 
			
		||||
     public void populateChunk(IChunkProvider p_76624_1_, IChunkProvider p_76624_2_, int p_76624_3_, int p_76624_4_)
 | 
			
		||||
     {
 | 
			
		||||
@@ -305,7 +301,7 @@
 | 
			
		||||
         if (!this.isTerrainPopulated && p_76624_1_.chunkExists(p_76624_3_ + 1, p_76624_4_ + 1) && p_76624_1_.chunkExists(p_76624_3_, p_76624_4_ + 1) && p_76624_1_.chunkExists(p_76624_3_ + 1, p_76624_4_))
 | 
			
		||||
         {
 | 
			
		||||
             p_76624_1_.populate(p_76624_2_, p_76624_3_, p_76624_4_);
 | 
			
		||||
@@ -1054,6 +1201,7 @@
 | 
			
		||||
@@ -1054,6 +1197,7 @@
 | 
			
		||||
         {
 | 
			
		||||
             p_76624_1_.populate(p_76624_2_, p_76624_3_ - 1, p_76624_4_ - 1);
 | 
			
		||||
         }
 | 
			
		||||
@@ -313,7 +309,7 @@
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     public int getPrecipitationHeight(int p_76626_1_, int p_76626_2_)
 | 
			
		||||
@@ -1091,7 +1239,7 @@
 | 
			
		||||
@@ -1091,7 +1235,7 @@
 | 
			
		||||
     {
 | 
			
		||||
         if (this.isGapLightingUpdated && !this.worldObj.provider.hasNoSky && !p_150804_1_)
 | 
			
		||||
         {
 | 
			
		||||
@@ -322,7 +318,7 @@
 | 
			
		||||
         }
 | 
			
		||||
 
 | 
			
		||||
         this.field_150815_m = true;
 | 
			
		||||
@@ -1184,8 +1332,10 @@
 | 
			
		||||
@@ -1184,8 +1328,10 @@
 | 
			
		||||
             if ((p_76607_2_ & 1 << l) != 0 && this.storageArrays[l] != null)
 | 
			
		||||
             {
 | 
			
		||||
                 nibblearray = this.storageArrays[l].getMetadataArray();
 | 
			
		||||
@@ -335,7 +331,7 @@
 | 
			
		||||
             }
 | 
			
		||||
         }
 | 
			
		||||
 
 | 
			
		||||
@@ -1194,8 +1344,10 @@
 | 
			
		||||
@@ -1194,8 +1340,10 @@
 | 
			
		||||
             if ((p_76607_2_ & 1 << l) != 0 && this.storageArrays[l] != null)
 | 
			
		||||
             {
 | 
			
		||||
                 nibblearray = this.storageArrays[l].getBlocklightArray();
 | 
			
		||||
@@ -348,7 +344,7 @@
 | 
			
		||||
             }
 | 
			
		||||
         }
 | 
			
		||||
 
 | 
			
		||||
@@ -1206,8 +1358,10 @@
 | 
			
		||||
@@ -1206,8 +1354,10 @@
 | 
			
		||||
                 if ((p_76607_2_ & 1 << l) != 0 && this.storageArrays[l] != null)
 | 
			
		||||
                 {
 | 
			
		||||
                     nibblearray = this.storageArrays[l].getSkylightArray();
 | 
			
		||||
@@ -361,7 +357,7 @@
 | 
			
		||||
                 }
 | 
			
		||||
             }
 | 
			
		||||
         }
 | 
			
		||||
@@ -1229,8 +1383,8 @@
 | 
			
		||||
@@ -1229,8 +1379,8 @@
 | 
			
		||||
                         nibblearray = this.storageArrays[l].createBlockMSBArray();
 | 
			
		||||
                     }
 | 
			
		||||
 
 | 
			
		||||
@@ -372,7 +368,7 @@
 | 
			
		||||
                 }
 | 
			
		||||
             }
 | 
			
		||||
             else if (p_76607_4_ && this.storageArrays[l] != null && this.storageArrays[l].getBlockMSBArray() != null)
 | 
			
		||||
@@ -1523,4 +1677,24 @@
 | 
			
		||||
@@ -1523,4 +1673,24 @@
 | 
			
		||||
             }
 | 
			
		||||
         }
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
@@ -94,7 +94,7 @@
 | 
			
		||||
     {
 | 
			
		||||
+        // PaperSpigot start - Asynchronous lighting updates
 | 
			
		||||
+        Chunk chunk = this.getChunkIfLoaded(p_73241_1_,p_73241_2_);
 | 
			
		||||
+        if (chunk != null && chunk.worldObj.spigotConfig.useAsyncLighting && (chunk.pendingLightUpdates.get() > 0 || chunk.worldObj.getTotalWorldTime() - chunk.lightUpdateTime < 20)) {
 | 
			
		||||
+        if (chunk == null) {
 | 
			
		||||
+            return;
 | 
			
		||||
+        }
 | 
			
		||||
+        // PaperSpigot end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user