|
|
|
@@ -8,7 +8,7 @@ Copyright xymb@endcrystal.me
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
|
|
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
|
|
|
index 7f1f4988a25a5ebac36c25c045c51eefecab6862..09f9a12da1807dd72a95378b4824d9a09f7ccbfe 100644
|
|
|
|
index abfd4d5faf23511284b4efac771ef79da0ef72da..0a6549d0f545e81ae95527797333f2e2da85e1f1 100644
|
|
|
|
--- a/build.gradle.kts
|
|
|
|
--- a/build.gradle.kts
|
|
|
|
+++ b/build.gradle.kts
|
|
|
|
+++ b/build.gradle.kts
|
|
|
|
@@ -13,6 +13,10 @@ dependencies {
|
|
|
|
@@ -13,6 +13,10 @@ dependencies {
|
|
|
|
@@ -76,51 +76,35 @@ index 0000000000000000000000000000000000000000..249303116d3cfadd078ebf0ae6e44bf9
|
|
|
|
+}
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/region/AbstractRegionFileFactory.java b/src/main/java/dev/kaiijumc/kaiiju/region/AbstractRegionFileFactory.java
|
|
|
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/region/AbstractRegionFileFactory.java b/src/main/java/dev/kaiijumc/kaiiju/region/AbstractRegionFileFactory.java
|
|
|
|
new file mode 100644
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000000000000000000000000000000000000..a470609b107f46ffc3bb7b121525ca8b803b4322
|
|
|
|
index 0000000000000000000000000000000000000000..67991815a0ff9235a846ca8db817c90f094c4a58
|
|
|
|
--- /dev/null
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/AbstractRegionFileFactory.java
|
|
|
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/AbstractRegionFileFactory.java
|
|
|
|
@@ -0,0 +1,46 @@
|
|
|
|
@@ -0,0 +1,30 @@
|
|
|
|
+package dev.kaiijumc.kaiiju.region;
|
|
|
|
+package dev.kaiijumc.kaiiju.region;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+import net.minecraft.world.level.chunk.storage.RegionFile;
|
|
|
|
+import net.minecraft.world.level.chunk.storage.RegionFile;
|
|
|
|
+import net.minecraft.world.level.chunk.storage.RegionFileVersion;
|
|
|
|
+import net.minecraft.world.level.chunk.storage.RegionFileVersion;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+import java.io.File;
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.nio.file.Path;
|
|
|
|
+import java.nio.file.Path;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+public class AbstractRegionFileFactory {
|
|
|
|
+public class AbstractRegionFileFactory {
|
|
|
|
+ public static AbstractRegionFile getAbstractRegionFile(Path file, Path directory, boolean dsync) throws IOException {
|
|
|
|
+
|
|
|
|
+ return getAbstractRegionFile(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync);
|
|
|
|
+ public static AbstractRegionFile getAbstractRegionFile(int linearCompression, int linearInternalCompression, Path file, Path directory, boolean dsync) throws IOException {
|
|
|
|
|
|
|
|
+ return getAbstractRegionFile(linearCompression, linearInternalCompression, file, directory, RegionFileVersion.VERSION_DEFLATE, dsync);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public static AbstractRegionFile getAbstractRegionFile(Path file, Path directory, boolean dsync, boolean canRecalcHeader) throws IOException {
|
|
|
|
+ public static AbstractRegionFile getAbstractRegionFile(int linearCompression, int linearInternalCompression, Path file, Path directory, boolean dsync, boolean canRecalcHeader) throws IOException {
|
|
|
|
+ return getAbstractRegionFile(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync, canRecalcHeader);
|
|
|
|
+ return getAbstractRegionFile(linearCompression, linearInternalCompression, file, directory, RegionFileVersion.VERSION_DEFLATE, dsync, canRecalcHeader);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public static AbstractRegionFile getAbstractRegionFile(Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync) throws IOException {
|
|
|
|
+ public static AbstractRegionFile getAbstractRegionFile(int linearCompression, int linearInternalCompression, Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync) throws IOException {
|
|
|
|
+ return getAbstractRegionFile(file, directory, outputChunkStreamVersion, dsync, false);
|
|
|
|
+ return getAbstractRegionFile(linearCompression, linearInternalCompression, file, directory, outputChunkStreamVersion, dsync, false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public static AbstractRegionFile getAbstractRegionFile(Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync, boolean canRecalcHeader) throws IOException {
|
|
|
|
+ public static AbstractRegionFile getAbstractRegionFile(int linearCompression, int linearInternalCompression, Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync, boolean canRecalcHeader) throws IOException {
|
|
|
|
+ return getAbstractRegionFile(1, file, directory, outputChunkStreamVersion, dsync, canRecalcHeader);
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ public static AbstractRegionFile getAbstractRegionFile(int linearCompression, Path file, Path directory, boolean dsync) throws IOException {
|
|
|
|
|
|
|
|
+ return getAbstractRegionFile(linearCompression, file, directory, RegionFileVersion.VERSION_DEFLATE, dsync);
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ public static AbstractRegionFile getAbstractRegionFile(int linearCompression, Path file, Path directory, boolean dsync, boolean canRecalcHeader) throws IOException {
|
|
|
|
|
|
|
|
+ return getAbstractRegionFile(linearCompression, file, directory, RegionFileVersion.VERSION_DEFLATE, dsync, canRecalcHeader);
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ public static AbstractRegionFile getAbstractRegionFile(int linearCompression, Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync) throws IOException {
|
|
|
|
|
|
|
|
+ return getAbstractRegionFile(linearCompression, file, directory, outputChunkStreamVersion, dsync, false);
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ public static AbstractRegionFile getAbstractRegionFile(int linearCompression, Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync, boolean canRecalcHeader) throws IOException {
|
|
|
|
|
|
|
|
+ if (file.toString().endsWith(".linear")) {
|
|
|
|
+ if (file.toString().endsWith(".linear")) {
|
|
|
|
+ return new LinearRegionFile(file, linearCompression);
|
|
|
|
+ return new LinearRegionFile(file, linearCompression, linearInternalCompression);
|
|
|
|
+ } else {
|
|
|
|
+ } else {
|
|
|
|
+ return new RegionFile(file, directory, outputChunkStreamVersion, dsync, canRecalcHeader);
|
|
|
|
+ return new RegionFile(file, directory, outputChunkStreamVersion, dsync, canRecalcHeader);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
@@ -128,19 +112,15 @@ index 0000000000000000000000000000000000000000..a470609b107f46ffc3bb7b121525ca8b
|
|
|
|
+}
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
|
|
|
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
|
|
|
|
new file mode 100644
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000000000000000000000000000000000000..2e0d10ded886e82c09700a1c6602cd1bb9d1967e
|
|
|
|
index 0000000000000000000000000000000000000000..df2edc187480aef6af1cbeb82824984e31672068
|
|
|
|
--- /dev/null
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
|
|
|
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
|
|
|
|
@@ -0,0 +1,342 @@
|
|
|
|
@@ -0,0 +1,325 @@
|
|
|
|
+package dev.kaiijumc.kaiiju.region;
|
|
|
|
+package dev.kaiijumc.kaiiju.region;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+import com.github.luben.zstd.ZstdInputStream;
|
|
|
|
+import com.github.luben.zstd.Zstd;import com.github.luben.zstd.ZstdInputStream;
|
|
|
|
+import com.github.luben.zstd.ZstdOutputStream;
|
|
|
|
+import com.github.luben.zstd.ZstdOutputStream;
|
|
|
|
+import com.mojang.logging.LogUtils;
|
|
|
|
+import com.mojang.logging.LogUtils;
|
|
|
|
+import dev.kaiijumc.kaiiju.KaiijuConfig;
|
|
|
|
|
|
|
|
+import net.jpountz.lz4.LZ4Compressor;
|
|
|
|
|
|
|
|
+import net.jpountz.lz4.LZ4Factory;
|
|
|
|
|
|
|
|
+import net.jpountz.lz4.LZ4FastDecompressor;
|
|
|
|
|
|
|
|
+import net.jpountz.xxhash.XXHashFactory;
|
|
|
|
+import net.jpountz.xxhash.XXHashFactory;
|
|
|
|
+import net.minecraft.nbt.CompoundTag;
|
|
|
|
+import net.minecraft.nbt.CompoundTag;
|
|
|
|
+import net.minecraft.world.level.ChunkPos;
|
|
|
|
+import net.minecraft.world.level.ChunkPos;
|
|
|
|
@@ -154,6 +134,7 @@ index 0000000000000000000000000000000000000000..2e0d10ded886e82c09700a1c6602cd1b
|
|
|
|
+import java.nio.file.Path;
|
|
|
|
+import java.nio.file.Path;
|
|
|
|
+import java.nio.file.StandardCopyOption;
|
|
|
|
+import java.nio.file.StandardCopyOption;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
|
+import java.util.concurrent.locks.ReentrantLock;
|
|
|
|
+import java.util.concurrent.locks.ReentrantLock;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+public class LinearRegionFile extends Thread implements AbstractRegionFile {
|
|
|
|
+public class LinearRegionFile extends Thread implements AbstractRegionFile {
|
|
|
|
@@ -171,6 +152,7 @@ index 0000000000000000000000000000000000000000..2e0d10ded886e82c09700a1c6602cd1b
|
|
|
|
+ public Path regionFile;
|
|
|
|
+ public Path regionFile;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private final int compressionLevel;
|
|
|
|
+ private final int compressionLevel;
|
|
|
|
|
|
|
|
+ private final int internalCompressionLevel;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public Path getRegionFile() {
|
|
|
|
+ public Path getRegionFile() {
|
|
|
|
+ return this.regionFile;
|
|
|
|
+ return this.regionFile;
|
|
|
|
@@ -180,13 +162,12 @@ index 0000000000000000000000000000000000000000..2e0d10ded886e82c09700a1c6602cd1b
|
|
|
|
+ return this.fileLock;
|
|
|
|
+ return this.fileLock;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public LinearRegionFile(Path file, int compression) throws IOException {
|
|
|
|
+ public LinearRegionFile(Path file, int compression, int internalCompression) throws IOException {
|
|
|
|
+ this.regionFile = file;
|
|
|
|
+ this.regionFile = file;
|
|
|
|
+ this.compressionLevel = compression;
|
|
|
|
+ this.compressionLevel = compression;
|
|
|
|
|
|
|
|
+ this.internalCompressionLevel = internalCompression;
|
|
|
|
+ File regionFile = new File(this.regionFile.toString());
|
|
|
|
+ File regionFile = new File(this.regionFile.toString());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ LZ4Compressor compressor = LZ4Factory.fastestInstance().fastCompressor();
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ for (int i = 0; i < 32 * 32; i++)
|
|
|
|
+ for (int i = 0; i < 32 * 32; i++)
|
|
|
|
+ this.bufferUncompressedSize[i] = 0;
|
|
|
|
+ this.bufferUncompressedSize[i] = 0;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
@@ -203,17 +184,13 @@ index 0000000000000000000000000000000000000000..2e0d10ded886e82c09700a1c6602cd1b
|
|
|
|
+ long superBlock = rawDataStream.readLong();
|
|
|
|
+ long superBlock = rawDataStream.readLong();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (superBlock != SUPERBLOCK) {
|
|
|
|
+ if (superBlock != SUPERBLOCK) {
|
|
|
|
+ System.out.println(file);
|
|
|
|
+ throw new IOException("SUPERBLOCK VERSION! " + file);
|
|
|
|
+ System.out.println("SUPERBLOCK INVALID!");
|
|
|
|
|
|
|
|
+ return;
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ byte version = rawDataStream.readByte();
|
|
|
|
+ byte version = rawDataStream.readByte();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (version != VERSION) {
|
|
|
|
+ if (version != VERSION) {
|
|
|
|
+ System.out.println(file);
|
|
|
|
+ throw new IOException("INVALID VERSION! " + file);
|
|
|
|
+ System.out.println("VERSION INVALID!");
|
|
|
|
|
|
|
|
+ return;
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ rawDataStream.readLong(); // newestTimestamp
|
|
|
|
+ rawDataStream.readLong(); // newestTimestamp
|
|
|
|
@@ -250,11 +227,10 @@ index 0000000000000000000000000000000000000000..2e0d10ded886e82c09700a1c6602cd1b
|
|
|
|
+ byte[] b = new byte[size];
|
|
|
|
+ byte[] b = new byte[size];
|
|
|
|
+ dataStream.readFully(b, 0, size);
|
|
|
|
+ dataStream.readFully(b, 0, size);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ int maxCompressedLength = compressor.maxCompressedLength(size);
|
|
|
|
+ int maxCompressedLength = (int)Zstd.compressBound(size);
|
|
|
|
+ byte[] compressed = new byte[maxCompressedLength];
|
|
|
|
+ byte[] compressed = new byte[maxCompressedLength];
|
|
|
|
+ int compressedLength = compressor.compress(b, 0, size, compressed, 0, maxCompressedLength);
|
|
|
|
+ long compressedLength = Zstd.compress(compressed, b, this.internalCompressionLevel);
|
|
|
|
+ b = new byte[compressedLength];
|
|
|
|
+ b = Arrays.copyOfRange(compressed, 0, (int) compressedLength);
|
|
|
|
+ System.arraycopy(compressed, 0, b, 0, compressedLength);
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ this.buffer[i] = b;
|
|
|
|
+ this.buffer[i] = b;
|
|
|
|
+ this.bufferUncompressedSize[i] = size;
|
|
|
|
+ this.bufferUncompressedSize[i] = size;
|
|
|
|
@@ -287,7 +263,7 @@ index 0000000000000000000000000000000000000000..2e0d10ded886e82c09700a1c6602cd1b
|
|
|
|
+ try {
|
|
|
|
+ try {
|
|
|
|
+ flush();
|
|
|
|
+ flush();
|
|
|
|
+ } catch(IOException ex) {
|
|
|
|
+ } catch(IOException ex) {
|
|
|
|
+ LOGGER.error("Region file " + this.regionFile.toAbsolutePath() + " flush failed");
|
|
|
|
+ LOGGER.error("Region file " + this.regionFile.toAbsolutePath() + " flush failed", ex);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for(int i = 0 ; i < 100 ; i++) {
|
|
|
|
+ for(int i = 0 ; i < 100 ; i++) {
|
|
|
|
@@ -327,14 +303,12 @@ index 0000000000000000000000000000000000000000..2e0d10ded886e82c09700a1c6602cd1b
|
|
|
|
+ dataStream.writeLong(timestamp);
|
|
|
|
+ dataStream.writeLong(timestamp);
|
|
|
|
+ dataStream.writeByte(this.compressionLevel);
|
|
|
|
+ dataStream.writeByte(this.compressionLevel);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ LZ4FastDecompressor decompressor = LZ4Factory.fastestInstance().fastDecompressor();
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ ArrayList<byte[]> byteBuffers = new ArrayList<>();
|
|
|
|
+ ArrayList<byte[]> byteBuffers = new ArrayList<>();
|
|
|
|
+ for(int i = 0 ; i < 32 * 32 ; i++) {
|
|
|
|
+ for(int i = 0 ; i < 32 * 32 ; i++) {
|
|
|
|
+ if(this.bufferUncompressedSize[i] != 0) {
|
|
|
|
+ if(this.bufferUncompressedSize[i] != 0) {
|
|
|
|
+ chunkCount += 1;
|
|
|
|
+ chunkCount += 1;
|
|
|
|
+ byte[] content = new byte[bufferUncompressedSize[i]];
|
|
|
|
+ byte[] content = new byte[bufferUncompressedSize[i]];
|
|
|
|
+ decompressor.decompress(buffer[i], 0, content, 0, bufferUncompressedSize[i]);
|
|
|
|
+ Zstd.decompress(content, buffer[i]);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ byteBuffers.add(content);
|
|
|
|
+ byteBuffers.add(content);
|
|
|
|
+ } else byteBuffers.add(null);
|
|
|
|
+ } else byteBuffers.add(null);
|
|
|
|
@@ -370,18 +344,11 @@ index 0000000000000000000000000000000000000000..2e0d10ded886e82c09700a1c6602cd1b
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public synchronized void write(ChunkPos pos, ByteBuffer buffer) {
|
|
|
|
+ public synchronized void write(ChunkPos pos, ByteBuffer buffer) {
|
|
|
|
+ LZ4Compressor compressor = LZ4Factory.fastestInstance().fastCompressor();
|
|
|
|
|
|
|
|
+ try {
|
|
|
|
+ try {
|
|
|
|
+ byte[] b = toByteArray(new ByteArrayInputStream(buffer.array()));
|
|
|
|
+ byte[] b = toByteArray(new ByteArrayInputStream(buffer.array()));
|
|
|
|
+ int uncompressedSize = b.length;
|
|
|
|
+ int uncompressedSize = b.length;
|
|
|
|
+
|
|
|
|
+ byte[] compressed = Zstd.compress(b, this.internalCompressionLevel);
|
|
|
|
+ int maxCompressedLength = compressor.maxCompressedLength(b.length);
|
|
|
|
+ this.buffer[getChunkIndex(pos.x, pos.z)] = compressed;
|
|
|
|
+ byte[] compressed = new byte[maxCompressedLength];
|
|
|
|
|
|
|
|
+ int compressedLength = compressor.compress(b, 0, b.length, compressed, 0, maxCompressedLength);
|
|
|
|
|
|
|
|
+ b = new byte[compressedLength];
|
|
|
|
|
|
|
|
+ System.arraycopy(compressed, 0, b, 0, compressedLength);
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ this.buffer[getChunkIndex(pos.x, pos.z)] = b;
|
|
|
|
|
|
|
|
+ this.bufferUncompressedSize[getChunkIndex(pos.x, pos.z)] = uncompressedSize;
|
|
|
|
+ this.bufferUncompressedSize[getChunkIndex(pos.x, pos.z)] = uncompressedSize;
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ LOGGER.error("Chunk write IOException " + e + " " + this.regionFile);
|
|
|
|
+ LOGGER.error("Chunk write IOException " + e + " " + this.regionFile);
|
|
|
|
@@ -424,9 +391,9 @@ index 0000000000000000000000000000000000000000..2e0d10ded886e82c09700a1c6602cd1b
|
|
|
|
+ @Nullable
|
|
|
|
+ @Nullable
|
|
|
|
+ public synchronized DataInputStream getChunkDataInputStream(ChunkPos pos) {
|
|
|
|
+ public synchronized DataInputStream getChunkDataInputStream(ChunkPos pos) {
|
|
|
|
+ if (this.bufferUncompressedSize[getChunkIndex(pos.x, pos.z)] != 0) {
|
|
|
|
+ if (this.bufferUncompressedSize[getChunkIndex(pos.x, pos.z)] != 0) {
|
|
|
|
+ LZ4FastDecompressor decompressor = LZ4Factory.fastestInstance().fastDecompressor();
|
|
|
|
+ byte[] compressedData = this.buffer[getChunkIndex(pos.x, pos.z)];
|
|
|
|
+ byte[] content = new byte[bufferUncompressedSize[getChunkIndex(pos.x, pos.z)]];
|
|
|
|
+ byte[] content = new byte[bufferUncompressedSize[getChunkIndex(pos.x, pos.z)]];
|
|
|
|
+ decompressor.decompress(this.buffer[getChunkIndex(pos.x, pos.z)], 0, content, 0, bufferUncompressedSize[getChunkIndex(pos.x, pos.z)]);
|
|
|
|
+ Zstd.decompress(content, compressedData);
|
|
|
|
+ return new DataInputStream(new ByteArrayInputStream(content));
|
|
|
|
+ return new DataInputStream(new ByteArrayInputStream(content));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ return null;
|
|
|
|
@@ -542,27 +509,29 @@ index a08cde4eefe879adcee7c4118bc38f98c5097ed0..1cfc20b7496f93aff1d6c2387dc5bb8b
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
|
|
|
|
index 95cac7edae8ac64811fc6a2f6b97dd4a0fceb0b0..d21077fdcdeb14860ef6f05b7586650051f6d44b 100644
|
|
|
|
index 95cac7edae8ac64811fc6a2f6b97dd4a0fceb0b0..e340878efb93499acd7fdf83a66ead9b53210a76 100644
|
|
|
|
--- a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
|
|
|
|
--- a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
|
|
|
|
+++ b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
|
|
|
|
+++ b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
|
|
|
|
@@ -83,9 +83,13 @@ public class ThreadedWorldUpgrader {
|
|
|
|
@@ -83,9 +83,15 @@ public class ThreadedWorldUpgrader {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LOGGER.info("Found " + regionFiles.length + " regionfiles to convert");
|
|
|
|
LOGGER.info("Found " + regionFiles.length + " regionfiles to convert");
|
|
|
|
LOGGER.info("Starting conversion now for world " + this.worldName);
|
|
|
|
LOGGER.info("Starting conversion now for world " + this.worldName);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
+ // Kaiiju start
|
|
|
|
+ // Kaiiju start
|
|
|
|
+ String formatName = ((org.bukkit.craftbukkit.CraftWorld) org.bukkit.Bukkit.getWorld(worldName)).getHandle().kaiijuConfig.regionFormatName;
|
|
|
|
+ net.minecraft.server.level.ServerLevel level = ((org.bukkit.craftbukkit.CraftWorld) org.bukkit.Bukkit.getWorld(worldName)).getHandle();
|
|
|
|
+ int linearCompression = ((org.bukkit.craftbukkit.CraftWorld) org.bukkit.Bukkit.getWorld(worldName)).getHandle().kaiijuConfig.regionFormatLinearCompressionLevel;
|
|
|
|
+ String formatName = level.kaiijuConfig.regionFormatName;
|
|
|
|
|
|
|
|
+ int linearCompression = level.kaiijuConfig.regionFormatLinearCompressionLevel;
|
|
|
|
|
|
|
|
+ int internalLinearCompression = level.kaiijuConfig.regionFormatLinearInternalCompressionLevel;
|
|
|
|
+ LOGGER.info("Using format " + formatName + " (" + linearCompression + ")");
|
|
|
|
+ LOGGER.info("Using format " + formatName + " (" + linearCompression + ")");
|
|
|
|
+ // Kaiiju end
|
|
|
|
+ // Kaiiju end
|
|
|
|
final WorldInfo info = new WorldInfo(() -> worldPersistentData,
|
|
|
|
final WorldInfo info = new WorldInfo(() -> worldPersistentData,
|
|
|
|
- new ChunkStorage(regionFolder.toPath(), this.dataFixer, false), this.removeCaches, this.dimensionType, this.generatorKey);
|
|
|
|
- new ChunkStorage(regionFolder.toPath(), this.dataFixer, false), this.removeCaches, this.dimensionType, this.generatorKey);
|
|
|
|
+ new ChunkStorage(formatName, linearCompression, regionFolder.toPath(), this.dataFixer, false), this.removeCaches, this.dimensionType, this.generatorKey); // Kaiiju
|
|
|
|
+ new ChunkStorage(formatName, linearCompression, internalLinearCompression, regionFolder.toPath(), this.dataFixer, false), this.removeCaches, this.dimensionType, this.generatorKey); // Kaiiju
|
|
|
|
|
|
|
|
|
|
|
|
long expectedChunks = (long)regionFiles.length * (32L * 32L);
|
|
|
|
long expectedChunks = (long)regionFiles.length * (32L * 32L);
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
|
|
index 75965afd7b4bed23a5ecf618c7f91ff5e7ffd92f..4f4a94f60c60eb8bf4214bfcfe6f963e16b39c98 100644
|
|
|
|
index 75965afd7b4bed23a5ecf618c7f91ff5e7ffd92f..3dd88803c5897ac856c107e7f54c3b73cba5adf8 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
|
|
@@ -291,7 +291,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
@@ -291,7 +291,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
@@ -570,7 +539,7 @@ index 75965afd7b4bed23a5ecf618c7f91ff5e7ffd92f..4f4a94f60c60eb8bf4214bfcfe6f963e
|
|
|
|
|
|
|
|
|
|
|
|
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
|
|
|
|
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
|
|
|
|
- super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
|
|
|
|
- super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
|
|
|
|
+ super(world.getLevel().kaiijuConfig.regionFormatName, world.getLevel().kaiijuConfig.regionFormatLinearCompressionLevel, session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); // Kaiiju
|
|
|
|
+ super(world.getLevel().kaiijuConfig.regionFormatName, world.getLevel().kaiijuConfig.regionFormatLinearCompressionLevel, world.getLevel().kaiijuConfig.regionFormatLinearInternalCompressionLevel, session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); // Kaiiju
|
|
|
|
// Paper - rewrite chunk system
|
|
|
|
// Paper - rewrite chunk system
|
|
|
|
this.tickingGenerated = new AtomicInteger();
|
|
|
|
this.tickingGenerated = new AtomicInteger();
|
|
|
|
this.playerMap = new PlayerMap();
|
|
|
|
this.playerMap = new PlayerMap();
|
|
|
|
@@ -579,7 +548,7 @@ index 75965afd7b4bed23a5ecf618c7f91ff5e7ffd92f..4f4a94f60c60eb8bf4214bfcfe6f963e
|
|
|
|
this.distanceManager = new ChunkMap.ChunkDistanceManager(executor, mainThreadExecutor);
|
|
|
|
this.distanceManager = new ChunkMap.ChunkDistanceManager(executor, mainThreadExecutor);
|
|
|
|
this.overworldDataStorage = persistentStateManagerFactory;
|
|
|
|
this.overworldDataStorage = persistentStateManagerFactory;
|
|
|
|
- this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, iregistrycustom, world);
|
|
|
|
- this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, iregistrycustom, world);
|
|
|
|
+ this.poiManager = new PoiManager(this.level.kaiijuConfig.regionFormatName, this.level.kaiijuConfig.regionFormatLinearCompressionLevel, path.resolve("poi"), dataFixer, dsync, iregistrycustom, world); // Kaiiju
|
|
|
|
+ this.poiManager = new PoiManager(this.level.kaiijuConfig.regionFormatName, this.level.kaiijuConfig.regionFormatLinearCompressionLevel, this.level.kaiijuConfig.regionFormatLinearInternalCompressionLevel, path.resolve("poi"), dataFixer, dsync, iregistrycustom, world); // Kaiiju
|
|
|
|
this.setViewDistance(viewDistance);
|
|
|
|
this.setViewDistance(viewDistance);
|
|
|
|
// Paper start
|
|
|
|
// Paper start
|
|
|
|
this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
|
|
|
|
this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
|
|
|
|
@@ -609,7 +578,7 @@ index 75965afd7b4bed23a5ecf618c7f91ff5e7ffd92f..4f4a94f60c60eb8bf4214bfcfe6f963e
|
|
|
|
regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkSerializer.getStatus(compound));
|
|
|
|
regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkSerializer.getStatus(compound));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
index b396a329e753f42b3878736b6b14bafda02d3744..906d394bbb80b9069645d01a319a9fab24c42288 100644
|
|
|
|
index a5655ebb233f1e1e1dd7f79fdd948020478928fc..92430e71f64d88352838ee9cf0f4d22c050e7acc 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
@@ -390,9 +390,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
|
|
@@ -390,9 +390,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
|
|
@@ -619,8 +588,8 @@ index b396a329e753f42b3878736b6b14bafda02d3744..906d394bbb80b9069645d01a319a9fab
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- public EntityRegionFileStorage(Path directory, boolean dsync) {
|
|
|
|
- public EntityRegionFileStorage(Path directory, boolean dsync) {
|
|
|
|
- super(directory, dsync);
|
|
|
|
- super(directory, dsync);
|
|
|
|
+ public EntityRegionFileStorage(String format, int linearCompression, Path directory, boolean dsync) { // Kaiiju
|
|
|
|
+ public EntityRegionFileStorage(String format, int linearCompression, int linearInternalCompression, Path directory, boolean dsync) { // Kaiiju
|
|
|
|
+ super(format, linearCompression, directory, dsync); // Kaiiju
|
|
|
|
+ super(format, linearCompression, linearInternalCompression, directory, dsync); // Kaiiju
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void write(ChunkPos pos, net.minecraft.nbt.CompoundTag nbt) throws IOException {
|
|
|
|
protected void write(ChunkPos pos, net.minecraft.nbt.CompoundTag nbt) throws IOException {
|
|
|
|
@@ -629,23 +598,14 @@ index b396a329e753f42b3878736b6b14bafda02d3744..906d394bbb80b9069645d01a319a9fab
|
|
|
|
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
|
|
|
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
|
|
|
DataFixer datafixer = minecraftserver.getFixerUpper();
|
|
|
|
DataFixer datafixer = minecraftserver.getFixerUpper();
|
|
|
|
- this.entityStorage = new EntityRegionFileStorage(convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), flag2); // Paper - rewrite chunk system //EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
|
|
|
|
- this.entityStorage = new EntityRegionFileStorage(convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), flag2); // Paper - rewrite chunk system //EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
|
|
|
|
+ this.entityStorage = new EntityRegionFileStorage(this.getLevel().kaiijuConfig.regionFormatName, this.getLevel().kaiijuConfig.regionFormatLinearCompressionLevel, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), flag2); // Paper - rewrite chunk system //EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver); // Kaiiju
|
|
|
|
+ this.entityStorage = new EntityRegionFileStorage(this.getLevel().kaiijuConfig.regionFormatName, this.getLevel().kaiijuConfig.regionFormatLinearCompressionLevel, this.getLevel().kaiijuConfig.regionFormatLinearInternalCompressionLevel, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), flag2); // Paper - rewrite chunk system //EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver); // Kaiiju
|
|
|
|
|
|
|
|
|
|
|
|
// this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage, this.entitySliceManager); // Paper // Paper - rewrite chunk system
|
|
|
|
// this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage, this.entitySliceManager); // Paper // Paper - rewrite chunk system
|
|
|
|
StructureTemplateManager structuretemplatemanager = minecraftserver.getStructureManager();
|
|
|
|
StructureTemplateManager structuretemplatemanager = minecraftserver.getStructureManager();
|
|
|
|
diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
|
|
|
diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
|
|
|
index 759b125cc1251b9b4f1f443c9f70c482ef5b32f8..74bc03e43096c865bba36b15aa248b9dc3481828 100644
|
|
|
|
index 759b125cc1251b9b4f1f443c9f70c482ef5b32f8..761293b17cf12e28487034508906702bae2a3feb 100644
|
|
|
|
--- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
|
|
|
--- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
|
|
|
+++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
|
|
|
+++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
|
|
|
@@ -41,7 +41,7 @@ import net.minecraft.world.level.chunk.storage.RegionFile;
|
|
|
|
|
|
|
|
import net.minecraft.world.level.dimension.LevelStem;
|
|
|
|
|
|
|
|
import net.minecraft.world.level.storage.DimensionDataStorage;
|
|
|
|
|
|
|
|
import net.minecraft.world.level.storage.LevelStorageSource;
|
|
|
|
|
|
|
|
-import org.slf4j.Logger;
|
|
|
|
|
|
|
|
+import org.bukkit.Bukkit;import org.bukkit.craftbukkit.CraftWorld;import org.slf4j.Logger;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class WorldUpgrader {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -61,7 +61,7 @@ public class WorldUpgrader {
|
|
|
|
@@ -61,7 +61,7 @@ public class WorldUpgrader {
|
|
|
|
private volatile int skipped;
|
|
|
|
private volatile int skipped;
|
|
|
|
private final Object2FloatMap<ResourceKey<LevelStem>> progressMap = Object2FloatMaps.synchronize(new Object2FloatOpenCustomHashMap(Util.identityStrategy())); // CraftBukkit
|
|
|
|
private final Object2FloatMap<ResourceKey<LevelStem>> progressMap = Object2FloatMaps.synchronize(new Object2FloatOpenCustomHashMap(Util.identityStrategy())); // CraftBukkit
|
|
|
|
@@ -655,7 +615,7 @@ index 759b125cc1251b9b4f1f443c9f70c482ef5b32f8..74bc03e43096c865bba36b15aa248b9d
|
|
|
|
private final DimensionDataStorage overworldDataStorage;
|
|
|
|
private final DimensionDataStorage overworldDataStorage;
|
|
|
|
|
|
|
|
|
|
|
|
public WorldUpgrader(LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, Registry<LevelStem> dimensionOptionsRegistry, boolean eraseCache) {
|
|
|
|
public WorldUpgrader(LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, Registry<LevelStem> dimensionOptionsRegistry, boolean eraseCache) {
|
|
|
|
@@ -115,8 +115,11 @@ public class WorldUpgrader {
|
|
|
|
@@ -115,8 +115,14 @@ public class WorldUpgrader {
|
|
|
|
while (iterator1.hasNext()) {
|
|
|
|
while (iterator1.hasNext()) {
|
|
|
|
ResourceKey<LevelStem> resourcekey1 = (ResourceKey) iterator1.next(); // CraftBukkit
|
|
|
|
ResourceKey<LevelStem> resourcekey1 = (ResourceKey) iterator1.next(); // CraftBukkit
|
|
|
|
Path path = this.levelStorage.getDimensionPath((ResourceKey) null); // CraftBukkit
|
|
|
|
Path path = this.levelStorage.getDimensionPath((ResourceKey) null); // CraftBukkit
|
|
|
|
@@ -663,13 +623,16 @@ index 759b125cc1251b9b4f1f443c9f70c482ef5b32f8..74bc03e43096c865bba36b15aa248b9d
|
|
|
|
- builder1.put(resourcekey1, new ChunkStorage(path.resolve("region"), this.dataFixer, true));
|
|
|
|
- builder1.put(resourcekey1, new ChunkStorage(path.resolve("region"), this.dataFixer, true));
|
|
|
|
+ // Kaiiju start
|
|
|
|
+ // Kaiiju start
|
|
|
|
+ String worldName = this.levelStorage.getLevelId();
|
|
|
|
+ String worldName = this.levelStorage.getLevelId();
|
|
|
|
+ String formatName = ((CraftWorld) Bukkit.getWorld(worldName)).getHandle().kaiijuConfig.regionFormatName;
|
|
|
|
+ net.minecraft.server.level.ServerLevel level = ((org.bukkit.craftbukkit.CraftWorld) org.bukkit.Bukkit.getWorld(worldName)).getHandle();
|
|
|
|
+ builder1.put(resourcekey1, new ChunkStorage(formatName, 6, path.resolve("region"), this.dataFixer, true));
|
|
|
|
+ String formatName = level.kaiijuConfig.regionFormatName;
|
|
|
|
|
|
|
|
+ int linearCompression = level.kaiijuConfig.regionFormatLinearCompressionLevel;
|
|
|
|
|
|
|
|
+ int linearInternalCompression = level.kaiijuConfig.regionFormatLinearInternalCompressionLevel;
|
|
|
|
|
|
|
|
+ builder1.put(resourcekey1, new ChunkStorage(formatName, linearCompression, linearInternalCompression, path.resolve("region"), this.dataFixer, true));
|
|
|
|
+ // Kaiiju end
|
|
|
|
+ // Kaiiju end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ImmutableMap<ResourceKey<LevelStem>, ChunkStorage> immutablemap1 = builder1.build(); // CraftBukkit
|
|
|
|
ImmutableMap<ResourceKey<LevelStem>, ChunkStorage> immutablemap1 = builder1.build(); // CraftBukkit
|
|
|
|
@@ -235,7 +238,7 @@ public class WorldUpgrader {
|
|
|
|
@@ -235,7 +241,7 @@ public class WorldUpgrader {
|
|
|
|
File file = this.levelStorage.getDimensionPath((ResourceKey) null).toFile(); // CraftBukkit
|
|
|
|
File file = this.levelStorage.getDimensionPath((ResourceKey) null).toFile(); // CraftBukkit
|
|
|
|
File file1 = new File(file, "region");
|
|
|
|
File file1 = new File(file, "region");
|
|
|
|
File[] afile = file1.listFiles((file2, s) -> {
|
|
|
|
File[] afile = file1.listFiles((file2, s) -> {
|
|
|
|
@@ -678,17 +641,23 @@ index 759b125cc1251b9b4f1f443c9f70c482ef5b32f8..74bc03e43096c865bba36b15aa248b9d
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (afile == null) {
|
|
|
|
if (afile == null) {
|
|
|
|
@@ -254,7 +257,7 @@ public class WorldUpgrader {
|
|
|
|
@@ -254,7 +260,13 @@ public class WorldUpgrader {
|
|
|
|
int l = Integer.parseInt(matcher.group(2)) << 5;
|
|
|
|
int l = Integer.parseInt(matcher.group(2)) << 5;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
- RegionFile regionfile = new RegionFile(file2.toPath(), file1.toPath(), true);
|
|
|
|
- RegionFile regionfile = new RegionFile(file2.toPath(), file1.toPath(), true);
|
|
|
|
+ dev.kaiijumc.kaiiju.region.AbstractRegionFile regionfile = dev.kaiijumc.kaiiju.region.AbstractRegionFileFactory.getAbstractRegionFile(file2.toPath(), file1.toPath(), true); // Kaiiju
|
|
|
|
+ // Kaiiju start
|
|
|
|
|
|
|
|
+ String worldName = this.levelStorage.getLevelId();
|
|
|
|
|
|
|
|
+ net.minecraft.server.level.ServerLevel level = ((org.bukkit.craftbukkit.CraftWorld) org.bukkit.Bukkit.getWorld(worldName)).getHandle();
|
|
|
|
|
|
|
|
+ int linearCompression = level.kaiijuConfig.regionFormatLinearCompressionLevel;
|
|
|
|
|
|
|
|
+ int linearInternalCompression = level.kaiijuConfig.regionFormatLinearInternalCompressionLevel;
|
|
|
|
|
|
|
|
+ dev.kaiijumc.kaiiju.region.AbstractRegionFile regionfile = dev.kaiijumc.kaiiju.region.AbstractRegionFileFactory.getAbstractRegionFile(linearCompression, linearInternalCompression, file2.toPath(), file1.toPath(), true);
|
|
|
|
|
|
|
|
+ // Kaiiju end
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
for (int i1 = 0; i1 < 32; ++i1) {
|
|
|
|
for (int i1 = 0; i1 < 32; ++i1) {
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
|
|
|
index 8950b220b9a3512cd4667beb7bdec0e82e07edc6..71b38521fd2039bb2ddfdc5dc89341282869ce30 100644
|
|
|
|
index 8950b220b9a3512cd4667beb7bdec0e82e07edc6..ca93af37207a78e41b6d20333638bec32c11c416 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
|
|
|
@@ -57,8 +57,8 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
|
|
|
@@ -57,8 +57,8 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
|
|
|
@@ -697,13 +666,13 @@ index 8950b220b9a3512cd4667beb7bdec0e82e07edc6..71b38521fd2039bb2ddfdc5dc8934128
|
|
|
|
|
|
|
|
|
|
|
|
- public PoiManager(Path path, DataFixer dataFixer, boolean dsync, RegistryAccess registryManager, LevelHeightAccessor world) {
|
|
|
|
- public PoiManager(Path path, DataFixer dataFixer, boolean dsync, RegistryAccess registryManager, LevelHeightAccessor world) {
|
|
|
|
- super(path, PoiSection::codec, PoiSection::new, dataFixer, DataFixTypes.POI_CHUNK, dsync, registryManager, world);
|
|
|
|
- super(path, PoiSection::codec, PoiSection::new, dataFixer, DataFixTypes.POI_CHUNK, dsync, registryManager, world);
|
|
|
|
+ public PoiManager(String formatName, int linearCompression, Path path, DataFixer dataFixer, boolean dsync, RegistryAccess registryManager, LevelHeightAccessor world) { // Kaiiju
|
|
|
|
+ public PoiManager(String formatName, int linearCompression, int linearInternalCompression, Path path, DataFixer dataFixer, boolean dsync, RegistryAccess registryManager, LevelHeightAccessor world) { // Kaiiju
|
|
|
|
+ super(formatName, linearCompression, path, PoiSection::codec, PoiSection::new, dataFixer, DataFixTypes.POI_CHUNK, dsync, registryManager, world); // Kaiiju
|
|
|
|
+ super(formatName, linearCompression, linearInternalCompression, path, PoiSection::codec, PoiSection::new, dataFixer, DataFixTypes.POI_CHUNK, dsync, registryManager, world); // Kaiiju
|
|
|
|
this.world = (net.minecraft.server.level.ServerLevel)world; // Paper - rewrite chunk system
|
|
|
|
this.world = (net.minecraft.server.level.ServerLevel)world; // Paper - rewrite chunk system
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
|
|
|
index 5a425be023d77f0370d102dfb52427147849ac1a..5396d6944cee6c3075fcfd030510254461569120 100644
|
|
|
|
index 5a425be023d77f0370d102dfb52427147849ac1a..527384a43f5c512273cce0d16a3bc887e24357c2 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
|
|
|
@@ -37,11 +37,12 @@ public class ChunkStorage implements AutoCloseable {
|
|
|
|
@@ -37,11 +37,12 @@ public class ChunkStorage implements AutoCloseable {
|
|
|
|
@@ -711,13 +680,13 @@ index 5a425be023d77f0370d102dfb52427147849ac1a..5396d6944cee6c3075fcfd0305102544
|
|
|
|
// Paper end - async chunk loading
|
|
|
|
// Paper end - async chunk loading
|
|
|
|
|
|
|
|
|
|
|
|
- public ChunkStorage(Path directory, DataFixer dataFixer, boolean dsync) {
|
|
|
|
- public ChunkStorage(Path directory, DataFixer dataFixer, boolean dsync) {
|
|
|
|
+ public ChunkStorage(String format, int linearCompression, Path directory, DataFixer dataFixer, boolean dsync) { // Kaiiju
|
|
|
|
+ public ChunkStorage(String format, int linearCompression, int linearInternalCompression, Path directory, DataFixer dataFixer, boolean dsync) { // Kaiiju
|
|
|
|
this.fixerUpper = dataFixer;
|
|
|
|
this.fixerUpper = dataFixer;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
// Paper start - async chunk io
|
|
|
|
// Paper start - async chunk io
|
|
|
|
// remove IO worker
|
|
|
|
// remove IO worker
|
|
|
|
- this.regionFileCache = new RegionFileStorage(directory, dsync, true); // Paper - nuke IOWorker // Paper
|
|
|
|
- this.regionFileCache = new RegionFileStorage(directory, dsync, true); // Paper - nuke IOWorker // Paper
|
|
|
|
+ this.regionFileCache = new RegionFileStorage(format, linearCompression, directory, dsync, true); // Paper - nuke IOWorker // Paper
|
|
|
|
+ this.regionFileCache = new RegionFileStorage(format, linearCompression, linearInternalCompression, directory, dsync, true); // Paper - nuke IOWorker // Paper // Kaiiju
|
|
|
|
// Paper end - async chunk io
|
|
|
|
// Paper end - async chunk io
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -783,10 +752,10 @@ index dcfe090c269d4cbcc2eb1b6f85392848bb34656c..d42c320179ae055b8675d1ce6ce1788e
|
|
|
|
try (DataInputStream out = new DataInputStream(new java.io.BufferedInputStream(new InflaterInputStream(Files.newInputStream(file))))) {
|
|
|
|
try (DataInputStream out = new DataInputStream(new java.io.BufferedInputStream(new InflaterInputStream(Files.newInputStream(file))))) {
|
|
|
|
return NbtIo.read((java.io.DataInput) out);
|
|
|
|
return NbtIo.read((java.io.DataInput) out);
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
|
|
index bd502ca721de0cab438d995efa00ad0554c0d2fe..ee4005cd62da567d5701d59ddceb212f65a2188d 100644
|
|
|
|
index bd502ca721de0cab438d995efa00ad0554c0d2fe..ad784bc53d5c9a4abb944ce21e5bb81b939ecbea 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
|
|
@@ -22,17 +22,25 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
@@ -22,17 +22,27 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
|
|
|
|
|
|
|
|
public static final String ANVIL_EXTENSION = ".mca";
|
|
|
|
public static final String ANVIL_EXTENSION = ".mca";
|
|
|
|
private static final int MAX_CACHE_SIZE = 256;
|
|
|
|
private static final int MAX_CACHE_SIZE = 256;
|
|
|
|
@@ -797,26 +766,28 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..ee4005cd62da567d5701d59ddceb212f
|
|
|
|
+ // Kaiiju start - Per world chunk format
|
|
|
|
+ // Kaiiju start - Per world chunk format
|
|
|
|
+ public final String format;
|
|
|
|
+ public final String format;
|
|
|
|
+ public final int linearCompression;
|
|
|
|
+ public final int linearCompression;
|
|
|
|
|
|
|
|
+ public final int linearInternalCompression;
|
|
|
|
+ // Kaiiju end
|
|
|
|
+ // Kaiiju end
|
|
|
|
|
|
|
|
|
|
|
|
private final boolean isChunkData; // Paper
|
|
|
|
private final boolean isChunkData; // Paper
|
|
|
|
|
|
|
|
|
|
|
|
- protected RegionFileStorage(Path directory, boolean dsync) { // Paper - protected constructor
|
|
|
|
- protected RegionFileStorage(Path directory, boolean dsync) { // Paper - protected constructor
|
|
|
|
+ protected RegionFileStorage(String format, int linearCompression, Path directory, boolean dsync) { // Paper - protected constructor
|
|
|
|
+ protected RegionFileStorage(String format, int linearCompression, int linearInternalCompression, Path directory, boolean dsync) { // Paper - protected constructor
|
|
|
|
// Paper start - add isChunkData param
|
|
|
|
// Paper start - add isChunkData param
|
|
|
|
- this(directory, dsync, false);
|
|
|
|
- this(directory, dsync, false);
|
|
|
|
+ this(format, linearCompression, directory, dsync, false);
|
|
|
|
+ this(format, linearCompression, linearInternalCompression, directory, dsync, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
- RegionFileStorage(Path directory, boolean dsync, boolean isChunkData) {
|
|
|
|
- RegionFileStorage(Path directory, boolean dsync, boolean isChunkData) {
|
|
|
|
+ RegionFileStorage(String format, int linearCompression, Path directory, boolean dsync, boolean isChunkData) { // Kaiiju
|
|
|
|
+ RegionFileStorage(String format, int linearCompression, int linearInternalCompression, Path directory, boolean dsync, boolean isChunkData) { // Kaiiju
|
|
|
|
+ // Kaiiju start
|
|
|
|
+ // Kaiiju start
|
|
|
|
+ this.format = format;
|
|
|
|
+ this.format = format;
|
|
|
|
+ this.linearCompression = linearCompression;
|
|
|
|
+ this.linearCompression = linearCompression;
|
|
|
|
|
|
|
|
+ this.linearInternalCompression = linearInternalCompression;
|
|
|
|
+ // Kaiiju end
|
|
|
|
+ // Kaiiju end
|
|
|
|
this.isChunkData = isChunkData;
|
|
|
|
this.isChunkData = isChunkData;
|
|
|
|
// Paper end - add isChunkData param
|
|
|
|
// Paper end - add isChunkData param
|
|
|
|
this.folder = directory;
|
|
|
|
this.folder = directory;
|
|
|
|
@@ -42,7 +50,7 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
@@ -42,7 +52,7 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
// Paper start
|
|
|
|
// Paper start
|
|
|
|
public static @Nullable ChunkPos getRegionFileCoordinates(Path file) {
|
|
|
|
public static @Nullable ChunkPos getRegionFileCoordinates(Path file) {
|
|
|
|
String fileName = file.getFileName().toString();
|
|
|
|
String fileName = file.getFileName().toString();
|
|
|
|
@@ -825,7 +796,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..ee4005cd62da567d5701d59ddceb212f
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -62,49 +70,66 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
@@ -62,49 +72,66 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -892,7 +863,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..ee4005cd62da567d5701d59ddceb212f
|
|
|
|
+ //if (existingOnly && !java.nio.file.Files.exists(path1)) return null; // CraftBukkit
|
|
|
|
+ //if (existingOnly && !java.nio.file.Files.exists(path1)) return null; // CraftBukkit
|
|
|
|
+ // Kaiiju end
|
|
|
|
+ // Kaiiju end
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ dev.kaiijumc.kaiiju.region.AbstractRegionFile regionfile1 = dev.kaiijumc.kaiiju.region.AbstractRegionFileFactory.getAbstractRegionFile(this.linearCompression, path1, this.folder, this.sync, this.isChunkData); // Paper - allow for chunk regionfiles to regen header // Kaiiju
|
|
|
|
+ dev.kaiijumc.kaiiju.region.AbstractRegionFile regionfile1 = dev.kaiijumc.kaiiju.region.AbstractRegionFileFactory.getAbstractRegionFile(this.linearCompression, this.linearInternalCompression, path1, this.folder, this.sync, this.isChunkData); // Paper - allow for chunk regionfiles to regen header // Kaiiju
|
|
|
|
|
|
|
|
|
|
|
|
this.regionCache.putAndMoveToFirst(i, regionfile1);
|
|
|
|
this.regionCache.putAndMoveToFirst(i, regionfile1);
|
|
|
|
// Paper start
|
|
|
|
// Paper start
|
|
|
|
@@ -903,7 +874,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..ee4005cd62da567d5701d59ddceb212f
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Paper end
|
|
|
|
// Paper end
|
|
|
|
return regionfile1;
|
|
|
|
return regionfile1;
|
|
|
|
@@ -132,7 +157,7 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
@@ -132,7 +159,7 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -912,7 +883,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..ee4005cd62da567d5701d59ddceb212f
|
|
|
|
synchronized (regionfile) {
|
|
|
|
synchronized (regionfile) {
|
|
|
|
try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) {
|
|
|
|
try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) {
|
|
|
|
CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z);
|
|
|
|
CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z);
|
|
|
|
@@ -179,14 +204,14 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
@@ -179,14 +206,14 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
@Nullable
|
|
|
|
@Nullable
|
|
|
|
public CompoundTag read(ChunkPos pos) throws IOException {
|
|
|
|
public CompoundTag read(ChunkPos pos) throws IOException {
|
|
|
|
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
|
|
|
|
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
|
|
|
|
@@ -929,7 +900,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..ee4005cd62da567d5701d59ddceb212f
|
|
|
|
// We add the regionfile parameter to avoid the potential deadlock (on fileLock) if we went back to obtain a regionfile
|
|
|
|
// We add the regionfile parameter to avoid the potential deadlock (on fileLock) if we went back to obtain a regionfile
|
|
|
|
// if we decide to re-read
|
|
|
|
// if we decide to re-read
|
|
|
|
// Paper end
|
|
|
|
// Paper end
|
|
|
|
@@ -196,7 +221,7 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
@@ -196,7 +223,7 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
|
|
|
|
|
|
|
|
// Paper start
|
|
|
|
// Paper start
|
|
|
|
if (regionfile.isOversized(pos.x, pos.z)) {
|
|
|
|
if (regionfile.isOversized(pos.x, pos.z)) {
|
|
|
|
@@ -938,7 +909,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..ee4005cd62da567d5701d59ddceb212f
|
|
|
|
return readOversizedChunk(regionfile, pos);
|
|
|
|
return readOversizedChunk(regionfile, pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Paper end
|
|
|
|
// Paper end
|
|
|
|
@@ -210,12 +235,12 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
@@ -210,12 +237,12 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
if (this.isChunkData) {
|
|
|
|
if (this.isChunkData) {
|
|
|
|
ChunkPos chunkPos = ChunkSerializer.getChunkCoordinate(nbttagcompound);
|
|
|
|
ChunkPos chunkPos = ChunkSerializer.getChunkCoordinate(nbttagcompound);
|
|
|
|
if (!chunkPos.equals(pos)) {
|
|
|
|
if (!chunkPos.equals(pos)) {
|
|
|
|
@@ -954,7 +925,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..ee4005cd62da567d5701d59ddceb212f
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -249,13 +274,13 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
@@ -249,13 +276,13 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
|
|
|
|
|
|
|
|
return nbttagcompound;
|
|
|
|
return nbttagcompound;
|
|
|
|
} finally { // Paper start
|
|
|
|
} finally { // Paper start
|
|
|
|
@@ -970,7 +941,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..ee4005cd62da567d5701d59ddceb212f
|
|
|
|
if (regionfile == null) {
|
|
|
|
if (regionfile == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -285,7 +310,7 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
@@ -285,7 +312,7 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException {
|
|
|
|
protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException {
|
|
|
|
@@ -979,7 +950,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..ee4005cd62da567d5701d59ddceb212f
|
|
|
|
if (nbt == null && regionfile == null) {
|
|
|
|
if (nbt == null && regionfile == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -335,7 +360,7 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
@@ -335,7 +362,7 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Paper end
|
|
|
|
// Paper end
|
|
|
|
} finally { // Paper start
|
|
|
|
} finally { // Paper start
|
|
|
|
@@ -988,7 +959,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..ee4005cd62da567d5701d59ddceb212f
|
|
|
|
} // Paper end
|
|
|
|
} // Paper end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -344,7 +369,7 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
@@ -344,7 +371,7 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
ObjectIterator objectiterator = this.regionCache.values().iterator();
|
|
|
|
ObjectIterator objectiterator = this.regionCache.values().iterator();
|
|
|
|
|
|
|
|
|
|
|
|
while (objectiterator.hasNext()) {
|
|
|
|
while (objectiterator.hasNext()) {
|
|
|
|
@@ -997,7 +968,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..ee4005cd62da567d5701d59ddceb212f
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
regionfile.close();
|
|
|
|
regionfile.close();
|
|
|
|
@@ -360,7 +385,7 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
@@ -360,7 +387,7 @@ public class RegionFileStorage implements AutoCloseable {
|
|
|
|
ObjectIterator objectiterator = this.regionCache.values().iterator();
|
|
|
|
ObjectIterator objectiterator = this.regionCache.values().iterator();
|
|
|
|
|
|
|
|
|
|
|
|
while (objectiterator.hasNext()) {
|
|
|
|
while (objectiterator.hasNext()) {
|
|
|
|
@@ -1007,7 +978,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..ee4005cd62da567d5701d59ddceb212f
|
|
|
|
regionfile.flush();
|
|
|
|
regionfile.flush();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
|
|
|
index d783072bc964e45c308197e6f79874eb4a09f871..261613054a4ba0e78ad1aec819d743eaaae01cf2 100644
|
|
|
|
index d783072bc964e45c308197e6f79874eb4a09f871..f335bb86031c4efbc88f44d542eefcc6815cd2b7 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
|
|
|
@@ -47,8 +47,8 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
|
|
|
|
@@ -47,8 +47,8 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
|
|
|
|
@@ -1016,13 +987,13 @@ index d783072bc964e45c308197e6f79874eb4a09f871..261613054a4ba0e78ad1aec819d743ea
|
|
|
|
|
|
|
|
|
|
|
|
- public SectionStorage(Path path, Function<Runnable, Codec<R>> codecFactory, Function<Runnable, R> factory, DataFixer dataFixer, DataFixTypes dataFixTypes, boolean dsync, RegistryAccess dynamicRegistryManager, LevelHeightAccessor world) {
|
|
|
|
- public SectionStorage(Path path, Function<Runnable, Codec<R>> codecFactory, Function<Runnable, R> factory, DataFixer dataFixer, DataFixTypes dataFixTypes, boolean dsync, RegistryAccess dynamicRegistryManager, LevelHeightAccessor world) {
|
|
|
|
- super(path, dsync); // Paper - remove mojang I/O thread
|
|
|
|
- super(path, dsync); // Paper - remove mojang I/O thread
|
|
|
|
+ public SectionStorage(String format, int linearCompression, Path path, Function<Runnable, Codec<R>> codecFactory, Function<Runnable, R> factory, DataFixer dataFixer, DataFixTypes dataFixTypes, boolean dsync, RegistryAccess dynamicRegistryManager, LevelHeightAccessor world) { // Kaiiju
|
|
|
|
+ public SectionStorage(String format, int linearCompression, int linearInternalCompression, Path path, Function<Runnable, Codec<R>> codecFactory, Function<Runnable, R> factory, DataFixer dataFixer, DataFixTypes dataFixTypes, boolean dsync, RegistryAccess dynamicRegistryManager, LevelHeightAccessor world) { // Kaiiju
|
|
|
|
+ super(format, linearCompression, path, dsync); // Paper - remove mojang I/O thread // Kaiiju
|
|
|
|
+ super(format, linearCompression, linearInternalCompression, path, dsync); // Paper - remove mojang I/O thread // Kaiiju
|
|
|
|
this.codec = codecFactory;
|
|
|
|
this.codec = codecFactory;
|
|
|
|
this.factory = factory;
|
|
|
|
this.factory = factory;
|
|
|
|
this.fixerUpper = dataFixer;
|
|
|
|
this.fixerUpper = dataFixer;
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
index 9b5323edd99848b73ea0e34230e7bec8dc23be8c..619c7713d573e8f438ea23a3fcb185a98abf5100 100644
|
|
|
|
index 6a327616cd590b70170f8441c003a2109640201d..2ef0a41fd9ee60bc0866cf5c678498c68250689c 100644
|
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
@@ -552,7 +552,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|
|
|
@@ -552,7 +552,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|
|
|
|