Browse Source

PaperSpigot fix (a4e0b24594)

master
Robotia 9 years ago
parent
commit
9fc6cf3770
  1. 46
      patches/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch
  2. 24
      patches/net/minecraft/world/chunk/storage/RegionFileCache.java.patch

46
patches/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch

@ -22,7 +22,14 @@
private static final String __OBFID = "CL_00000384"; private static final String __OBFID = "CL_00000384";
public AnvilChunkLoader(File p_i2003_1_) public AnvilChunkLoader(File p_i2003_1_)
@@ -73,13 +81,16 @@ @@ -68,18 +76,22 @@
}
}
- return RegionFileCache.createOrLoadRegionFile(this.chunkSaveLocation, i, j).chunkExists(i & 31, j & 31);
+ final RegionFile region = RegionFileCache.createOrLoadRegionFile(this.chunkSaveLocation, i, j, false);
+ return region != null && region.chunkExists(i & 31, j & 31);
}
public Chunk loadChunk(World p_75815_1_, int p_75815_2_, int p_75815_3_) throws IOException public Chunk loadChunk(World p_75815_1_, int p_75815_2_, int p_75815_3_) throws IOException
{ {
@ -39,7 +46,7 @@
return chunk; return chunk;
} }
@@ -156,8 +167,8 @@ @@ -156,8 +168,8 @@
if (!chunk.isAtLocation(p_75822_2_, p_75822_3_)) if (!chunk.isAtLocation(p_75822_2_, p_75822_3_))
{ {
logger.error("Chunk file at " + p_75822_2_ + "," + p_75822_3_ + " is in the wrong location; relocating. (Expected " + p_75822_2_ + ", " + p_75822_3_ + ", got " + chunk.xPosition + ", " + chunk.zPosition + ")"); logger.error("Chunk file at " + p_75822_2_ + "," + p_75822_3_ + " is in the wrong location; relocating. (Expected " + p_75822_2_ + ", " + p_75822_3_ + ", got " + chunk.xPosition + ", " + chunk.zPosition + ")");
@ -50,7 +57,7 @@
// Have to move tile entities since we don't load them at this stage // Have to move tile entities since we don't load them at this stage
NBTTagList tileEntities = p_75822_4_.getCompoundTag("Level").getTagList("TileEntities", 10); NBTTagList tileEntities = p_75822_4_.getCompoundTag("Level").getTagList("TileEntities", 10);
@@ -187,8 +198,18 @@ @@ -187,7 +199,17 @@
public void saveChunk(World p_75816_1_, Chunk p_75816_2_) throws MinecraftException, IOException public void saveChunk(World p_75816_1_, Chunk p_75816_2_) throws MinecraftException, IOException
{ {
@ -64,13 +71,12 @@
+ { + {
+ ex.printStackTrace(); + ex.printStackTrace();
+ } + }
+ // CraftBukkit end
+ +
+ // CraftBukkit end
try try
{ {
NBTTagCompound nbttagcompound = new NBTTagCompound(); @@ -230,7 +252,7 @@
@@ -230,7 +251,7 @@
public boolean writeNextIO() public boolean writeNextIO()
{ {
@ -79,7 +85,7 @@
Object object = this.syncLockObject; Object object = this.syncLockObject;
synchronized (this.syncLockObject) synchronized (this.syncLockObject)
@@ -240,15 +261,15 @@ @@ -240,15 +262,15 @@
return false; return false;
} }
@ -99,7 +105,7 @@
} }
catch (Exception exception) catch (Exception exception)
{ {
@@ -259,7 +280,7 @@ @@ -259,7 +281,7 @@
return true; return true;
} }
@ -108,7 +114,7 @@
{ {
DataOutputStream dataoutputstream = RegionFileCache.getChunkOutputStream(this.chunkSaveLocation, p_75821_1_.chunkCoordinate.chunkXPos, p_75821_1_.chunkCoordinate.chunkZPos); DataOutputStream dataoutputstream = RegionFileCache.getChunkOutputStream(this.chunkSaveLocation, p_75821_1_.chunkCoordinate.chunkXPos, p_75821_1_.chunkCoordinate.chunkZPos);
CompressedStreamTools.write(p_75821_1_.nbtTags, dataoutputstream); CompressedStreamTools.write(p_75821_1_.nbtTags, dataoutputstream);
@@ -307,19 +328,19 @@ @@ -307,19 +329,19 @@
if (extendedblockstorage.getBlockMSBArray() != null) if (extendedblockstorage.getBlockMSBArray() != null)
{ {
@ -133,7 +139,7 @@
} }
nbttaglist.appendTag(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1);
@@ -455,6 +476,7 @@ @@ -455,6 +477,7 @@
public void loadEntities(World p_75823_1_, NBTTagCompound p_75823_2_, Chunk chunk) public void loadEntities(World p_75823_1_, NBTTagCompound p_75823_2_, Chunk chunk)
{ {
@ -141,7 +147,7 @@
NBTTagList nbttaglist1 = p_75823_2_.getTagList("Entities", 10); NBTTagList nbttaglist1 = p_75823_2_.getTagList("Entities", 10);
if (nbttaglist1 != null) if (nbttaglist1 != null)
@@ -468,24 +490,31 @@ @@ -468,24 +491,31 @@
if (entity2 != null) if (entity2 != null)
{ {
chunk.addEntity(entity2); chunk.addEntity(entity2);
@ -161,14 +167,14 @@
- entity.mountEntity(entity1); - entity.mountEntity(entity1);
- } - }
+ Entity entity1 = EntityList.createEntityFromNBT(nbttagcompound2.getCompoundTag("Riding"), p_75823_1_); + Entity entity1 = EntityList.createEntityFromNBT(nbttagcompound2.getCompoundTag("Riding"), p_75823_1_);
+
- entity = entity1;
+ if (entity1 != null) + if (entity1 != null)
+ { + {
+ chunk.addEntity(entity1); + chunk.addEntity(entity1);
+ entity.mountEntity(entity1); + entity.mountEntity(entity1);
+ } + }
+
- entity = entity1;
+ entity = entity1; + entity = entity1;
+ } + }
} }
@ -182,7 +188,7 @@
NBTTagList nbttaglist2 = p_75823_2_.getTagList("TileEntities", 10); NBTTagList nbttaglist2 = p_75823_2_.getTagList("TileEntities", 10);
if (nbttaglist2 != null) if (nbttaglist2 != null)
@@ -497,11 +526,35 @@ @@ -497,11 +527,35 @@
if (tileentity != null) if (tileentity != null)
{ {
@ -218,7 +224,7 @@
if (p_75823_2_.hasKey("TileTicks", 9)) if (p_75823_2_.hasKey("TileTicks", 9))
{ {
NBTTagList nbttaglist3 = p_75823_2_.getTagList("TileTicks", 10); NBTTagList nbttaglist3 = p_75823_2_.getTagList("TileTicks", 10);
@@ -515,6 +568,7 @@ @@ -515,6 +569,7 @@
} }
} }
} }
@ -226,3 +232,9 @@
// return chunk; // return chunk;
} }
@@ -531,4 +586,4 @@
this.nbtTags = p_i2002_2_;
}
}
-}
+}

