19
19
import net .minecraft .server .MinecraftServer ;
20
20
import net .minecraft .server .TickTask ;
21
21
import net .minecraft .server .level .ChunkHolder ;
22
+ import net .minecraft .server .level .ChunkLevel ;
22
23
import net .minecraft .server .level .ChunkMap ;
23
24
import net .minecraft .server .level .ChunkMap .DistanceManager ;
24
25
import net .minecraft .server .level .ChunkResult ;
@@ -64,10 +65,6 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi
64
65
@ Final
65
66
private ServerLevel level ;
66
67
67
- @ Shadow
68
- @ Final
69
- private LongSet entitiesInLevel ;
70
-
71
68
@ Shadow
72
69
@ Final
73
70
private Long2ObjectLinkedOpenHashMap <ChunkHolder > updatingChunkMap ;
@@ -111,6 +108,10 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi
111
108
112
109
// in protoChunkToFullChunk
113
110
// fancier version of the one below, ensuring that the event is triggered when the chunk is actually loaded.
111
+
112
+ /*
113
+
114
+
114
115
@Inject(method = "method_17227", at = @At("HEAD"), remap = false)
115
116
private void onChunkGeneratedStart(ChunkHolder chunkHolder, ChunkAccess chunkAccess, CallbackInfoReturnable<ChunkAccess> cir)
116
117
{
@@ -146,6 +147,8 @@ private void onChunkGeneratedEnd(ChunkHolder chunkHolder, ChunkAccess chunk, Cal
146
147
}
147
148
}
148
149
150
+ */
151
+
149
152
/* simple but a version that doesn't guarantee that the chunk is actually loaded
150
153
@Inject(method = "convertToFullChunk", at = @At("HEAD"))
151
154
private void onChunkGeneratedEnd(ChunkHolder chunkHolder, CallbackInfoReturnable<CompletableFuture<ChunkResult<ChunkAccess>>> cir)
@@ -167,7 +170,7 @@ private void onChunkGeneratedEnd(ChunkHolder chunkHolder, CallbackInfoReturnable
167
170
@ Unique
168
171
private void addTicket (ChunkPos pos , ChunkStatus status )
169
172
{ // UNKNOWN
170
- this .distanceManager .addTicket (TicketType .UNKNOWN , pos , 33 + ChunkStatus . getDistance (status ), pos );
173
+ this .distanceManager .addTicket (TicketType .UNKNOWN , pos , 33 + ChunkLevel . byStatus (status ), pos );
171
174
}
172
175
173
176
@ Unique
@@ -176,6 +179,8 @@ private void addTicket(ChunkPos pos)
176
179
this .addTicket (pos , ChunkStatus .EMPTY );
177
180
}
178
181
182
+
183
+ /*
179
184
@Unique
180
185
private void addRelightTicket(ChunkPos pos)
181
186
{
@@ -190,7 +195,7 @@ public void releaseRelightTicket(ChunkPos pos)
190
195
() -> "release relight ticket " + pos
191
196
));
192
197
}
193
-
198
+ */
194
199
@ Unique
195
200
private void tickTicketManager ()
196
201
{
@@ -214,6 +219,8 @@ private Set<ChunkPos> getExistingChunks(Set<ChunkPos> requestedChunks)
214
219
return ret ;
215
220
}
216
221
222
+
223
+ /*
217
224
@Unique
218
225
private Set<ChunkPos> loadExistingChunksFromDisk(Set<ChunkPos> requestedChunks)
219
226
{
@@ -329,6 +336,8 @@ public void relightChunk(ChunkPos pos)
329
336
this.waitFor(lightFuture);
330
337
}
331
338
339
+ /*
340
+
332
341
@Override
333
342
public Map<String, Integer> regenerateChunkRegion(List<ChunkPos> requestedChunksList)
334
343
{
@@ -385,7 +394,7 @@ public Map<String, Integer> regenerateChunkRegion(List<ChunkPos> requestedChunks
385
394
{
386
395
ChunkAccess chunk = this.getCurrentChunk(pos);
387
396
388
- if (chunk .getStatus ().isOrAfter (ChunkStatus .LIGHT .getParent ()))
397
+ if (chunk.getPersistedStatus ().isOrAfter(ChunkStatus.LIGHT.getParent()))
389
398
{
390
399
affectedNeighbors.add(chunk);
391
400
}
@@ -399,7 +408,7 @@ public Map<String, Integer> regenerateChunkRegion(List<ChunkPos> requestedChunks
399
408
400
409
// remove entities
401
410
long longPos = pos.toLong();
402
- if (this . entitiesInLevel . contains ( longPos ) && chunk instanceof LevelChunk )
411
+ if (chunk instanceof LevelChunk)
403
412
{
404
413
((SimpleEntityLookupInterface<Entity>) ((ServerWorldInterface) level).getEntityLookupCMPublic()).getChunkEntities(pos).forEach(entity -> {
405
414
if (!(entity instanceof Player))
@@ -415,7 +424,7 @@ public Map<String, Integer> regenerateChunkRegion(List<ChunkPos> requestedChunks
415
424
((LevelChunk) chunk).setLoaded(false);
416
425
}
417
426
418
- if (this . entitiesInLevel . remove ( pos . toLong ()) && chunk instanceof LevelChunk )
427
+ if (chunk instanceof LevelChunk)
419
428
{
420
429
this.level.unload((LevelChunk) chunk); // block entities only
421
430
}
@@ -450,7 +459,7 @@ public Map<String, Integer> regenerateChunkRegion(List<ChunkPos> requestedChunks
450
459
// Also, this is needed to ensure chunks are saved to disk
451
460
452
461
Map<ChunkPos, ChunkStatus> targetGenerationStatus = affectedChunks.stream().collect(
453
- Collectors .toMap (ChunkAccess ::getPos , ChunkAccess ::getStatus )
462
+ Collectors.toMap(ChunkAccess::getPos, ChunkAccess::getPersistedStatus )
454
463
);
455
464
456
465
for (Entry<ChunkPos, ChunkStatus> entry : targetGenerationStatus.entrySet())
@@ -547,4 +556,14 @@ public Map<String, Integer> regenerateChunkRegion(List<ChunkPos> requestedChunks
547
556
548
557
return report;
549
558
}
559
+
560
+
561
+
562
+ @Override
563
+ public Iterable<ChunkHolder> getChunksCM()
564
+ {
565
+ return getChunks();
566
+ }
567
+
568
+ */
550
569
}
0 commit comments