[1.12] Remove patches adding chunkExists() function, switch to vanilla code (#4054)
This commit is contained in:
parent
523b4f85c2
commit
71d81cbd8d
|
@ -1,27 +1,14 @@
|
|||
--- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
|
||||
+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
|
||||
@@ -49,9 +49,43 @@
|
||||
@@ -49,9 +49,30 @@
|
||||
this.field_193416_e = p_i46673_2_;
|
||||
}
|
||||
|
||||
+ @Deprecated // TODO: remove (1.13)
|
||||
+ public boolean chunkExists(World world, int x, int z)
|
||||
+ {
|
||||
+ ChunkPos chunkcoordintpair = new ChunkPos(x, z);
|
||||
+
|
||||
+ if (this.field_193415_c.contains(chunkcoordintpair))
|
||||
+ {
|
||||
+ for(ChunkPos pendingChunkCoord : this.field_75828_a.keySet())
|
||||
+ {
|
||||
+ if (pendingChunkCoord.equals(chunkcoordintpair))
|
||||
+ {
|
||||
+ return true;
|
||||
+ return func_191063_a(x, z);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return RegionFileCache.func_76550_a(this.field_75825_d, x, z).chunkExists(x & 31, z & 31);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
@Nullable
|
||||
public Chunk func_75815_a(World p_75815_1_, int p_75815_2_, int p_75815_3_) throws IOException
|
||||
|
@ -44,7 +31,7 @@
|
|||
ChunkPos chunkpos = new ChunkPos(p_75815_2_, p_75815_3_);
|
||||
NBTTagCompound nbttagcompound = this.field_75828_a.get(chunkpos);
|
||||
|
||||
@@ -67,7 +101,7 @@
|
||||
@@ -67,7 +88,7 @@
|
||||
nbttagcompound = this.field_193416_e.func_188257_a(FixTypes.CHUNK, CompressedStreamTools.func_74794_a(datainputstream));
|
||||
}
|
||||
|
||||
|
@ -53,7 +40,7 @@
|
|||
}
|
||||
|
||||
public boolean func_191063_a(int p_191063_1_, int p_191063_2_)
|
||||
@@ -80,6 +114,12 @@
|
||||
@@ -80,6 +101,12 @@
|
||||
@Nullable
|
||||
protected Chunk func_75822_a(World p_75822_1_, int p_75822_2_, int p_75822_3_, NBTTagCompound p_75822_4_)
|
||||
{
|
||||
|
@ -66,7 +53,7 @@
|
|||
if (!p_75822_4_.func_150297_b("Level", 10))
|
||||
{
|
||||
field_151505_a.error("Chunk file at {},{} is missing level data, skipping", Integer.valueOf(p_75822_2_), Integer.valueOf(p_75822_3_));
|
||||
@@ -103,10 +143,29 @@
|
||||
@@ -103,10 +130,29 @@
|
||||
field_151505_a.error("Chunk file at {},{} is in the wrong location; relocating. (Expected {}, {}, got {}, {})", Integer.valueOf(p_75822_2_), Integer.valueOf(p_75822_3_), Integer.valueOf(p_75822_2_), Integer.valueOf(p_75822_3_), Integer.valueOf(chunk.field_76635_g), Integer.valueOf(chunk.field_76647_h));
|
||||
nbttagcompound.func_74768_a("xPos", p_75822_2_);
|
||||
nbttagcompound.func_74768_a("zPos", p_75822_3_);
|
||||
|
@ -97,7 +84,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -121,7 +180,9 @@
|
||||
@@ -121,7 +167,9 @@
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound.func_74782_a("Level", nbttagcompound1);
|
||||
nbttagcompound.func_74768_a("DataVersion", 1241);
|
||||
|
@ -107,7 +94,7 @@
|
|||
this.func_75824_a(p_75816_2_.func_76632_l(), nbttagcompound);
|
||||
}
|
||||
catch (Exception exception)
|
||||
@@ -305,11 +366,19 @@
|
||||
@@ -305,11 +353,19 @@
|
||||
{
|
||||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
|
||||
|
@ -127,7 +114,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -318,8 +387,16 @@
|
||||
@@ -318,8 +374,16 @@
|
||||
|
||||
for (TileEntity tileentity : p_75820_1_.func_177434_r().values())
|
||||
{
|
||||
|
@ -144,7 +131,7 @@
|
|||
}
|
||||
|
||||
p_75820_3_.func_74782_a("TileEntities", nbttaglist2);
|
||||
@@ -388,6 +465,12 @@
|
||||
@@ -388,6 +452,12 @@
|
||||
chunk.func_76616_a(p_75823_2_.func_74770_j("Biomes"));
|
||||
}
|
||||
|
||||
|
@ -157,7 +144,7 @@
|
|||
NBTTagList nbttaglist1 = p_75823_2_.func_150295_c("Entities", 10);
|
||||
|
||||
for (int j1 = 0; j1 < nbttaglist1.func_74745_c(); ++j1)
|
||||
@@ -431,8 +514,6 @@
|
||||
@@ -431,8 +501,6 @@
|
||||
p_75823_1_.func_180497_b(new BlockPos(nbttagcompound3.func_74762_e("x"), nbttagcompound3.func_74762_e("y"), nbttagcompound3.func_74762_e("z")), block, nbttagcompound3.func_74762_e("t"), nbttagcompound3.func_74762_e("p"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,40 +1,13 @@
|
|||
--- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFile.java
|
||||
+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFile.java
|
||||
@@ -95,6 +95,39 @@
|
||||
@@ -95,6 +95,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // This is a copy (sort of) of the method below it, make sure they stay in sync
|
||||
+ @Deprecated // TODO: remove (1.13)
|
||||
+ public synchronized boolean chunkExists(int x, int z)
|
||||
+ {
|
||||
+ if (this.func_76705_d(x, z)) return false;
|
||||
+
|
||||
+ try
|
||||
+ {
|
||||
+ int offset = this.func_76707_e(x, z);
|
||||
+
|
||||
+ if (offset == 0) return false;
|
||||
+
|
||||
+ int sectorNumber = offset >> 8;
|
||||
+ int numSectors = offset & 255;
|
||||
+
|
||||
+ if (sectorNumber + numSectors > this.field_76714_f.size()) return false;
|
||||
+
|
||||
+ this.field_76719_c.seek((long)(sectorNumber * 4096));
|
||||
+ int length = this.field_76719_c.readInt();
|
||||
+
|
||||
+ if (length > 4096 * numSectors || length <= 0) return false;
|
||||
+
|
||||
+ byte version = this.field_76719_c.readByte();
|
||||
+
|
||||
+ if (version == 1 || version == 2) return true;
|
||||
+ }
|
||||
+ catch (IOException ioexception)
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ return func_76709_c(x, z);
|
||||
+ }
|
||||
+
|
||||
@Nullable
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
+ net.minecraft.world.chunk.storage.AnvilChunkLoader loader = (net.minecraft.world.chunk.storage.AnvilChunkLoader) this.field_73247_e;
|
||||
+ if (runnable == null)
|
||||
+ chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.field_73251_h, loader, this, p_186028_1_, p_186028_2_);
|
||||
+ else if (loader.chunkExists(this.field_73251_h, p_186028_1_, p_186028_2_))
|
||||
+ else if (loader.func_191063_a(p_186028_1_, p_186028_2_))
|
||||
+ {
|
||||
+ // We can only use the async queue for already generated chunks
|
||||
+ net.minecraftforge.common.chunkio.ChunkIOExecutor.queueChunkLoad(this.field_73251_h, loader, this, p_186028_1_, p_186028_2_, runnable);
|
||||
|
|
Loading…
Reference in New Issue