mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 14:26:00 +03:00
116 lines
4.2 KiB
Diff
116 lines
4.2 KiB
Diff
--- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
|
|
+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
|
|
@@ -5,6 +5,7 @@
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.util.Collections;
|
|
+import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
@@ -71,8 +72,9 @@
|
|
@Nullable
|
|
public Chunk loadChunk(World worldIn, int x, int z) throws IOException
|
|
{
|
|
+ worldIn.timings.syncChunkLoadDataTimer.startTiming(); // Spigot
|
|
Object[] data = this.loadChunk__Async(worldIn, x, z);
|
|
-
|
|
+ worldIn.timings.syncChunkLoadDataTimer.stopTiming(); // Spigot
|
|
if (data != null)
|
|
{
|
|
Chunk chunk = (Chunk) data[0];
|
|
@@ -91,14 +93,14 @@
|
|
|
|
if (nbttagcompound == null)
|
|
{
|
|
- DataInputStream datainputstream = RegionFileCache.getChunkInputStream(this.chunkSaveLocation, x, z);
|
|
+ nbttagcompound = RegionFileCache.getChunkInputStream(this.chunkSaveLocation, x, z);
|
|
|
|
- if (datainputstream == null)
|
|
+ if (nbttagcompound == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
- nbttagcompound = this.dataFixer.process(FixTypes.CHUNK, CompressedStreamTools.read(datainputstream));
|
|
+ nbttagcompound = this.dataFixer.process(FixTypes.CHUNK, nbttagcompound);
|
|
}
|
|
|
|
return this.checkedReadChunkFromNBT__Async(worldIn, x, z, nbttagcompound);
|
|
@@ -194,7 +196,8 @@
|
|
|
|
public boolean writeNextIO()
|
|
{
|
|
- if (this.chunksToRemove.isEmpty())
|
|
+ Iterator<Map.Entry<ChunkPos, NBTTagCompound>> iter = this.chunksToRemove.entrySet().iterator();
|
|
+ if (!iter.hasNext())
|
|
{
|
|
if (this.savingExtraData)
|
|
{
|
|
@@ -205,13 +208,17 @@
|
|
}
|
|
else
|
|
{
|
|
- ChunkPos chunkpos = (ChunkPos)this.chunksToRemove.keySet().iterator().next();
|
|
+ // CraftBukkit start
|
|
+ Map.Entry<ChunkPos, NBTTagCompound> entry = iter.next();
|
|
+ iter.remove(); // Pop single entry
|
|
+ ChunkPos chunkpos = entry.getKey();
|
|
+ // CraftBukkit end
|
|
boolean lvt_3_1_;
|
|
|
|
try
|
|
{
|
|
this.pendingAnvilChunksCoordinates.add(chunkpos);
|
|
- NBTTagCompound nbttagcompound = (NBTTagCompound)this.chunksToRemove.remove(chunkpos);
|
|
+ NBTTagCompound nbttagcompound = (NBTTagCompound) entry.getValue(); // CraftBukkit
|
|
|
|
if (nbttagcompound != null)
|
|
{
|
|
@@ -238,9 +245,7 @@
|
|
|
|
private void writeChunkData(ChunkPos pos, NBTTagCompound compound) throws IOException
|
|
{
|
|
- DataOutputStream dataoutputstream = RegionFileCache.getChunkOutputStream(this.chunkSaveLocation, pos.chunkXPos, pos.chunkZPos);
|
|
- CompressedStreamTools.write(compound, dataoutputstream);
|
|
- dataoutputstream.close();
|
|
+ RegionFileCache.getChunkOutputStream(this.chunkSaveLocation, pos.chunkXPos, pos.chunkZPos,compound);
|
|
}
|
|
|
|
public void saveExtraChunkData(World worldIn, Chunk chunkIn) throws IOException
|
|
@@ -464,6 +469,7 @@
|
|
|
|
public void loadEntities(World worldIn, NBTTagCompound compound, Chunk chunk)
|
|
{
|
|
+ worldIn.timings.syncChunkLoadEntitiesTimer.startTiming(); // Spigot
|
|
NBTTagList nbttaglist1 = compound.getTagList("Entities", 10);
|
|
|
|
if (nbttaglist1 != null)
|
|
@@ -476,6 +482,8 @@
|
|
}
|
|
}
|
|
|
|
+ worldIn.timings.syncChunkLoadEntitiesTimer.stopTiming(); // Spigot
|
|
+ worldIn.timings.syncChunkLoadTileEntitiesTimer.startTiming(); // Spigot
|
|
NBTTagList nbttaglist2 = compound.getTagList("TileEntities", 10);
|
|
|
|
if (nbttaglist2 != null)
|
|
@@ -491,7 +499,8 @@
|
|
}
|
|
}
|
|
}
|
|
-
|
|
+ worldIn.timings.syncChunkLoadTileEntitiesTimer.stopTiming(); // Spigot
|
|
+ worldIn.timings.syncChunkLoadTileTicksTimer.startTiming(); // Spigot
|
|
if (compound.hasKey("TileTicks", 9))
|
|
{
|
|
NBTTagList nbttaglist3 = compound.getTagList("TileTicks", 10);
|
|
@@ -516,6 +525,7 @@
|
|
}
|
|
}
|
|
}
|
|
+ worldIn.timings.syncChunkLoadTileTicksTimer.stopTiming(); // Spigot
|
|
}
|
|
|
|
@Nullable
|