Correctly clear explosion density cache(#11541)

This commit is contained in:
Noah van der Aa 2024-10-31 22:30:18 +01:00 committed by GitHub
parent c5c125079c
commit 7ee4835074
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 93 additions and 93 deletions

View File

@ -10,17 +10,17 @@ This patch adds a per-tick cache that is used for storing and retrieving
an entity's exposure during an explosion.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b86d8a3756cb8c1adb1aceda57f60b0ccdb3f659..cc4c5fcbeca4862d8ff78b127cb3f2c07956dfaf 100644
index b86d8a3756cb8c1adb1aceda57f60b0ccdb3f659..43c7014b51f1f46a0e52f0595e85636767ed92ff 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -400,6 +400,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (System.console() == null && System.getProperty("jline.terminal") == null) {
System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
Main.useJline = false;
@@ -1611,6 +1611,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
gameprofilerfiller.pop();
gameprofilerfiller.pop();
+ worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
}
try {
gameprofilerfiller.popPush("connection");
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 071545e60f838fa6c930edc35f46e0ce9b73fb44..e90dac1e46bca60896b027f670ba521d67c02c1e 100644
--- a/src/main/java/net/minecraft/world/level/Level.java

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener
Saves on some object allocation and processing when no plugin listens to this
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index cc4c5fcbeca4862d8ff78b127cb3f2c07956dfaf..ece7f630937abd6d341a2498bac2f0afcfb1ce0f 100644
index 43c7014b51f1f46a0e52f0595e85636767ed92ff..0db5bd55b738baa51f5f2790d398a22b802ae070 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1585,6 +1585,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1584,6 +1584,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();

View File

@ -18,10 +18,10 @@ index 9a1a961eabd4362c171da78c6be82c867f3696a4..1d0c473442b5c72245c356054440323e
ComponentSerialization.TRUSTED_STREAM_CODEC.encode(buf, this.playerPrefix);
ComponentSerialization.TRUSTED_STREAM_CODEC.encode(buf, this.playerSuffix);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ece7f630937abd6d341a2498bac2f0afcfb1ce0f..2e6531f39c6b65d79fc544459629ef61b2ad961a 100644
index 0db5bd55b738baa51f5f2790d398a22b802ae070..351dbb35a9ba0ce52cd5e182ef6dd8c3d54c28f6 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -654,6 +654,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -653,6 +653,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Async GameProfileCache saving
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index bdc4eafcad57bb0073662e904bde87e9ac5ed0f3..383808406dd3a6c5b6098db93e638749489b80e3 100644
index 04b57bc2f99adcd65cd21350effe066af2e806df..12c8a4f79abf2c2c15bd271cff4c4ca800e0625a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1012,7 +1012,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1011,7 +1011,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} catch (java.lang.InterruptedException ignored) {} // Paper
if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
MinecraftServer.LOGGER.info("Saving usercache.json");

View File

@ -30,7 +30,7 @@ will have plugins and worlds saving to the disk has a high potential to result
in corruption/dataloss.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 383808406dd3a6c5b6098db93e638749489b80e3..0adba72139779a20eed8f489f7cfaff9e84e24f4 100644
index 12c8a4f79abf2c2c15bd271cff4c4ca800e0625a..d69d759de22726f4a825cb5e485670aefe05df4a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -247,6 +247,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -41,7 +41,7 @@ index 383808406dd3a6c5b6098db93e638749489b80e3..0adba72139779a20eed8f489f7cfaff9
private boolean stopped;
private int tickCount;
private int ticksUntilAutosave;
@@ -951,7 +952,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -950,7 +951,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.playerList != null) {
MinecraftServer.LOGGER.info("Saving players");
this.playerList.saveAll();
@ -50,7 +50,7 @@ index 383808406dd3a6c5b6098db93e638749489b80e3..0adba72139779a20eed8f489f7cfaff9
try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets
}
@@ -1031,6 +1032,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1030,6 +1031,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void halt(boolean waitForShutdown) {

View File

@ -170,7 +170,7 @@ index 0000000000000000000000000000000000000000..30a19d10869f73d67b794e8e4c035bc5
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0adba72139779a20eed8f489f7cfaff9e84e24f4..260d755666efc94e2ea2c8fdb38d7deddda82c08 100644
index d69d759de22726f4a825cb5e485670aefe05df4a..762c62923bbf38d59f65038222ff7923f3292d33 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -3,6 +3,9 @@ package net.minecraft.server;
@ -183,7 +183,7 @@ index 0adba72139779a20eed8f489f7cfaff9e84e24f4..260d755666efc94e2ea2c8fdb38d7ded
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -1564,7 +1567,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1563,7 +1566,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hidesOnlinePlayers()) {
return new ServerStatus.Players(i, list.size(), List.of());
} else {

View File

@ -9,10 +9,10 @@ thread dumps at an interval until the point of crash.
This will help diagnose what was going on in that time before the crash.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 260d755666efc94e2ea2c8fdb38d7deddda82c08..eb0adba0178a88243946e0c7f39503aa8c7d8feb 100644
index 762c62923bbf38d59f65038222ff7923f3292d33..c4d8918a7accbe5eb3035b4ec3b423f30c613d60 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1121,6 +1121,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1120,6 +1120,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.status = this.buildServerStatus();
// Spigot start

View File

@ -8,10 +8,10 @@ the updates per world, so that we can re-use the same packet
object for every player unless they have per-player time enabled.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3669a2943b01e0e9add41df1ff38afd1cd40e96b..a4c897000a5e70e64b5fe4306581b04d8d38bce2 100644
index b54c1ecf3384fba741fa6334caee498b83887508..13aa191235ac6bb1d00d89ae29c750595cc6be78 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1604,10 +1604,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1603,10 +1603,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Send time updates to everyone, it will get the right time from the world the player is in.

View File

@ -53,10 +53,10 @@ index 2008fd542eaf1c2fac776ae1751c227a3b6dde4b..e812cc865baaa1ee03872f7969ee9860
event.getPlayer().getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a4c897000a5e70e64b5fe4306581b04d8d38bce2..8f427475f7418bbfb8121dbd3e25e7827775ea41 100644
index 13aa191235ac6bb1d00d89ae29c750595cc6be78..0f1a7b649d398a875b57746530242e3ced595bfd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -945,6 +945,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -944,6 +944,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
MinecraftServer.LOGGER.info("Stopping server");

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Server Tick Events
Fires event at start and end of a server tick
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8f427475f7418bbfb8121dbd3e25e7827775ea41..447b8f9ede3f57c6c5f968a0d25153c5c8770c5a 100644
index 0f1a7b649d398a875b57746530242e3ced595bfd..59bd596a140b4b389c5b73adaab94323759abfc2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1482,6 +1482,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1481,6 +1481,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
@ -17,7 +17,7 @@ index 8f427475f7418bbfb8121dbd3e25e7827775ea41..447b8f9ede3f57c6c5f968a0d25153c5
++this.tickCount;
this.tickRateManager.tick();
this.tickChildren(shouldKeepTicking);
@@ -1498,6 +1499,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1497,6 +1498,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ProfilerFiller gameprofilerfiller = Profiler.get();
this.runAllTasks(); // Paper - move runAllTasks() into full server tick (previously for timings)

View File

@ -125,7 +125,7 @@ index 72f2e81b9905a0d57ed8e2a88578f62d5235c456..7b58b2d6297800c2dcdbf7539e5ab8e7
public static void registerCommands(final MinecraftServer server) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 447b8f9ede3f57c6c5f968a0d25153c5c8770c5a..652626c30a5e25ada797ec01273f1e016798aae1 100644
index 59bd596a140b4b389c5b73adaab94323759abfc2..e07b25d5e633d2dcc6e9850afd7b8aa0287ec6bc 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -263,6 +263,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -140,7 +140,7 @@ index 447b8f9ede3f57c6c5f968a0d25153c5c8770c5a..652626c30a5e25ada797ec01273f1e01
@Nullable
private KeyPair keyPair;
@Nullable
@@ -1512,6 +1517,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1511,6 +1516,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.aggregatedTickTimesNanos += k;
this.tickTimesNanos[l] = k;
this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float) k / (float) TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F;

