geforkt von Mirrors/Paper
Update upstream
Dieser Commit ist enthalten in:
Ursprung
7253bb10ca
Commit
03553d232e
@ -63,8 +63,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.common.collect.Lists; // CraftBukkit
|
||||
import org.bukkit.Bukkit; // CraftBukkit
|
||||
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
import org.bukkit.Server; // CraftBukkit
|
||||
+import org.bukkit.craftbukkit.util.CraftMagicNumbers; // Paper
|
||||
|
||||
public class Chunk {
|
||||
|
||||
|
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
// CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
|
||||
private int neighbors = 0x1 << 12;
|
||||
|
||||
public long chunkKey;
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
entity.ad = k;
|
||||
entity.ae = this.locZ;
|
||||
|
@ -41,9 +41,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
private boolean j;
|
||||
public final World world;
|
||||
public final int[] heightMap;
|
||||
public final long chunkKey; // Paper
|
||||
+ public Long scheduledForUnload; // Paper - delay chunk unloads
|
||||
public final int locX;
|
||||
public final int locZ;
|
||||
|
@ -10,9 +10,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public void loadNearby(IChunkProvider ichunkprovider, ChunkGenerator chunkgenerator) {
|
||||
world.timings.syncChunkLoadPostTimer.startTiming(); // Spigot
|
||||
- Chunk chunk = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ - 1);
|
||||
- Chunk chunk1 = ichunkprovider.getLoadedChunkAt(this.locX + 1, this.locZ);
|
||||
- Chunk chunk2 = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ + 1);
|
||||
@ -43,69 +43,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
if (chunk4 != null) {
|
||||
chunk4.a(chunkgenerator);
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
continue;
|
||||
}
|
||||
|
||||
- Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
+ Chunk neighbor = MCUtil.getLoadedChunkWithoutMarkingActive(this, chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborLoaded(-x, -z);
|
||||
chunk.setNeighborLoaded(x, z);
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
continue;
|
||||
}
|
||||
|
||||
- Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
+ Chunk neighbor = MCUtil.getLoadedChunkWithoutMarkingActive(this, chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborUnloaded(-x, -z);
|
||||
chunk.setNeighborUnloaded(x, z);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
continue;
|
||||
}
|
||||
|
||||
- net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
+ net.minecraft.server.Chunk neighbor = net.minecraft.server.MCUtil.getLoadedChunkWithoutMarkingActive(world, chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborUnloaded(-xx, -zz);
|
||||
chunk.setNeighborUnloaded(xx, zz);
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
continue;
|
||||
}
|
||||
|
||||
- net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
|
||||
+ net.minecraft.server.Chunk neighbor = net.minecraft.server.MCUtil.getLoadedChunkWithoutMarkingActive(world, chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborLoaded(-x, -z);
|
||||
chunk.setNeighborLoaded(x, z);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.server.Chunk;
|
||||
import net.minecraft.server.ChunkCoordIntPair;
|
||||
import net.minecraft.server.ChunkRegionLoader;
|
||||
import net.minecraft.server.NBTTagCompound;
|
||||
-
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.util.AsynchronousExecutor;
|
||||
|
||||
@@ -0,0 +0,0 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
|
||||
continue;
|
||||
}
|
||||
|
||||
- Chunk neighbor = queuedChunk.provider.getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
|
||||
+ Chunk neighbor = net.minecraft.server.MCUtil.getLoadedChunkWithoutMarkingActive(queuedChunk.provider, chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborLoaded(-x, -z);
|
||||
chunk.setNeighborLoaded(x, z);
|
||||
--
|
@ -1,26 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 2 Mar 2016 23:55:20 -0600
|
||||
Subject: [PATCH] Don't create a chunk just to unload it
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
private boolean unloadChunk0(int x, int z, boolean save, boolean safe) {
|
||||
- net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkAt(x, z);
|
||||
+ // Paper start - Don't create a chunk just to unload it
|
||||
+ net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkIfLoaded(x, z);
|
||||
+ if (chunk == null) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if (chunk.mustSave) { // If chunk had previously been queued to save, must do save to avoid loss of that data
|
||||
save = true;
|
||||
}
|
||||
--
|
@ -26,43 +26,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
Chunk chunk = (Chunk) this.chunks.get(olong);
|
||||
|
||||
if (chunk != null && chunk.d) {
|
||||
// CraftBukkit start - move unload logic to own method
|
||||
+ chunk.setShouldUnload(false); // Paper
|
||||
// CraftBukkit start
|
||||
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
// Use the default variant of loadChunk when generate == true.
|
||||
return world.getChunkProviderServer().getChunkAt(x, z) != null;
|
||||
}
|
||||
+ // Paper start - below is not updated for the new unload queue logic.
|
||||
+ return world.getChunkProviderServer().getOrLoadChunkAt(x, z) != null;
|
||||
+ /*
|
||||
|
||||
world.getChunkProviderServer().unloadQueue.remove(ChunkCoordIntPair.a(x, z));
|
||||
net.minecraft.server.Chunk chunk = world.getChunkProviderServer().chunks.get(ChunkCoordIntPair.a(x, z));
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
chunk = world.getChunkProviderServer().getOrLoadChunkAt(x, z);
|
||||
world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
|
||||
}
|
||||
- return chunk != null;
|
||||
+ return chunk != null;*/ // Paper end
|
||||
}
|
||||
|
||||
private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int cx, int cz) {
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
// Already unloading?
|
||||
- if (cps.unloadQueue.contains(ChunkCoordIntPair.a(chunk.locX, chunk.locZ))) {
|
||||
+ if (chunk.isUnloading()) { // Paper
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!unloadChunk(chunk, true)) {
|
||||
continue;
|
||||
}
|
||||
--
|
@ -89,13 +89,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
if (event.isCancelled()) {
|
||||
continue;
|
||||
}
|
||||
+ chunk.lightingQueue.processUnload(); // Paper
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
+ chunk.lightingQueue.processUnload(); // Paper
|
||||
|
||||
// Update neighbor counts
|
||||
for (int x = -2; x < 3; x++) {
|
||||
// Update neighbor counts
|
||||
for (int x = -2; x < 3; x++) {
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
|
@ -8,26 +8,6 @@ getChunkAt is called for the same chunk multiple times in a row, often from getT
|
||||
|
||||
Optimize this look up by using a Last Access cache.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
private boolean j;
|
||||
public final World world;
|
||||
public final int[] heightMap;
|
||||
+ public final long chunkKey; // Paper
|
||||
public final int locX;
|
||||
public final int locZ;
|
||||
private boolean m;
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
this.world = world;
|
||||
this.locX = i;
|
||||
this.locZ = j;
|
||||
+ this.chunkKey = org.bukkit.craftbukkit.util.LongHash.toLong(this.locX, this.locZ); // Paper
|
||||
this.heightMap = new int[256];
|
||||
|
||||
for (int k = 0; k < this.entitySlices.length; ++k) {
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 9af379fc4741a6fb487aaf4b5c7ffdbcbb12ca4f
|
||||
Subproject commit 1953f52da1ece0feb56dea20592c1b86616b31a5
|
@ -1 +1 @@
|
||||
Subproject commit c55900f7285842593df7101bf7ee81516aacb0c5
|
||||
Subproject commit c3e4052b69acbcf52439c51ae8b0d65a4b1bb98a
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren