Skip to content

Commit 8b274f8

Browse files
committed
First review pass
1 parent 1de06ce commit 8b274f8

File tree

6 files changed

+176
-102
lines changed

6 files changed

+176
-102
lines changed

folia-server/minecraft-patches/features/0001-Region-Threading-Base.patch

Lines changed: 154 additions & 81 deletions
Large diffs are not rendered by default.

folia-server/minecraft-patches/features/0006-Sync-vehicle-position-to-player-position-on-player-d.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ This allows the player to be re-positioned before logging into
77
the world without causing thread checks to trip on Folia.
88

99
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
10-
index d02e15fca5aceede3466eef3c3ab67c14c56f160..2da37f8df788a1bb6cb63566b2b74d7013def037 100644
10+
index 73f641d4035293c3a3c6abb8fa7c61a38c4012cb..0dbc2d45bd367342a15024e72458f7c18370a369 100644
1111
--- a/net/minecraft/server/level/ServerPlayer.java
1212
+++ b/net/minecraft/server/level/ServerPlayer.java
13-
@@ -721,8 +721,18 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
13+
@@ -718,8 +718,18 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
1414
Optional<ValueInput> optional = input.child("RootVehicle");
1515
if (!optional.isEmpty()) {
1616
ServerLevel serverLevel = this.level();

folia-server/minecraft-patches/features/0007-Region-profiler.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,11 +1446,11 @@ index 0000000000000000000000000000000000000000..08a0f331ac8895acb1d0fe163d85037c
14461446
+ }
14471447
+}
14481448
diff --git a/net/minecraft/network/PacketProcessor.java b/net/minecraft/network/PacketProcessor.java
1449-
index 217d6b3077ff0cc9524104f0aeb043e2271e96d1..1f2a7435aacf9925228de8eb3a5d38eff437ba82 100644
1449+
index 406849772f764eb5f5f986ea5e3e0213f83b3255..758cb258a7e0478bfaacfc1b6c93ce8a501b0e6c 100644
14501450
--- a/net/minecraft/network/PacketProcessor.java
14511451
+++ b/net/minecraft/network/PacketProcessor.java
14521452
@@ -103,7 +103,10 @@ public class PacketProcessor implements AutoCloseable {
1453-
if (this.listener instanceof net.minecraft.server.network.ServerCommonPacketListenerImpl serverCommonPacketListener && serverCommonPacketListener.processedDisconnect) return; // Paper - Don't handle sync packets for kicked players
1453+
if (this.listener instanceof net.minecraft.server.network.ServerCommonPacketListenerImpl serverCommonPacketListener && (serverCommonPacketListener.processedDisconnect || serverCommonPacketListener.handledDisconnect)) return; // Paper - Don't handle sync packets for kicked players // Folia - correctly handle cases where the configuration listener disconnects, ensure that no login packets get processed
14541454
if (this.listener.shouldHandleMessage(this.packet)) {
14551455
try {
14561456
+ final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler(); // Folia - profiler
@@ -1461,7 +1461,7 @@ index 217d6b3077ff0cc9524104f0aeb043e2271e96d1..1f2a7435aacf9925228de8eb3a5d38ef
14611461
if (var3 instanceof ReportedException reportedException && reportedException.getCause() instanceof OutOfMemoryError) {
14621462
throw PacketUtils.makeReportedException(var3, this.packet, this.listener);
14631463
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
1464-
index 2ab577f545330efa8ee27999c99301a062a79307..f887361fcce734f42f11bca3e0029deb0141bab6 100644
1464+
index ae5ef245999e456612edc6c566e8a8c302684fb7..bcbce98f97169f98053badeabf2d20f3a798b488 100644
14651465
--- a/net/minecraft/server/MinecraftServer.java
14661466
+++ b/net/minecraft/server/MinecraftServer.java
14671467
@@ -1658,6 +1658,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1938,7 +1938,7 @@ index abccad13c2bb3a33e98ad8eb6d7f08c0ef021811..0590d5723854a03a59fe9471710802f4
19381938
}
19391939
}
19401940
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
1941-
index 40d8a43b6b4a3fdb623a796dcd219cabc8632d7c..28e89704793676b1d47afbbc1b1472b14fce9d84 100644
1941+
index 9f7fa145f7f6a765c668dc7754626a91bef4ce6a..6809547216f9767d600cc4bf0bff43d572161417 100644
19421942
--- a/net/minecraft/world/level/Level.java
19431943
+++ b/net/minecraft/world/level/Level.java
19441944
@@ -194,6 +194,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl

folia-server/paper-patches/features/0001-Region-Threading-Base.patch

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ index b2961752b50e98d95adf3af4f658e2fdb2127d43..51b54104eb70f64a548f37eeab1a4446
929929

930930
@Override
931931
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
932-
index 6cd3469d49f0e56f212d393f133205aa3b295a88..df936767a7d7a252d362bd97cad4aaf093e70ab0 100644
932+
index 6cd3469d49f0e56f212d393f133205aa3b295a88..d66f6b829dda61823ddb238d31a9d9de381741a2 100644
933933
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
934934
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
935935
@@ -239,7 +239,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1172,7 +1172,7 @@ index 6cd3469d49f0e56f212d393f133205aa3b295a88..df936767a7d7a252d362bd97cad4aaf0
11721172
Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
11731173
Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory);
11741174

1175-
@@ -1498,26 +1518,31 @@ public class CraftWorld extends CraftRegionAccessor implements World {
1175+
@@ -1498,21 +1518,25 @@ public class CraftWorld extends CraftRegionAccessor implements World {
11761176

11771177
@Override
11781178
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
@@ -1198,21 +1198,15 @@ index 6cd3469d49f0e56f212d393f133205aa3b295a88..df936767a7d7a252d362bd97cad4aaf0
11981198
this.server.getWorldMetadata().removeMetadata(this, metadataKey, owningPlugin);
11991199
}
12001200

1201-
@Override
1202-
public int getSpawnLimit(SpawnCategory spawnCategory) {
1203-
+ io.papermc.paper.threadedregions.RegionizedServer.ensureGlobalTickThread("Cannot modify server settings off of the global region"); // Folia - region threading
1204-
Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
1205-
Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory);
1206-
1207-
@@ -1534,6 +1559,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
1201+
@@ -1534,6 +1558,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
12081202

12091203
@Override
12101204
public void setSpawnLimit(SpawnCategory spawnCategory, int limit) {
12111205
+ io.papermc.paper.threadedregions.RegionizedServer.ensureGlobalTickThread("Cannot modify server settings off of the global region"); // Folia - region threading
12121206
Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
12131207
Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory);
12141208

1215-
@@ -1591,7 +1617,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
1209+
@@ -1591,7 +1616,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
12161210
if (!(entity instanceof CraftEntity craftEntity) || entity.getWorld() != this || sound == null || category == null) return;
12171211

12181212
ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(CraftSound.bukkitToMinecraftHolder(sound), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed);
@@ -1221,7 +1215,7 @@ index 6cd3469d49f0e56f212d393f133205aa3b295a88..df936767a7d7a252d362bd97cad4aaf0
12211215
if (entityTracker != null) {
12221216
entityTracker.sendToTrackingPlayersAndSelf(packet);
12231217
}
1224-
@@ -1612,7 +1638,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
1218+
@@ -1612,7 +1637,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
12251219
if (!(entity instanceof CraftEntity craftEntity) || entity.getWorld() != this || sound == null || category == null) return;
12261220

12271221
ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(Holder.direct(SoundEvent.createVariableRangeEvent(Identifier.parse(sound))), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed);
@@ -1230,23 +1224,23 @@ index 6cd3469d49f0e56f212d393f133205aa3b295a88..df936767a7d7a252d362bd97cad4aaf0
12301224
if (entityTracker != null) {
12311225
entityTracker.sendToTrackingPlayersAndSelf(packet);
12321226
}
1233-
@@ -1663,6 +1689,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
1227+
@@ -1663,6 +1688,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
12341228
@SuppressWarnings({"unchecked", "rawtypes"})
12351229
@Override
12361230
public boolean setGameRuleValue(String rule, String value) {
12371231
+ io.papermc.paper.threadedregions.RegionizedServer.ensureGlobalTickThread("Cannot modify server settings off of the global region"); // Folia - region threading
12381232
// No null values allowed
12391233
if (rule == null || value == null) return false;
12401234

1241-
@@ -1726,6 +1753,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
1235+
@@ -1726,6 +1752,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
12421236

12431237
@Override
12441238
public <T> boolean setGameRule(org.bukkit.@NotNull GameRule<T> rule, @NotNull T newValue) {
12451239
+ io.papermc.paper.threadedregions.RegionizedServer.ensureGlobalTickThread("Cannot modify server settings off of the global region"); // Folia - region threading
12461240
Preconditions.checkArgument(rule != null, "GameRule cannot be null");
12471241
Preconditions.checkArgument(newValue != null, "GameRule value cannot be null");
12481242

1249-
@@ -1879,6 +1907,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
1243+
@@ -1879,6 +1906,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
12501244

12511245
@Override
12521246
public void sendGameEvent(Entity sourceEntity, org.bukkit.GameEvent gameEvent, Vector position) {
@@ -1259,7 +1253,7 @@ index 6cd3469d49f0e56f212d393f133205aa3b295a88..df936767a7d7a252d362bd97cad4aaf0
12591253
getHandle().gameEvent(sourceEntity != null ? ((CraftEntity) sourceEntity).getHandle(): null, net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT.get(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(gameEvent.getKey())).orElseThrow(), org.bukkit.craftbukkit.util.CraftVector.toBlockPos(position));
12601254
}
12611255
// Paper end
1262-
@@ -1908,7 +1942,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
1256+
@@ -1908,7 +1941,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
12631257
Preconditions.checkArgument(radius >= 0, "Radius value (%s) cannot be negative", radius);
12641258

12651259
Raids persistentRaid = this.world.getRaids();

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
group=dev.folia
22
version=1.21.11-R0.1-SNAPSHOT
33
mcVersion=1.21.11
4+
# This is the current API version for use in (paper-)plugin.yml files
5+
# During snapshot cycles this should be the anticipated version of the release target
6+
apiVersion=1.21.11
47

58
paperRef=e5e2c50ed3f7a6e4dbe7451c089cb1ad3f77f8f9
69

update.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- world loading structure: dubious handling of custom generator spawn selection (MinecraftServer#setInitialSpawn)
2+
3+
- chk player login logic
4+
- chk entity/player teleport/respawn logic

0 commit comments

Comments
 (0)