Update Paper

Also included is a fix to Connection#handleDisconnection
using the wrong login state for removing pending login
This commit is contained in:
Spottedleaf 2024-02-05 11:41:39 -08:00
parent 7bc26ecc74
commit 32ff12e4dc
13 changed files with 733 additions and 754 deletions

View File

@ -2,7 +2,7 @@ group=dev.folia
version=1.20.4-R0.1-SNAPSHOT
mcVersion=1.20.4
paperRef=4a98986e2881439fc018d847df2808e2f17f3a7d
paperRef=9e171ef8ff0a0ec57ebc75772fc9de578c987059
org.gradle.caching=true
org.gradle.parallel=true

View File

@ -11,7 +11,7 @@ the schedulers depending on the result of the ownership
check.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 48fab492609e0bae459d20cc2eae78b87e37ab75..00ed780f190fa1bf3c33fc093a46b4e914131e5f 100644
index 2d53675907f411046978b0a234c0b6f33c909973..15252f744d60408a816dba1c0ca0c7104236ae6f 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2837,6 +2837,14 @@ public final class Bukkit {

View File

@ -93,20 +93,20 @@ index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..e2f704c115fd6e00960bb56bb0779f11
).openBufferedStream()) {
JsonObject json = new Gson().fromJson(reader, JsonObject.class);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 24430f9bf1b641a84e79b4b9b2e0ac5d16681ada..c7498b4ec41f0ae56530b948bd04c892a0f6d4a7 100644
index d06185566b447c432d4dc2e3ba04d121bcdbc71b..680919045310be7e50e2d503a23d265f2e9b2bc6 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1852,7 +1852,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1855,7 +1855,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {
- return "Paper"; // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return "Folia"; // Folia - Folia > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
- return "Paper"; // Paper
+ return "Folia"; // Paper // Folia - Folia
}
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index eb617d659c701e512aac8a1ff822c147b69d3a3b..3b133cd19c0cceeb78f58d36de817b699cc59884 100644
index 4df3b94c8126f00188f5e125757411a0359728fa..825e7abebd6eb898198106ca6e783ec462e64173 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -264,7 +264,7 @@ import javax.annotation.Nullable; // Paper

File diff suppressed because it is too large Load Diff

View File

@ -6,20 +6,20 @@ Subject: [PATCH] Max pending logins
Should help the floodgates on launch
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 586027a4c97a3c1be42f1c8d5a248e2672bb6489..d809dd5f6aa39fcd7583d7db822450297225eb49 100644
index 58cdb65083134680230d7070f9f6209f2d32873b..aa4b461bbb2c8c4753f7c9057bab1740de2c0284 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -89,7 +89,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
if (this.server.getPlayerList().pushPendingJoin(name, uniqueId, this.connection)) {
// Folia end - region threading - rewrite login process
this.verifyLoginAndFinishConnectionSetup((GameProfile) Objects.requireNonNull(this.authenticatedProfile));
- } // Folia - region threading - rewrite login process
+ } else { --this.tick; } // Folia - region threading - rewrite login process // Folia - max concurrent logins
- } // Paper - prevent logins to be processed even though disconnect was called
+ } else { --this.tick; } // Paper - prevent logins to be processed even though disconnect was called // Folia - max concurrent logins
}
if (this.state == ServerLoginPacketListenerImpl.State.WAITING_FOR_DUPE_DISCONNECT && !this.isPlayerAlreadyInWorld((GameProfile) Objects.requireNonNull(this.authenticatedProfile))) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 8284cde1984408a97a933f4299ad8541e7a015ca..739e8966c7326edf47e85f959374cbc8970d7b2a 100644
index fa36e892b019877a770a618fe8d4cda118fe137d..93e192ea1a0cda2d7aae983980a6fead013c8b90 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -171,6 +171,17 @@ public abstract class PlayerList {

View File

@ -29,10 +29,10 @@ index 41bf71d116ffc5431586ce54abba7f8def6c1dcf..519da6886613b8460e989767b1a21e31
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1ee49570e9c3250d1d3ce0420a0a0c94cda717fe..cc4eb106b3ff1953de11f1faa7c04f3f9982fca2 100644
index b736cb55542ea7bc35d1a02e7fe5913de024ca60..eade31ea668c171dceafee958e265041a439c54b 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2919,6 +2919,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -2907,6 +2907,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
return false;
} else {
@ -40,7 +40,7 @@ index 1ee49570e9c3250d1d3ce0420a0a0c94cda717fe..cc4eb106b3ff1953de11f1faa7c04f3f
// CraftBukkit start
if (entity.getBukkitEntity() instanceof Vehicle && this.getBukkitEntity() instanceof LivingEntity) {
VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.getBukkitEntity());
@@ -2940,6 +2941,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -2928,6 +2929,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return false;
}
// CraftBukkit end
@ -48,7 +48,7 @@ index 1ee49570e9c3250d1d3ce0420a0a0c94cda717fe..cc4eb106b3ff1953de11f1faa7c04f3f
if (this.isPassenger()) {
this.stopRiding();
}
@@ -3017,6 +3019,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3005,6 +3007,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else {
// CraftBukkit start
@ -56,7 +56,7 @@ index 1ee49570e9c3250d1d3ce0420a0a0c94cda717fe..cc4eb106b3ff1953de11f1faa7c04f3f
CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
Entity orig = craft == null ? null : craft.getHandle();
if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
@@ -3044,6 +3047,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3032,6 +3035,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return false;
}
// CraftBukkit end
@ -414,7 +414,7 @@ index dd91de8f24c27b9318c2a898a49991d74c100bff..d7c34f601ce66a6b090ec431a0503462
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
index 8184a2adf889e02b048ceb015edfc04d1b5c21b9..9165bb2458f2440c6a17dff8da985b60f84796db 100644
index e33b1b6fd50a4eea57500cc00dba20d6edcab75d..f9a8e684a04c4ffdf566b29252e18dbfcf09ade9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
@@ -102,8 +102,16 @@ public class CraftBoat extends CraftVehicle implements Boat {
@ -897,7 +897,7 @@ index d657fd2c507a5b215aeab0a5f3e9c2ee892a27c8..9fc90b162aab15a9cd60b02aba563181
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 1d9e123f5c1bc94f6be08f372c94a2c595a789c6..39cb7a0a58ea24f48f7e621f696f0dbfea229ea3 100644
index ac91fe913b4f6a6148955e7181e5abda13f15820..5adbfb278aed3c32b6d4992b8932cc3dafd8f9cc 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -490,7 +490,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@ -918,7 +918,7 @@ index 1d9e123f5c1bc94f6be08f372c94a2c595a789c6..39cb7a0a58ea24f48f7e621f696f0dbf
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java
index b66dd5c5c5d98c9285e0d0a4ad4b99a66419f732..3d284b790c869fb30180b92b891b292006c7dad4 100644
index 3a890cccf1766758794f3a3b5d31428f42590049..06863afd6bd855130ac0e672824aa2755e141286 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java
@@ -11,8 +11,16 @@ public class CraftEvoker extends CraftSpellcaster implements Evoker {
@ -1359,7 +1359,7 @@ index 8746f80d08df5501b32958eb123aa7d814573ddf..c6c6eb55f4649e18beef9832c2ea7b9d
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 827fe201a7b74f485abb46b127a28bf0cb479c3b..bc74382c4b62ba14e655d10c261aada61191733a 100644
index acbb64010cd59668aa1bcb52ff1220789cadb1d3..35958bb85389ca0ed02f567e0fd9f4a9dbc66ff2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -291,8 +291,16 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@ -1827,7 +1827,7 @@ index 79b608e89d4d1f76a58868c585bb87c82e2689b1..7767a342b3d8bf9c07fbd73ad4ccacd8
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index 5f6a1fb323782816f706ccf7df922cb203238302..4cae2bb318f8f6e060314fe4bd24051e84982787 100644
index 31f62fbb54ec7b270fbd8afba7bd7c4bfafa09e3..0c89084eae131ae91d6c6aa910b1e0d2fc47747d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -55,8 +55,16 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
@ -1854,7 +1854,7 @@ index 5f6a1fb323782816f706ccf7df922cb203238302..4cae2bb318f8f6e060314fe4bd24051e
- paperPathfinder.setHandle(getHandle());
+ paperPathfinder.setHandle((net.minecraft.world.entity.Mob)entity); // Folia - region threading
}
// Paper end
// Paper end - Mob Pathfinding API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java
index 706c74c832f6893df3797023f68add31139c7d57..80a612f16669e571e336dd6369a968b4664c98e4 100644
@ -2130,10 +2130,10 @@ index 2638c341bc02f201f7ab17fdebcdbdf3a7ec05bf..0f5c2d31a2dea13a46ba81e353393633
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 9c9b7728122aaaeb92f565f0c9322f0e3aed947b..003684843c2a9fc709619c1de8cf73dbb1b25c42 100644
index f5985bac1f72591e31a85d53a5dfde7c26966a62..fc301fcf812b79ac7ceae710132a762f101b82b2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -616,7 +616,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -574,7 +574,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void kick(net.kyori.adventure.text.Component message, org.bukkit.event.player.PlayerKickEvent.Cause cause) {
@ -2142,7 +2142,7 @@ index 9c9b7728122aaaeb92f565f0c9322f0e3aed947b..003684843c2a9fc709619c1de8cf73db
final ServerGamePacketListenerImpl connection = this.getHandle().connection;
if (connection != null) {
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause);
@@ -2206,9 +2206,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2179,9 +2179,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this;
}
@ -2160,7 +2160,7 @@ index 9c9b7728122aaaeb92f565f0c9322f0e3aed947b..003684843c2a9fc709619c1de8cf73db
}
public void setHandle(final ServerPlayer entity) {
@@ -3242,7 +3249,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3215,7 +3222,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
{
if ( CraftPlayer.this.getHealth() <= 0 && CraftPlayer.this.isOnline() )
{
@ -2970,7 +2970,7 @@ index 6c15d40979fd3e3d246a447c432b321fbf29ada3..771eb799b032fcf4fc33c5e445b7fa25
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java
index fd968881eeec6dc5bdf90decc23a2bfc619c410d..96dba371b8fe88f8e15eee5fbc152a0b85bc0511 100644
index 3aa23d9f22d5cd22231293fd7d1ca4cb79eb7cb3..f340cf90512a7097153d7fa1a2b38fe3e0f1e8d5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java
@@ -14,8 +14,16 @@ public class CraftVillagerZombie extends CraftZombie implements ZombieVillager {

View File

@ -10,10 +10,10 @@ the impact from scaling the region threads, but is not a fix
to the underlying issue.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 301ff715b89abbebda83af1e15f8d5d15097002f..7df4935a6c1a631e07dcf9c30341f93f3fba7090 100644
index 0330f180ef8fed3091b69758cea64d742a4dc0ac..b912a5d6737cf8bd74617225ca0837e6e97b7206 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1463,6 +1463,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1466,6 +1466,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Folia end - region threading
public final void executeMidTickTasks() {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Throw UnsupportedOperationException() for broken APIs
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9dfcdc92d8507dff6a77115de5122b109dce44da..f97f764c70243a57e78b62af9971677d5e49c66d 100644
index 4f9c1b04ce6e4874cfb80a91c50aceda0eff2acc..3f266934e70a5f29d55d390841e536999cec8582 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1266,6 +1266,7 @@ public final class CraftServer implements Server {
@ -16,7 +16,7 @@ index 9dfcdc92d8507dff6a77115de5122b109dce44da..f97f764c70243a57e78b62af9971677d
Preconditions.checkState(this.console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP");
//Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot create a world while worlds are being ticked"); // Paper - Cat - Temp disable. We'll see how this goes.
Preconditions.checkArgument(creator != null, "WorldCreator cannot be null");
@@ -1445,6 +1446,7 @@ public final class CraftServer implements Server {
@@ -1444,6 +1445,7 @@ public final class CraftServer implements Server {
@Override
public boolean unloadWorld(World world, boolean save) {

View File

@ -31,13 +31,13 @@ index 45bd29b70782e29eb11c36eaca0f940aee49799b..b930bd722caf6ecc6e2d584535cdd7a8
public @NotNull List<String> getProvidedPlugins() {
return this.provides;
diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java
index 84305ea4bd21acf0ff2415808933552696686ac7..7858c88ffc505b7b79155f9c95316f825c5ee575 100644
index 0a27b468560ccf4b9588cd12d50c02e442f3024f..6369b13e1fcdbdb25dd9d6e4d3bffdedbee4f739 100644
--- a/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java
+++ b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java
@@ -24,6 +24,11 @@ class PaperPluginProviderFactory implements PluginTypeFactory<PaperPluginParent,
@Override
public PaperPluginParent build(JarFile file, PaperPluginMeta configuration, Path source) throws Exception {
public PaperPluginParent build(JarFile file, PaperPluginMeta configuration, Path source) {
+ // Folia start - block plugins not marked as supported
+ if (!configuration.isFoliaSupported()) {
+ throw new RuntimeException("Could not load plugin '" + configuration.getDisplayName() + "' as it is not marked as supporting Folia!");
@ -47,13 +47,13 @@ index 84305ea4bd21acf0ff2415808933552696686ac7..7858c88ffc505b7b79155f9c95316f82
ComponentLogger logger = ComponentLogger.logger(jul.getName());
PluginProviderContext context = PluginProviderContextImpl.create(configuration, logger, source);
diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
index 14ed05945ba5bfeb2b539d4786278b0e04130404..ad13d60eeb94a75c97b3d0696c39d834d6082bfa 100644
index bdd9bc8a414719b9f1d6f01f90539ddb8603a878..bf1856316aa45d2de061e6f4268dd9c63deb1ced 100644
--- a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
+++ b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
@@ -17,6 +17,11 @@ class SpigotPluginProviderFactory implements PluginTypeFactory<SpigotPluginProvi
@Override
public SpigotPluginProvider build(JarFile file, PluginDescriptionFile configuration, Path source) throws Exception {
public SpigotPluginProvider build(JarFile file, PluginDescriptionFile configuration, Path source) throws InvalidDescriptionException {
+ // Folia start - block plugins not marked as supported
+ if (!configuration.isFoliaSupported()) {
+ throw new RuntimeException("Could not load plugin '" + configuration.getDisplayName() + "' as it is not marked as supporting Folia!");

View File

@ -9,10 +9,10 @@ add explicit block update suppression techniques, it's better
than the server crashing.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 7334a522956649fdf606b560d52e127c2f500b5d..394ec4f018b676a441e49d7ccbef3f8c56673603 100644
index 2b8674034979e3f8d45362f7cbae3c1b453834ee..de7c06785e3914fe7181bcb836b70a96a4900011 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1763,7 +1763,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1753,7 +1753,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
Direction enumdirection = (Direction) iterator.next();
BlockPos blockposition1 = pos.relative(enumdirection);
@ -22,7 +22,7 @@ index 7334a522956649fdf606b560d52e127c2f500b5d..394ec4f018b676a441e49d7ccbef3f8c
if (iblockdata.is(Blocks.COMPARATOR)) {
diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
index 9de6503f20396601a270e6eb0b66c40187fca690..f5fb81ebe2ca06cd8e4bf5b28494563f7beb4a7c 100644
index 57e542d5c8b887acecedf76c08c8d4379d712c0f..9c0ad01eae1e0d5044669f561587a69b6ca8e237 100644
--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
@@ -134,9 +134,9 @@ public class DetectorRailBlock extends BaseRailBlock {
@ -54,7 +54,7 @@ index b84c48902ef24fdae17578a304e6c93dc20c5dce..218c1954a7922c9e6bf6f34f9497f89c
} else {
RailShape blockpropertytrackposition1 = (RailShape) iblockdata.getValue(PoweredRailBlock.SHAPE);
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
index 875a776d5aa1399808e5d5eab1c608dd35011c85..1b34a5beb7f17b25552375d3b8017e26da0239b8 100644
index 18cb719ae55b736a6dade61237a845c866fb6858..306e8dc1546927def934148c0c542c48872544e7 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -200,8 +200,9 @@ public class RedStoneWireBlock extends Block {
@ -69,7 +69,7 @@ index 875a776d5aa1399808e5d5eab1c608dd35011c85..1b34a5beb7f17b25552375d3b8017e26
BlockState iblockdata1 = world.getBlockState(blockposition_mutableblockposition);
diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
index a25c2983a7e0df3292f701fc46487e5e15ec7ac8..8185959e02a82590dcc3f5625494b6f0f38e31b1 100644
index de048d920452b04922871eaaafacd1abd0ee21b7..7c3688849eaad93085cd3510a5a62823a19d649f 100644
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
@@ -119,7 +119,8 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
@ -81,16 +81,16 @@ index a25c2983a7e0df3292f701fc46487e5e15ec7ac8..8185959e02a82590dcc3f5625494b6f0
+ if (blockState != null) { // Folia - block updates in unloaded chunks
// Paper start - Call BlockPhysicsEvent
try {
boolean cancelled = false;
@@ -141,6 +142,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
world.lastPhysicsProblem = new BlockPos(blockPos);
org.bukkit.event.block.BlockPhysicsEvent event = new org.bukkit.event.block.BlockPhysicsEvent(
@@ -134,6 +135,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
world.lastPhysicsProblem = blockPos;
}
// Paper end - Call BlockPhysicsEvent
+ } // Folia - block updates in unloaded chunks
if (this.idx < NeighborUpdater.UPDATE_ORDER.length && NeighborUpdater.UPDATE_ORDER[this.idx] == this.skipDirection) {
++this.idx;
}
@@ -156,7 +158,9 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
@@ -149,7 +151,9 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
static record ShapeUpdate(Direction direction, BlockState state, BlockPos pos, BlockPos neighborPos, int updateFlags, int updateLimit) implements CollectingNeighborUpdater.NeighborUpdates {
@Override
public boolean runNext(Level world) {
@ -100,7 +100,7 @@ index a25c2983a7e0df3292f701fc46487e5e15ec7ac8..8185959e02a82590dcc3f5625494b6f0
return false;
}
}
@@ -164,8 +168,8 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
@@ -157,8 +161,8 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
static record SimpleNeighborUpdate(BlockPos pos, Block block, BlockPos neighborPos) implements CollectingNeighborUpdater.NeighborUpdates {
@Override
public boolean runNext(Level world) {

View File

@ -9,7 +9,7 @@ data deserialization and is racey even in Vanilla. But in Folia,
some accesses may throw and as such we need to fix this directly.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 9a4481da26820f967d38ff582c256361936f957b..bd9edb8271e3111431d45eb908d8336e0e7e23bc 100644
index b9e7c8776b5b4086fb2455035857947f9a4b3dba..c8ee0307fa6c13c34a1db80ddf65d8381fd556be 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -644,7 +644,7 @@ public class ServerPlayer extends Player {
@ -22,7 +22,7 @@ index 9a4481da26820f967d38ff582c256361936f957b..bd9edb8271e3111431d45eb908d8336e
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 36ec42505505af86b1a63bd8cfea5a88f4569c74..8d8c80a41e01df4d0fef7d045b9c5d283a8f168d 100644
index 03e96af48a1d54d19383a3f0b270248f673ad0aa..28da90b59f60d3f7618a42e149467a3a55c91682 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -4361,6 +4361,11 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@ -7,7 +7,7 @@ This allows the player to be re-positioned before logging into
the world without causing thread checks to trip on Folia.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 739e8966c7326edf47e85f959374cbc8970d7b2a..8c74ba46920c41f82df7ae066caffd17b333301c 100644
index 93e192ea1a0cda2d7aae983980a6fead013c8b90..b19f1db38e71d9185cca9fc0e44937f91443a042 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -514,7 +514,13 @@ public abstract class PlayerList {
@ -21,6 +21,6 @@ index 739e8966c7326edf47e85f959374cbc8970d7b2a..8c74ba46920c41f82df7ae066caffd17
+ entity1.setPosRaw(playerPos.x, playerPos.y, playerPos.z, true);
+ }
+ // Paper end - force sync root vehicle to player position
return !finalWorldServer.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper
return !finalWorldServer.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper - Entity#getEntitySpawnReason
// CraftBukkit end
});

View File

@ -1376,10 +1376,10 @@ index 98fb69a9adeb6eaab199aec127692acb07f56808..7cc624505931dcb6696c3ef3ee3bbea7
label25:
{
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7df4935a6c1a631e07dcf9c30341f93f3fba7090..4383528df7627c5eb7cba1218f1b4e524e4fe956 100644
index b912a5d6737cf8bd74617225ca0837e6e97b7206..b73699a08a368e6305759438c00066b0d5e7b39a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1579,6 +1579,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1582,6 +1582,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Folia start - region threading
public void tickServer(long startTime, long scheduledEnd, long targetBuffer,
io.papermc.paper.threadedregions.TickRegions.TickRegionData region) {
@ -1387,7 +1387,7 @@ index 7df4935a6c1a631e07dcf9c30341f93f3fba7090..4383528df7627c5eb7cba1218f1b4e52
if (region != null) {
region.world.getCurrentWorldData().updateTickData();
if (region.world.checkInitialised.get() != ServerLevel.WORLD_INIT_CHECKED) {
@@ -1613,10 +1614,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1616,10 +1617,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Folia start - region threading
if (region != null) {
@ -1404,7 +1404,7 @@ index 7df4935a6c1a631e07dcf9c30341f93f3fba7090..4383528df7627c5eb7cba1218f1b4e52
for (Entity entity : region.world.getCurrentWorldData().getLocalEntitiesCopy()) {
if (!io.papermc.paper.util.TickThread.isTickThreadFor(entity) || entity.isRemoved()) {
continue;
@@ -1624,10 +1631,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1627,10 +1634,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw();
if (bukkit != null) {
bukkit.taskScheduler.executeTick();
@ -1420,7 +1420,7 @@ index 7df4935a6c1a631e07dcf9c30341f93f3fba7090..4383528df7627c5eb7cba1218f1b4e52
}
// Folia end - region threading
@@ -1647,6 +1659,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1650,6 +1662,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
this.profiler.push("save");
final boolean fullSave = autosavePeriod > 0 && io.papermc.paper.threadedregions.RegionizedServer.getCurrentTick() % autosavePeriod == 0; // Folia - region threading
@ -1428,15 +1428,15 @@ index 7df4935a6c1a631e07dcf9c30341f93f3fba7090..4383528df7627c5eb7cba1218f1b4e52
try {
this.isSaving = true;
if (playerSaveInterval > 0) {
@@ -1660,6 +1673,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1663,6 +1676,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally {
this.isSaving = false;
}
+ } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.AUTOSAVE); } // Folia - profiler
this.profiler.pop();
// Paper end
// Paper end - Incremental chunk and player saving
io.papermc.paper.util.CachedLists.reset(); // Paper
@@ -1724,6 +1738,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1727,6 +1741,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void tickChildren(BooleanSupplier shouldKeepTicking, io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { // Folia - region threading
@ -1444,7 +1444,7 @@ index 7df4935a6c1a631e07dcf9c30341f93f3fba7090..4383528df7627c5eb7cba1218f1b4e52
final io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = io.papermc.paper.threadedregions.TickRegionScheduler.getCurrentRegionizedWorldData(); // Folia - regionised ticking
if (region == null) this.getPlayerList().getPlayers().forEach((entityplayer) -> { // Folia - region threading
entityplayer.connection.suspendFlushing();
@@ -1790,12 +1805,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1793,12 +1808,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try {
worldserver.timings.doTick.startTiming(); // Spigot
@ -1460,10 +1460,10 @@ index 7df4935a6c1a631e07dcf9c30341f93f3fba7090..4383528df7627c5eb7cba1218f1b4e52
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index bc1c0ce0a29654172afdfc30baee190208213216..4c160f62336acdbcd835ebbf7f683205a776ce79 100644
index 6aa8595c22ac933a79b25c7bb159343365b70f26..21ec49acb3c1241d9286959c42a7f8363f637e4f 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -470,16 +470,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -463,16 +463,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected void tick(BooleanSupplier shouldKeepTicking) {
@ -1485,7 +1485,7 @@ index bc1c0ce0a29654172afdfc30baee190208213216..4c160f62336acdbcd835ebbf7f683205
} // Paper
}
@@ -1092,9 +1097,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1078,9 +1083,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Folia start - region threading - replace entity tracking ticking
private void foliaEntityTrackerTick() {
@ -1500,7 +1500,7 @@ index bc1c0ce0a29654172afdfc30baee190208213216..4c160f62336acdbcd835ebbf7f683205
TrackedEntity tracker = entity.tracker;
if (tracker == null) {
continue;
@@ -1104,12 +1114,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1090,12 +1100,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
// process unloads
for (Entity entity : worldData.takeTrackingUnloads()) {
@ -1518,10 +1518,10 @@ index bc1c0ce0a29654172afdfc30baee190208213216..4c160f62336acdbcd835ebbf7f683205
// Folia end - region threading - replace entity tracking ticking
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index a21cc9c7d5981c742f379affe9c1ef4dcb0fa1e1..88db5ada13329a5fe0d0fb652d2c8a8d561649e8 100644
index d532043f33825ce2971d9e53f290cdead22d6916..74483543836d9ed042cc7b9cbbde8d58d6994475 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -434,16 +434,23 @@ public class ServerChunkCache extends ChunkSource {
@@ -426,16 +426,23 @@ public class ServerChunkCache extends ChunkSource {
@Override
public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) {
@ -1545,7 +1545,7 @@ index a21cc9c7d5981c742f379affe9c1ef4dcb0fa1e1..88db5ada13329a5fe0d0fb652d2c8a8d
this.level.timings.chunks.stopTiming(); // Paper - timings
this.chunkMap.tick();
}
@@ -458,6 +465,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -450,6 +457,7 @@ public class ServerChunkCache extends ChunkSource {
private void tickChunks() {
io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = this.level.getCurrentWorldData(); // Folia - region threading
@ -1553,23 +1553,23 @@ index a21cc9c7d5981c742f379affe9c1ef4dcb0fa1e1..88db5ada13329a5fe0d0fb652d2c8a8d
//long i = this.level.getGameTime(); // Folia - region threading
long j = 1; // Folia - region threading
@@ -479,6 +487,7 @@ public class ServerChunkCache extends ChunkSource {
// Paper start - per player mob spawning
@@ -471,6 +479,7 @@ public class ServerChunkCache extends ChunkSource {
// Paper start - Optional per player mob spawns
int naturalSpawnChunkCount = k;
NaturalSpawner.SpawnState spawnercreature_d; // moved down
+ profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.MOB_SPAWN_ENTITY_COUNT); try { // Folia - profiler
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
for (ServerPlayer player : this.level.getLocalPlayers()) { // Folia - region threading
@@ -498,6 +507,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -490,6 +499,7 @@ public class ServerChunkCache extends ChunkSource {
} else {
spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, regionizedWorldData.getLoadedEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false); // Folia - region threading - note: function only cares about loaded entities, doesn't need all
}
+ } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.MOB_SPAWN_ENTITY_COUNT); } // Folia - profiler
// Paper end
// Paper end - Optional per player mob spawns
this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
@@ -561,6 +571,9 @@ public class ServerChunkCache extends ChunkSource {
@@ -553,6 +563,9 @@ public class ServerChunkCache extends ChunkSource {
}
try {
// Paper end - optimise chunk tick iteration
@ -1579,7 +1579,7 @@ index a21cc9c7d5981c742f379affe9c1ef4dcb0fa1e1..88db5ada13329a5fe0d0fb652d2c8a8d
while (chunkIterator.hasNext()) {
LevelChunk chunk1 = chunkIterator.next();
// Paper end - optimise chunk tick iteration
@@ -592,15 +605,20 @@ public class ServerChunkCache extends ChunkSource {
@@ -584,15 +597,20 @@ public class ServerChunkCache extends ChunkSource {
// Paper end - optimise chunk tick iteration
chunk1.incrementInhabitedTime(j);
if (spawn && flag && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) { // Spigot // Paper - optimise chunk tick iteration
@ -1600,7 +1600,7 @@ index a21cc9c7d5981c742f379affe9c1ef4dcb0fa1e1..88db5ada13329a5fe0d0fb652d2c8a8d
// Paper start - optimise chunk tick iteration
} finally {
if (chunkIterator instanceof io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator safeIterator) {
@@ -612,9 +630,11 @@ public class ServerChunkCache extends ChunkSource {
@@ -604,9 +622,11 @@ public class ServerChunkCache extends ChunkSource {
gameprofilerfiller.popPush("customSpawners");
if (flag) {
@ -1612,7 +1612,7 @@ index a21cc9c7d5981c742f379affe9c1ef4dcb0fa1e1..88db5ada13329a5fe0d0fb652d2c8a8d
}
}
@@ -624,6 +644,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -616,6 +636,7 @@ public class ServerChunkCache extends ChunkSource {
// Paper start - optimise chunk tick iteration
// Folia start - region threading
if (!this.level.needsChangeBroadcasting.isEmpty()) {
@ -1620,7 +1620,7 @@ index a21cc9c7d5981c742f379affe9c1ef4dcb0fa1e1..88db5ada13329a5fe0d0fb652d2c8a8d
for (Iterator<ChunkHolder> iterator = this.level.needsChangeBroadcasting.iterator(); iterator.hasNext();) {
ChunkHolder holder = iterator.next();
if (!io.papermc.paper.util.TickThread.isTickThreadFor(holder.newChunkHolder.world, holder.pos)) {
@@ -635,6 +656,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -627,6 +648,7 @@ public class ServerChunkCache extends ChunkSource {
iterator.remove();
}
}
@ -1629,10 +1629,10 @@ index a21cc9c7d5981c742f379affe9c1ef4dcb0fa1e1..88db5ada13329a5fe0d0fb652d2c8a8d
// Folia end - region threading
// Paper end - optimise chunk tick iteration
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a04ae14681880897132bd410680d8f69b1593795..653728709b275fee822e55a511e67ec11fdc48f7 100644
index 172f8e1abb036669b787fde570da8d326d2ab262..a16fc5ba55dbde0cf7f968884da40d70a754a0d8 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -897,6 +897,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -892,6 +892,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void tick(BooleanSupplier shouldKeepTicking, io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { // Folia - regionised ticking
final io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = this.getCurrentWorldData(); // Folia - regionised ticking
@ -1640,7 +1640,7 @@ index a04ae14681880897132bd410680d8f69b1593795..653728709b275fee822e55a511e67ec1
ProfilerFiller gameprofilerfiller = this.getProfiler();
regionizedWorldData.setHandlingTick(true); // Folia - regionised ticking
@@ -925,9 +926,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -920,9 +921,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!this.isDebug() && flag) {
j = regionizedWorldData.getRedstoneGameTime(); // Folia - region threading
gameprofilerfiller.push("blockTicks");
@ -1654,7 +1654,7 @@ index a04ae14681880897132bd410680d8f69b1593795..653728709b275fee822e55a511e67ec1
gameprofilerfiller.pop();
}
this.timings.scheduledBlocks.stopTiming(); // Paper
@@ -935,18 +940,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -930,18 +935,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
gameprofilerfiller.popPush("raid");
if (flag) {
this.timings.raids.startTiming(); // Paper - timings
@ -1679,7 +1679,7 @@ index a04ae14681880897132bd410680d8f69b1593795..653728709b275fee822e55a511e67ec1
this.timings.doSounds.stopTiming(); // Spigot
}
@@ -962,6 +973,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -957,6 +968,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
gameprofilerfiller.push("entities");
this.timings.tickEntities.startTiming(); // Spigot
if (this.dragonFight != null && flag) {
@ -1687,7 +1687,7 @@ index a04ae14681880897132bd410680d8f69b1593795..653728709b275fee822e55a511e67ec1
if (io.papermc.paper.util.TickThread.isTickThreadFor(this, this.dragonFight.origin)) { // Folia - region threading
gameprofilerfiller.push("dragonFight");
this.dragonFight.tick();
@@ -974,10 +986,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -969,10 +981,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
fightCenter
);
} // Folia end - region threading
@ -1700,7 +1700,7 @@ index a04ae14681880897132bd410680d8f69b1593795..653728709b275fee822e55a511e67ec1
regionizedWorldData.forEachTickingEntity((entity) -> { // Folia - regionised ticking
if (!entity.isRemoved()) {
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
@@ -1005,10 +1019,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1000,10 +1014,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
});
@ -1714,7 +1714,7 @@ index a04ae14681880897132bd410680d8f69b1593795..653728709b275fee822e55a511e67ec1
}
gameprofilerfiller.push("entityManagement");
@@ -1068,12 +1085,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1063,12 +1080,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
public void tickCustomSpawners(boolean spawnMonsters, boolean spawnAnimals) {
@ -1730,7 +1730,7 @@ index a04ae14681880897132bd410680d8f69b1593795..653728709b275fee822e55a511e67ec1
}
}
@@ -1523,6 +1543,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1518,6 +1538,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper start- timings
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity);
timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper
@ -1742,7 +1742,7 @@ index a04ae14681880897132bd410680d8f69b1593795..653728709b275fee822e55a511e67ec1
try {
// Paper end - timings
entity.setOldPosAndRot();
@@ -1548,7 +1573,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1543,7 +1568,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Folia end - region threading
} else { entity.inactiveTick(); } // Paper - EAR 2
this.getProfiler().pop();
@ -1751,7 +1751,7 @@ index a04ae14681880897132bd410680d8f69b1593795..653728709b275fee822e55a511e67ec1
Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) {
@@ -1572,6 +1597,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1567,6 +1592,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper - EAR 2
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger);
co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper
@ -1763,7 +1763,7 @@ index a04ae14681880897132bd410680d8f69b1593795..653728709b275fee822e55a511e67ec1
try {
// Paper end
passenger.setOldPosAndRot();
@@ -1611,7 +1641,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1606,7 +1636,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(passenger, entity2);
}
@ -1773,10 +1773,10 @@ index a04ae14681880897132bd410680d8f69b1593795..653728709b275fee822e55a511e67ec1
} else {
passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 8c74ba46920c41f82df7ae066caffd17b333301c..5d4876fc53eb12ee8e4a0159177e05cee847f077 100644
index b19f1db38e71d9185cca9fc0e44937f91443a042..d13edeff0de64cb77d7668e5b964cabcf9729388 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1329,6 +1329,7 @@ public abstract class PlayerList {
@@ -1327,6 +1327,7 @@ public abstract class PlayerList {
public void saveAll(int interval) {
io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
@ -1784,7 +1784,7 @@ index 8c74ba46920c41f82df7ae066caffd17b333301c..5d4876fc53eb12ee8e4a0159177e05ce
MinecraftTimings.savePlayers.startTiming(); // Paper
int numSaved = 0;
long now = System.nanoTime(); // Folia - region threading
@@ -1340,7 +1341,9 @@ public abstract class PlayerList {
@@ -1338,7 +1339,9 @@ public abstract class PlayerList {
}
// Folia end - region threading
if (interval == -1 || now - entityplayer.lastSave >= timeInterval) { // Folia - region threading
@ -1795,7 +1795,7 @@ index 8c74ba46920c41f82df7ae066caffd17b333301c..5d4876fc53eb12ee8e4a0159177e05ce
if (interval != -1 && max != -1 && ++numSaved >= max) {
break;
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index e52f3da3b63cc3dba59d3e874a8420dd312b5e96..dc83dc377aff965222006e3eaaceb57692d2604f 100644
index 09e8445a3f8c6b3ebc852a75a9a25b41a51ba659..f921c159c4f7556daf3c8405241de3607ba251ad 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -326,6 +326,13 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@ -1826,10 +1826,10 @@ index e52f3da3b63cc3dba59d3e874a8420dd312b5e96..dc83dc377aff965222006e3eaaceb576
this.factory = factory;
this.category = spawnGroup;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 394ec4f018b676a441e49d7ccbef3f8c56673603..412b764a4911485487c7967ed64b74e97eb8fa8c 100644
index de7c06785e3914fe7181bcb836b70a96a4900011..bc38893427cbe560ffea30996a391b7ba97f9d5c 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -229,6 +229,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -223,6 +223,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return this.getCurrentWorldData().getLocalPlayers();
}
// Folia end - region ticking
@ -1839,7 +1839,7 @@ index 394ec4f018b676a441e49d7ccbef3f8c56673603..412b764a4911485487c7967ed64b74e9
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, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
@@ -321,6 +324,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -315,6 +318,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
this.maxSection = io.papermc.paper.util.WorldUtil.getMaxSection(this);
// Paper end - optimise collisions
@ -1848,8 +1848,8 @@ index 394ec4f018b676a441e49d7ccbef3f8c56673603..412b764a4911485487c7967ed64b74e9
+ // Folia end - profiler
}
// Paper start
@@ -1309,17 +1315,21 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper start - Cancel hit for vanished players
@@ -1299,17 +1305,21 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
protected void tickBlockEntities() {
@ -1871,10 +1871,10 @@ index 394ec4f018b676a441e49d7ccbef3f8c56673603..412b764a4911485487c7967ed64b74e9
// Spigot start
// Iterator<TickingBlockEntity> iterator = this.blockEntityTickers.iterator();
boolean flag = this.tickRateManager().runsNormally();
@@ -1346,6 +1356,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1336,6 +1346,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
}
blockEntityTickers.removeAll(toRemove); // Folia - regionised ticking
blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 // Folia - regionised ticking
+ } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.TILE_ENTITY_TICK); } // Folia - profiler
this.timings.tileEntityTick.stopTiming(); // Spigot
@ -1917,7 +1917,7 @@ index 2e110da3502a7ac5ec4cc20510a3fac933569895..5aac65f37a0190c5d6a7175073fb0cc0
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 562f42d0ccda8dadf9ddc08b1acb67c0e0c22d7e..d6bc8c0dfa8f180ced0ee55d03797411164ad55a 100644
index 852fef18497435827a03e0056a09e5deb2525ed9..4847f7caa9147a63f85a86c1c45500f45ff48fbb 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1181,11 +1181,14 @@ public class LevelChunk extends ChunkAccess {