mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-09 01:47:54 +01:00
implement BatchOption#isFullChunk, clarity change in Chunk
This commit is contained in:
parent
eca3abe11d
commit
ca8eac5356
@ -570,6 +570,7 @@ public abstract class Chunk implements Viewable, DataContainer {
|
||||
@NotNull
|
||||
protected ChunkDataPacket createChunkSectionUpdatePacket(int section) {
|
||||
ChunkDataPacket chunkDataPacket = getFreshPartialDataPacket();
|
||||
chunkDataPacket.fullChunk = false;
|
||||
int[] sections = new int[CHUNK_SECTION_COUNT];
|
||||
sections[section] = 1;
|
||||
chunkDataPacket.sections = sections;
|
||||
|
@ -193,17 +193,20 @@ public class ChunkBatch implements Batch<ChunkCallback> {
|
||||
private void singleThreadFlush(Instance instance, Chunk chunk, @Nullable ChunkBatch inverse,
|
||||
@Nullable ChunkCallback callback, boolean safeCallback) {
|
||||
try {
|
||||
if (blocks.isEmpty()) {
|
||||
OptionalCallback.execute(callback, chunk);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!chunk.isLoaded()) {
|
||||
LOGGER.warn("Unable to apply ChunkBatch to unloaded chunk ({}, {}) in {}.",
|
||||
chunk.getChunkX(), chunk.getChunkZ(), instance.getUniqueId());
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.options.isFullChunk())
|
||||
chunk.reset();
|
||||
|
||||
if (blocks.isEmpty()) {
|
||||
OptionalCallback.execute(callback, chunk);
|
||||
return;
|
||||
}
|
||||
|
||||
final IntSet sections = new IntArraySet();
|
||||
synchronized (blocks) {
|
||||
for (long block : blocks) {
|
||||
|
Loading…
Reference in New Issue
Block a user