Skip to content

Commit 899b76b

Browse files
committed
fix: downgrade to max deferred instead of clearing on level downgrade
1 parent cb00445 commit 899b76b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

c2me-rewrites-chunk-system/src/main/java/com/ishland/c2me/rewrites/chunksystem/common/NewChunkHolderVanillaInterface.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,15 @@ public void updateDeferredStatus(NewChunkStatus status) {
174174
// both nonnull and different
175175
if (this.loadedDeferredStatus != null && this.loadedDeferredStatus.ordinal() > status.ordinal()) {
176176
ChunkPos pos1 = this.getPos();
177-
this.chunkSystem.removeTicket(pos1, TicketTypeExtension.VANILLA_DEFERRED_LOAD, pos1, this.loadedDeferredStatus);
178-
this.loadedDeferredStatus = null;
177+
if (status.getPrev() != null) { // don't add unloaded tickets
178+
ItemHolder<ChunkPos, ChunkState, ChunkLoadingContext, NewChunkHolderVanillaInterface> holder1 = this.chunkSystem.addTicket(pos1, TicketTypeExtension.VANILLA_DEFERRED_LOAD, pos1, status, StatusAdvancingScheduler.NO_OP);
179+
Assertions.assertTrue(holder1 == this.newHolder);
180+
this.chunkSystem.removeTicket(pos1, TicketTypeExtension.VANILLA_DEFERRED_LOAD, pos1, this.loadedDeferredStatus);
181+
this.loadedDeferredStatus = status;
182+
} else {
183+
this.chunkSystem.removeTicket(pos1, TicketTypeExtension.VANILLA_DEFERRED_LOAD, pos1, this.loadedDeferredStatus);
184+
this.loadedDeferredStatus = null;
185+
}
179186
}
180187
this.deferredStatus = status;
181188
}

0 commit comments

Comments
 (0)