mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-23 00:21:26 +01:00
hollow-cube/chunk-sending-rate-config
This commit is contained in:
parent
b572709a2d
commit
a981bd78ff
@ -706,14 +706,14 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
|||||||
(x, z) -> chunkQueue.add(ChunkUtils.getChunkIndex(x, z)));
|
(x, z) -> chunkQueue.add(ChunkUtils.getChunkIndex(x, z)));
|
||||||
var iter = chunkQueue.iterator();
|
var iter = chunkQueue.iterator();
|
||||||
Supplier<TaskSchedule> taskRunnable = () -> {
|
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();
|
if (!iter.hasNext()) return TaskSchedule.stop();
|
||||||
|
|
||||||
var next = iter.nextLong();
|
var next = iter.nextLong();
|
||||||
chunkAdder.accept(ChunkUtils.getChunkCoordX(next), ChunkUtils.getChunkCoordZ(next));
|
chunkAdder.accept(ChunkUtils.getChunkCoordX(next), ChunkUtils.getChunkCoordZ(next));
|
||||||
}
|
}
|
||||||
|
|
||||||
return TaskSchedule.tick(20);
|
return TaskSchedule.tick(ChunkUtils.NEW_CHUNK_SEND_INTERVAL);
|
||||||
};
|
};
|
||||||
scheduler().submitTask(taskRunnable);
|
scheduler().submitTask(taskRunnable);
|
||||||
} else {
|
} else {
|
||||||
|
@ -17,6 +17,8 @@ import java.util.function.Consumer;
|
|||||||
public final class ChunkUtils {
|
public final class ChunkUtils {
|
||||||
|
|
||||||
public static final boolean USE_NEW_CHUNK_SENDING = Boolean.getBoolean("minestom.use-new-chunk-sending");
|
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() {
|
private ChunkUtils() {
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user