|
18 | 18 | public class Chunk
|
19 | 19 | {
|
20 | 20 | private static final Logger logger = LogManager.getLogger();
|
21 |
| -@@ -62,15 +73,49 @@ |
| 21 | +@@ -62,15 +73,45 @@ |
22 | 22 | public int heightMapMinimum;
|
23 | 23 | public long inhabitedTime;
|
24 | 24 | private int queuedLightChecks;
|
25 | 25 | + public gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot (Cauldron protected -> public)
|
26 |
| -+ // PaperSpigot start - Asynchronous light updates |
27 |
| -+ public java.util.concurrent.atomic.AtomicInteger pendingLightUpdates = new java.util.concurrent.atomic.AtomicInteger(); |
28 |
| -+ public long lightUpdateTime; |
29 |
| -+ // PaperSpigot end |
30 | 26 | + public int lastAccessedTick; // Cauldron track last time the chunk was accessed
|
31 | 27 | private static final String __OBFID = "CL_00000373";
|
32 | 28 |
|
|
69 | 65 | this.queuedLightChecks = 4096;
|
70 | 66 | this.entityLists = new List[16];
|
71 | 67 | this.worldObj = p_i1995_1_;
|
72 |
| -@@ -80,13 +125,22 @@ |
| 68 | +@@ -80,13 +121,22 @@ |
73 | 69 |
|
74 | 70 | for (int k = 0; k < this.entityLists.length; ++k)
|
75 | 71 | {
|
|
93 | 89 | public Chunk(World p_i45446_1_, Block[] p_i45446_2_, int p_i45446_3_, int p_i45446_4_)
|
94 | 90 | {
|
95 | 91 | this(p_i45446_1_, p_i45446_3_, p_i45446_4_);
|
96 |
| -@@ -505,17 +559,17 @@ |
| 92 | +@@ -505,17 +555,17 @@ |
97 | 93 | public Block getBlock(final int p_150810_1_, final int p_150810_2_, final int p_150810_3_)
|
98 | 94 | {
|
99 | 95 | Block block = Blocks.air;
|
|
117 | 113 | catch (Throwable throwable)
|
118 | 114 | {
|
119 | 115 | CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting block");
|
120 |
| -@@ -529,7 +583,7 @@ |
| 116 | +@@ -529,7 +579,7 @@ |
121 | 117 | }
|
122 | 118 | });
|
123 | 119 | throw new ReportedException(crashreport);
|
|
126 | 122 | }
|
127 | 123 | }
|
128 | 124 |
|
129 |
| -@@ -589,9 +643,10 @@ |
| 125 | +@@ -589,9 +639,10 @@ |
130 | 126 |
|
131 | 127 | if (!this.worldObj.isRemote)
|
132 | 128 | {
|
|
138 | 134 | extendedblockstorage.func_150818_a(p_150807_1_, p_150807_2_ & 15, p_150807_3_, p_150807_4_);
|
139 | 135 | 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
|
140 | 136 |
|
141 |
| -@@ -777,8 +832,20 @@ |
| 137 | +@@ -777,8 +828,20 @@ |
142 | 138 |
|
143 | 139 | if (i != this.xPosition || j != this.zPosition)
|
144 | 140 | {
|
|
161 | 157 | }
|
162 | 158 |
|
163 | 159 | int k = MathHelper.floor_double(p_76612_1_.posY / 16.0D);
|
164 |
| -@@ -799,6 +866,26 @@ |
| 160 | +@@ -799,6 +862,26 @@ |
165 | 161 | p_76612_1_.chunkCoordY = k;
|
166 | 162 | p_76612_1_.chunkCoordZ = this.zPosition;
|
167 | 163 | this.entityLists[k].add(p_76612_1_);
|
|
188 | 184 | }
|
189 | 185 |
|
190 | 186 | public void removeEntity(Entity p_76622_1_)
|
191 |
| -@@ -819,6 +906,26 @@ |
| 187 | +@@ -819,6 +902,26 @@ |
192 | 188 | }
|
193 | 189 |
|
194 | 190 | this.entityLists[p_76608_2_].remove(p_76608_1_);
|
|
215 | 211 | }
|
216 | 212 |
|
217 | 213 | public boolean canBlockSeeTheSky(int p_76619_1_, int p_76619_2_, int p_76619_3_)
|
218 |
| -@@ -874,9 +981,23 @@ |
| 214 | +@@ -874,9 +977,23 @@ |
219 | 215 | p_150812_4_.xCoord = this.xPosition * 16 + p_150812_1_;
|
220 | 216 | p_150812_4_.yCoord = p_150812_2_;
|
221 | 217 | p_150812_4_.zCoord = this.zPosition * 16 + p_150812_3_;
|
|
240 | 236 | {
|
241 | 237 | if (this.chunkTileEntityMap.containsKey(chunkposition))
|
242 | 238 | {
|
243 |
| -@@ -886,6 +1007,16 @@ |
| 239 | +@@ -886,6 +1003,16 @@ |
244 | 240 | p_150812_4_.validate();
|
245 | 241 | this.chunkTileEntityMap.put(chunkposition, p_150812_4_);
|
246 | 242 | }
|
|
257 | 253 | }
|
258 | 254 |
|
259 | 255 | public void removeTileEntity(int p_150805_1_, int p_150805_2_, int p_150805_3_)
|
260 |
| -@@ -936,6 +1067,21 @@ |
| 256 | +@@ -936,6 +1063,21 @@ |
261 | 257 |
|
262 | 258 | for (int i = 0; i < this.entityLists.length; ++i)
|
263 | 259 | {
|
|
279 | 275 | this.worldObj.unloadEntities(this.entityLists[i]);
|
280 | 276 | }
|
281 | 277 | MinecraftForge.EVENT_BUS.post(new ChunkEvent.Unload(this));
|
282 |
| -@@ -952,16 +1098,20 @@ |
| 278 | +@@ -952,16 +1094,20 @@ |
283 | 279 | int j = MathHelper.floor_double((p_76588_2_.maxY + World.MAX_ENTITY_RADIUS) / 16.0D);
|
284 | 280 | i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1);
|
285 | 281 | j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1);
|
|
303 | 299 | {
|
304 | 300 | p_76588_3_.add(entity1);
|
305 | 301 | Entity[] aentity = entity1.getParts();
|
306 |
| -@@ -998,7 +1148,7 @@ |
| 302 | +@@ -998,7 +1144,7 @@ |
307 | 303 | {
|
308 | 304 | Entity entity = (Entity)list1.get(l);
|
309 | 305 |
|
|
312 | 308 | {
|
313 | 309 | p_76618_3_.add(entity);
|
314 | 310 | }
|
315 |
| -@@ -1015,7 +1165,7 @@ |
| 311 | +@@ -1015,7 +1161,7 @@ |
316 | 312 | return true;
|
317 | 313 | }
|
318 | 314 | }
|
|
321 | 317 | {
|
322 | 318 | return true;
|
323 | 319 | }
|
324 |
| -@@ -1025,7 +1175,7 @@ |
| 320 | +@@ -1025,7 +1171,7 @@ |
325 | 321 |
|
326 | 322 | public Random getRandomWithSeed(long p_76617_1_)
|
327 | 323 | {
|
|
330 | 326 | }
|
331 | 327 |
|
332 | 328 | public boolean isEmpty()
|
333 |
| -@@ -1035,6 +1185,7 @@ |
| 329 | +@@ -1035,6 +1181,7 @@ |
334 | 330 |
|
335 | 331 | public void populateChunk(IChunkProvider p_76624_1_, IChunkProvider p_76624_2_, int p_76624_3_, int p_76624_4_)
|
336 | 332 | {
|
337 | 333 | + worldObj.timings.syncChunkLoadPostTimer.startTiming(); // Spigot
|
338 | 334 | 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_))
|
339 | 335 | {
|
340 | 336 | p_76624_1_.populate(p_76624_2_, p_76624_3_, p_76624_4_);
|
341 |
| -@@ -1054,6 +1205,7 @@ |
| 337 | +@@ -1054,6 +1201,7 @@ |
342 | 338 | {
|
343 | 339 | p_76624_1_.populate(p_76624_2_, p_76624_3_ - 1, p_76624_4_ - 1);
|
344 | 340 | }
|
345 | 341 | + worldObj.timings.syncChunkLoadPostTimer.stopTiming(); // Spigot
|
346 | 342 | }
|
347 | 343 |
|
348 | 344 | public int getPrecipitationHeight(int p_76626_1_, int p_76626_2_)
|
349 |
| -@@ -1091,7 +1243,7 @@ |
| 345 | +@@ -1091,7 +1239,7 @@ |
350 | 346 | {
|
351 | 347 | if (this.isGapLightingUpdated && !this.worldObj.provider.hasNoSky && !p_150804_1_)
|
352 | 348 | {
|
|
355 | 351 | }
|
356 | 352 |
|
357 | 353 | this.field_150815_m = true;
|
358 |
| -@@ -1104,7 +1256,8 @@ |
| 354 | +@@ -1104,7 +1252,8 @@ |
359 | 355 |
|
360 | 356 | public boolean func_150802_k()
|
361 | 357 | {
|
|
365 | 361 | }
|
366 | 362 |
|
367 | 363 | public ChunkCoordIntPair getChunkCoordIntPair()
|
368 |
| -@@ -1184,8 +1337,10 @@ |
| 364 | +@@ -1184,8 +1333,10 @@ |
369 | 365 | if ((p_76607_2_ & 1 << l) != 0 && this.storageArrays[l] != null)
|
370 | 366 | {
|
371 | 367 | nibblearray = this.storageArrays[l].getMetadataArray();
|
|
378 | 374 | }
|
379 | 375 | }
|
380 | 376 |
|
381 |
| -@@ -1194,8 +1349,10 @@ |
| 377 | +@@ -1194,8 +1345,10 @@ |
382 | 378 | if ((p_76607_2_ & 1 << l) != 0 && this.storageArrays[l] != null)
|
383 | 379 | {
|
384 | 380 | nibblearray = this.storageArrays[l].getBlocklightArray();
|
|
391 | 387 | }
|
392 | 388 | }
|
393 | 389 |
|
394 |
| -@@ -1206,8 +1363,10 @@ |
| 390 | +@@ -1206,8 +1359,10 @@ |
395 | 391 | if ((p_76607_2_ & 1 << l) != 0 && this.storageArrays[l] != null)
|
396 | 392 | {
|
397 | 393 | nibblearray = this.storageArrays[l].getSkylightArray();
|
|
404 | 400 | }
|
405 | 401 | }
|
406 | 402 | }
|
407 |
| -@@ -1229,8 +1388,8 @@ |
| 403 | +@@ -1229,8 +1384,8 @@ |
408 | 404 | nibblearray = this.storageArrays[l].createBlockMSBArray();
|
409 | 405 | }
|
410 | 406 |
|
|
415 | 411 | }
|
416 | 412 | }
|
417 | 413 | else if (p_76607_4_ && this.storageArrays[l] != null && this.storageArrays[l].getBlockMSBArray() != null)
|
418 |
| -@@ -1523,4 +1682,22 @@ |
| 414 | +@@ -1523,4 +1678,22 @@ |
419 | 415 | }
|
420 | 416 | }
|
421 | 417 | }
|
|
0 commit comments