24
patches/net/minecraft/world/chunk/storage/RegionFileCache.java.patch

@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFileCache.java --- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFileCache.java
+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFileCache.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFileCache.java
@@ -10,7 +10,7 @@ @@ -10,11 +10,15 @@
public class RegionFileCache public class RegionFileCache
{ {
@ -9,3 +9,25 @@
private static final String __OBFID = "CL_00000383"; private static final String __OBFID = "CL_00000383";
public static synchronized RegionFile createOrLoadRegionFile(File p_76550_0_, int p_76550_1_, int p_76550_2_) public static synchronized RegionFile createOrLoadRegionFile(File p_76550_0_, int p_76550_1_, int p_76550_2_)
{
+ return createOrLoadRegionFile(p_76550_0_, p_76550_1_, p_76550_2_, true);
+ }
+ public static synchronized RegionFile createOrLoadRegionFile(File p_76550_0_, int p_76550_1_, int p_76550_2_, boolean create)
+ {
File file2 = new File(p_76550_0_, "region");
File file3 = new File(file2, "r." + (p_76550_1_ >> 5) + "." + (p_76550_2_ >> 5) + ".mca");
RegionFile regionfile = (RegionFile)regionsByFilename.get(file3);
@@ -25,6 +29,7 @@
}
else
{
+ if (!create && !file2.exists()) { return null; } // PaperSpigot
if (!file2.exists())
{
file2.mkdirs();
@@ -76,4 +81,4 @@
RegionFile regionfile = createOrLoadRegionFile(p_76552_0_, p_76552_1_, p_76552_2_);
return regionfile.getChunkDataOutputStream(p_76552_1_ & 31, p_76552_2_ & 31);
}
-}
+}

Loading…
Cancel
Save