hollow-cube/chunk-sending-rate-config

This commit is contained in:
mworzala 2023-06-30 16:41:00 -04:00
parent b572709a2d
commit a981bd78ff
No known key found for this signature in database
GPG Key ID: B148F922E64797C7
2 changed files with 4 additions and 2 deletions

View File

@ -706,14 +706,14 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
(x, z) -> chunkQueue.add(ChunkUtils.getChunkIndex(x, z)));
var iter = chunkQueue.iterator();
Supplier<TaskSchedule> taskRunnable = () -> {
for (int i = 0; i < 50; i++) {
for (int i = 0; i < ChunkUtils.NEW_CHUNK_COUNT_PER_INTERVAL; i++) {
if (!iter.hasNext()) return TaskSchedule.stop();
var next = iter.nextLong();
chunkAdder.accept(ChunkUtils.getChunkCoordX(next), ChunkUtils.getChunkCoordZ(next));
}
return TaskSchedule.tick(20);
return TaskSchedule.tick(ChunkUtils.NEW_CHUNK_SEND_INTERVAL);
};
scheduler().submitTask(taskRunnable);
} else {

View File

@ -17,6 +17,8 @@ import java.util.function.Consumer;
public final class ChunkUtils {
public static final boolean USE_NEW_CHUNK_SENDING = Boolean.getBoolean("minestom.use-new-chunk-sending");
public static final int NEW_CHUNK_COUNT_PER_INTERVAL = Integer.getInteger("minestom.new-chunk-sending-count-per-interval", 50);
public static final int NEW_CHUNK_SEND_INTERVAL = Integer.getInteger("minestom.new-chunk-sending-send-interval", 20);
private ChunkUtils() {
}