mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-24 09:58:00 +01:00
Execute chunk tasks mid-tick
If the server tick length is high, then the amount of time available to process chunk tasks inbetween ticks is low. As a result, chunk loading and generation may appear to slow down. To ensure that chunk tasks are always processed, we add logic to execute chunk tasks during tile entity tick, entity tick, chunk random ticking, and scheduled block/fluid ticking. The mid-tick task execution is timed so that it is not prioritised over the server tick.
This commit is contained in:
parent
7eec21e80d
commit
8c8b227547
@ -4888,10 +4888,10 @@ index 0000000000000000000000000000000000000000..af867f8fedd0bb8f675e94243aa1a3f1
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemLevel.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemLevel.java
|
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemLevel.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemLevel.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..eab09949c001fbfd708079fae83c45ab59fb25e7
|
index 0000000000000000000000000000000000000000..efcd9057f008f0b9cf0d22b2b21d1851205841e5
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemLevel.java
|
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemLevel.java
|
||||||
@@ -0,0 +1,20 @@
|
@@ -0,0 +1,22 @@
|
||||||
+package ca.spottedleaf.moonrise.patches.chunk_system.level;
|
+package ca.spottedleaf.moonrise.patches.chunk_system.level;
|
||||||
+
|
+
|
||||||
+import ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup;
|
+import ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup;
|
||||||
@ -4911,6 +4911,8 @@ index 0000000000000000000000000000000000000000..eab09949c001fbfd708079fae83c45ab
|
|||||||
+
|
+
|
||||||
+ public ChunkAccess moonrise$getSpecificChunkIfLoaded(final int chunkX, final int chunkZ, final ChunkStatus leastStatus);
|
+ public ChunkAccess moonrise$getSpecificChunkIfLoaded(final int chunkX, final int chunkZ, final ChunkStatus leastStatus);
|
||||||
+
|
+
|
||||||
|
+ public void moonrise$midTickTasks();
|
||||||
|
+
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemLevelReader.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemLevelReader.java
|
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemLevelReader.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemLevelReader.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
@ -4930,10 +4932,10 @@ index 0000000000000000000000000000000000000000..0b58701342d573fa43cdd06681534854
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemServerLevel.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemServerLevel.java
|
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemServerLevel.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemServerLevel.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..d0d97588e02a7846ef9da57679a9ca4525daee17
|
index 0000000000000000000000000000000000000000..6828a3ca7151692a41b5370f680f867958a214fc
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemServerLevel.java
|
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/ChunkSystemServerLevel.java
|
||||||
@@ -0,0 +1,47 @@
|
@@ -0,0 +1,50 @@
|
||||||
+package ca.spottedleaf.moonrise.patches.chunk_system.level;
|
+package ca.spottedleaf.moonrise.patches.chunk_system.level;
|
||||||
+
|
+
|
||||||
+import ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor;
|
+import ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor;
|
||||||
@ -4980,6 +4982,9 @@ index 0000000000000000000000000000000000000000..d0d97588e02a7846ef9da57679a9ca45
|
|||||||
+
|
+
|
||||||
+ public RegionizedPlayerChunkLoader.ViewDistanceHolder moonrise$getViewDistanceHolder();
|
+ public RegionizedPlayerChunkLoader.ViewDistanceHolder moonrise$getViewDistanceHolder();
|
||||||
+
|
+
|
||||||
|
+ public long moonrise$getLastMidTickFailure();
|
||||||
|
+
|
||||||
|
+ public void moonrise$setLastMidTickFailure(final long time);
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/chunk/ChunkSystemChunkHolder.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/chunk/ChunkSystemChunkHolder.java
|
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/chunk/ChunkSystemChunkHolder.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/chunk/ChunkSystemChunkHolder.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
@ -17417,16 +17422,18 @@ index 0000000000000000000000000000000000000000..7a65d351b448873c6f2c145c975c92be
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/server/ChunkSystemMinecraftServer.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/server/ChunkSystemMinecraftServer.java
|
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/server/ChunkSystemMinecraftServer.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/server/ChunkSystemMinecraftServer.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..21c9562781b05adf3871e522fddb654d75f605ba
|
index 0000000000000000000000000000000000000000..cb6af3712bf9f6f6b8f7a459c309c75dabe83a50
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/server/ChunkSystemMinecraftServer.java
|
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/server/ChunkSystemMinecraftServer.java
|
||||||
@@ -0,0 +1,7 @@
|
@@ -0,0 +1,9 @@
|
||||||
+package ca.spottedleaf.moonrise.patches.chunk_system.server;
|
+package ca.spottedleaf.moonrise.patches.chunk_system.server;
|
||||||
+
|
+
|
||||||
+public interface ChunkSystemMinecraftServer {
|
+public interface ChunkSystemMinecraftServer {
|
||||||
+
|
+
|
||||||
+ public void moonrise$setChunkSystemCrash(final Throwable throwable);
|
+ public void moonrise$setChunkSystemCrash(final Throwable throwable);
|
||||||
+
|
+
|
||||||
|
+ public void moonrise$executeMidTickTasks();
|
||||||
|
+
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/status/ChunkSystemChunkStep.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/status/ChunkSystemChunkStep.java
|
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/status/ChunkSystemChunkStep.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/status/ChunkSystemChunkStep.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
@ -23006,7 +23013,7 @@ index c33f85b570f159ab465b5a10a8044a81f2797f43..244a19ecd0234fa1d7a6ecfea2075159
|
|||||||
DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, worldLoader.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::createFromGameruleRadius);
|
DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, worldLoader.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::createFromGameruleRadius);
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index e14c0e1ccf526f81e28db5545d9e2351641e1bc8..3c230ae060998bfb79d5812fef21a80a9df8c8ff 100644
|
index e14c0e1ccf526f81e28db5545d9e2351641e1bc8..91cc3eb6db2875710064f6b31413ccc84af56bb2 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -198,7 +198,7 @@ import org.bukkit.event.server.ServerLoadEvent;
|
@@ -198,7 +198,7 @@ import org.bukkit.event.server.ServerLoadEvent;
|
||||||
@ -23027,7 +23034,7 @@ index e14c0e1ccf526f81e28db5545d9e2351641e1bc8..3c230ae060998bfb79d5812fef21a80a
|
|||||||
((MinecraftServer) atomicreference.get()).runServer();
|
((MinecraftServer) atomicreference.get()).runServer();
|
||||||
}, "Server thread");
|
}, "Server thread");
|
||||||
|
|
||||||
@@ -341,6 +341,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -341,6 +341,77 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
return s0;
|
return s0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23038,12 +23045,74 @@ index e14c0e1ccf526f81e28db5545d9e2351641e1bc8..3c230ae060998bfb79d5812fef21a80a
|
|||||||
+ public final void moonrise$setChunkSystemCrash(final Throwable throwable) {
|
+ public final void moonrise$setChunkSystemCrash(final Throwable throwable) {
|
||||||
+ this.chunkSystemCrash = throwable;
|
+ this.chunkSystemCrash = throwable;
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ private static final long CHUNK_TASK_QUEUE_BACKOFF_MIN_TIME = 25L * 1000L; // 25us
|
||||||
|
+ private static final long MAX_CHUNK_EXEC_TIME = 1000L; // 1us
|
||||||
|
+ private static final long TASK_EXECUTION_FAILURE_BACKOFF = 5L * 1000L; // 5us
|
||||||
|
+
|
||||||
|
+ private long lastMidTickExecute;
|
||||||
|
+ private long lastMidTickExecuteFailure;
|
||||||
|
+
|
||||||
|
+ private boolean tickMidTickTasks() {
|
||||||
|
+ // give all worlds a fair chance at by targeting them all.
|
||||||
|
+ // if we execute too many tasks, that's fine - we have logic to correctly handle overuse of allocated time.
|
||||||
|
+ boolean executed = false;
|
||||||
|
+ for (final ServerLevel world : this.getAllLevels()) {
|
||||||
|
+ long currTime = System.nanoTime();
|
||||||
|
+ if (currTime - ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)world).moonrise$getLastMidTickFailure() <= TASK_EXECUTION_FAILURE_BACKOFF) {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ if (!world.getChunkSource().pollTask()) {
|
||||||
|
+ // we need to back off if this fails
|
||||||
|
+ ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)world).moonrise$setLastMidTickFailure(currTime);
|
||||||
|
+ } else {
|
||||||
|
+ executed = true;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return executed;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public final void moonrise$executeMidTickTasks() {
|
||||||
|
+ final long startTime = System.nanoTime();
|
||||||
|
+ if ((startTime - this.lastMidTickExecute) <= CHUNK_TASK_QUEUE_BACKOFF_MIN_TIME || (startTime - this.lastMidTickExecuteFailure) <= TASK_EXECUTION_FAILURE_BACKOFF) {
|
||||||
|
+ // it's shown to be bad to constantly hit the queue (chunk loads slow to a crawl), even if no tasks are executed.
|
||||||
|
+ // so, backoff to prevent this
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (;;) {
|
||||||
|
+ final boolean moreTasks = this.tickMidTickTasks();
|
||||||
|
+ final long currTime = System.nanoTime();
|
||||||
|
+ final long diff = currTime - startTime;
|
||||||
|
+
|
||||||
|
+ if (!moreTasks || diff >= MAX_CHUNK_EXEC_TIME) {
|
||||||
|
+ if (!moreTasks) {
|
||||||
|
+ this.lastMidTickExecuteFailure = currTime;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // note: negative values reduce the time
|
||||||
|
+ long overuse = diff - MAX_CHUNK_EXEC_TIME;
|
||||||
|
+ if (overuse >= (10L * 1000L * 1000L)) { // 10ms
|
||||||
|
+ // make sure something like a GC or dumb plugin doesn't screw us over...
|
||||||
|
+ overuse = 10L * 1000L * 1000L; // 10ms
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ final double overuseCount = (double)overuse/(double)MAX_CHUNK_EXEC_TIME;
|
||||||
|
+ final long extraSleep = (long)Math.round(overuseCount*CHUNK_TASK_QUEUE_BACKOFF_MIN_TIME);
|
||||||
|
+
|
||||||
|
+ this.lastMidTickExecute = currTime + extraSleep;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
+ // Paper end - rewrite chunk system
|
+ // Paper end - rewrite chunk system
|
||||||
+
|
+
|
||||||
public MinecraftServer(OptionSet options, WorldLoader.DataLoadContext worldLoader, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) {
|
public MinecraftServer(OptionSet options, WorldLoader.DataLoadContext worldLoader, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) {
|
||||||
super("Server");
|
super("Server");
|
||||||
SERVER = this; // Paper - better singleton
|
SERVER = this; // Paper - better singleton
|
||||||
@@ -657,7 +666,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -657,7 +728,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
this.forceDifficulty();
|
this.forceDifficulty();
|
||||||
for (ServerLevel worldserver : this.getAllLevels()) {
|
for (ServerLevel worldserver : this.getAllLevels()) {
|
||||||
this.prepareLevels(worldserver.getChunkSource().chunkMap.progressListener, worldserver);
|
this.prepareLevels(worldserver.getChunkSource().chunkMap.progressListener, worldserver);
|
||||||
@ -23052,7 +23121,7 @@ index e14c0e1ccf526f81e28db5545d9e2351641e1bc8..3c230ae060998bfb79d5812fef21a80a
|
|||||||
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
|
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -870,6 +879,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -870,6 +941,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
public abstract boolean shouldRconBroadcast();
|
public abstract boolean shouldRconBroadcast();
|
||||||
|
|
||||||
public boolean saveAllChunks(boolean suppressLogs, boolean flush, boolean force) {
|
public boolean saveAllChunks(boolean suppressLogs, boolean flush, boolean force) {
|
||||||
@ -23064,7 +23133,7 @@ index e14c0e1ccf526f81e28db5545d9e2351641e1bc8..3c230ae060998bfb79d5812fef21a80a
|
|||||||
boolean flag3 = false;
|
boolean flag3 = false;
|
||||||
|
|
||||||
for (Iterator iterator = this.getAllLevels().iterator(); iterator.hasNext(); flag3 = true) {
|
for (Iterator iterator = this.getAllLevels().iterator(); iterator.hasNext(); flag3 = true) {
|
||||||
@@ -879,7 +893,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -879,7 +955,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
MinecraftServer.LOGGER.info("Saving chunks for level '{}'/{}", worldserver, worldserver.dimension().location());
|
MinecraftServer.LOGGER.info("Saving chunks for level '{}'/{}", worldserver, worldserver.dimension().location());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23073,7 +23142,7 @@ index e14c0e1ccf526f81e28db5545d9e2351641e1bc8..3c230ae060998bfb79d5812fef21a80a
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start - moved to WorldServer.save
|
// CraftBukkit start - moved to WorldServer.save
|
||||||
@@ -980,7 +994,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -980,7 +1056,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23082,7 +23151,7 @@ index e14c0e1ccf526f81e28db5545d9e2351641e1bc8..3c230ae060998bfb79d5812fef21a80a
|
|||||||
return worldserver1.getChunkSource().chunkMap.hasWork();
|
return worldserver1.getChunkSource().chunkMap.hasWork();
|
||||||
})) {
|
})) {
|
||||||
this.nextTickTimeNanos = Util.getNanos() + TimeUtil.NANOSECONDS_PER_MILLISECOND;
|
this.nextTickTimeNanos = Util.getNanos() + TimeUtil.NANOSECONDS_PER_MILLISECOND;
|
||||||
@@ -997,19 +1011,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -997,19 +1073,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
this.waitUntilNextTick();
|
this.waitUntilNextTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23103,7 +23172,7 @@ index e14c0e1ccf526f81e28db5545d9e2351641e1bc8..3c230ae060998bfb79d5812fef21a80a
|
|||||||
|
|
||||||
this.isSaving = false;
|
this.isSaving = false;
|
||||||
this.resources.close();
|
this.resources.close();
|
||||||
@@ -1029,6 +1031,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1029,6 +1093,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
}
|
}
|
||||||
// Spigot end
|
// Spigot end
|
||||||
|
|
||||||
@ -23111,7 +23180,7 @@ index e14c0e1ccf526f81e28db5545d9e2351641e1bc8..3c230ae060998bfb79d5812fef21a80a
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getLocalIp() {
|
public String getLocalIp() {
|
||||||
@@ -1203,6 +1206,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1203,6 +1268,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
this.tickServer(flag ? () -> {
|
this.tickServer(flag ? () -> {
|
||||||
return false;
|
return false;
|
||||||
} : this::haveTime);
|
} : this::haveTime);
|
||||||
@ -23125,7 +23194,15 @@ index e14c0e1ccf526f81e28db5545d9e2351641e1bc8..3c230ae060998bfb79d5812fef21a80a
|
|||||||
this.profiler.popPush("nextTickWait");
|
this.profiler.popPush("nextTickWait");
|
||||||
this.mayHaveDelayedTasks = true;
|
this.mayHaveDelayedTasks = true;
|
||||||
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + i, this.nextTickTimeNanos);
|
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + i, this.nextTickTimeNanos);
|
||||||
@@ -1594,7 +1604,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1392,6 +1464,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
|
||||||
|
private boolean pollTaskInternal() {
|
||||||
|
if (super.pollTask()) {
|
||||||
|
+ this.moonrise$executeMidTickTasks(); // Paper - rewrite chunk system
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
boolean ret = false; // Paper - force execution of all worlds, do not just bias the first
|
||||||
|
@@ -1594,7 +1667,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
// Paper start - Folia scheduler API
|
// Paper start - Folia scheduler API
|
||||||
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
|
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
|
||||||
getAllLevels().forEach(level -> {
|
getAllLevels().forEach(level -> {
|
||||||
@ -23134,7 +23211,7 @@ index e14c0e1ccf526f81e28db5545d9e2351641e1bc8..3c230ae060998bfb79d5812fef21a80a
|
|||||||
if (entity.isRemoved()) {
|
if (entity.isRemoved()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2656,6 +2666,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -2656,6 +2729,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25417,7 +25494,7 @@ index 3dc1daa3c6a04d3ff1a2353773b465fc380994a2..3575782f13a7f3c52e64dc5046803305
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
index be9604a0f267558c95125852d86761a2f175732a..014e7d3c3b9e8f6c2b456d63bcf885f55b01ded9 100644
|
index be9604a0f267558c95125852d86761a2f175732a..67eb2fb32de3555b3afb4b4b7a3a47a164158ac8 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
@@ -46,7 +46,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp
|
@@ -46,7 +46,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp
|
||||||
@ -25735,7 +25812,27 @@ index be9604a0f267558c95125852d86761a2f175732a..014e7d3c3b9e8f6c2b456d63bcf885f5
|
|||||||
this.tickChunks();
|
this.tickChunks();
|
||||||
this.level.timings.chunks.stopTiming(); // Paper - timings
|
this.level.timings.chunks.stopTiming(); // Paper - timings
|
||||||
this.chunkMap.tick();
|
this.chunkMap.tick();
|
||||||
@@ -495,11 +497,12 @@ public class ServerChunkCache extends ChunkSource {
|
@@ -410,6 +412,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tickChunks() {
|
||||||
|
+ long chunksTicked = 0; // Paper - rewrite chunk system
|
||||||
|
long i = this.level.getGameTime();
|
||||||
|
long j = i - this.lastInhabitedUpdate;
|
||||||
|
|
||||||
|
@@ -470,6 +473,11 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
|
|
||||||
|
if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) {
|
||||||
|
this.level.tickChunk(chunk1, l);
|
||||||
|
+ // Paper start - rewrite chunk system
|
||||||
|
+ if ((++chunksTicked & 7L) == 0L) {
|
||||||
|
+ ((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this.level.getServer()).moonrise$executeMidTickTasks();
|
||||||
|
+ }
|
||||||
|
+ // Paper end - rewrite chunk system
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -495,11 +503,12 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getFullChunk(long pos, Consumer<LevelChunk> chunkConsumer) {
|
private void getFullChunk(long pos, Consumer<LevelChunk> chunkConsumer) {
|
||||||
@ -25752,7 +25849,7 @@ index be9604a0f267558c95125852d86761a2f175732a..014e7d3c3b9e8f6c2b456d63bcf885f5
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,6 +596,12 @@ public class ServerChunkCache extends ChunkSource {
|
@@ -593,6 +602,12 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
this.chunkMap.setServerViewDistance(watchDistance);
|
this.chunkMap.setServerViewDistance(watchDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25765,7 +25862,7 @@ index be9604a0f267558c95125852d86761a2f175732a..014e7d3c3b9e8f6c2b456d63bcf885f5
|
|||||||
public void setSimulationDistance(int simulationDistance) {
|
public void setSimulationDistance(int simulationDistance) {
|
||||||
this.distanceManager.updateSimulationDistance(simulationDistance);
|
this.distanceManager.updateSimulationDistance(simulationDistance);
|
||||||
}
|
}
|
||||||
@@ -671,16 +680,14 @@ public class ServerChunkCache extends ChunkSource {
|
@@ -671,16 +686,14 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
@Override
|
@Override
|
||||||
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
|
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
|
||||||
public boolean pollTask() {
|
public boolean pollTask() {
|
||||||
@ -25788,7 +25885,7 @@ index be9604a0f267558c95125852d86761a2f175732a..014e7d3c3b9e8f6c2b456d63bcf885f5
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c0029c2af 100644
|
index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..cf33e22ae85cd30b4f5d526dbfececca87d4ee40 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -184,7 +184,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
|
@@ -184,7 +184,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
|
||||||
@ -25809,7 +25906,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
private final GameEventDispatcher gameEventDispatcher;
|
private final GameEventDispatcher gameEventDispatcher;
|
||||||
public boolean noSave;
|
public boolean noSave;
|
||||||
private final SleepStatus sleepStatus;
|
private final SleepStatus sleepStatus;
|
||||||
@@ -339,6 +339,162 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -339,6 +339,179 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
return player != null && player.level() == this ? player : null;
|
return player != null && player.level() == this ? player : null;
|
||||||
}
|
}
|
||||||
// Paper end - optimise getPlayerByUUID
|
// Paper end - optimise getPlayerByUUID
|
||||||
@ -25821,6 +25918,8 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
+ private final ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.PoiDataController poiDataController;
|
+ private final ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.PoiDataController poiDataController;
|
||||||
+ private final ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController chunkDataController;
|
+ private final ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController chunkDataController;
|
||||||
+ private final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler chunkTaskScheduler;
|
+ private final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler chunkTaskScheduler;
|
||||||
|
+ private long lastMidTickFailure;
|
||||||
|
+ private long tickedBlocksOrFluids;
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public final LevelChunk moonrise$getFullChunkIfLoaded(final int chunkX, final int chunkZ) {
|
+ public final LevelChunk moonrise$getFullChunkIfLoaded(final int chunkX, final int chunkZ) {
|
||||||
@ -25856,6 +25955,11 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
|
+ public final void moonrise$midTickTasks() {
|
||||||
|
+ ((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this.server).moonrise$executeMidTickTasks();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
+ public final ChunkAccess moonrise$syncLoadNonFull(final int chunkX, final int chunkZ, final net.minecraft.world.level.chunk.status.ChunkStatus status) {
|
+ public final ChunkAccess moonrise$syncLoadNonFull(final int chunkX, final int chunkZ, final net.minecraft.world.level.chunk.status.ChunkStatus status) {
|
||||||
+ return this.moonrise$getChunkTaskScheduler().syncLoadNonFull(chunkX, chunkZ, status);
|
+ return this.moonrise$getChunkTaskScheduler().syncLoadNonFull(chunkX, chunkZ, status);
|
||||||
+ }
|
+ }
|
||||||
@ -25968,11 +26072,21 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
+ public final ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder moonrise$getViewDistanceHolder() {
|
+ public final ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder moonrise$getViewDistanceHolder() {
|
||||||
+ return this.viewDistanceHolder;
|
+ return this.viewDistanceHolder;
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public final long moonrise$getLastMidTickFailure() {
|
||||||
|
+ return this.lastMidTickFailure;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public final void moonrise$setLastMidTickFailure(final long time) {
|
||||||
|
+ this.lastMidTickFailure = time;
|
||||||
|
+ }
|
||||||
+ // Paper end - rewrite chunk system
|
+ // Paper end - rewrite chunk system
|
||||||
|
|
||||||
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer
|
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer
|
||||||
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
||||||
@@ -385,14 +541,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -385,14 +558,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver);
|
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver);
|
||||||
|
|
||||||
@ -25990,7 +26104,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
return minecraftserver.overworld().getDataStorage();
|
return minecraftserver.overworld().getDataStorage();
|
||||||
});
|
});
|
||||||
this.chunkSource.getGeneratorState().ensureStructuresGenerated();
|
this.chunkSource.getGeneratorState().ensureStructuresGenerated();
|
||||||
@@ -420,6 +575,19 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -420,6 +592,19 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> {
|
this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> {
|
||||||
return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences");
|
return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences");
|
||||||
});
|
});
|
||||||
@ -26010,7 +26124,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
|
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -553,7 +721,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -553,7 +738,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
gameprofilerfiller.push("checkDespawn");
|
gameprofilerfiller.push("checkDespawn");
|
||||||
entity.checkDespawn();
|
entity.checkDespawn();
|
||||||
gameprofilerfiller.pop();
|
gameprofilerfiller.pop();
|
||||||
@ -26019,7 +26133,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
Entity entity1 = entity.getVehicle();
|
Entity entity1 = entity.getVehicle();
|
||||||
|
|
||||||
if (entity1 != null) {
|
if (entity1 != null) {
|
||||||
@@ -578,13 +746,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -578,13 +763,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
}
|
}
|
||||||
|
|
||||||
gameprofilerfiller.push("entityManagement");
|
gameprofilerfiller.push("entityManagement");
|
||||||
@ -26038,7 +26152,31 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void tickTime() {
|
protected void tickTime() {
|
||||||
@@ -1061,6 +1232,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -976,6 +1164,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
|
if (fluid1.is(fluid)) {
|
||||||
|
fluid1.tick(this, pos);
|
||||||
|
}
|
||||||
|
+ // Paper start - rewrite chunk system
|
||||||
|
+ if ((++this.tickedBlocksOrFluids & 7L) != 0L) {
|
||||||
|
+ ((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this.server).moonrise$executeMidTickTasks();
|
||||||
|
+ }
|
||||||
|
+ // Paper end - rewrite chunk system
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -985,6 +1178,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
|
if (iblockdata.is(block)) {
|
||||||
|
iblockdata.tick(this, pos, this.random);
|
||||||
|
}
|
||||||
|
+ // Paper start - rewrite chunk system
|
||||||
|
+ if ((++this.tickedBlocksOrFluids & 7L) != 0L) {
|
||||||
|
+ ((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this.server).moonrise$executeMidTickTasks();
|
||||||
|
+ }
|
||||||
|
+ // Paper end - rewrite chunk system
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1061,6 +1259,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(@Nullable ProgressListener progressListener, boolean flush, boolean savingDisabled) {
|
public void save(@Nullable ProgressListener progressListener, boolean flush, boolean savingDisabled) {
|
||||||
@ -26050,7 +26188,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
ServerChunkCache chunkproviderserver = this.getChunkSource();
|
ServerChunkCache chunkproviderserver = this.getChunkSource();
|
||||||
|
|
||||||
if (!savingDisabled) {
|
if (!savingDisabled) {
|
||||||
@@ -1076,16 +1252,21 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -1076,16 +1279,21 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
}
|
}
|
||||||
|
|
||||||
timings.worldSaveChunks.startTiming(); // Paper
|
timings.worldSaveChunks.startTiming(); // Paper
|
||||||
@ -26078,7 +26216,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
|
|
||||||
// CraftBukkit start - moved from MinecraftServer.saveChunks
|
// CraftBukkit start - moved from MinecraftServer.saveChunks
|
||||||
ServerLevel worldserver1 = this;
|
ServerLevel worldserver1 = this;
|
||||||
@@ -1218,7 +1399,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -1218,7 +1426,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED);
|
this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26087,7 +26225,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
@@ -1249,7 +1430,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -1249,7 +1457,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -26096,7 +26234,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1260,11 +1441,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -1260,11 +1468,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
|
|
||||||
public boolean tryAddFreshEntityWithPassengers(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
public boolean tryAddFreshEntityWithPassengers(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -26109,7 +26247,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit
|
this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit
|
||||||
@@ -1850,7 +2027,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -1850,7 +2054,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26118,7 +26256,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
bufferedwriter.write(String.format(Locale.ROOT, "block_entity_tickers: %d\n", this.blockEntityTickers.size()));
|
bufferedwriter.write(String.format(Locale.ROOT, "block_entity_tickers: %d\n", this.blockEntityTickers.size()));
|
||||||
bufferedwriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count()));
|
bufferedwriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count()));
|
||||||
bufferedwriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count()));
|
bufferedwriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count()));
|
||||||
@@ -1899,7 +2076,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -1899,7 +2103,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1);
|
BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -26127,7 +26265,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
} catch (Throwable throwable4) {
|
} catch (Throwable throwable4) {
|
||||||
if (bufferedwriter2 != null) {
|
if (bufferedwriter2 != null) {
|
||||||
try {
|
try {
|
||||||
@@ -1920,7 +2097,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -1920,7 +2124,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2);
|
BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -26136,7 +26274,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
} catch (Throwable throwable6) {
|
} catch (Throwable throwable6) {
|
||||||
if (bufferedwriter3 != null) {
|
if (bufferedwriter3 != null) {
|
||||||
try {
|
try {
|
||||||
@@ -2062,7 +2239,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -2062,7 +2266,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public String getWatchdogStats() {
|
public String getWatchdogStats() {
|
||||||
@ -26145,7 +26283,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
|
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
|
||||||
}), this.blockEntityTickers.size(), ServerLevel.getTypeCount(this.blockEntityTickers, TickingBlockEntity::getType), this.getBlockTicks().count(), this.getFluidTicks().count(), this.gatherChunkSourceStats());
|
}), this.blockEntityTickers.size(), ServerLevel.getTypeCount(this.blockEntityTickers, TickingBlockEntity::getType), this.getBlockTicks().count(), this.getFluidTicks().count(), this.gatherChunkSourceStats());
|
||||||
}
|
}
|
||||||
@@ -2092,15 +2269,25 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -2092,15 +2296,25 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
@Override
|
@Override
|
||||||
public LevelEntityGetter<Entity> getEntities() {
|
public LevelEntityGetter<Entity> getEntities() {
|
||||||
org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot
|
org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot
|
||||||
@ -26174,7 +26312,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void startTickingChunk(LevelChunk chunk) {
|
public void startTickingChunk(LevelChunk chunk) {
|
||||||
@@ -2120,34 +2307,47 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -2120,34 +2334,47 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
super.close();
|
super.close();
|
||||||
@ -26229,7 +26367,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..f8ea3298a995901e114cb811c01b504c
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2173,7 +2373,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -2173,7 +2400,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report);
|
CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report);
|
||||||
|
|
||||||
crashreportsystemdetails.setDetail("Loaded entity count", () -> {
|
crashreportsystemdetails.setDetail("Loaded entity count", () -> {
|
||||||
@ -27249,7 +27387,7 @@ index bd20bea7f76a7307f1698fb2dfef37125032d166..70c2017400168d4fef3c14462798edcf
|
|||||||
if (shape.isEmpty()) {
|
if (shape.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
index e27d3547d1e19c137e05e6b8d075127a8bafb237..557273061fa03ebaa4b9de01ad12ed4ac859c292 100644
|
index e27d3547d1e19c137e05e6b8d075127a8bafb237..613752e2df61fdd8010f8ad0cf25257580bfe32e 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
@@ -102,7 +102,7 @@ import org.bukkit.entity.SpawnCategory;
|
@@ -102,7 +102,7 @@ import org.bukkit.entity.SpawnCategory;
|
||||||
@ -27261,7 +27399,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..557273061fa03ebaa4b9de01ad12ed4a
|
|||||||
|
|
||||||
public static final Codec<ResourceKey<Level>> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION);
|
public static final Codec<ResourceKey<Level>> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION);
|
||||||
public static final ResourceKey<Level> OVERWORLD = ResourceKey.create(Registries.DIMENSION, ResourceLocation.withDefaultNamespace("overworld"));
|
public static final ResourceKey<Level> OVERWORLD = ResourceKey.create(Registries.DIMENSION, ResourceLocation.withDefaultNamespace("overworld"));
|
||||||
@@ -199,6 +199,58 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@@ -199,6 +199,63 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||||
|
|
||||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
public abstract ResourceKey<LevelStem> getTypeKey();
|
||||||
|
|
||||||
@ -27315,12 +27453,17 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..557273061fa03ebaa4b9de01ad12ed4a
|
|||||||
+ public ChunkAccess moonrise$getSpecificChunkIfLoaded(final int chunkX, final int chunkZ, final ChunkStatus leastStatus) {
|
+ public ChunkAccess moonrise$getSpecificChunkIfLoaded(final int chunkX, final int chunkZ, final ChunkStatus leastStatus) {
|
||||||
+ return this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, false);
|
+ return this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, false);
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void moonrise$midTickTasks() {
|
||||||
|
+ // no-op on ClientLevel
|
||||||
|
+ }
|
||||||
+ // Paper end - rewrite chunk system
|
+ // Paper end - rewrite chunk system
|
||||||
+
|
+
|
||||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper - create paper world config
|
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper - create paper world config
|
||||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||||
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
||||||
@@ -281,6 +333,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@@ -281,6 +338,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||||
this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
|
this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
|
||||||
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
|
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
|
||||||
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
|
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
|
||||||
@ -27328,7 +27471,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..557273061fa03ebaa4b9de01ad12ed4a
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Paper start - Cancel hit for vanished players
|
// Paper start - Cancel hit for vanished players
|
||||||
@@ -549,7 +602,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@@ -549,7 +607,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||||
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
|
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27337,7 +27480,34 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..557273061fa03ebaa4b9de01ad12ed4a
|
|||||||
this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i);
|
this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -949,7 +1002,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@@ -813,6 +871,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||||
|
// Iterator<TickingBlockEntity> iterator = this.blockEntityTickers.iterator();
|
||||||
|
boolean flag = this.tickRateManager().runsNormally();
|
||||||
|
|
||||||
|
+ int tickedEntities = 0; // Paper - rewrite chunk system
|
||||||
|
+
|
||||||
|
int tilesThisCycle = 0;
|
||||||
|
var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity>(); // Paper - Fix MC-117075; use removeAll
|
||||||
|
toRemove.add(null); // Paper - Fix MC-117075
|
||||||
|
@@ -828,6 +888,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||||
|
// Spigot end
|
||||||
|
} else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
|
||||||
|
tickingblockentity.tick();
|
||||||
|
+ if ((++tickedEntities & 7) == 0) {
|
||||||
|
+ ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)(Level)(Object)this).moonrise$midTickTasks();
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
|
||||||
|
@@ -850,6 +913,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||||
|
entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
|
||||||
|
// Paper end - Prevent block entity and entity crashes
|
||||||
|
}
|
||||||
|
+ this.moonrise$midTickTasks(); // Paper - rewrite chunk system
|
||||||
|
}
|
||||||
|
// Paper start - Option to prevent armor stands from doing entity lookups
|
||||||
|
@Override
|
||||||
|
@@ -949,7 +1013,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||||
}
|
}
|
||||||
// Paper end - Perf: Optimize capturedTileEntities lookup
|
// Paper end - Perf: Optimize capturedTileEntities lookup
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -27346,23 +27516,24 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..557273061fa03ebaa4b9de01ad12ed4a
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockEntity(BlockEntity blockEntity) {
|
public void setBlockEntity(BlockEntity blockEntity) {
|
||||||
@@ -1039,28 +1092,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@@ -1039,28 +1103,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||||
@Override
|
@Override
|
||||||
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
|
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
|
||||||
this.getProfiler().incrementCounter("getEntities");
|
this.getProfiler().incrementCounter("getEntities");
|
||||||
- List<Entity> list = Lists.newArrayList();
|
- List<Entity> list = Lists.newArrayList();
|
||||||
-
|
+ // Paper start - rewrite chunk system
|
||||||
|
+ final List<Entity> ret = new java.util.ArrayList<>();
|
||||||
|
|
||||||
- this.getEntities().get(box, (entity1) -> {
|
- this.getEntities().get(box, (entity1) -> {
|
||||||
- if (entity1 != except && predicate.test(entity1)) {
|
- if (entity1 != except && predicate.test(entity1)) {
|
||||||
- list.add(entity1);
|
- list.add(entity1);
|
||||||
- }
|
- }
|
||||||
+ // Paper start - rewrite chunk system
|
-
|
||||||
+ final List<Entity> ret = new java.util.ArrayList<>();
|
|
||||||
|
|
||||||
- if (entity1 instanceof EnderDragon) {
|
- if (entity1 instanceof EnderDragon) {
|
||||||
- EnderDragonPart[] aentitycomplexpart = ((EnderDragon) entity1).getSubEntities();
|
- EnderDragonPart[] aentitycomplexpart = ((EnderDragon) entity1).getSubEntities();
|
||||||
- int i = aentitycomplexpart.length;
|
- int i = aentitycomplexpart.length;
|
||||||
-
|
+ ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(except, box, ret, predicate);
|
||||||
|
|
||||||
- for (int j = 0; j < i; ++j) {
|
- for (int j = 0; j < i; ++j) {
|
||||||
- EnderDragonPart entitycomplexpart = aentitycomplexpart[j];
|
- EnderDragonPart entitycomplexpart = aentitycomplexpart[j];
|
||||||
-
|
-
|
||||||
@ -27371,8 +27542,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..557273061fa03ebaa4b9de01ad12ed4a
|
|||||||
- }
|
- }
|
||||||
- }
|
- }
|
||||||
- }
|
- }
|
||||||
+ ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(except, box, ret, predicate);
|
-
|
||||||
|
|
||||||
- });
|
- });
|
||||||
- return list;
|
- return list;
|
||||||
+ return ret;
|
+ return ret;
|
||||||
@ -27380,7 +27550,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..557273061fa03ebaa4b9de01ad12ed4a
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1075,36 +1113,77 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@@ -1075,36 +1124,77 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||||
this.getEntities(filter, box, predicate, result, Integer.MAX_VALUE);
|
this.getEntities(filter, box, predicate, result, Integer.MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] disable forced empty world ticks
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index f8ea3298a995901e114cb811c01b504c0029c2af..73c33582eac01cbc6bf3728a78f9e1ee76b2b043 100644
|
index cf33e22ae85cd30b4f5d526dbfececca87d4ee40..db30381b3aeab83bcd0d1a341e4056d7c36a6f11 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -696,7 +696,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
@@ -713,7 +713,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||||
|
|
||||||
this.handlingTick = false;
|
this.handlingTick = false;
|
||||||
gameprofilerfiller.pop();
|
gameprofilerfiller.pop();
|
||||||
|
@ -29,10 +29,10 @@ index 02367ef1371dde94ff6c4cd40bd32e800d6ccaaf..7b0fc7135bc107103dcaed6dc0707b18
|
|||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
index 557273061fa03ebaa4b9de01ad12ed4ac859c292..316a72f5019d4ad65237b41ccb4ef3be729246ad 100644
|
index 613752e2df61fdd8010f8ad0cf25257580bfe32e..fe14d02b7c3ed2b69717622f392bf077171343fd 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
@@ -394,7 +394,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
@@ -399,7 +399,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
public boolean isInWorldBounds(BlockPos pos) {
|
public boolean isInWorldBounds(BlockPos pos) {
|
||||||
|
@ -13,10 +13,10 @@ custom renderers are in use, defaulting to the much simpler Vanilla system.
|
|||||||
Additionally, numerous issues to player position tracking on maps has been fixed.
|
Additionally, numerous issues to player position tracking on maps has been fixed.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 73c33582eac01cbc6bf3728a78f9e1ee76b2b043..b65927095e36451c53cdae770701a33470eaadbc 100644
|
index db30381b3aeab83bcd0d1a341e4056d7c36a6f11..fc011c30628d77d55defe421db6ac194217e8def 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -2465,6 +2465,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
@@ -2492,6 +2492,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||||
{
|
{
|
||||||
if ( iter.next().player == entity )
|
if ( iter.next().player == entity )
|
||||||
{
|
{
|
||||||
|
@ -62,10 +62,10 @@ index bb8e962e63c7a2d931f9bd7f7c002aa35cfa5fd3..0fa131a6c98adb498fc8d534e0e39647
|
|||||||
default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) {
|
default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) {
|
||||||
// Paper start - Add predicate for blocks when raytracing
|
// Paper start - Add predicate for blocks when raytracing
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
index 316a72f5019d4ad65237b41ccb4ef3be729246ad..5ea8f51accdda2387b640d2cff1d6a8baa673bee 100644
|
index fe14d02b7c3ed2b69717622f392bf077171343fd..ea81c6e924091bf86ddbc001f9ecdb58c9c3e5b2 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
@@ -386,10 +386,87 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
@@ -391,10 +391,87 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ Adds villagers as separate config
|
|||||||
public net.minecraft.world.entity.Entity isInsidePortal
|
public net.minecraft.world.entity.Entity isInsidePortal
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index b65927095e36451c53cdae770701a33470eaadbc..19de709c25cfb5a7d1ed810f93d100226d83758f 100644
|
index fc011c30628d77d55defe421db6ac194217e8def..975174a2f20e1597ffd2f9d840c77eec3c353b88 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -2,7 +2,6 @@ package net.minecraft.server.level;
|
@@ -2,7 +2,6 @@ package net.minecraft.server.level;
|
||||||
@ -28,7 +28,7 @@ index b65927095e36451c53cdae770701a33470eaadbc..19de709c25cfb5a7d1ed810f93d10022
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.mojang.datafixers.DataFixer;
|
import com.mojang.datafixers.DataFixer;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
@@ -1163,17 +1162,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
@@ -1190,17 +1189,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||||
++TimingHistory.entityTicks; // Paper - timings
|
++TimingHistory.entityTicks; // Paper - timings
|
||||||
// Spigot start
|
// Spigot start
|
||||||
co.aikar.timings.Timing timer; // Paper
|
co.aikar.timings.Timing timer; // Paper
|
||||||
@ -50,7 +50,7 @@ index b65927095e36451c53cdae770701a33470eaadbc..19de709c25cfb5a7d1ed810f93d10022
|
|||||||
try {
|
try {
|
||||||
// Paper end - timings
|
// Paper end - timings
|
||||||
entity.setOldPosAndRot();
|
entity.setOldPosAndRot();
|
||||||
@@ -1184,9 +1183,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
@@ -1211,9 +1210,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||||
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
|
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
|
||||||
});
|
});
|
||||||
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
||||||
@ -64,7 +64,7 @@ index b65927095e36451c53cdae770701a33470eaadbc..19de709c25cfb5a7d1ed810f93d10022
|
|||||||
Iterator iterator = entity.getPassengers().iterator();
|
Iterator iterator = entity.getPassengers().iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@@ -1194,13 +1197,18 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
@@ -1221,13 +1224,18 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||||
|
|
||||||
this.tickPassenger(entity, entity1);
|
this.tickPassenger(entity, entity1);
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ index b65927095e36451c53cdae770701a33470eaadbc..19de709c25cfb5a7d1ed810f93d10022
|
|||||||
passenger.setOldPosAndRot();
|
passenger.setOldPosAndRot();
|
||||||
++passenger.tickCount;
|
++passenger.tickCount;
|
||||||
ProfilerFiller gameprofilerfiller = this.getProfiler();
|
ProfilerFiller gameprofilerfiller = this.getProfiler();
|
||||||
@@ -1209,8 +1217,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
@@ -1236,8 +1244,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||||
return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString();
|
return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString();
|
||||||
});
|
});
|
||||||
gameprofilerfiller.incrementCounter("tickPassenger");
|
gameprofilerfiller.incrementCounter("tickPassenger");
|
||||||
@ -102,7 +102,7 @@ index b65927095e36451c53cdae770701a33470eaadbc..19de709c25cfb5a7d1ed810f93d10022
|
|||||||
gameprofilerfiller.pop();
|
gameprofilerfiller.pop();
|
||||||
Iterator iterator = passenger.getPassengers().iterator();
|
Iterator iterator = passenger.getPassengers().iterator();
|
||||||
|
|
||||||
@@ -1220,6 +1237,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
@@ -1247,6 +1264,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||||
this.tickPassenger(passenger, entity2);
|
this.tickPassenger(passenger, entity2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ index 0b7f52021441d633c37543e8ae485e81c292b747..d7f8464bf3eed0e42a5fc7f14a5b243d
|
|||||||
+
|
+
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
index 5ea8f51accdda2387b640d2cff1d6a8baa673bee..3fa8ae3a9afd81bf757ee1e183684442444376f4 100644
|
index ea81c6e924091bf86ddbc001f9ecdb58c9c3e5b2..c64bb7858345d93e4b2e65404ffdaffde8458c0f 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
@@ -156,6 +156,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
@@ -156,6 +156,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||||
|
@ -37,10 +37,10 @@ index 1363dda031d1b541d76241812a957a12521cbc05..b24d5b0818abfc8b969ab715ca21959c
|
|||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
index 014e7d3c3b9e8f6c2b456d63bcf885f55b01ded9..7bb3277883a326c436ef070eaf285343fe502a32 100644
|
index 67eb2fb32de3555b3afb4b4b7a3a47a164158ac8..bafeda818e02eb3de9dc78f62106a0d3e95d476b 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
@@ -438,7 +438,19 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
@@ -439,7 +439,19 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
||||||
gameprofilerfiller.popPush("naturalSpawnCount");
|
gameprofilerfiller.popPush("naturalSpawnCount");
|
||||||
this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
|
this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
|
||||||
int k = this.distanceManager.getNaturalSpawnChunkCount();
|
int k = this.distanceManager.getNaturalSpawnChunkCount();
|
||||||
|
@ -1104,10 +1104,10 @@ index 183b2191fa1c1b27adedf39593e1b5a223fb1279..8ead66c134688b11dca15f6509147e72
|
|||||||
|
|
||||||
private ClientboundLevelChunkWithLightPacket(RegistryFriendlyByteBuf buf) {
|
private ClientboundLevelChunkWithLightPacket(RegistryFriendlyByteBuf buf) {
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 19de709c25cfb5a7d1ed810f93d100226d83758f..a463cdd3b9dbda64d52c86223e1f2e1164deac80 100644
|
index 975174a2f20e1597ffd2f9d840c77eec3c353b88..8daa490817367391cac5c9852e0755b280fb9054 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -501,7 +501,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
@@ -518,7 +518,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||||
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
|
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
|
||||||
|
|
||||||
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
|
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
|
||||||
@ -1168,7 +1168,7 @@ index 9b1a6d8351fb473eec75a2fd08fb892b770e3586..0d0b07c9199be9ca0d5ac3feb1d44f14
|
|||||||
}
|
}
|
||||||
// Paper end - Send empty chunk
|
// Paper end - Send empty chunk
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
index 3fa8ae3a9afd81bf757ee1e183684442444376f4..392032d749b8a9077b61f4e1c5e413de048c7067 100644
|
index c64bb7858345d93e4b2e65404ffdaffde8458c0f..4994b964819600604cb123d4cf7ec27978796bb8 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
@@ -171,6 +171,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
@@ -171,6 +171,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||||
@ -1179,7 +1179,7 @@ index 3fa8ae3a9afd81bf757ee1e183684442444376f4..392032d749b8a9077b61f4e1c5e413de
|
|||||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||||
public static BlockPos lastPhysicsProblem; // Spigot
|
public static BlockPos lastPhysicsProblem; // Spigot
|
||||||
private org.spigotmc.TickLimiter entityLimiter;
|
private org.spigotmc.TickLimiter entityLimiter;
|
||||||
@@ -257,7 +258,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
@@ -262,7 +263,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||||
}
|
}
|
||||||
// Paper end - rewrite chunk system
|
// Paper end - rewrite chunk system
|
||||||
|
|
||||||
@ -1188,7 +1188,7 @@ index 3fa8ae3a9afd81bf757ee1e183684442444376f4..392032d749b8a9077b61f4e1c5e413de
|
|||||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||||
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
||||||
this.generator = gen;
|
this.generator = gen;
|
||||||
@@ -340,6 +341,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
@@ -345,6 +346,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||||
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
|
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
|
||||||
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
|
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
|
||||||
this.entityLookup = new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.dfl.DefaultEntityLookup(this); // Paper - rewrite chunk system
|
this.entityLookup = new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.dfl.DefaultEntityLookup(this); // Paper - rewrite chunk system
|
||||||
@ -1196,7 +1196,7 @@ index 3fa8ae3a9afd81bf757ee1e183684442444376f4..392032d749b8a9077b61f4e1c5e413de
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Paper start - Cancel hit for vanished players
|
// Paper start - Cancel hit for vanished players
|
||||||
@@ -617,6 +619,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
@@ -622,6 +624,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
BlockState iblockdata1 = chunk.setBlockState(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag
|
BlockState iblockdata1 = chunk.setBlockState(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag
|
||||||
|
@ -2009,7 +2009,7 @@ index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf78
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index a463cdd3b9dbda64d52c86223e1f2e1164deac80..798016774df02c3f7ebf909c9cc125f8427a39be 100644
|
index 8daa490817367391cac5c9852e0755b280fb9054..2d97ca1f3c625c0206d35b785c57d9587924ed0a 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -228,6 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
@@ -228,6 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||||
@ -2020,7 +2020,7 @@ index a463cdd3b9dbda64d52c86223e1f2e1164deac80..798016774df02c3f7ebf909c9cc125f8
|
|||||||
|
|
||||||
public LevelChunk getChunkIfLoaded(int x, int z) {
|
public LevelChunk getChunkIfLoaded(int x, int z) {
|
||||||
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
|
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
|
||||||
@@ -2396,6 +2397,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
@@ -2423,6 +2424,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||||
return crashreportsystemdetails;
|
return crashreportsystemdetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2035,10 +2035,10 @@ index a463cdd3b9dbda64d52c86223e1f2e1164deac80..798016774df02c3f7ebf909c9cc125f8
|
|||||||
|
|
||||||
EntityCallbacks() {}
|
EntityCallbacks() {}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
index 392032d749b8a9077b61f4e1c5e413de048c7067..55e841269585feb6a083b48ffeecea30cc65f6d6 100644
|
index 4994b964819600604cb123d4cf7ec27978796bb8..06e9fc703b0ef722cc21a365203a561009047d23 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
@@ -1568,4 +1568,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
@@ -1579,4 +1579,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Paper end - notify observers even if grow failed
|
// Paper end - notify observers even if grow failed
|
||||||
|
@ -37,10 +37,10 @@ index b24d5b0818abfc8b969ab715ca21959c235a9d70..c96740a82eac9101f74edeb44edf4b64
|
|||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
index 7bb3277883a326c436ef070eaf285343fe502a32..82e7f7c3c2f51bc135585f43bc5167bcde2f8a98 100644
|
index bafeda818e02eb3de9dc78f62106a0d3e95d476b..64ed296cfbe7e5d27286b8cee70454fd1d99ebb0 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
@@ -444,7 +444,17 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
@@ -445,7 +445,17 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
||||||
if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled
|
if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled
|
||||||
// re-set mob counts
|
// re-set mob counts
|
||||||
for (ServerPlayer player : this.level.players) {
|
for (ServerPlayer player : this.level.players) {
|
||||||
|
@ -50,10 +50,10 @@ index 0000000000000000000000000000000000000000..5c42823726e70ce6c9d0121d07431548
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index 3c230ae060998bfb79d5812fef21a80a9df8c8ff..64d0e04b6f9c52d90d0bc185b16a8a4768af4ac1 100644
|
index 91cc3eb6db2875710064f6b31413ccc84af56bb2..17b0e570016504d1b7704bbfa9ff2e3233b45d09 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -1659,6 +1659,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1722,6 +1722,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
ServerLevel worldserver = (ServerLevel) iterator.next();
|
ServerLevel worldserver = (ServerLevel) iterator.next();
|
||||||
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
|
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
|
||||||
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
|
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
|
||||||
|
@ -71,7 +71,7 @@ index 589a8bf75be6ccc59f1e5dd5d8d9afed41c4772d..b24265573fdef5d9a964bcd76146f345
|
|||||||
cause = cause.getCause();
|
cause = cause.getCause();
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index 64d0e04b6f9c52d90d0bc185b16a8a4768af4ac1..68f60e77e0bfd42b6419491c1d59b6432974216b 100644
|
index 17b0e570016504d1b7704bbfa9ff2e3233b45d09..330bee331335454a61cf8350a6654217c8124445 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -307,7 +307,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -307,7 +307,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
@ -93,7 +93,7 @@ index 64d0e04b6f9c52d90d0bc185b16a8a4768af4ac1..68f60e77e0bfd42b6419491c1d59b643
|
|||||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||||
AtomicReference<S> atomicreference = new AtomicReference();
|
AtomicReference<S> atomicreference = new AtomicReference();
|
||||||
Thread thread = new io.papermc.paper.util.TickThread(() -> { // Paper - rewrite chunk system
|
Thread thread = new io.papermc.paper.util.TickThread(() -> { // Paper - rewrite chunk system
|
||||||
@@ -943,6 +946,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1005,6 +1008,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
private boolean hasStopped = false;
|
private boolean hasStopped = false;
|
||||||
private boolean hasLoggedStop = false; // Paper - Debugging
|
private boolean hasLoggedStop = false; // Paper - Debugging
|
||||||
@ -101,7 +101,7 @@ index 64d0e04b6f9c52d90d0bc185b16a8a4768af4ac1..68f60e77e0bfd42b6419491c1d59b643
|
|||||||
private final Object stopLock = new Object();
|
private final Object stopLock = new Object();
|
||||||
public final boolean hasStopped() {
|
public final boolean hasStopped() {
|
||||||
synchronized (this.stopLock) {
|
synchronized (this.stopLock) {
|
||||||
@@ -958,6 +962,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1020,6 +1024,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
this.hasStopped = true;
|
this.hasStopped = true;
|
||||||
}
|
}
|
||||||
if (!hasLoggedStop && isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
|
if (!hasLoggedStop && isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
|
||||||
@ -121,7 +121,7 @@ index 64d0e04b6f9c52d90d0bc185b16a8a4768af4ac1..68f60e77e0bfd42b6419491c1d59b643
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
if (this.metricsRecorder.isRecording()) {
|
if (this.metricsRecorder.isRecording()) {
|
||||||
this.cancelRecordingMetrics();
|
this.cancelRecordingMetrics();
|
||||||
@@ -1031,7 +1048,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1093,7 +1110,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
}
|
}
|
||||||
// Spigot end
|
// Spigot end
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ index 64d0e04b6f9c52d90d0bc185b16a8a4768af4ac1..68f60e77e0bfd42b6419491c1d59b643
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getLocalIp() {
|
public String getLocalIp() {
|
||||||
@@ -1126,6 +1153,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1188,6 +1215,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
|
||||||
protected void runServer() {
|
protected void runServer() {
|
||||||
try {
|
try {
|
||||||
@ -147,7 +147,7 @@ index 64d0e04b6f9c52d90d0bc185b16a8a4768af4ac1..68f60e77e0bfd42b6419491c1d59b643
|
|||||||
if (!this.initServer()) {
|
if (!this.initServer()) {
|
||||||
throw new IllegalStateException("Failed to initialize server");
|
throw new IllegalStateException("Failed to initialize server");
|
||||||
}
|
}
|
||||||
@@ -1135,6 +1163,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1197,6 +1225,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
this.status = this.buildServerStatus();
|
this.status = this.buildServerStatus();
|
||||||
|
|
||||||
// Spigot start
|
// Spigot start
|
||||||
@ -166,7 +166,7 @@ index 64d0e04b6f9c52d90d0bc185b16a8a4768af4ac1..68f60e77e0bfd42b6419491c1d59b643
|
|||||||
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
|
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
|
||||||
Arrays.fill( this.recentTps, 20 );
|
Arrays.fill( this.recentTps, 20 );
|
||||||
// Paper start - further improve server tick loop
|
// Paper start - further improve server tick loop
|
||||||
@@ -1230,6 +1270,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1292,6 +1332,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis);
|
JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis);
|
||||||
}
|
}
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
@ -179,7 +179,7 @@ index 64d0e04b6f9c52d90d0bc185b16a8a4768af4ac1..68f60e77e0bfd42b6419491c1d59b643
|
|||||||
MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable);
|
MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable);
|
||||||
CrashReport crashreport = MinecraftServer.constructOrExtractCrashReport(throwable);
|
CrashReport crashreport = MinecraftServer.constructOrExtractCrashReport(throwable);
|
||||||
|
|
||||||
@@ -1254,15 +1300,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1316,15 +1362,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
this.services.profileCache().clearExecutor();
|
this.services.profileCache().clearExecutor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ index 64d0e04b6f9c52d90d0bc185b16a8a4768af4ac1..68f60e77e0bfd42b6419491c1d59b643
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1385,6 +1431,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1447,6 +1493,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TickTask wrapRunnable(Runnable runnable) {
|
public TickTask wrapRunnable(Runnable runnable) {
|
||||||
@ -212,7 +212,7 @@ index 64d0e04b6f9c52d90d0bc185b16a8a4768af4ac1..68f60e77e0bfd42b6419491c1d59b643
|
|||||||
return new TickTask(this.tickCount, runnable);
|
return new TickTask(this.tickCount, runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2204,7 +2256,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -2267,7 +2319,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
this.worldData.setDataConfiguration(worlddataconfiguration);
|
this.worldData.setDataConfiguration(worlddataconfiguration);
|
||||||
this.resources.managers.updateRegistryTags();
|
this.resources.managers.updateRegistryTags();
|
||||||
this.potionBrewing = this.potionBrewing.reload(this.worldData.enabledFeatures()); // Paper - Custom Potion Mixes
|
this.potionBrewing = this.potionBrewing.reload(this.worldData.enabledFeatures()); // Paper - Custom Potion Mixes
|
||||||
@ -287,10 +287,10 @@ index 2510589400b3012b827efcab477c6483d9d55901..43487a9ee202c5b0e5a416519939111f
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
index 55e841269585feb6a083b48ffeecea30cc65f6d6..fee155c81df385faa474e3aec777a30375ecb07d 100644
|
index 06e9fc703b0ef722cc21a365203a561009047d23..fa6b8ce6505a3c094187298a63b0e944e1e74af1 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
@@ -982,6 +982,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
@@ -992,6 +992,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||||
try {
|
try {
|
||||||
tickConsumer.accept(entity);
|
tickConsumer.accept(entity);
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
|
Loading…
Reference in New Issue
Block a user