Fixed vanilla issue where chunks would be mislocated and corrupt. Big thanks to Wug for the fix.

This commit is contained in:
Nathan Adams 2012-01-30 04:27:25 +00:00
parent 72559fe634
commit 875219e28c
2 changed files with 6 additions and 10 deletions

View File

@ -67,8 +67,8 @@ public class ChunkLoader implements IChunkLoader {
if (!chunk.a(i, j)) {
System.out.println("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.x + ", " + chunk.z + ")");
nbttagcompound.setInt("xPos", i);
nbttagcompound.setInt("zPos", j);
nbttagcompound.getCompound("Level").setInt("xPos", i); // CraftBukkit - .getCompound("Level")
nbttagcompound.getCompound("Level").setInt("zPos", j); // CraftBukkit - .getCompound("Level")
chunk = a(world, nbttagcompound.getCompound("Level"));
}

View File

@ -1,10 +1,6 @@
package net.minecraft.server;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.File;
import java.io.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@ -58,8 +54,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
if (!chunk.a(i, j)) {
System.out.println("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.x + ", " + chunk.z + ")");
nbttagcompound.setInt("xPos", i);
nbttagcompound.setInt("zPos", j);
nbttagcompound.getCompound("Level").setInt("xPos", i); // CraftBukkit - .getCompound("Level")
nbttagcompound.getCompound("Level").setInt("zPos", j); // CraftBukkit - .getCompound("Level")
chunk = ChunkLoader.a(world, nbttagcompound.getCompound("Level"));
}
@ -126,7 +122,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
return true;
}
public void a(PendingChunkToSave pendingchunktosave) {
public void a(PendingChunkToSave pendingchunktosave) throws IOException { // CraftBukkit - Added throws
DataOutputStream dataoutputstream = RegionFileCache.c(this.d, pendingchunktosave.a.x, pendingchunktosave.a.z);
NBTCompressedStreamTools.a(pendingchunktosave.b, (DataOutput) dataoutputstream);