View File

@ -49,10 +49,10 @@ index c847fbdb6f52386570eb4c070fcc01d39cc52151..a7eb2a37a81a414dcb19319c075faefe
StackTraceElement[] astacktraceelement = exception.getStackTrace();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 652626c30a5e25ada797ec01273f1e016798aae1..909302aa0afc082a2d0bf55fd31ff9c510e8c3c5 100644
index e07b25d5e633d2dcc6e9850afd7b8aa0287ec6bc..52cf2b4de3f544790f6372cbfffb0429ea311818 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -930,6 +930,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -929,6 +929,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
private boolean hasStopped = false;
@ -60,7 +60,7 @@ index 652626c30a5e25ada797ec01273f1e016798aae1..909302aa0afc082a2d0bf55fd31ff9c5
private final Object stopLock = new Object();
public final boolean hasStopped() {
synchronized (this.stopLock) {
@@ -944,6 +945,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -943,6 +944,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hasStopped) return;
this.hasStopped = true;
}
@ -68,7 +68,7 @@ index 652626c30a5e25ada797ec01273f1e016798aae1..909302aa0afc082a2d0bf55fd31ff9c5
// CraftBukkit end
if (this.metricsRecorder.isRecording()) {
this.cancelRecordingMetrics();
@@ -1047,6 +1049,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1046,6 +1048,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void safeShutdown(boolean waitForShutdown, boolean isRestarting) {
this.isRestarting = isRestarting;

View File

@ -10,10 +10,10 @@ Adds a 5 second grace period for any async tasks to finish and warns
if any are still running after that delay just as reload does.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 909302aa0afc082a2d0bf55fd31ff9c510e8c3c5..03d6045fd5721b32852a357f1f2e3d2e16efb85b 100644
index 52cf2b4de3f544790f6372cbfffb0429ea311818..3d2c70ab9938555c976588b0a98901d57876e51e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -956,6 +956,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -955,6 +955,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();

View File

@ -8,10 +8,10 @@ makes it so that the server keeps the last difficulty used instead
of restoring the server.properties every single load.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 03d6045fd5721b32852a357f1f2e3d2e16efb85b..fce70aa2b0d92c6291720b75a07a6472eb55855b 100644
index 3d2c70ab9938555c976588b0a98901d57876e51e..99b5877fc2f568929b35aa10638173bbef27503b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -851,7 +851,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -850,7 +850,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worldloadlistener.stop();
// CraftBukkit start
// this.updateMobSpawningFlags();

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add EntityMoveEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 264d0f57422b4fc03c5845d7456b22c9a48dd7ae..a200aacb1eaa749baa36be8be63b3f1421913b60 100644
index 3aed6821527133c7c0db9a04b9ac19ae5531d006..9e96998a36b63a1723406819eccb7841a96753fb 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1648,6 +1648,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1647,6 +1647,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Expose vanilla BiomeProvider from WorldInfo
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7ab9a9c04f94a68dccb5ec9bfc8171bfc02927a2..8cbc8eeaa8719f8bb136543e80ec85248c90e154 100644
index 8e0bc6559aad75a713e1760ea17e5004686d7e7a..0db44e8205d795cbeca1d6411aca0da5edf40d21 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -626,7 +626,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -625,7 +625,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(iworlddataserver));
LevelStem worlddimension = (LevelStem) dimensions.getValue(dimensionKey);

View File

@ -9,10 +9,10 @@ This might result in chunks loading far slower in the nether,
for example.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8cbc8eeaa8719f8bb136543e80ec85248c90e154..3cd23d329fae0a6a4eff36510edc5d9bd27c804e 100644
index 0db44e8205d795cbeca1d6411aca0da5edf40d21..606c63342dcfb88e5c5d34c2e841ec8fa12e38e7 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1405,6 +1405,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1404,6 +1404,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (super.pollTask()) {
return true;
} else {
@ -20,7 +20,7 @@ index 8cbc8eeaa8719f8bb136543e80ec85248c90e154..3cd23d329fae0a6a4eff36510edc5d9b
if (this.tickRateManager.isSprinting() || this.haveTime()) {
Iterator iterator = this.getAllLevels().iterator();
@@ -1412,12 +1413,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1411,12 +1412,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ServerLevel worldserver = (ServerLevel) iterator.next();
if (worldserver.getChunkSource().pollTask()) {

View File

@ -10,10 +10,10 @@ just looking at the LevelStem key, look at the DimensionType key which
is one level below that. Defaults to off to keep vanilla behavior.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3cd23d329fae0a6a4eff36510edc5d9bd27c804e..6fdc5be323833c4ca2722b695fe790ea2ecc53d5 100644
index 606c63342dcfb88e5c5d34c2e841ec8fa12e38e7..df93afc35403db15aa8e09b7e36ca0bb630041eb 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -646,7 +646,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -645,7 +645,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.commandStorage = new CommandStorage(worldpersistentdata);
} else {
ChunkProgressListener worldloadlistener = this.progressListenerFactory.create(this.worldData.getGameRules().getInt(GameRules.RULE_SPAWN_CHUNK_RADIUS));

View File

@ -7,10 +7,10 @@ Some parts of legacy conversion will need the overworld
to get the legacy structure data storage
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6fdc5be323833c4ca2722b695fe790ea2ecc53d5..88d4021bc4f9ab7c9ee33a5a5c2326b7c628f4a4 100644
index df93afc35403db15aa8e09b7e36ca0bb630041eb..4cbb5fdcb8734d3944963b911bb759923ad38d16 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -658,9 +658,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -657,9 +657,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());

View File

@ -7,7 +7,7 @@ There are no plans to support creating worlds while worlds are
being ticked themselvess.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a836ea518bc6d8ddd7c6484038d3d712b3fb13cf..aa9a4a0f35d0200777bdc83520ba82a970bfa900 100644
index 57c52a30d284332361f28d6138d3c5f1fc6d52bd..25e2baf2109b27887e4b3631d948907d9d8d65a2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -327,6 +327,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -18,7 +18,7 @@ index a836ea518bc6d8ddd7c6484038d3d712b3fb13cf..aa9a4a0f35d0200777bdc83520ba82a9
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
@@ -1627,7 +1628,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1626,7 +1627,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
gameprofilerfiller.push("commandFunctions");
this.getFunctions().tick();
gameprofilerfiller.popPush("levels");
@ -27,7 +27,7 @@ index a836ea518bc6d8ddd7c6484038d3d712b3fb13cf..aa9a4a0f35d0200777bdc83520ba82a9
// CraftBukkit start
// Run tasks that are waiting on processing
@@ -1655,6 +1656,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1654,6 +1655,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
@ -38,7 +38,7 @@ index a836ea518bc6d8ddd7c6484038d3d712b3fb13cf..aa9a4a0f35d0200777bdc83520ba82a9
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
@@ -1687,6 +1690,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
gameprofilerfiller.pop();
gameprofilerfiller.pop();
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
}
+ this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked

View File

@ -37,10 +37,10 @@ index 0000000000000000000000000000000000000000..c1d3bac79bb8b4796c013ff4472f75dc
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index aa9a4a0f35d0200777bdc83520ba82a970bfa900..cb40a2d855e7ac8c1c8b4ec679fd057a31f3fc6f 100644
index 25e2baf2109b27887e4b3631d948907d9d8d65a2..3fc8e626bc66f3cf32d165099ed7a6e4300e8146 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1277,6 +1277,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1276,6 +1276,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} catch (Exception ignored) {
}
// CraftBukkit end

View File

@ -1148,10 +1148,10 @@ index 0000000000000000000000000000000000000000..d306f911757a4d556c82c0070d4837db
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8f7a808b0c89953a7f2932e68e2c85f9330469f2..be188079f12b3f7b394ae91db62cc17b1d0f4e79 100644
index 741b5ba321d9bd854afb9b54f0e23c739c7f929c..9312279f8f958cd1fd13e8333ca476809e956e1c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1625,6 +1625,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1624,6 +1624,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
entityplayer.connection.suspendFlushing();
});
this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit

