Skip to content

Commit

Permalink
Fix empty chunks staying empty forever
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvinn8 committed Dec 28, 2023
1 parent 1c53a4f commit 5d9d97f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public static void run(MchRepository repository, String commitMessage, boolean c

// If there was no chunk in the last commit the version number is zero.
// Otherwise, check if it has been changed since last commit.
if (currentChunkVersionNumber == 0 || chunk.getLastModified(currentChunkVersionNumber) == chunkLastModified) {
if (currentChunkVersionNumber != 0 && chunk.getLastModified(currentChunkVersionNumber) == chunkLastModified) {
// The chunk has not been modified since the last commit.
// We do not need to store it again.
chunkVersionNumbers[chunk.getIndex()] = currentChunkVersionNumber;
Expand Down
10 changes: 9 additions & 1 deletion mch/src/main/java/ca/bkaw/mch/test/TestMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@
import java.util.zip.InflaterInputStream;

public class TestMain {
public static void main(String[] args) throws Exception {
public static void main(String[] args) throws IOException {
McRegionFileReader reader = new McRegionFileReader(Path.of("/Users/Alvin/Downloads/r.-2.-4.mca"));
System.out.println("reader.hasChunk(27, 27) = " + reader.hasChunk(27, 27));
System.out.println("reader.getChunkLastModified(27, 27) = " + reader.getChunkLastModified(27, 27));
NbtCompound chunkNbt = reader.readChunkNbt(27, 27);
System.out.println("chunkNbt = " + chunkNbt);
}

public static void main11(String[] args) throws Exception {
FTPClient client = new FTPClient();
client.connect("REDACTED", 21);

Expand Down

0 comments on commit 5d9d97f

Please sign in to comment.