Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import it.unimi.dsi.fastutil.longs.Long2IntLinkedOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2IntMap;
import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator;
import net.minecraft.server.world.ChunkHolder;
import net.minecraft.server.world.ChunkLevelManager;
import net.minecraft.server.world.ServerChunkLoadingManager;
Expand Down Expand Up @@ -78,11 +80,12 @@ private ThrottledChunkTaskScheduler syncPlayerTickets(TaskExecutor<Runnable> exe
private void postTicketPropagator(ServerChunkLoadingManager chunkLoadingManager, CallbackInfoReturnable<Boolean> cir) {
if (this.ticketDistanceLevelPropagator != null) { // ignore if replaced
Long2IntLinkedOpenHashMap updates = ((TicketDistanceLevelPropagatorExtension) this.ticketDistanceLevelPropagator).c2me$getTicketLevelUpdates();
while (!updates.isEmpty()) {
long pos = updates.firstLongKey();
int level = updates.removeFirstInt();
this.setLevel(pos, level, null, Integer.MAX_VALUE - 1); // holder and old level is ignored
ObjectBidirectionalIterator<Long2IntMap.Entry> iterator = updates.long2IntEntrySet().fastIterator();
while (iterator.hasNext()) {
Long2IntMap.Entry entry = iterator.next();
this.setLevel(entry.getLongKey(), entry.getIntValue(), null, Integer.MAX_VALUE - 1); // holder and old level is ignored
}
updates.clear();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ public class MixinChunkTicketManagerTicketDistanceLevelPropagator implements Tic
private void postInit(CallbackInfo ci) {
this.c2me$levels = new Long2IntOpenHashMap();
this.c2me$levels.defaultReturnValue(UNLOADED + 1);
this.c2me$ticketLevelUpdates = new Long2IntLinkedOpenHashMap();
this.c2me$ticketLevelUpdates = new Long2IntLinkedOpenHashMap() {
@Override
protected void rehash(int newN) {
if (newN <= n) {
return; // prevent shrinking
}
super.rehash(newN);
}
};
}

/**
Expand Down