View File

@ -29,10 +29,10 @@ index 56798215644d8bca1695856b3a941e8089f49e48..46c37c8db8ecf3cc808fcf59f6bee5fe
return instance;
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index be188079f12b3f7b394ae91db62cc17b1d0f4e79..2de0ae09de41f3ed254318a78d65045fc76e5016 100644
index 9312279f8f958cd1fd13e8333ca476809e956e1c..95786d2e1a8ac0fdbe8d449b3f100ac0512ee21e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1149,6 +1149,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1148,6 +1148,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
long tickSection = Util.getNanos();
long currentTime;
// Paper end - further improve server tick loop

View File

@ -2218,7 +2218,7 @@ index 55484826fc5ddd04ae024e25a0251796d7fa9c28..237e4f7b24908e9ade9a483eb7ae05fa
Component component = message.resolveComponent(commandSourceStack);
CommandSigningContext commandSigningContext = commandSourceStack.getSigningContext();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2de0ae09de41f3ed254318a78d65045fc76e5016..2d2bb7ed1456d90e7d9218a445a1cf26aaaa6ede 100644
index 95786d2e1a8ac0fdbe8d449b3f100ac0512ee21e..b13b3991292ab96542ba390f3e8e3ff0d7529c44 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -316,7 +316,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -2238,7 +2238,7 @@ index 2de0ae09de41f3ed254318a78d65045fc76e5016..2d2bb7ed1456d90e7d9218a445a1cf26
// Paper start - Handled by TerminalConsoleAppender
// Try to see if we're actually running in a terminal, disable jline if not
/*
@@ -692,6 +691,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -691,6 +690,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins

View File

@ -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
index 2d2bb7ed1456d90e7d9218a445a1cf26aaaa6ede..e3e3099bb33d21055e480fdbd2df2a3e159f0f1a 100644
index b13b3991292ab96542ba390f3e8e3ff0d7529c44..ff6f2dc31bbbaa420323a68282cb1ee3d8b98c0f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1689,6 +1689,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1688,6 +1688,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ServerLevel worldserver = (ServerLevel) iterator.next();
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

View File

@ -23386,7 +23386,7 @@ index fc6ce3485dc890f5105a37fe3e344a1460867556..e114e687f2f4503546687fd6792226a6
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
index 843f8ccce6302a6db6cc61c496a5eee21305a88f..e0b80b23197307d156ade8427a5227acbc45eb92 100644
index e18692ad6bdbc8bc2df605833501b1ad888b8b7d..ed1f8c735bf9f13014112056b85ff195b02ee76e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -204,7 +204,7 @@ import org.bukkit.event.server.ServerLoadEvent;
@ -23485,7 +23485,7 @@ index 843f8ccce6302a6db6cc61c496a5eee21305a88f..e0b80b23197307d156ade8427a5227ac
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");
SERVER = this; // Paper - better singleton
@@ -671,7 +742,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -670,7 +741,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.forceDifficulty();
for (ServerLevel worldserver : this.getAllLevels()) {
this.prepareLevels(worldserver.getChunkSource().chunkMap.progressListener, worldserver);
@ -23494,7 +23494,7 @@ index 843f8ccce6302a6db6cc61c496a5eee21305a88f..e0b80b23197307d156ade8427a5227ac
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
}
@@ -884,6 +955,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -883,6 +954,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public abstract boolean shouldRconBroadcast();
public boolean saveAllChunks(boolean suppressLogs, boolean flush, boolean force) {
@ -23506,7 +23506,7 @@ index 843f8ccce6302a6db6cc61c496a5eee21305a88f..e0b80b23197307d156ade8427a5227ac
boolean flag3 = false;
for (Iterator iterator = this.getAllLevels().iterator(); iterator.hasNext(); flag3 = true) {
@@ -893,7 +969,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -892,7 +968,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftServer.LOGGER.info("Saving chunks for level '{}'/{}", worldserver, worldserver.dimension().location());
}
@ -23515,7 +23515,7 @@ index 843f8ccce6302a6db6cc61c496a5eee21305a88f..e0b80b23197307d156ade8427a5227ac
}
// CraftBukkit start - moved to WorldServer.save
@@ -993,7 +1069,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -992,7 +1068,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
@ -23524,7 +23524,7 @@ index 843f8ccce6302a6db6cc61c496a5eee21305a88f..e0b80b23197307d156ade8427a5227ac
return worldserver1.getChunkSource().chunkMap.hasWork();
})) {
this.nextTickTimeNanos = Util.getNanos() + TimeUtil.NANOSECONDS_PER_MILLISECOND;
@@ -1010,19 +1086,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1009,19 +1085,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.waitUntilNextTick();
}
@ -23545,7 +23545,7 @@ index 843f8ccce6302a6db6cc61c496a5eee21305a88f..e0b80b23197307d156ade8427a5227ac
this.isSaving = false;
this.resources.close();
@@ -1042,6 +1106,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1041,6 +1105,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Spigot end
@ -23560,7 +23560,7 @@ index 843f8ccce6302a6db6cc61c496a5eee21305a88f..e0b80b23197307d156ade8427a5227ac
}
public String getLocalIp() {
@@ -1222,6 +1294,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1221,6 +1293,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.tickServer(flag ? () -> {
return false;
} : this::haveTime);
@ -23574,7 +23574,7 @@ index 843f8ccce6302a6db6cc61c496a5eee21305a88f..e0b80b23197307d156ade8427a5227ac
this.tickFrame.end();
gameprofilerfiller.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
@@ -1426,6 +1505,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1425,6 +1504,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private boolean pollTaskInternal() {
if (super.pollTask()) {

View File

@ -115,7 +115,7 @@ index e114e687f2f4503546687fd6792226a643af8793..90ca25c4aaf92a5639839a7cdaee2ffc
/* CraftBukkit start - Replace everything
OptionParser optionparser = new OptionParser();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e0b80b23197307d156ade8427a5227acbc45eb92..7a671772760152f26e5bb60ea2f2a7765c017c37 100644
index ed1f8c735bf9f13014112056b85ff195b02ee76e..b29dbab3c26c078eb993183d808149d958857f3a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -317,7 +317,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -137,7 +137,7 @@ index e0b80b23197307d156ade8427a5227acbc45eb92..7a671772760152f26e5bb60ea2f2a776
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
Thread thread = new ca.spottedleaf.moonrise.common.util.TickThread(() -> { // Paper - rewrite chunk system
@@ -503,6 +506,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -502,6 +505,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
*/
// Paper end
@ -145,7 +145,7 @@ index e0b80b23197307d156ade8427a5227acbc45eb92..7a671772760152f26e5bb60ea2f2a776
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
// CraftBukkit end
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
@@ -1019,6 +1023,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1018,6 +1022,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
private boolean hasStopped = false;
private boolean hasLoggedStop = false; // Paper - Debugging
@ -153,7 +153,7 @@ index e0b80b23197307d156ade8427a5227acbc45eb92..7a671772760152f26e5bb60ea2f2a776
private final Object stopLock = new Object();
public final boolean hasStopped() {
synchronized (this.stopLock) {
@@ -1034,6 +1039,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1033,6 +1038,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.hasStopped = true;
}
if (!hasLoggedStop && isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
@ -164,7 +164,7 @@ index e0b80b23197307d156ade8427a5227acbc45eb92..7a671772760152f26e5bb60ea2f2a776
// CraftBukkit end
if (this.metricsRecorder.isRecording()) {
this.cancelRecordingMetrics();
@@ -1114,6 +1123,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1113,6 +1122,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ca.spottedleaf.moonrise.common.util.MoonriseCommon.haltExecutors();
}
// Paper end - rewrite chunk system
@ -180,7 +180,7 @@ index e0b80b23197307d156ade8427a5227acbc45eb92..7a671772760152f26e5bb60ea2f2a776
}
public String getLocalIp() {
@@ -1208,6 +1226,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1207,6 +1225,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
protected void runServer() {
try {
@ -188,7 +188,7 @@ index e0b80b23197307d156ade8427a5227acbc45eb92..7a671772760152f26e5bb60ea2f2a776
if (!this.initServer()) {
throw new IllegalStateException("Failed to initialize server");
}
@@ -1217,6 +1236,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1216,6 +1235,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.status = this.buildServerStatus();
// Spigot start
@ -206,7 +206,7 @@ index e0b80b23197307d156ade8427a5227acbc45eb92..7a671772760152f26e5bb60ea2f2a776
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
Arrays.fill( this.recentTps, 20 );
// Paper start - further improve server tick loop
@@ -1337,6 +1367,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1336,6 +1366,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis);
}
} catch (Throwable throwable2) {
@ -219,7 +219,7 @@ index e0b80b23197307d156ade8427a5227acbc45eb92..7a671772760152f26e5bb60ea2f2a776
MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable2);
CrashReport crashreport = MinecraftServer.constructOrExtractCrashReport(throwable2);
@@ -1361,15 +1397,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1360,15 +1396,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.services.profileCache().clearExecutor();
}
@ -239,7 +239,7 @@ index e0b80b23197307d156ade8427a5227acbc45eb92..7a671772760152f26e5bb60ea2f2a776
}
}
@@ -1488,6 +1524,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1487,6 +1523,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Override
public TickTask wrapRunnable(Runnable runnable) {

View File

@ -279,10 +279,10 @@ index 6b8ed8a0baaf4a57d20e57cec3400af5561ddd79..48604e7f96adc9e226e034054c5e2bad
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7a671772760152f26e5bb60ea2f2a7765c017c37..8a45960de3fd890991a1c75a103fec1adb03c0cb 100644
index b29dbab3c26c078eb993183d808149d958857f3a..db90abc0e081d1d2623e6bfe000bc2694ae84c7a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -765,6 +765,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -764,6 +764,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end - Configurable player collision
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
@ -291,7 +291,7 @@ index 7a671772760152f26e5bb60ea2f2a7765c017c37..8a45960de3fd890991a1c75a103fec1a
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins
io.papermc.paper.command.brigadier.PaperCommands.INSTANCE.setValid(); // Paper - reset invalid state for event fire below
io.papermc.paper.plugin.lifecycle.event.LifecycleEventRunner.INSTANCE.callReloadableRegistrarEvent(io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents.COMMANDS, io.papermc.paper.command.brigadier.PaperCommands.INSTANCE, org.bukkit.plugin.Plugin.class, io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.INITIAL); // Paper - call commands event for regular plugins
@@ -1050,6 +1052,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1049,6 +1051,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftServer.LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
@ -299,7 +299,7 @@ index 7a671772760152f26e5bb60ea2f2a7765c017c37..8a45960de3fd890991a1c75a103fec1a
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
@@ -1245,6 +1248,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1244,6 +1247,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// tasks are default scheduled at -1 + delay, and first tick will tick at 1
final long actualDoneTimeMs = System.currentTimeMillis() - org.bukkit.craftbukkit.Main.BOOT_TIME.toEpochMilli(); // Paper - Add total time
LOGGER.info("Done ({})! For help, type \"help\"", String.format(java.util.Locale.ROOT, "%.3fs", actualDoneTimeMs / 1000.00D)); // Paper - Add total time
@ -307,7 +307,7 @@ index 7a671772760152f26e5bb60ea2f2a7765c017c37..8a45960de3fd890991a1c75a103fec1a
org.spigotmc.WatchdogThread.tick();
// Paper end - Improved Watchdog Support
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
@@ -1627,17 +1631,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1626,17 +1630,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
if (this.emptyTicks >= j) {
@ -329,7 +329,7 @@ index 7a671772760152f26e5bb60ea2f2a7765c017c37..8a45960de3fd890991a1c75a103fec1a
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper - Server Tick Events
++this.tickCount;
this.tickRateManager.tick();
@@ -1655,11 +1663,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1654,11 +1662,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ProfilerFiller gameprofilerfiller = Profiler.get();
this.runAllTasks(); // Paper - move runAllTasks() into full server tick (previously for timings)

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Incremental chunk and player saving
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8a45960de3fd890991a1c75a103fec1adb03c0cb..c1e8d2679083516040e9d1768d79f5e4d71bf0a6 100644
index db90abc0e081d1d2623e6bfe000bc2694ae84c7a..196d7ffb8b362873f93224ccdd37e7efc656fd78 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1008,7 +1008,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1007,7 +1007,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try {
this.isSaving = true;
@ -17,7 +17,7 @@ index 8a45960de3fd890991a1c75a103fec1adb03c0cb..c1e8d2679083516040e9d1768d79f5e4
flag3 = this.saveAllChunks(suppressLogs, flush, force);
} finally {
this.isSaving = false;
@@ -1656,9 +1656,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1655,9 +1655,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
--this.ticksUntilAutosave;

View File

@ -8,7 +8,7 @@ Areas affected by lag comepnsation:
- Eating food items
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c1e8d2679083516040e9d1768d79f5e4d71bf0a6..af7c6f56444c0e495fd39da872f8030199afc634 100644
index 196d7ffb8b362873f93224ccdd37e7efc656fd78..9dfa6bb83469620a446509656ea1ad140b2e683f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -331,6 +331,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -19,7 +19,7 @@ index c1e8d2679083516040e9d1768d79f5e4d71bf0a6..af7c6f56444c0e495fd39da872f80301
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
@@ -1842,6 +1843,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1841,6 +1842,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
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
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers

View File

@ -11,10 +11,10 @@ sleep by default, which avoids the problem and makes it more obvious to check if
enabled. We also unload chunks during sleep to prevent memory leaks caused by plugin chunk loads.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index af7c6f56444c0e495fd39da872f8030199afc634..7933d6900dac67a24fb5f9378097dbde34be30b1 100644
index 9dfa6bb83469620a446509656ea1ad140b2e683f..af8dbfcc9df105896c8574d2d9dd647ac30ae04d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1639,6 +1639,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1638,6 +1638,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit