2015-03-22 17:38:04 +00:00
|
|
|
--- ../src-base/minecraft/net/minecraftforge/common/chunkio/ChunkIOProvider.java
|
|
|
|
+++ ../src-work/minecraft/net/minecraftforge/common/chunkio/ChunkIOProvider.java
|
2016-03-16 05:01:28 +00:00
|
|
|
@@ -9,7 +9,10 @@
|
2015-03-22 17:38:04 +00:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
2016-03-16 05:01:28 +00:00
|
|
|
-class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChunk, net.minecraft.world.chunk.Chunk, Runnable, RuntimeException> {
|
2015-03-22 17:38:04 +00:00
|
|
|
+import org.bukkit.Server;
|
|
|
|
+import org.bukkit.craftbukkit.util.LongHash;
|
|
|
|
+
|
2016-03-16 05:01:28 +00:00
|
|
|
+class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChunk, net.minecraft.world.chunk.Chunk, kcauldron.ChunkCallback, RuntimeException> {
|
2015-03-22 17:38:04 +00:00
|
|
|
private final AtomicInteger threadNumber = new AtomicInteger(1);
|
|
|
|
|
2016-03-16 05:01:28 +00:00
|
|
|
// async stuff
|
|
|
|
@@ -41,19 +44,41 @@
|
2015-03-22 17:38:04 +00:00
|
|
|
queuedChunk.loader.loadEntities(queuedChunk.world, queuedChunk.compound.getCompoundTag("Level"), chunk);
|
|
|
|
MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(chunk, queuedChunk.compound)); // Don't call ChunkDataEvent.Load async
|
|
|
|
chunk.lastSaveTime = queuedChunk.provider.worldObj.getTotalWorldTime();
|
|
|
|
- queuedChunk.provider.loadedChunkHashMap.add(ChunkCoordIntPair.chunkXZ2Int(queuedChunk.x, queuedChunk.z), chunk);
|
2017-07-31 15:30:07 +00:00
|
|
|
+ queuedChunk.provider.loadedChunkHashMap.add(ChunkCoordIntPair.chunkXZ2Int(queuedChunk.x, queuedChunk.z),chunk);
|
2015-03-22 17:38:04 +00:00
|
|
|
queuedChunk.provider.loadedChunks.add(chunk);
|
|
|
|
chunk.onChunkLoad();
|
|
|
|
|
|
|
|
if (queuedChunk.provider.currentChunkProvider != null) {
|
|
|
|
+ queuedChunk.provider.worldObj.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot
|
|
|
|
queuedChunk.provider.currentChunkProvider.recreateStructures(queuedChunk.x, queuedChunk.z);
|
|
|
|
+ queuedChunk.provider.worldObj.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ Server server = queuedChunk.provider.worldObj.getServer();
|
|
|
|
+ if (server != null) {
|
|
|
|
+ server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, false));
|
|
|
|
+ }
|
|
|
|
|
2016-01-05 18:53:42 +00:00
|
|
|
+ // Update neighbor counts
|
|
|
|
+ for (int x = -2; x < 3; x++) {
|
|
|
|
+ for (int z = -2; z < 3; z++) {
|
|
|
|
+ if (x == 0 && z == 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ net.minecraft.world.chunk.Chunk neighbor = queuedChunk.provider.getChunkIfLoaded(chunk.xPosition + x, chunk.zPosition + z);
|
|
|
|
+ if (neighbor != null) {
|
|
|
|
+ neighbor.setNeighborLoaded(-x, -z);
|
|
|
|
+ chunk.setNeighborLoaded(x, z);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2015-03-22 17:38:04 +00:00
|
|
|
chunk.populateChunk(queuedChunk.provider, queuedChunk.provider, queuedChunk.x, queuedChunk.z);
|
|
|
|
}
|
2016-01-05 18:53:42 +00:00
|
|
|
|
2016-03-16 05:01:28 +00:00
|
|
|
- public void callStage3(QueuedChunk queuedChunk, net.minecraft.world.chunk.Chunk chunk, Runnable runnable) throws RuntimeException {
|
|
|
|
- runnable.run();
|
|
|
|
+ public void callStage3(QueuedChunk queuedChunk, net.minecraft.world.chunk.Chunk chunk, kcauldron.ChunkCallback callback) throws RuntimeException {
|
|
|
|
+ callback.onChunkLoaded(chunk);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Thread newThread(Runnable runnable) {
|