From 875219e28c07acfe2cfc1d03f889e9f7aac0c28f Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Mon, 30 Jan 2012 04:27:25 +0000 Subject: [PATCH] Fixed vanilla issue where chunks would be mislocated and corrupt. Big thanks to Wug for the fix. --- src/main/java/net/minecraft/server/ChunkLoader.java | 4 ++-- .../java/net/minecraft/server/ChunkRegionLoader.java | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/minecraft/server/ChunkLoader.java b/src/main/java/net/minecraft/server/ChunkLoader.java index 41d366fd35..c9462e4a02 100644 --- a/src/main/java/net/minecraft/server/ChunkLoader.java +++ b/src/main/java/net/minecraft/server/ChunkLoader.java @@ -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")); } diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java index 0b6905accf..6dc6ebd577 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -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);