Update to Paper 1.20.6

This commit is contained in:
Spottedleaf 2024-05-09 21:07:34 -07:00
parent ec6b1729ec
commit 7c75e53c65
21 changed files with 1294 additions and 1336 deletions

View File

@ -4,7 +4,7 @@ plugins {
java java
`maven-publish` `maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.1" apply false id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("io.papermc.paperweight.patcher") version "1.5.15" id("io.papermc.paperweight.patcher") version "1.6.3"
} }
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
@ -17,7 +17,7 @@ repositories {
} }
dependencies { dependencies {
remapper("net.fabricmc:tiny-remapper:0.10.1:fat") remapper("net.fabricmc:tiny-remapper:0.10.2:fat")
decompiler("org.vineflower:vineflower:1.10.1") decompiler("org.vineflower:vineflower:1.10.1")
paperclip("io.papermc:paperclip:3.0.3") paperclip("io.papermc:paperclip:3.0.3")
} }
@ -28,7 +28,7 @@ allprojects {
java { java {
toolchain { toolchain {
languageVersion.set(JavaLanguageVersion.of(17)) languageVersion.set(JavaLanguageVersion.of(21))
} }
} }
} }
@ -36,7 +36,7 @@ allprojects {
subprojects { subprojects {
tasks.withType<JavaCompile> { tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()
options.release.set(17) options.release.set(21)
} }
tasks.withType<Javadoc> { tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()

View File

@ -1,8 +1,8 @@
group=dev.folia group=dev.folia
version=1.20.6-R0.1-SNAPSHOT
mcVersion=1.20.6
version=1.20.4-R0.1-SNAPSHOT paperRef=1b67e023851f406c68789fd5f187cebdac04ce65
mcVersion=1.20.4
paperRef=7ac24a18940da12beb39a030113f6e459f348e2f
org.gradle.caching=true org.gradle.caching=true
org.gradle.parallel=true org.gradle.parallel=true

View File

@ -7,10 +7,10 @@ Add both a location based scheduler, an entity based scheduler,
and a global region scheduler. and a global region scheduler.
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index fc2dae69165776d08274e34a69962cc70445f411..06149045a44148bf0af5f52952ff0092fe2c70cb 100644 index 07a9c9e254188c251165ca84c8e961fccda01175..d42e586f6be226a9aaf344d49f7dd7dc7566005f 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -544,9 +544,9 @@ public final class SimplePluginManager implements PluginManager { @@ -556,9 +556,9 @@ public final class SimplePluginManager implements PluginManager {
} }
try { try {

View File

@ -11,10 +11,10 @@ the schedulers depending on the result of the ownership
check. check.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 9a428153f34291bdc026a71f7e60e285b7794b0c..c37904d1aae749030620e1bbdb955e25c91ab1f8 100644 index 5d1b55fdbcbe63f6b42b694d05211a3cc691a09d..b4327a55c422380ca6b3a1dc47c3adbe76de4655 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2879,6 +2879,14 @@ public final class Bukkit { @@ -2905,6 +2905,14 @@ public final class Bukkit {
return server.isOwnedByCurrentRegion(entity); return server.isOwnedByCurrentRegion(entity);
} }
// Paper end - Folia region threading API // Paper end - Folia region threading API
@ -30,10 +30,10 @@ index 9a428153f34291bdc026a71f7e60e285b7794b0c..c37904d1aae749030620e1bbdb955e25
@NotNull @NotNull
public static Server.Spigot spigot() { public static Server.Spigot spigot() {
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 4ff1b38eb65f97344257204cf018f176f247ed36..15395ef52505087e7eef3b1a5981e787dcc16508 100644 index 30cbe3bdc7142769019765b03cc4fe1f9ba1ddb4..2a888d33eff4487f23463c565c9f75c40fba7d94 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -2518,4 +2518,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2540,4 +2540,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/ */
boolean isOwnedByCurrentRegion(@NotNull Entity entity); boolean isOwnedByCurrentRegion(@NotNull Entity entity);
// Paper end - Folia region threading API // Paper end - Folia region threading API

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Build changes
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..12f9f9d46c098c5c88058cb1f73ae39a7d1debd5 100644 index 079bf6878538a1c223ac912f29f6df79a1167218..b1d621ed91c74790fd5b66339c044ec444de62ef 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { @@ -12,8 +12,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
val alsoShade: Configuration by configurations.creating val alsoShade: Configuration by configurations.creating
dependencies { dependencies {
@ -23,7 +23,7 @@ index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..12f9f9d46c098c5c88058cb1f73ae39a
// Paper start // Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0") implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0") implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -71,7 +75,7 @@ tasks.jar { @@ -79,7 +83,7 @@ tasks.jar {
attributes( attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main", "Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit", "Implementation-Title" to "CraftBukkit",
@ -32,7 +32,7 @@ index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..12f9f9d46c098c5c88058cb1f73ae39a
"Implementation-Vendor" to date, // Paper "Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit", "Specification-Title" to "Bukkit",
"Specification-Version" to project.version, "Specification-Version" to project.version,
@@ -150,7 +154,7 @@ fun TaskContainer.registerRunTask( @@ -138,7 +142,7 @@ fun TaskContainer.registerRunTask(
name: String, name: String,
block: JavaExec.() -> Unit block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) { ): TaskProvider<JavaExec> = register<JavaExec>(name) {
@ -93,10 +93,10 @@ index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..e2f704c115fd6e00960bb56bb0779f11
).openBufferedStream()) { ).openBufferedStream()) {
JsonObject json = new Gson().fromJson(reader, JsonObject.class); 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 diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2dc07e5ef249636e85ad9c78e3729e9e066a8fe8..6c42592bfaf85f23f7ff9966d7869aa0237f59c5 100644 index 8dc2f9df367c849ca333bf1a1fd92ff91617b548..5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1865,7 +1865,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1924,7 +1924,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate @DontObfuscate
public String getServerModName() { public String getServerModName() {
@ -106,10 +106,10 @@ index 2dc07e5ef249636e85ad9c78e3729e9e066a8fe8..6c42592bfaf85f23f7ff9966d7869aa0
public SystemReport fillSystemReport(SystemReport details) { 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 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c490a29bcf7410bc54959ee71375605964379ed5..b63effd92be5a8a75db6c37e5a1b91541020ec75 100644 index 57db399bc1d3b6b015740b059987bc8d9bcc3101..d50b1f84dfb6e30fd0d0dd2ee66f874681ad6b78 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -266,7 +266,7 @@ import javax.annotation.Nullable; // Paper @@ -268,7 +268,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server { public final class CraftServer implements Server {

File diff suppressed because it is too large Load Diff

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Max pending logins
Should help the floodgates on launch 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 diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 58cdb65083134680230d7070f9f6209f2d32873b..aa4b461bbb2c8c4753f7c9057bab1740de2c0284 100644 index 734f745ce383c8398fdedeb6fd71277e1482a4a6..83b09feec13a00c35e6f8d4f0ccdae1c8da9c0e5 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/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, @@ -110,7 +110,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
if (this.server.getPlayerList().pushPendingJoin(name, uniqueId, this.connection)) { if (this.server.getPlayerList().pushPendingJoin(name, uniqueId, this.connection)) {
// Folia end - region threading - rewrite login process // Folia end - region threading - rewrite login process
this.verifyLoginAndFinishConnectionSetup((GameProfile) Objects.requireNonNull(this.authenticatedProfile)); this.verifyLoginAndFinishConnectionSetup((GameProfile) Objects.requireNonNull(this.authenticatedProfile));
@ -17,12 +17,12 @@ index 58cdb65083134680230d7070f9f6209f2d32873b..aa4b461bbb2c8c4753f7c9057bab1740
+ } else { --this.tick; } // Paper - prevent logins to be processed even though disconnect was called // Folia - max concurrent logins + } 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))) { // CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 08daa5ed0b4b599836b97eef1e53e630e7659443..a390227e5af1232f2090d2be72f7789805025f76 100644 index 67b832c9a36f8af245e381c7fa3c56a7e9becd1e..db2903276c694d395f62afdc7c71344466ae505f 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -173,6 +173,17 @@ public abstract class PlayerList { @@ -175,6 +175,17 @@ public abstract class PlayerList {
conflictingId = this.connectionById.get(byId); conflictingId = this.connectionById.get(byId);
if (conflictingName == null && conflictingId == null) { if (conflictingName == null && conflictingId == null) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add chunk system throughput counters to /tps
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkFullTask.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkFullTask.java diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkFullTask.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkFullTask.java
index 679ed4d53269e1113035b462cf74ab16a231e22e..8a48238fac0949cfddcdd9ccf179d16befe9c4d4 100644 index c307b084f59f7bb94dc02f25bbcd3e01e01d2306..b53d15a3979f42cb1b9a4cba24147c32f9a1a676 100644
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkFullTask.java --- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkFullTask.java
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkFullTask.java +++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkFullTask.java
@@ -22,6 +22,9 @@ public final class ChunkFullTask extends ChunkProgressionTask implements Runnabl @@ -22,6 +22,9 @@ public final class ChunkFullTask extends ChunkProgressionTask implements Runnabl

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 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index fe07f0881f5835974f00c65498a31a19c8ead97c..0e71fa29ebfa649bc23899046396a6b01c4bd131 100644 index b1b6c173d8d083e50120eb890116e8d50e20b2a8..75c2e1a599f2205e0bbc433d8ccdf3de566360c7 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2930,6 +2930,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2992,6 +2992,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) { if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
return false; return false;
} else { } else {
@ -40,7 +40,7 @@ index fe07f0881f5835974f00c65498a31a19c8ead97c..0e71fa29ebfa649bc23899046396a6b0
// CraftBukkit start // CraftBukkit start
if (entity.getBukkitEntity() instanceof Vehicle && this.getBukkitEntity() instanceof LivingEntity) { if (entity.getBukkitEntity() instanceof Vehicle && this.getBukkitEntity() instanceof LivingEntity) {
VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.getBukkitEntity()); VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.getBukkitEntity());
@@ -2951,6 +2952,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3013,6 +3014,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return false; return false;
} }
// CraftBukkit end // CraftBukkit end
@ -48,7 +48,7 @@ index fe07f0881f5835974f00c65498a31a19c8ead97c..0e71fa29ebfa649bc23899046396a6b0
if (this.isPassenger()) { if (this.isPassenger()) {
this.stopRiding(); this.stopRiding();
} }
@@ -3028,6 +3030,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3090,6 +3092,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else { } else {
// CraftBukkit start // CraftBukkit start
@ -56,7 +56,7 @@ index fe07f0881f5835974f00c65498a31a19c8ead97c..0e71fa29ebfa649bc23899046396a6b0
CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle(); CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
Entity orig = craft == null ? null : craft.getHandle(); Entity orig = craft == null ? null : craft.getHandle();
if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
@@ -3055,6 +3058,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3117,6 +3120,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return false; return false;
} }
// CraftBukkit end // CraftBukkit end
@ -65,7 +65,7 @@ index fe07f0881f5835974f00c65498a31a19c8ead97c..0e71fa29ebfa649bc23899046396a6b0
this.passengers = ImmutableList.of(); this.passengers = ImmutableList.of();
} else { } else {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java
index 236f94348ff8da661e23e3e17b7fc1b143680da9..7d4cdb0c5cd24aee4c831e59836c5bdd0b9ea800 100644 index 591af9d0d2fdc9953415979fc97a4a00afd85885..4d4c88b2464bd1a65082a3377fac8a5ec90fdeae 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java --- a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -97,8 +97,20 @@ index 236f94348ff8da661e23e3e17b7fc1b143680da9..7d4cdb0c5cd24aee4c831e59836c5bdd
return (net.minecraft.world.entity.projectile.Projectile) entity; return (net.minecraft.world.entity.projectile.Projectile) entity;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java
index d4e0170694409e674d488f913e61c205f6483712..328b0609491fe11b1e46574807cea3bc8992a068 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java
@@ -120,6 +120,7 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr
@Override
public net.minecraft.world.entity.projectile.AbstractArrow getHandle() {
+ io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading
return (net.minecraft.world.entity.projectile.AbstractArrow) this.entity;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
index f9cd595ec28f0284d11bae6bfc5bf92d56526ef9..a8479fa2839c77399be83dbf20051b33900044bb 100644 index 9bcc0931510607b8fbd01233e2b3c346369b214d..74aeff7b47b1f5325e5ac676d9aed3c94a2a843c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
@@ -17,8 +17,16 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac @@ -17,8 +17,16 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
@ -161,6 +173,18 @@ index 34e4c763c7ec971885147ab2509281fad56e1ca6..a0a83e9111523a8080f30d0fdd35b9c9
return (Villager) this.entity; return (Villager) this.entity;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractWindCharge.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractWindCharge.java
index 5e6bbeeea0cbf53180fd1260fc53f843469d6588..cb3c3c3294f0760956b6c5643e69afe0e9562f23 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractWindCharge.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractWindCharge.java
@@ -17,6 +17,7 @@ public abstract class CraftAbstractWindCharge extends CraftFireball implements A
@Override
public net.minecraft.world.entity.projectile.windcharge.AbstractWindCharge getHandle() {
+ io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading
return (net.minecraft.world.entity.projectile.windcharge.AbstractWindCharge) this.entity;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java
index ae16e8d1bfe8e9315391510eddb367a3fbdc9e03..bdbb54cc60c9afa8a7b89419563fcbe502554aac 100644 index ae16e8d1bfe8e9315391510eddb367a3fbdc9e03..bdbb54cc60c9afa8a7b89419563fcbe502554aac 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java
@ -246,7 +270,7 @@ index ab42bc721d5b6c17c2ca6c7153b757571aea05e8..2887699c16b9452ce948f8b945c595ca
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
index a46b2dfb2f1c0c7c3b55d81fc881e481348f98b8..17f1d4bdd3ee642e5fa5e0d9f5a61348d9ee1e1d 100644 index af35ff560a02daca7a130322fccbb52160e2db98..e6422dd9175e1e87580c9f3930ce486d1cfe730d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
@@ -27,8 +27,16 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud @@ -27,8 +27,16 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
@ -266,6 +290,18 @@ index a46b2dfb2f1c0c7c3b55d81fc881e481348f98b8..17f1d4bdd3ee642e5fa5e0d9f5a61348
return (net.minecraft.world.entity.AreaEffectCloud) super.getHandle(); return (net.minecraft.world.entity.AreaEffectCloud) super.getHandle();
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmadillo.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmadillo.java
index e7f2d8de25a489d7f52c78c750e6f7f9b8fee177..99f331b555cb6c55af4e0d7785d282645f92a570 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmadillo.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmadillo.java
@@ -11,6 +11,7 @@ public class CraftArmadillo extends CraftAnimals implements Armadillo {
@Override
public net.minecraft.world.entity.animal.armadillo.Armadillo getHandle() {
+ io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading
return (net.minecraft.world.entity.animal.armadillo.Armadillo) super.getHandle();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
index ccda0d7a96c201905f0f62dcb0e5b278a51dee9f..3ba6c46e0f5bc5f6b5994d41aaa9c4dd8276df9b 100644 index ccda0d7a96c201905f0f62dcb0e5b278a51dee9f..3ba6c46e0f5bc5f6b5994d41aaa9c4dd8276df9b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@ -288,11 +324,19 @@ index ccda0d7a96c201905f0f62dcb0e5b278a51dee9f..3ba6c46e0f5bc5f6b5994d41aaa9c4dd
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
index 0fd2677181d741e553b9825c8c319a209194ec46..a3a5c77b264a40911ddcee9b8c593fd07b3041d7 100644 index 62fe1ae5cfdcba84d8d1456a9939e4649aea8794..e7f6a14956d0131c2089285e6fbf0223f3e8e340 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
@@ -135,6 +135,13 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow { @@ -25,6 +25,7 @@ public class CraftArrow extends CraftAbstractArrow implements Arrow {
this.getHandle().setShotFromCrossbow(shotFromCrossbow);
@Override
public net.minecraft.world.entity.projectile.Arrow getHandle() {
+ io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading
return (net.minecraft.world.entity.projectile.Arrow) this.entity;
}
@@ -89,6 +90,13 @@ public class CraftArrow extends CraftAbstractArrow implements Arrow {
return true;
} }
+ // Folia start - region threading + // Folia start - region threading
@ -303,16 +347,8 @@ index 0fd2677181d741e553b9825c8c319a209194ec46..a3a5c77b264a40911ddcee9b8c593fd0
+ // Folia end - region threading + // Folia end - region threading
+ +
@Override @Override
public ItemStack getItem() { public void setBasePotionType(PotionType potionType) {
return CraftItemStack.asBukkitCopy(this.getHandle().pickupItemStack); if (potionType != null) {
@@ -149,6 +156,7 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
@Override
public net.minecraft.world.entity.projectile.AbstractArrow getHandle() {
+ io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading
return (net.minecraft.world.entity.projectile.AbstractArrow) this.entity;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java
index cbfca242f820d238b112f8ce64e9de8398c48a1c..c5f0cd5e69a20f1fffcd017385bf9fab59630ffc 100644 index cbfca242f820d238b112f8ce64e9de8398c48a1c..c5f0cd5e69a20f1fffcd017385bf9fab59630ffc 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java
@ -439,6 +475,42 @@ index e33b1b6fd50a4eea57500cc00dba20d6edcab75d..f9a8e684a04c4ffdf566b29252e18dbf
return (net.minecraft.world.entity.vehicle.Boat) this.entity; return (net.minecraft.world.entity.vehicle.Boat) this.entity;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBogged.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBogged.java
index b252236369315502278e9b7c93709a347ec16636..a6baa179d43495f71c4dcece8b50556e7217261b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBogged.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBogged.java
@@ -12,6 +12,7 @@ public class CraftBogged extends CraftAbstractSkeleton implements Bogged {
@Override
public net.minecraft.world.entity.monster.Bogged getHandle() {
+ io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading
return (net.minecraft.world.entity.monster.Bogged) this.entity;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBreeze.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBreeze.java
index 3f3d087387d3169f352d7377c0e5a24668c3d17e..23f6eac9cec63da625c6328895702bc26c9c8ada 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBreeze.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBreeze.java
@@ -11,6 +11,7 @@ public class CraftBreeze extends CraftMonster implements Breeze {
@Override
public net.minecraft.world.entity.monster.breeze.Breeze getHandle() {
+ io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading
return (net.minecraft.world.entity.monster.breeze.Breeze) this.entity;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBreezeWindCharge.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBreezeWindCharge.java
index e88e52a9b8a4d2d750101b0529cbe2a9976e91dd..8ba5a80bb4847cf33e2618cf5122f1fcffc2453d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBreezeWindCharge.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBreezeWindCharge.java
@@ -10,6 +10,7 @@ public class CraftBreezeWindCharge extends CraftAbstractWindCharge implements Br
@Override
public net.minecraft.world.entity.projectile.windcharge.BreezeWindCharge getHandle() {
+ io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading
return (net.minecraft.world.entity.projectile.windcharge.BreezeWindCharge) this.entity;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCamel.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCamel.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCamel.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCamel.java
index 80e571c977db5cdf43bfbfce035f37a3fa325c95..6fafba37dd7128a397ba046be7b33067c9e88f25 100644 index 80e571c977db5cdf43bfbfce035f37a3fa325c95..6fafba37dd7128a397ba046be7b33067c9e88f25 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCamel.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCamel.java
@ -461,10 +533,10 @@ index 80e571c977db5cdf43bfbfce035f37a3fa325c95..6fafba37dd7128a397ba046be7b33067
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
index 42342628227742aa7ee6b84caa0e1f13b498babe..8fa5a33a32ea0c9e5e7f941011612060db8ea826 100644 index a565ac47b3dc9a27e043fc9cb00b6dea950f08cf..d753d481d84f3c6cabef79752b8164ebbb02e605 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
@@ -16,8 +16,16 @@ public class CraftCat extends CraftTameableAnimal implements Cat { @@ -17,8 +17,16 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
super(server, entity); super(server, entity);
} }
@ -503,10 +575,10 @@ index 4f661fbdb860cf550da0d952b775fe6f990b43b3..4a8b2b6bf80d43bba551c34a1a03fd5c
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java
index f1844d697b91e61878ade5b922cf2a3a538365c7..c07479ea6eca28e47bb618b420e57814c861ef8d 100644 index c0f6939ed782dd3151ebd7ee9d3d7e292154e76c..0e87d66a4c5da38bdf12b657adaf56711483f0fa 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java
@@ -18,8 +18,16 @@ public class CraftChestBoat extends CraftBoat implements org.bukkit.entity.Chest @@ -15,8 +15,16 @@ public class CraftChestBoat extends CraftBoat implements org.bukkit.entity.Chest
this.inventory = new CraftInventory(entity); this.inventory = new CraftInventory(entity);
} }
@ -902,7 +974,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 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 1cfe604573000fa9b32237313aa467875a891f3c..8c7e01972888df4ccbaccc4eebceeeb5ab357f4c 100644 index cf9282a46534319308e9ccf69f332a5c8c1745cf..9e883ff5ffd1298edc682873be248b8319061bb8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -491,7 +491,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -491,7 +491,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@ -1007,7 +1079,7 @@ index 1359d25a32b4a5d5e8e68ce737bd19f7b5afaf69..0be7f84a50b7568d0c639f5906b5ca76
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
index a8699b274b51c5f6691557c3c3db88436f05e304..45e900cd12c5615149c99a5dc85e8f78edb5483b 100644 index 939a0713c74dd92273190017d3976d894f002d95..51c96a085ca8b164435bafdc4f269f43e8f8fe6d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
@@ -60,8 +60,16 @@ public class CraftFireball extends AbstractProjectile implements Fireball { @@ -60,8 +60,16 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
@ -1133,10 +1205,10 @@ index c455deb4fd2a7684bcc01a8212c362a2375c190b..50ee6d3c3aa157fe69a483e02f33f231
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFrog.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFrog.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFrog.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFrog.java
index 65131d153b78a0787b977b9f65c15cfcbd395d11..e7501d8ec8f920939ef7599d5a88bd6ce7ab4f53 100644 index 4b0aac4362b773f30dfe7c1867fad98fc30b414c..e83fae32769cc4f258011aa7d15f7b2b64674c1c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFrog.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFrog.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFrog.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFrog.java
@@ -16,8 +16,16 @@ public class CraftFrog extends CraftAnimals implements org.bukkit.entity.Frog { @@ -17,8 +17,16 @@ public class CraftFrog extends CraftAnimals implements org.bukkit.entity.Frog {
super(server, entity); super(server, entity);
} }
@ -1364,10 +1436,10 @@ 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 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 7984365c8290ac9e526a413b56e1c8c0841e330c..0c468a1324996137eba5d1927d38a39859b705f0 100644 index 41f3cdec7deabf34358b8087df77169f85a5b919..51752a1ef885295e2c50832da1c1550ac0a8fb90 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -292,8 +292,16 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @@ -290,8 +290,16 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
this.mode = mode; this.mode = mode;
} }
@ -1595,10 +1667,10 @@ index e9f471e60af0725ec34e2985d63ae9ea9f88590a..6a443f42ecec16abea3ddf7bc2e85bb8
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index c4a166a0c226c6083c25c58145d9631d4296e615..ee1d3f33cf5f3cfc7909dbc33178df69bd656ab8 100644 index aa351df679f300018367244c7ccb3e5a59e9276f..9a24e70d574c854fa48510603bee7b0e5f7371e3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -470,6 +470,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -469,6 +469,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
this.getHandle().invulnerableTime = ticks; this.getHandle().invulnerableTime = ticks;
} }
@ -1612,7 +1684,7 @@ index c4a166a0c226c6083c25c58145d9631d4296e615..ee1d3f33cf5f3cfc7909dbc33178df69
@Override @Override
public int getNoActionTicks() { public int getNoActionTicks() {
return this.getHandle().getNoActionTime(); return this.getHandle().getNoActionTime();
@@ -483,6 +490,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -482,6 +489,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override @Override
public net.minecraft.world.entity.LivingEntity getHandle() { public net.minecraft.world.entity.LivingEntity getHandle() {
@ -1726,7 +1798,7 @@ index 8920af5a0dfe737c1f38d906b53e6a278456d2aa..8bc87cfe29d61b09eee8ecfccda319b5
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
index 0ee159d488b15e571f9b19ec852fe279755696fa..356ac7fcea71f173d8698f3de33bfe9616c08312 100644 index f34fa6715e477936097367a7aefd1a2bf87d3d90..40ecce7b710650a893ff5d4e5fac99cfa1b06cf9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
@@ -20,8 +20,16 @@ public class CraftMinecartCommand extends CraftMinecart implements CommandMineca @@ -20,8 +20,16 @@ public class CraftMinecartCommand extends CraftMinecart implements CommandMineca
@ -1747,10 +1819,10 @@ index 0ee159d488b15e571f9b19ec852fe279755696fa..356ac7fcea71f173d8698f3de33bfe96
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
index 313ee5c8737b2e57f9b5db6512c1871766b2ccd4..a0a136893a09185577cb46dfe8426fdb3a9a6ccd 100644 index 4388cd0303b45faf21631e7644baebb63baaba10..7bd3722e86b9da74d5e8476d189ba28f8f10956e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
@@ -16,8 +16,16 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo @@ -13,8 +13,16 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo
super(server, entity); super(server, entity);
} }
@ -1832,10 +1904,10 @@ 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 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index 31f62fbb54ec7b270fbd8afba7bd7c4bfafa09e3..0c89084eae131ae91d6c6aa910b1e0d2fc47747d 100644 index e155501fb3a88edf3ddac3aa0aae1b6a5a84962e..c17d5f6e60c4e2e0266e5c4288418d127e0ccdc8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/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 { @@ -53,8 +53,16 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
return (sound != null) ? CraftSound.minecraftToBukkit(sound) : null; return (sound != null) ? CraftSound.minecraftToBukkit(sound) : null;
} }
@ -1852,7 +1924,7 @@ index 31f62fbb54ec7b270fbd8afba7bd7c4bfafa09e3..0c89084eae131ae91d6c6aa910b1e0d2
return (net.minecraft.world.entity.Mob) this.entity; return (net.minecraft.world.entity.Mob) this.entity;
} }
@@ -64,7 +72,7 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { @@ -62,7 +70,7 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
@Override @Override
public void setHandle(net.minecraft.world.entity.Entity entity) { public void setHandle(net.minecraft.world.entity.Entity entity) {
super.setHandle(entity); super.setHandle(entity);
@ -1883,7 +1955,7 @@ index 706c74c832f6893df3797023f68add31139c7d57..80a612f16669e571e336dd6369a968b4
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
index 983e0cdbd1bd950807967a36cba49859fb956f31..7dc7e382d63cd5c42bb0ef72d4766d24be99c3a6 100644 index 5c5b64bd058684520fa175bfd10622ff57856b7c..ab8d6052c7f11b0563ea49a4766aa1cac93a5c1b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
@@ -19,6 +19,13 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm @@ -19,6 +19,13 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm
@ -1899,8 +1971,8 @@ index 983e0cdbd1bd950807967a36cba49859fb956f31..7dc7e382d63cd5c42bb0ef72d4766d24
+ +
@Override @Override
public boolean hasEffectsForNextStew() { public boolean hasEffectsForNextStew() {
return this.getHandle().stewEffects != null && !this.getHandle().stewEffects.isEmpty(); SuspiciousStewEffects stewEffects = this.getHandle().stewEffects;
@@ -100,6 +107,7 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm @@ -94,6 +101,7 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm
@Override @Override
public net.minecraft.world.entity.animal.MushroomCow getHandle() { public net.minecraft.world.entity.animal.MushroomCow getHandle() {
@ -1929,6 +2001,18 @@ index 5c60a30e80448fbf04b5fa4b1ef12fb2ee99bfd5..77eefdff4a5102fbc3abba7d7037fa7a
return (net.minecraft.world.entity.animal.Ocelot) this.entity; return (net.minecraft.world.entity.animal.Ocelot) this.entity;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftOminousItemSpawner.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftOminousItemSpawner.java
index ecdac2cf74e99f0d69e053dece11ab891973dc2b..14a1c58aacf7e07ffc254b5f02b6eb6dfc1a6277 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftOminousItemSpawner.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftOminousItemSpawner.java
@@ -13,6 +13,7 @@ public class CraftOminousItemSpawner extends CraftEntity implements OminousItemS
@Override
public net.minecraft.world.entity.OminousItemSpawner getHandle() {
+ io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading
return (net.minecraft.world.entity.OminousItemSpawner) this.entity;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java
index bcac1359c667ef1ee46384f9c7a5adf4010d2b08..f131a80df94a9f0d42a64a86424451fb06755b12 100644 index bcac1359c667ef1ee46384f9c7a5adf4010d2b08..f131a80df94a9f0d42a64a86424451fb06755b12 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java
@ -2140,10 +2224,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 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 232490c970d67e6bc77a35d5ccfef8fa95646ffe..0ece776a1e281a328e28dc07fb4dc882b19d029c 100644 index 81f442d23582049757353d9aba02d612e6058299..92f08b13da2e13cf375d8794e54f7292140545d7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -582,7 +582,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -667,7 +667,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void kick(net.kyori.adventure.text.Component message, org.bukkit.event.player.PlayerKickEvent.Cause cause) { public void kick(net.kyori.adventure.text.Component message, org.bukkit.event.player.PlayerKickEvent.Cause cause) {
@ -2152,7 +2236,7 @@ index 232490c970d67e6bc77a35d5ccfef8fa95646ffe..0ece776a1e281a328e28dc07fb4dc882
final ServerGamePacketListenerImpl connection = this.getHandle().connection; final ServerGamePacketListenerImpl connection = this.getHandle().connection;
if (connection != null) { if (connection != null) {
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause); connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause);
@@ -2209,9 +2209,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2294,9 +2294,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this; return this;
} }
@ -2170,7 +2254,7 @@ index 232490c970d67e6bc77a35d5ccfef8fa95646ffe..0ece776a1e281a328e28dc07fb4dc882
} }
public void setHandle(final ServerPlayer entity) { public void setHandle(final ServerPlayer entity) {
@@ -3266,7 +3273,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -3332,7 +3339,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
{ {
if ( CraftPlayer.this.getHealth() <= 0 && CraftPlayer.this.isOnline() ) if ( CraftPlayer.this.getHealth() <= 0 && CraftPlayer.this.isOnline() )
{ {
@ -2412,7 +2496,7 @@ index 7c75d78e5e28d7320c6dbe979bcd576658fb310b..83de93bd751b1c15ad763819e4fe87ec
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSizedFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSizedFireball.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSizedFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSizedFireball.java
index 824638b3428fd480419f559c07d1fc7fbd434a24..278ad88925fb5530fdeef35cb19002a0cdab68a0 100644 index de3327812c08b3bb8f5907ae657f67962d1e4e8b..d2452b8efdd066df985e4a55f80f09275a589a9c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSizedFireball.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSizedFireball.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSizedFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSizedFireball.java
@@ -27,8 +27,16 @@ public class CraftSizedFireball extends CraftFireball implements SizedFireball { @@ -27,8 +27,16 @@ public class CraftSizedFireball extends CraftFireball implements SizedFireball {
@ -2580,10 +2664,10 @@ index 4ce2373ff71c3c1b8951646e057587a3ab09e145..9041c121b9bc41152640c8e2ed983b9e
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java
index 6dff6db2e6a3a4fb2ada257041b168347d33bc6a..62b9c7fce1e3f7e17e9a1be999cf94760c057445 100644 index 70f1f8740091d5a3d5983227ef2e6e166bb6ce7e..eed30dd92b9741718f7b9f2446ec0e45d21fead6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java
@@ -9,8 +9,16 @@ public class CraftSpectralArrow extends CraftArrow implements SpectralArrow { @@ -9,8 +9,16 @@ public class CraftSpectralArrow extends CraftAbstractArrow implements SpectralAr
super(server, entity); super(server, entity);
} }
@ -2727,7 +2811,7 @@ index d7c6a0bbc5671ea8f2488230c94df5146a1e98b9..71faf263dd5ac43ab9b89b5a152dd0d1
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java
index a06679e1e5686d9bd601b3dcf8492add58918bc4..389ba1c170014f9d5b7e4acf10b494338f46efcb 100644 index cedb8e67e208cdf954d052a4f0a100c1c07a962b..cb6bb7ce434dd72e5f23da0a257958dbffdc0547 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java
@@ -12,8 +12,16 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat @@ -12,8 +12,16 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat
@ -2769,7 +2853,7 @@ index 9ef939b76d06874b856e0c850addb364146f5a00..d3975a461778d9815f68f323e616e25c
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrowableProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrowableProjectile.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrowableProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrowableProjectile.java
index 2a57a2ce8c21d2ab2376d34d1343315209715579..04a28b8bcd449d312dcb495e496913f470705c10 100644 index bf7b111abdf42969218a3608d86a3313432bc0a0..51bfd27170e8aceb2274918d9c8ff71cbc2625a5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrowableProjectile.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrowableProjectile.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrowableProjectile.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrowableProjectile.java
@@ -26,8 +26,16 @@ public abstract class CraftThrowableProjectile extends CraftProjectile implement @@ -26,8 +26,16 @@ public abstract class CraftThrowableProjectile extends CraftProjectile implement
@ -2811,10 +2895,10 @@ index 5e7fef664c56d6087502e56a0eb4fc07d34ade9f..7538d449e24a8d680628f31b22924e7d
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
index d3aeb4b614b2b17d9613aa3ffa34ebfc81666f79..a8eba002d3620192781abcccd1b5172b77cdd1c5 100644 index 93b42b970b174b800cf89cb0d12cf3d2574323bd..e21207d107be5dcae30add4d4e68e33979020b89 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
@@ -60,8 +60,17 @@ public class CraftThrownPotion extends CraftThrowableProjectile implements Throw @@ -61,8 +61,17 @@ public class CraftThrownPotion extends CraftThrowableProjectile implements Throw
this.getHandle().splash(null); this.getHandle().splash(null);
} }
// Paper end // Paper end
@ -2832,27 +2916,6 @@ index d3aeb4b614b2b17d9613aa3ffa34ebfc81666f79..a8eba002d3620192781abcccd1b5172b
return (net.minecraft.world.entity.projectile.ThrownPotion) this.entity; return (net.minecraft.world.entity.projectile.ThrownPotion) this.entity;
} }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTippedArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTippedArrow.java
index b2747e37600cadc385e2e9e1115ba1d4ec22f5da..11f7c05740e68fdc171aa5cbf6f8b3f71026948f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTippedArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTippedArrow.java
@@ -23,8 +23,16 @@ public class CraftTippedArrow extends CraftArrow implements Arrow {
super(server, entity);
}
+ // Folia start - region threading
+ @Override
+ public net.minecraft.world.entity.projectile.Arrow getHandleRaw() {
+ return (net.minecraft.world.entity.projectile.Arrow)this.entity;
+ }
+ // Folia end - region threading
+
@Override
public net.minecraft.world.entity.projectile.Arrow getHandle() {
+ io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading
return (net.minecraft.world.entity.projectile.Arrow) this.entity;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTraderLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTraderLlama.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTraderLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTraderLlama.java
index 4b3a764114c8372e1549dadeeced26dc7727f2d1..04cbe165b99d348a864da5d342225fc929b2bfd0 100644 index 4b3a764114c8372e1549dadeeced26dc7727f2d1..04cbe165b99d348a864da5d342225fc929b2bfd0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTraderLlama.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTraderLlama.java
@ -2875,10 +2938,10 @@ index 4b3a764114c8372e1549dadeeced26dc7727f2d1..04cbe165b99d348a864da5d342225fc9
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
index 8a6af0db8e0aa0cffbf19584be747076c2c8ee44..b7c639a027001a064333fb4e8feb0e049e8cabbd 100644 index 4fc893378fb0568ddcffc7593d66df6bfe23f659..fe730d081e93ea6b2854b246389fde9ed8b40a94 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
@@ -12,8 +12,16 @@ public class CraftTrident extends CraftArrow implements Trident { @@ -12,8 +12,16 @@ public class CraftTrident extends CraftAbstractArrow implements Trident {
super(server, entity); super(server, entity);
} }
@ -3084,6 +3147,18 @@ index 1b347deb6eb0b39c4a23936f7cd387421f06350d..4e5d311e10736f84964c22cb01a9fafe
return (WaterAnimal) this.entity; return (WaterAnimal) this.entity;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWindCharge.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWindCharge.java
index 46447b9651dc48181916ce1306ee5deec397be12..37d205c3186ea6fa8a6ca78812b4c310ce553992 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWindCharge.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWindCharge.java
@@ -10,6 +10,7 @@ public class CraftWindCharge extends CraftAbstractWindCharge implements WindChar
@Override
public net.minecraft.world.entity.projectile.windcharge.WindCharge getHandle() {
+ io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading
return (net.minecraft.world.entity.projectile.windcharge.WindCharge) this.entity;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
index 4b3d783cabcb2de1a67d7fbfb6f525bfb493aed1..b8d1fe35b9c0b00389b2aaca229f31a6d0de85c6 100644 index 4b3d783cabcb2de1a67d7fbfb6f525bfb493aed1..b8d1fe35b9c0b00389b2aaca229f31a6d0de85c6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
@ -3148,10 +3223,10 @@ index bc978391255c9414e06ff393f2e6707d329d020a..5af2d0f7c496d49dcb66b888047836c0
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java
index 38b6d2c377800134de592a780b737b45c8096a11..ca35b9bdabc456b64272046cb069b8d7477aa1b2 100644 index 86574da257731de7646a712ed73384955fe35aa3..0e81a82f92934ceb03dae6908b321c9b15caa15b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java
@@ -23,8 +23,16 @@ public class CraftWolf extends CraftTameableAnimal implements Wolf { @@ -31,8 +31,16 @@ public class CraftWolf extends CraftTameableAnimal implements Wolf {
} }
} }

View File

@ -10,10 +10,10 @@ the impact from scaling the region threads, but is not a fix
to the underlying issue. to the underlying issue.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4e94de4a3184fd36119bf39beccff62ac561c1e4..2bd923c61642edf67338471d0578609039a51822 100644 index 8a59bcecd4b1b373505e1a3a2fae7b66de227b1e..cdc791dae404dcdb4cb335b17c5785352144657e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1476,6 +1476,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1526,6 +1526,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Folia end - region threading // Folia end - region threading
public final void executeMidTickTasks() { public final void executeMidTickTasks() {

View File

@ -5,10 +5,10 @@ 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 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 350fc61fd709453a86c9f7f6e4bccc434065cc35..9dd9e86a5f7f30ce37b906ebfe4bccad0e52577f 100644 index e4015835ebaa5fb96cbe90f7f9640fe5b5cb713e..57963e9e427e2533ae9cdbd1e98ff3dfadbdebac 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1283,6 +1283,7 @@ public final class CraftServer implements Server { @@ -1284,6 +1284,7 @@ public final class CraftServer implements Server {
@Override @Override
public World createWorld(WorldCreator creator) { public World createWorld(WorldCreator creator) {
@ -16,7 +16,7 @@ index 350fc61fd709453a86c9f7f6e4bccc434065cc35..9dd9e86a5f7f30ce37b906ebfe4bccad
Preconditions.checkState(this.console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP"); 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.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"); Preconditions.checkArgument(creator != null, "WorldCreator cannot be null");
@@ -1461,6 +1462,7 @@ public final class CraftServer implements Server { @@ -1466,6 +1467,7 @@ public final class CraftServer implements Server {
@Override @Override
public boolean unloadWorld(World world, boolean save) { public boolean unloadWorld(World world, boolean save) {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Fix tests by removing them
We don't care about this one, some commands just need to be removed. We don't care about this one, some commands just need to be removed.
diff --git a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java diff --git a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java
index afeb4271fffb7546209f1e651214065187c88302..6927b8f9f426300c3a85feb4711244ba59ab5c1d 100644 index 2f3ff50bf3f70b6b404d02d5ffcc079162a63bc1..773d6538365509467ac14b95463a3f9ba56fdcba 100644
--- a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java --- a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java
+++ b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java +++ b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java
@@ -36,6 +36,7 @@ public class MinecraftCommandPermissionsTest extends AbstractTestingBase { @@ -36,6 +36,7 @@ public class MinecraftCommandPermissionsTest extends AbstractTestingBase {

View File

@ -5,19 +5,19 @@ Subject: [PATCH] Require plugins to be explicitly marked as Folia supported
diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
index 45bd29b70782e29eb11c36eaca0f940aee49799b..b930bd722caf6ecc6e2d584535cdd7a8924d9e08 100644 index c685871155c8dff1d57ff151d7a5ec70350e5390..e582b988071f56c3e44de75460cf83db140339a3 100644
--- a/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java --- a/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
+++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java +++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
@@ -60,6 +60,7 @@ public class PaperPluginMeta implements PluginMeta { @@ -64,6 +64,7 @@ public class PaperPluginMeta implements PluginMeta {
private PermissionConfiguration permissionConfiguration = new PermissionConfiguration(PermissionDefault.OP, List.of());
@Required @Required
@PluginConfigConstraints.PluginVersion private ApiVersion apiVersion;
private String apiVersion;
+ private boolean foliaSupported = false; // Folia + private boolean foliaSupported = false; // Folia
private Map<PluginDependencyLifeCycle, Map<String, DependencyConfiguration>> dependencies = new EnumMap<>(PluginDependencyLifeCycle.class); private Map<PluginDependencyLifeCycle, Map<String, DependencyConfiguration>> dependencies = new EnumMap<>(PluginDependencyLifeCycle.class);
@@ -228,6 +229,13 @@ public class PaperPluginMeta implements PluginMeta { @@ -251,6 +252,13 @@ public class PaperPluginMeta implements PluginMeta {
return this.apiVersion; return this.apiVersion.getVersionString();
} }
+ // Folia start + // Folia start
@ -47,10 +47,10 @@ index 0a27b468560ccf4b9588cd12d50c02e442f3024f..6369b13e1fcdbdb25dd9d6e4d3bffded
ComponentLogger logger = ComponentLogger.logger(jul.getName()); ComponentLogger logger = ComponentLogger.logger(jul.getName());
PluginProviderContext context = PluginProviderContextImpl.create(configuration, logger, source); 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 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 bdd9bc8a414719b9f1d6f01f90539ddb8603a878..bf1856316aa45d2de061e6f4268dd9c63deb1ced 100644 index fdb52ad85cfaa1d53aadcad72cec3d3c8c12c058..1b2964d5a3d839950e6831b7542e9587187bd375 100644
--- a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java --- 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 +++ b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
@@ -17,6 +17,11 @@ class SpigotPluginProviderFactory implements PluginTypeFactory<SpigotPluginProvi @@ -26,6 +26,11 @@ class SpigotPluginProviderFactory implements PluginTypeFactory<SpigotPluginProvi
@Override @Override
public SpigotPluginProvider build(JarFile file, PluginDescriptionFile configuration, Path source) throws InvalidDescriptionException { public SpigotPluginProvider build(JarFile file, PluginDescriptionFile configuration, Path source) throws InvalidDescriptionException {

View File

@ -9,10 +9,10 @@ add explicit block update suppression techniques, it's better
than the server crashing. 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 diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 2c0ce270c947c7fc1d7e0163a43467129a65f999..38ff839aa25fa2b7397f6fc6e3eadda7ae600d48 100644 index c038be43af1af9b077060ae26bb63756de02cdd0..3a1f9598c3e25a061ac934102bd86b8c9c8332a1 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1762,7 +1762,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1758,7 +1758,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
Direction enumdirection = (Direction) iterator.next(); Direction enumdirection = (Direction) iterator.next();
BlockPos blockposition1 = pos.relative(enumdirection); BlockPos blockposition1 = pos.relative(enumdirection);
@ -22,7 +22,7 @@ index 2c0ce270c947c7fc1d7e0163a43467129a65f999..38ff839aa25fa2b7397f6fc6e3eadda7
if (iblockdata.is(Blocks.COMPARATOR)) { 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 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 57e542d5c8b887acecedf76c08c8d4379d712c0f..9c0ad01eae1e0d5044669f561587a69b6ca8e237 100644 index 9d69e439ff853465303c2abd896e6c5314752e1e..8313d0a927b693fb355c9d6bd5284c5a78d5f322 100644
--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java --- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
+++ b/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 { @@ -134,9 +134,9 @@ public class DetectorRailBlock extends BaseRailBlock {
@ -38,7 +38,7 @@ index 57e542d5c8b887acecedf76c08c8d4379d712c0f..9c0ad01eae1e0d5044669f561587a69b
} }
diff --git a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
index b84c48902ef24fdae17578a304e6c93dc20c5dce..218c1954a7922c9e6bf6f34f9497f89ce1207eac 100644 index 9603d8c84ff483030dc08e82d3579b89e5c1f6e9..4148a7fa8ba249d34ba670b015b123c943a225e8 100644
--- a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java --- a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
@@ -104,9 +104,9 @@ public class PoweredRailBlock extends BaseRailBlock { @@ -104,9 +104,9 @@ public class PoweredRailBlock extends BaseRailBlock {
@ -54,10 +54,10 @@ index b84c48902ef24fdae17578a304e6c93dc20c5dce..218c1954a7922c9e6bf6f34f9497f89c
} else { } else {
RailShape blockpropertytrackposition1 = (RailShape) iblockdata.getValue(PoweredRailBlock.SHAPE); 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 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 7f33db05284a957690eac6eb6f5b3b05586727bb..cdf9434635e6d3d15e003f1f6e6a3be7df3f5b04 100644 index c4471342eea4f9e2b0916fc1c5f1b24bc07757fd..32bf3d9b5482a85e23e7f6ad21392a5d16ba3fee 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java --- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/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 { @@ -199,8 +199,9 @@ public class RedStoneWireBlock extends Block {
while (iterator.hasNext()) { while (iterator.hasNext()) {
Direction enumdirection = (Direction) iterator.next(); Direction enumdirection = (Direction) iterator.next();
RedstoneSide blockpropertyredstoneside = (RedstoneSide) state.getValue((Property) RedStoneWireBlock.PROPERTY_BY_DIRECTION.get(enumdirection)); RedstoneSide blockpropertyredstoneside = (RedstoneSide) state.getValue((Property) RedStoneWireBlock.PROPERTY_BY_DIRECTION.get(enumdirection));

View File

@ -7,10 +7,10 @@ The returned TE may be in the world, in which case it is unsafe
for the current thread to modify or access its contents. for the current thread to modify or access its contents.
diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
index b4e05ce176dfc6a2e66b294ed461c32020adf203..10429dfb6f2ec6aaffa7d71c4d32666ec6f65636 100644 index 6359d2d80f4c1360f8450bf6555ccfea3b69daa5..0d5797cbc0c054d64e54accbe3285854752be267 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
@@ -90,6 +90,11 @@ public class ImposterProtoChunk extends ProtoChunk { @@ -92,6 +92,11 @@ public class ImposterProtoChunk extends ProtoChunk {
@Nullable @Nullable
@Override @Override
public BlockEntity getBlockEntity(BlockPos pos) { public BlockEntity getBlockEntity(BlockPos pos) {

View File

@ -9,10 +9,10 @@ data deserialization and is racey even in Vanilla. But in Folia,
some accesses may throw and as such we need to fix this directly. 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 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 36d074d1abed62b09ca808dc2774bc83a6fd5df7..9d7837f90340a96edbd544826ae2241c61ae72c4 100644 index 0d6ab0490d02fc4c856c3e27c0726b1e994c2418..92997c4597d4e96dc678c2f097c5437607e3f0b2 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/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 { @@ -672,7 +672,7 @@ public class ServerPlayer extends Player {
this.getBukkitEntity().readExtraData(nbt); // CraftBukkit this.getBukkitEntity().readExtraData(nbt); // CraftBukkit
if (this.isSleeping()) { if (this.isSleeping()) {
@ -22,10 +22,10 @@ index 36d074d1abed62b09ca808dc2774bc83a6fd5df7..9d7837f90340a96edbd544826ae2241c
// CraftBukkit start // CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 73e0c2ec5ab8cf54767755f31d1a8d0a168ee46f..b9f6e599afd4bdfb97e7f1b1881730cbed781bba 100644 index ed1aa10948897780aefa9a2b4034abb4c7efbb17..a1e90547816ebf0811e7b22af793f40015d6c4f3 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -4390,6 +4390,11 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -4382,6 +4382,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
} }
}); });

View File

@ -8,19 +8,19 @@ the lodestone block, as that is at least safe enough for the light
engine compared to the POI access. This should make it safe for engine compared to the POI access. This should make it safe for
off-region access. off-region access.
diff --git a/src/main/java/net/minecraft/world/item/CompassItem.java b/src/main/java/net/minecraft/world/item/CompassItem.java diff --git a/src/main/java/net/minecraft/world/item/component/LodestoneTracker.java b/src/main/java/net/minecraft/world/item/component/LodestoneTracker.java
index 0f3621483a6ddcaeeb25eac51dbfaad41933579a..1086652ae74527c71153053c2e079c1c85d8b5ce 100644 index cdd1f6939ce33e62f6609f7eb3a5dff59bf12675..5d92251dc5a53eb6b2f5ecfef1261ad6edd0e2a9 100644
--- a/src/main/java/net/minecraft/world/item/CompassItem.java --- a/src/main/java/net/minecraft/world/item/component/LodestoneTracker.java
+++ b/src/main/java/net/minecraft/world/item/CompassItem.java +++ b/src/main/java/net/minecraft/world/item/component/LodestoneTracker.java
@@ -77,7 +77,10 @@ public class CompassItem extends Item implements Vanishable { @@ -29,7 +29,10 @@ public record LodestoneTracker(Optional<GlobalPos> target, boolean tracked) {
Optional<ResourceKey<Level>> optional = getLodestoneDimension(compoundTag); return this;
if (optional.isPresent() && optional.get() == world.dimension() && compoundTag.contains("LodestonePos")) { } else {
BlockPos blockPos = NbtUtils.readBlockPos(compoundTag.getCompound("LodestonePos")); BlockPos blockPos = this.target.get().pos();
- if (!world.isInWorldBounds(blockPos) || (world.hasChunkAt(blockPos) && !((ServerLevel)world).getPoiManager().existsAtPosition(PoiTypes.LODESTONE, blockPos))) { // Paper - Prevent compass from loading chunks - return world.isInWorldBounds(blockPos) && (!world.hasChunkAt(blockPos) || world.getPoiManager().existsAtPosition(PoiTypes.LODESTONE, blockPos)) // Paper - Prevent compass from loading chunks
+ // Folia start - do not access the POI data off-region + // Folia start - do not access the POI data off-region
+ net.minecraft.world.level.chunk.LevelChunk chunk = world.getChunkIfLoaded(blockPos); + net.minecraft.world.level.chunk.LevelChunk chunk = world.getChunkIfLoaded(blockPos);
+ if (!world.isInWorldBounds(blockPos) || chunk != null && chunk.getBlockState(blockPos).getBlock() != Blocks.LODESTONE) { // Paper - Prevent compass from loading chunks + return world.isInWorldBounds(blockPos) && (chunk == null || chunk.getBlockState(blockPos).getBlock() == net.minecraft.world.level.block.Blocks.LODESTONE) // Paper - Prevent compass from loading chunks
+ // Folia end - do not access the POI data off-region + // Folia end - do not access the POI data off-region
compoundTag.remove("LodestonePos"); ? this
} : new LodestoneTracker(Optional.empty(), true);
} }

View File

@ -9,15 +9,15 @@ raid before it's completion, it would throw an exception due to not being on the
same region thread anymore. same region thread anymore.
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
index 2905dab1f9b3dd846261c5b0777d073927882825..488ff78fd704b8a87b7012c3c4f66814dff97e1b 100644 index 7c9d63c94f36c1702fc48570b07393375c77bd21..9339f7b3c4c856fc32abbca0959a961c4fe7e09b 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java --- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java +++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
@@ -420,14 +420,22 @@ public class Raid { @@ -432,14 +432,22 @@ public class Raid {
LivingEntity entityliving = (LivingEntity) entity; LivingEntity entityliving = (LivingEntity) entity;
if (!entity.isSpectator()) { if (!entity.isSpectator()) {
- entityliving.addEffect(new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE, 48000, this.badOmenLevel - 1, false, false, true)); - entityliving.addEffect(new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE, 48000, this.raidOmenLevel - 1, false, false, true));
+ //entityliving.addEffect(new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE, 48000, this.badOmenLevel - 1, false, false, true)); // Folia - Fix off region raid heroes - move down + //entityliving.addEffect(new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE, 48000, this.raidOmenLevel - 1, false, false, true)); // Folia - Fix off region raid heroes - move down
if (entityliving instanceof ServerPlayer) { if (entityliving instanceof ServerPlayer) {
ServerPlayer entityplayer = (ServerPlayer) entityliving; ServerPlayer entityplayer = (ServerPlayer) entityliving;
@ -28,7 +28,7 @@ index 2905dab1f9b3dd846261c5b0777d073927882825..488ff78fd704b8a87b7012c3c4f66814
} }
+ // Folia start - Fix off region raid heroes + // Folia start - Fix off region raid heroes
+ entityliving.getBukkitEntity().taskScheduler.schedule((LivingEntity lv) -> { + entityliving.getBukkitEntity().taskScheduler.schedule((LivingEntity lv) -> {
+ lv.addEffect(new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE, 48000, this.badOmenLevel - 1, false, false, true)); + lv.addEffect(new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE, 48000, this.raidOmenLevel - 1, false, false, true));
+ if (lv instanceof ServerPlayer entityplayer) { + if (lv instanceof ServerPlayer entityplayer) {
+ entityplayer.awardStat(Stats.RAID_WIN); + entityplayer.awardStat(Stats.RAID_WIN);
+ CriteriaTriggers.RAID_WIN.trigger(entityplayer); + CriteriaTriggers.RAID_WIN.trigger(entityplayer);

View File

@ -7,20 +7,20 @@ This allows the player to be re-positioned before logging into
the world without causing thread checks to trip on Folia. 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 diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index a390227e5af1232f2090d2be72f7789805025f76..bbf43b5844a75a25c1757cfb1c3c9dbe9b1fadde 100644 index db2903276c694d395f62afdc7c71344466ae505f..5f9c89dbbfa9b3e4d2b68c0d8628cf223c1f7aa0 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -522,7 +522,13 @@ public abstract class PlayerList { @@ -522,7 +522,13 @@ public abstract class PlayerList {
CompoundTag nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); if (optional.isPresent() && ((CompoundTag) optional.get()).contains("RootVehicle", 10)) {
// CraftBukkit start CompoundTag nbttagcompound = ((CompoundTag) optional.get()).getCompound("RootVehicle");
ServerLevel finalWorldServer = worldserver1; ServerLevel finalWorldServer = worldserver1; // CraftBukkit - decompile error
+ Vec3 playerPos = player.position(); // Paper - force sync root vehicle to player position + Vec3 playerPos = player.position(); // Paper - force sync root vehicle to player position
Entity entity = EntityType.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> { Entity entity = EntityType.loadEntityRecursive(nbttagcompound.getCompound("Entity"), worldserver1, (entity1) -> {
+ // Paper start - force sync root vehicle to player position + // Paper start - force sync root vehicle to player position
+ if (entity1.distanceToSqr(player) > (5.0 * 5.0)) { + if (entity1.distanceToSqr(player) > (5.0 * 5.0)) {
+ entity1.setPosRaw(playerPos.x, playerPos.y, playerPos.z, true); + entity1.setPosRaw(playerPos.x, playerPos.y, playerPos.z, true);
+ } + }
+ // Paper end - force sync root vehicle to player position + // Paper end - force sync root vehicle to player position
return !finalWorldServer.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper - Entity#getEntitySpawnReason return !finalWorldServer.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // CraftBukkit - decompile error // Paper - Entity#getEntitySpawnReason
// CraftBukkit end
}); });

View File

@ -942,7 +942,7 @@ index 67bf841878eb8e3703782caeb16db4803d13f0d9..0d8b2a4127e8c8e4970d220b8a224049
} }
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
index 08075b8895f816420c2a940bf551dfada3c0cd9e..2c688d886b14679d7ab4a485da2675e97c2bac43 100644 index 014cacbcb537a30566ab756bd884a20c256f9c4c..e46def6929f95828abc9b0e16e4c98c142490433 100644
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java --- a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java +++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
@@ -1750,6 +1750,8 @@ public final class NewChunkHolder { @@ -1750,6 +1750,8 @@ public final class NewChunkHolder {
@ -1361,10 +1361,10 @@ index 0000000000000000000000000000000000000000..e36fd244f71a92d11c6ee45944948be5
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index 1192503d2729b3f14aa2936c2060df9884870cb4..632c5ba694a37159d5297f6af885408a5cb76330 100644 index 9f07a1a5e2c082d16de068de6f47bf8fb06ba99a..662a9e4f48cfc314b9d619a813122b1ac67273fd 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java --- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java +++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -51,7 +51,10 @@ public class PacketUtils { @@ -52,7 +52,10 @@ public class PacketUtils {
if (listener.shouldHandleMessage(packet)) { if (listener.shouldHandleMessage(packet)) {
co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
@ -1373,13 +1373,13 @@ index 1192503d2729b3f14aa2936c2060df9884870cb4..632c5ba694a37159d5297f6af885408a
packet.handle(listener); packet.handle(listener);
+ } finally { profiler.stopTimer(packetTimerId); } // Folia - profiler + } finally { profiler.stopTimer(packetTimerId); } // Folia - profiler
} catch (Exception exception) { } catch (Exception exception) {
label25: if (exception instanceof ReportedException) {
{ ReportedException reportedexception = (ReportedException) exception;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2bd923c61642edf67338471d0578609039a51822..bcc8a0171f981e2b2e24dd57834701c1899ab4c9 100644 index cdc791dae404dcdb4cb335b17c5785352144657e..5d89b2fc8f3f637e8d91c878f16c02cbc3294dfa 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1592,6 +1592,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1642,6 +1642,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Folia start - region threading // Folia start - region threading
public void tickServer(long startTime, long scheduledEnd, long targetBuffer, public void tickServer(long startTime, long scheduledEnd, long targetBuffer,
io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { io.papermc.paper.threadedregions.TickRegions.TickRegionData region) {
@ -1387,7 +1387,7 @@ index 2bd923c61642edf67338471d0578609039a51822..bcc8a0171f981e2b2e24dd57834701c1
if (region != null) { if (region != null) {
region.world.getCurrentWorldData().updateTickData(); region.world.getCurrentWorldData().updateTickData();
if (region.world.checkInitialised.get() != ServerLevel.WORLD_INIT_CHECKED) { if (region.world.checkInitialised.get() != ServerLevel.WORLD_INIT_CHECKED) {
@@ -1626,10 +1627,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1676,10 +1677,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Folia start - region threading // Folia start - region threading
if (region != null) { if (region != null) {
@ -1404,7 +1404,7 @@ index 2bd923c61642edf67338471d0578609039a51822..bcc8a0171f981e2b2e24dd57834701c1
for (Entity entity : region.world.getCurrentWorldData().getLocalEntitiesCopy()) { for (Entity entity : region.world.getCurrentWorldData().getLocalEntitiesCopy()) {
if (!io.papermc.paper.util.TickThread.isTickThreadFor(entity) || entity.isRemoved()) { if (!io.papermc.paper.util.TickThread.isTickThreadFor(entity) || entity.isRemoved()) {
continue; continue;
@@ -1637,8 +1644,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1687,8 +1694,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw(); org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw();
if (bukkit != null) { if (bukkit != null) {
bukkit.taskScheduler.executeTick(); bukkit.taskScheduler.executeTick();
@ -1416,7 +1416,7 @@ index 2bd923c61642edf67338471d0578609039a51822..bcc8a0171f981e2b2e24dd57834701c1
} }
// Folia end - region threading // Folia end - region threading
@@ -1658,6 +1668,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1708,6 +1718,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
this.profiler.push("save"); this.profiler.push("save");
final boolean fullSave = autosavePeriod > 0 && io.papermc.paper.threadedregions.RegionizedServer.getCurrentTick() % autosavePeriod == 0; // Folia - region threading final boolean fullSave = autosavePeriod > 0 && io.papermc.paper.threadedregions.RegionizedServer.getCurrentTick() % autosavePeriod == 0; // Folia - region threading
@ -1424,7 +1424,7 @@ index 2bd923c61642edf67338471d0578609039a51822..bcc8a0171f981e2b2e24dd57834701c1
try { try {
this.isSaving = true; this.isSaving = true;
if (playerSaveInterval > 0) { if (playerSaveInterval > 0) {
@@ -1671,6 +1682,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1721,6 +1732,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally { } finally {
this.isSaving = false; this.isSaving = false;
} }
@ -1432,7 +1432,7 @@ index 2bd923c61642edf67338471d0578609039a51822..bcc8a0171f981e2b2e24dd57834701c1
this.profiler.pop(); this.profiler.pop();
// Paper end - Incremental chunk and player saving // Paper end - Incremental chunk and player saving
io.papermc.paper.util.CachedLists.reset(); // Paper io.papermc.paper.util.CachedLists.reset(); // Paper
@@ -1735,6 +1747,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1794,6 +1806,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
public void tickChildren(BooleanSupplier shouldKeepTicking, io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { // Folia - region threading public void tickChildren(BooleanSupplier shouldKeepTicking, io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { // Folia - region threading
@ -1440,7 +1440,7 @@ index 2bd923c61642edf67338471d0578609039a51822..bcc8a0171f981e2b2e24dd57834701c1
final io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = io.papermc.paper.threadedregions.TickRegionScheduler.getCurrentRegionizedWorldData(); // Folia - regionised ticking 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 if (region == null) this.getPlayerList().getPlayers().forEach((entityplayer) -> { // Folia - region threading
entityplayer.connection.suspendFlushing(); entityplayer.connection.suspendFlushing();
@@ -1801,12 +1814,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1862,12 +1875,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try { try {
worldserver.timings.doTick.startTiming(); // Spigot worldserver.timings.doTick.startTiming(); // Spigot
@ -1455,7 +1455,7 @@ index 2bd923c61642edf67338471d0578609039a51822..bcc8a0171f981e2b2e24dd57834701c1
worldserver.timings.doTick.stopTiming(); // Spigot worldserver.timings.doTick.stopTiming(); // Spigot
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world"); CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
@@ -1824,7 +1839,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1885,7 +1900,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.popPush("connection"); this.profiler.popPush("connection");
MinecraftTimings.connectionTimer.startTiming(); // Spigot // Paper MinecraftTimings.connectionTimer.startTiming(); // Spigot // Paper
if (region == null) this.getConnection().tick(); // Folia - region threading if (region == null) this.getConnection().tick(); // Folia - region threading
@ -1466,10 +1466,10 @@ index 2bd923c61642edf67338471d0578609039a51822..bcc8a0171f981e2b2e24dd57834701c1
this.profiler.popPush("players"); this.profiler.popPush("players");
MinecraftTimings.playerListTimer.startTiming(); // Spigot // Paper MinecraftTimings.playerListTimer.startTiming(); // Spigot // Paper
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index d45f4efd66380ace44fb0aa3f8a2569dc702e1aa..30aa7891292da87092724e0e046a08e500dd22ca 100644 index c75990f0549a1267ecb591227b0f97fa8707bc40..c547d51eebd965f2be7ac45bc0981626c0515ef1 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -463,16 +463,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -466,16 +466,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
protected void tick(BooleanSupplier shouldKeepTicking) { protected void tick(BooleanSupplier shouldKeepTicking) {
@ -1491,7 +1491,7 @@ index d45f4efd66380ace44fb0aa3f8a2569dc702e1aa..30aa7891292da87092724e0e046a08e5
} // Paper } // Paper
} }
@@ -1078,9 +1083,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1094,9 +1099,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Folia start - region threading - replace entity tracking ticking // Folia start - region threading - replace entity tracking ticking
private void foliaEntityTrackerTick() { private void foliaEntityTrackerTick() {
@ -1506,7 +1506,7 @@ index d45f4efd66380ace44fb0aa3f8a2569dc702e1aa..30aa7891292da87092724e0e046a08e5
TrackedEntity tracker = entity.tracker; TrackedEntity tracker = entity.tracker;
if (tracker == null) { if (tracker == null) {
continue; continue;
@@ -1090,12 +1100,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1106,12 +1116,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
// process unloads // process unloads
for (Entity entity : worldData.takeTrackingUnloads()) { for (Entity entity : worldData.takeTrackingUnloads()) {
@ -1524,10 +1524,10 @@ index d45f4efd66380ace44fb0aa3f8a2569dc702e1aa..30aa7891292da87092724e0e046a08e5
// Folia end - region threading - replace entity tracking ticking // 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 diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index d532043f33825ce2971d9e53f290cdead22d6916..74483543836d9ed042cc7b9cbbde8d58d6994475 100644 index 034218c47afa99a0623b1f9c9b7830ae6da4322d..1cb09933aa4fa9f766c92ce000aed103fb2a5f54 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -426,16 +426,23 @@ public class ServerChunkCache extends ChunkSource { @@ -421,19 +421,26 @@ public class ServerChunkCache extends ChunkSource {
@Override @Override
public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) { public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) {
@ -1535,7 +1535,10 @@ index d532043f33825ce2971d9e53f290cdead22d6916..74483543836d9ed042cc7b9cbbde8d58
this.level.getProfiler().push("purge"); this.level.getProfiler().push("purge");
this.level.timings.doChunkMap.startTiming(); // Spigot this.level.timings.doChunkMap.startTiming(); // Spigot
+ profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.CHUNK_HOLDER_MANAGER_TICK); try { // Folia - profiler + profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.CHUNK_HOLDER_MANAGER_TICK); try { // Folia - profiler
if (this.level.tickRateManager().runsNormally() || !tickChunks) {
this.distanceManager.purgeStaleTickets(); this.distanceManager.purgeStaleTickets();
}
this.runDistanceManagerUpdates(); this.runDistanceManagerUpdates();
+ } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.CHUNK_HOLDER_MANAGER_TICK); } // Folia - profiler + } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.CHUNK_HOLDER_MANAGER_TICK); } // Folia - profiler
this.level.timings.doChunkMap.stopTiming(); // Spigot this.level.timings.doChunkMap.stopTiming(); // Spigot
@ -1551,7 +1554,7 @@ index d532043f33825ce2971d9e53f290cdead22d6916..74483543836d9ed042cc7b9cbbde8d58
this.level.timings.chunks.stopTiming(); // Paper - timings this.level.timings.chunks.stopTiming(); // Paper - timings
this.chunkMap.tick(); this.chunkMap.tick();
} }
@@ -450,6 +457,7 @@ public class ServerChunkCache extends ChunkSource { @@ -448,6 +455,7 @@ public class ServerChunkCache extends ChunkSource {
private void tickChunks() { private void tickChunks() {
io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = this.level.getCurrentWorldData(); // Folia - region threading io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = this.level.getCurrentWorldData(); // Folia - region threading
@ -1559,7 +1562,7 @@ index d532043f33825ce2971d9e53f290cdead22d6916..74483543836d9ed042cc7b9cbbde8d58
//long i = this.level.getGameTime(); // Folia - region threading //long i = this.level.getGameTime(); // Folia - region threading
long j = 1; // Folia - region threading long j = 1; // Folia - region threading
@@ -471,6 +479,7 @@ public class ServerChunkCache extends ChunkSource { @@ -469,6 +477,7 @@ public class ServerChunkCache extends ChunkSource {
// Paper start - Optional per player mob spawns // Paper start - Optional per player mob spawns
int naturalSpawnChunkCount = k; int naturalSpawnChunkCount = k;
NaturalSpawner.SpawnState spawnercreature_d; // moved down NaturalSpawner.SpawnState spawnercreature_d; // moved down
@ -1567,7 +1570,7 @@ index d532043f33825ce2971d9e53f290cdead22d6916..74483543836d9ed042cc7b9cbbde8d58
if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled
// re-set mob counts // re-set mob counts
for (ServerPlayer player : this.level.getLocalPlayers()) { // Folia - region threading for (ServerPlayer player : this.level.getLocalPlayers()) { // Folia - region threading
@@ -490,6 +499,7 @@ public class ServerChunkCache extends ChunkSource { @@ -488,6 +497,7 @@ public class ServerChunkCache extends ChunkSource {
} else { } 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 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
} }
@ -1575,7 +1578,7 @@ index d532043f33825ce2971d9e53f290cdead22d6916..74483543836d9ed042cc7b9cbbde8d58
// Paper end - Optional per player mob spawns // Paper end - Optional per player mob spawns
this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
@@ -553,6 +563,9 @@ public class ServerChunkCache extends ChunkSource { @@ -551,6 +561,9 @@ public class ServerChunkCache extends ChunkSource {
} }
try { try {
// Paper end - optimise chunk tick iteration // Paper end - optimise chunk tick iteration
@ -1585,7 +1588,7 @@ index d532043f33825ce2971d9e53f290cdead22d6916..74483543836d9ed042cc7b9cbbde8d58
while (chunkIterator.hasNext()) { while (chunkIterator.hasNext()) {
LevelChunk chunk1 = chunkIterator.next(); LevelChunk chunk1 = chunkIterator.next();
// Paper end - optimise chunk tick iteration // Paper end - optimise chunk tick iteration
@@ -584,15 +597,20 @@ public class ServerChunkCache extends ChunkSource { @@ -582,15 +595,20 @@ public class ServerChunkCache extends ChunkSource {
// Paper end - optimise chunk tick iteration // Paper end - optimise chunk tick iteration
chunk1.incrementInhabitedTime(j); chunk1.incrementInhabitedTime(j);
if (spawn && flag && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) { // Spigot // Paper - optimise chunk tick iteration if (spawn && flag && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) { // Spigot // Paper - optimise chunk tick iteration
@ -1606,7 +1609,7 @@ index d532043f33825ce2971d9e53f290cdead22d6916..74483543836d9ed042cc7b9cbbde8d58
// Paper start - optimise chunk tick iteration // Paper start - optimise chunk tick iteration
} finally { } finally {
if (chunkIterator instanceof io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator safeIterator) { if (chunkIterator instanceof io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator safeIterator) {
@@ -604,9 +622,11 @@ public class ServerChunkCache extends ChunkSource { @@ -602,9 +620,11 @@ public class ServerChunkCache extends ChunkSource {
gameprofilerfiller.popPush("customSpawners"); gameprofilerfiller.popPush("customSpawners");
if (flag) { if (flag) {
@ -1618,7 +1621,7 @@ index d532043f33825ce2971d9e53f290cdead22d6916..74483543836d9ed042cc7b9cbbde8d58
} }
} }
@@ -616,6 +636,7 @@ public class ServerChunkCache extends ChunkSource { @@ -614,6 +634,7 @@ public class ServerChunkCache extends ChunkSource {
// Paper start - optimise chunk tick iteration // Paper start - optimise chunk tick iteration
// Folia start - region threading // Folia start - region threading
if (!this.level.needsChangeBroadcasting.isEmpty()) { if (!this.level.needsChangeBroadcasting.isEmpty()) {
@ -1626,7 +1629,7 @@ index d532043f33825ce2971d9e53f290cdead22d6916..74483543836d9ed042cc7b9cbbde8d58
for (Iterator<ChunkHolder> iterator = this.level.needsChangeBroadcasting.iterator(); iterator.hasNext();) { for (Iterator<ChunkHolder> iterator = this.level.needsChangeBroadcasting.iterator(); iterator.hasNext();) {
ChunkHolder holder = iterator.next(); ChunkHolder holder = iterator.next();
if (!io.papermc.paper.util.TickThread.isTickThreadFor(holder.newChunkHolder.world, holder.pos)) { if (!io.papermc.paper.util.TickThread.isTickThreadFor(holder.newChunkHolder.world, holder.pos)) {
@@ -627,6 +648,7 @@ public class ServerChunkCache extends ChunkSource { @@ -625,6 +646,7 @@ public class ServerChunkCache extends ChunkSource {
iterator.remove(); iterator.remove();
} }
} }
@ -1635,10 +1638,10 @@ index d532043f33825ce2971d9e53f290cdead22d6916..74483543836d9ed042cc7b9cbbde8d58
// Folia end - region threading // Folia end - region threading
// Paper end - optimise chunk tick iteration // 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 diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 2f799ead36f0f22afe7dc4b688e59ef25fe2f9b8..36f1af9ef5fca7c45f250470d21a4dfbf573ceac 100644 index 9ac1372d7236dd6207d2d8ed94a032f52a3b0b00..d0350e7c6e2cb5a4bbb31be264bb26a5dcabf2c2 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -891,6 +891,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -897,6 +897,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void tick(BooleanSupplier shouldKeepTicking, io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { // Folia - regionised ticking 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 final io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = this.getCurrentWorldData(); // Folia - regionised ticking
@ -1646,7 +1649,7 @@ index 2f799ead36f0f22afe7dc4b688e59ef25fe2f9b8..36f1af9ef5fca7c45f250470d21a4dfb
ProfilerFiller gameprofilerfiller = this.getProfiler(); ProfilerFiller gameprofilerfiller = this.getProfiler();
regionizedWorldData.setHandlingTick(true); // Folia - regionised ticking regionizedWorldData.setHandlingTick(true); // Folia - regionised ticking
@@ -919,9 +920,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -925,9 +926,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!this.isDebug() && flag) { if (!this.isDebug() && flag) {
j = regionizedWorldData.getRedstoneGameTime(); // Folia - region threading j = regionizedWorldData.getRedstoneGameTime(); // Folia - region threading
gameprofilerfiller.push("blockTicks"); gameprofilerfiller.push("blockTicks");
@ -1660,7 +1663,7 @@ index 2f799ead36f0f22afe7dc4b688e59ef25fe2f9b8..36f1af9ef5fca7c45f250470d21a4dfb
gameprofilerfiller.pop(); gameprofilerfiller.pop();
} }
this.timings.scheduledBlocks.stopTiming(); // Paper this.timings.scheduledBlocks.stopTiming(); // Paper
@@ -929,18 +934,24 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -935,18 +940,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
gameprofilerfiller.popPush("raid"); gameprofilerfiller.popPush("raid");
if (flag) { if (flag) {
this.timings.raids.startTiming(); // Paper - timings this.timings.raids.startTiming(); // Paper - timings
@ -1685,7 +1688,7 @@ index 2f799ead36f0f22afe7dc4b688e59ef25fe2f9b8..36f1af9ef5fca7c45f250470d21a4dfb
this.timings.doSounds.stopTiming(); // Spigot this.timings.doSounds.stopTiming(); // Spigot
} }
@@ -956,6 +967,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -962,6 +973,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
gameprofilerfiller.push("entities"); gameprofilerfiller.push("entities");
this.timings.tickEntities.startTiming(); // Spigot this.timings.tickEntities.startTiming(); // Spigot
if (this.dragonFight != null && flag) { if (this.dragonFight != null && flag) {
@ -1693,7 +1696,7 @@ index 2f799ead36f0f22afe7dc4b688e59ef25fe2f9b8..36f1af9ef5fca7c45f250470d21a4dfb
if (io.papermc.paper.util.TickThread.isTickThreadFor(this, this.dragonFight.origin)) { // Folia - region threading if (io.papermc.paper.util.TickThread.isTickThreadFor(this, this.dragonFight.origin)) { // Folia - region threading
gameprofilerfiller.push("dragonFight"); gameprofilerfiller.push("dragonFight");
this.dragonFight.tick(); this.dragonFight.tick();
@@ -968,10 +980,12 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -974,10 +986,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
fightCenter fightCenter
); );
} // Folia end - region threading } // Folia end - region threading
@ -1706,7 +1709,7 @@ index 2f799ead36f0f22afe7dc4b688e59ef25fe2f9b8..36f1af9ef5fca7c45f250470d21a4dfb
regionizedWorldData.forEachTickingEntity((entity) -> { // Folia - regionised ticking regionizedWorldData.forEachTickingEntity((entity) -> { // Folia - regionised ticking
if (!entity.isRemoved()) { if (!entity.isRemoved()) {
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
@@ -999,10 +1013,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1005,10 +1019,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
} }
}); });
@ -1720,7 +1723,7 @@ index 2f799ead36f0f22afe7dc4b688e59ef25fe2f9b8..36f1af9ef5fca7c45f250470d21a4dfb
} }
gameprofilerfiller.push("entityManagement"); gameprofilerfiller.push("entityManagement");
@@ -1062,12 +1079,15 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1068,12 +1085,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
public void tickCustomSpawners(boolean spawnMonsters, boolean spawnAnimals) { public void tickCustomSpawners(boolean spawnMonsters, boolean spawnAnimals) {
@ -1736,7 +1739,7 @@ index 2f799ead36f0f22afe7dc4b688e59ef25fe2f9b8..36f1af9ef5fca7c45f250470d21a4dfb
} }
} }
@@ -1517,6 +1537,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1523,6 +1543,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper start- timings // Paper start- timings
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity);
timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper
@ -1748,7 +1751,7 @@ index 2f799ead36f0f22afe7dc4b688e59ef25fe2f9b8..36f1af9ef5fca7c45f250470d21a4dfb
try { try {
// Paper end - timings // Paper end - timings
entity.setOldPosAndRot(); entity.setOldPosAndRot();
@@ -1542,7 +1567,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1548,7 +1573,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Folia end - region threading // Folia end - region threading
} else { entity.inactiveTick(); } // Paper - EAR 2 } else { entity.inactiveTick(); } // Paper - EAR 2
this.getProfiler().pop(); this.getProfiler().pop();
@ -1757,7 +1760,7 @@ index 2f799ead36f0f22afe7dc4b688e59ef25fe2f9b8..36f1af9ef5fca7c45f250470d21a4dfb
Iterator iterator = entity.getPassengers().iterator(); Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1566,6 +1591,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1572,6 +1597,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper - EAR 2 // Paper - EAR 2
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger); final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger);
co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper
@ -1769,7 +1772,7 @@ index 2f799ead36f0f22afe7dc4b688e59ef25fe2f9b8..36f1af9ef5fca7c45f250470d21a4dfb
try { try {
// Paper end // Paper end
passenger.setOldPosAndRot(); passenger.setOldPosAndRot();
@@ -1605,7 +1635,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1611,7 +1641,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(passenger, entity2); this.tickPassenger(passenger, entity2);
} }
@ -1779,10 +1782,10 @@ index 2f799ead36f0f22afe7dc4b688e59ef25fe2f9b8..36f1af9ef5fca7c45f250470d21a4dfb
} else { } else {
passenger.stopRiding(); passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index bbf43b5844a75a25c1757cfb1c3c9dbe9b1fadde..90be312057221a5a78066d89783c5e22008d797d 100644 index 5f9c89dbbfa9b3e4d2b68c0d8628cf223c1f7aa0..771b259ce930d2c857a08ca9150a243679c88c80 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1335,6 +1335,7 @@ public abstract class PlayerList { @@ -1334,6 +1334,7 @@ public abstract class PlayerList {
public void saveAll(int interval) { public void saveAll(int interval) {
io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
@ -1790,7 +1793,7 @@ index bbf43b5844a75a25c1757cfb1c3c9dbe9b1fadde..90be312057221a5a78066d89783c5e22
MinecraftTimings.savePlayers.startTiming(); // Paper MinecraftTimings.savePlayers.startTiming(); // Paper
int numSaved = 0; int numSaved = 0;
long now = System.nanoTime(); // Folia - region threading long now = System.nanoTime(); // Folia - region threading
@@ -1346,7 +1347,9 @@ public abstract class PlayerList { @@ -1345,7 +1346,9 @@ public abstract class PlayerList {
} }
// Folia end - region threading // Folia end - region threading
if (interval == -1 || now - entityplayer.lastSave >= timeInterval) { // Folia - region threading if (interval == -1 || now - entityplayer.lastSave >= timeInterval) { // Folia - region threading
@ -1801,10 +1804,10 @@ index bbf43b5844a75a25c1757cfb1c3c9dbe9b1fadde..90be312057221a5a78066d89783c5e22
if (interval != -1 && max != -1 && ++numSaved >= max) { if (interval != -1 && max != -1 && ++numSaved >= max) {
break; break;
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 09e8445a3f8c6b3ebc852a75a9a25b41a51ba659..f921c159c4f7556daf3c8405241de3607ba251ad 100644 index a46bf73c608641bf1f00fd55242de71a0f2ee06e..a2f0fb8b4057bd3a84d18298e49c4d02955240d3 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java --- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/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 @@ -338,6 +338,13 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
return BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(id)); return BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(id));
} }
@ -1815,10 +1818,10 @@ index 09e8445a3f8c6b3ebc852a75a9a25b41a51ba659..f921c159c4f7556daf3c8405241de360
+ public final int passengerInactiveTickTimerId; + public final int passengerInactiveTickTimerId;
+ // Folia end - profiler + // Folia end - profiler
+ +
public EntityType(EntityType.EntityFactory<T> factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet<Block> canSpawnInside, EntityDimensions dimensions, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures) { public EntityType(EntityType.EntityFactory<T> factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet<Block> canSpawnInside, EntityDimensions dimensions, float spawnBoxScale, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures) {
// Paper start // Paper start
this(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnInside, dimensions, maxTrackDistance, trackTickInterval, requiredFeatures, "custom"); this(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnInside, dimensions, spawnBoxScale, maxTrackDistance, trackTickInterval, requiredFeatures, "custom");
@@ -336,6 +343,12 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT @@ -348,6 +355,12 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
this.passengerTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerTick"); this.passengerTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerTick");
this.passengerInactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerInactiveTick"); this.passengerInactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerInactiveTick");
// Paper end // Paper end
@ -1832,10 +1835,10 @@ index 09e8445a3f8c6b3ebc852a75a9a25b41a51ba659..f921c159c4f7556daf3c8405241de360
this.factory = factory; this.factory = factory;
this.category = spawnGroup; 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 diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 38ff839aa25fa2b7397f6fc6e3eadda7ae600d48..3cd8573db9dadb2e32f3c107f4812b525db014b1 100644 index 3a1f9598c3e25a061ac934102bd86b8c9c8332a1..8c124cb3d1238c9f3297f9f2d2345399055147fe 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -232,6 +232,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -229,6 +229,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return this.getCurrentWorldData().getLocalPlayers(); return this.getCurrentWorldData().getLocalPlayers();
} }
// Folia end - region ticking // Folia end - region ticking
@ -1845,7 +1848,7 @@ index 38ff839aa25fa2b7397f6fc6e3eadda7ae600d48..3cd8573db9dadb2e32f3c107f4812b52
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 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 this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
@@ -324,6 +327,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -317,6 +320,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.minSection = io.papermc.paper.util.WorldUtil.getMinSection(this); this.minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
this.maxSection = io.papermc.paper.util.WorldUtil.getMaxSection(this); this.maxSection = io.papermc.paper.util.WorldUtil.getMaxSection(this);
// Paper end - optimise collisions // Paper end - optimise collisions
@ -1855,7 +1858,7 @@ index 38ff839aa25fa2b7397f6fc6e3eadda7ae600d48..3cd8573db9dadb2e32f3c107f4812b52
} }
// Paper start - Cancel hit for vanished players // Paper start - Cancel hit for vanished players
@@ -1308,17 +1314,21 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1299,17 +1305,21 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} }
protected void tickBlockEntities() { protected void tickBlockEntities() {
@ -1877,7 +1880,7 @@ index 38ff839aa25fa2b7397f6fc6e3eadda7ae600d48..3cd8573db9dadb2e32f3c107f4812b52
// Spigot start // Spigot start
// Iterator<TickingBlockEntity> iterator = this.blockEntityTickers.iterator(); // Iterator<TickingBlockEntity> iterator = this.blockEntityTickers.iterator();
boolean flag = this.tickRateManager().runsNormally(); boolean flag = this.tickRateManager().runsNormally();
@@ -1345,6 +1355,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1336,6 +1346,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} }
} }
blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 // Folia - regionised ticking blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 // Folia - regionised ticking
@ -1886,10 +1889,10 @@ index 38ff839aa25fa2b7397f6fc6e3eadda7ae600d48..3cd8573db9dadb2e32f3c107f4812b52
this.timings.tileEntityTick.stopTiming(); // Spigot this.timings.tileEntityTick.stopTiming(); // Spigot
regionizedWorldData.seTtickingBlockEntities(false); // Folia - regionised ticking regionizedWorldData.seTtickingBlockEntities(false); // Folia - regionised ticking
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java
index 86b661de30e134258b6b74a78e8ea05fd8224aed..37938d0e116982915f470b3d2b233c74d501bb0f 100644 index 96b99aab3720e5bdf293fd4a95944c7218ce43c0..e7691f856f85469c06f2b5a2a3db3120ec6f193d 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java
@@ -281,10 +281,17 @@ public class BlockEntityType<T extends BlockEntity> { @@ -283,10 +283,17 @@ public class BlockEntityType<T extends BlockEntity> {
} }
Type<?> type = Util.fetchChoiceType(References.BLOCK_ENTITY, id); Type<?> type = Util.fetchChoiceType(References.BLOCK_ENTITY, id);
@ -1908,7 +1911,7 @@ index 86b661de30e134258b6b74a78e8ea05fd8224aed..37938d0e116982915f470b3d2b233c74
this.factory = factory; this.factory = factory;
this.validBlocks = blocks; this.validBlocks = blocks;
this.dataType = type; this.dataType = type;
@@ -329,7 +336,12 @@ public class BlockEntityType<T extends BlockEntity> { @@ -331,7 +338,12 @@ public class BlockEntityType<T extends BlockEntity> {
} }
public BlockEntityType<T> build(Type<?> type) { public BlockEntityType<T> build(Type<?> type) {
@ -1923,10 +1926,10 @@ index 86b661de30e134258b6b74a78e8ea05fd8224aed..37938d0e116982915f470b3d2b233c74
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java 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 ff1a7b78fa010857daab7a306cb9483c98560b79..8c6ade7cf14e367d6390849ef1b2a1bfef0d52ac 100644 index f1f0391b5e5b808b1176bc76e7c49fc7ecd141a4..0c3f095854396da0e5f38234060ba9a190a572de 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/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 { @@ -1179,11 +1179,14 @@ public class LevelChunk extends ChunkAccess {
BlockPos blockposition = this.blockEntity.getBlockPos(); BlockPos blockposition = this.blockEntity.getBlockPos();
if (LevelChunk.this.isTicking(blockposition)) { if (LevelChunk.this.isTicking(blockposition)) {
@ -1941,7 +1944,7 @@ index ff1a7b78fa010857daab7a306cb9483c98560b79..8c6ade7cf14e367d6390849ef1b2a1bf
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
if (this.blockEntity.getType().isValid(iblockdata)) { if (this.blockEntity.getType().isValid(iblockdata)) {
@@ -1200,6 +1203,7 @@ public class LevelChunk extends ChunkAccess { @@ -1198,6 +1201,7 @@ public class LevelChunk extends ChunkAccess {
} }
// Paper end - Remove the Block Entity if it's invalid // Paper end - Remove the Block Entity if it's invalid
} }

View File

@ -1,85 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Tue, 20 Feb 2024 18:24:16 -0800
Subject: [PATCH] Fix entity tracker desync when new players are added to the
tracker
The delta position packet instructs the client to update
the entity position by a position difference. However, this position
difference is relative to the last position in the entity tracker
state, not the last position which has been sent to the player. As
a result, if the last position the player has recorded is different
than the one stored in the entity tracker (which occurs when a new
player is added to an existing entity tracker state) then the sent
position difference will cause a position desync for the client.
We can resolve this problem by either tracking the last position
sent per-player, or by simply resetting the last sent position
in the entity tracker state every time a new player is added.
Resetting the last sent position every time a new player is
added to the tracker is just easier to do, so that is what
this patch does.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 30aa7891292da87092724e0e046a08e500dd22ca..6ab9f83786dcfbd3156d2f2bd6da57baed1399f4 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1419,6 +1419,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.serverEntity.addPairing(player);
}
// Paper end - entity tracking events
+ this.serverEntity.onPlayerAdd(); // Paper - fix desync when a player is added to the tracker
}
} else if (this.seenBy.remove(player.connection)) {
this.serverEntity.removePairing(player);
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 529ab44baaf573b97cf7e89560c548642733188f..16373e0c5ea38199fab3eb289bf2a5fcf0dd7439 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -93,6 +93,13 @@ public class ServerEntity {
this.trackedDataValues = entity.getEntityData().getNonDefaultValues();
}
+ // Paper start - fix desync when a player is added to the tracker
+ private boolean forceStateResync;
+ public void onPlayerAdd() {
+ this.forceStateResync = true;
+ }
+ // Paper end - fix desync when a player is added to the tracker
+
public void sendChanges() {
List<Entity> list = this.entity.getPassengers();
@@ -141,7 +148,7 @@ public class ServerEntity {
}
}
- if (this.tickCount % this.updateInterval == 0 || this.entity.hasImpulse || this.entity.getEntityData().isDirty()) {
+ if (this.forceStateResync || this.tickCount % this.updateInterval == 0 || this.entity.hasImpulse || this.entity.getEntityData().isDirty()) { // Paper - fix desync when a player is added to the tracker
int i;
int j;
@@ -177,13 +184,13 @@ public class ServerEntity {
boolean flag4 = false;
boolean flag5 = false;
- if (!(this.entity instanceof net.minecraft.world.entity.decoration.HangingEntity) || this.tickCount > 0 || this.entity instanceof AbstractArrow) { // Paper - Always update position to fix first-tick teleports
+ if (this.forceStateResync || !(this.entity instanceof net.minecraft.world.entity.decoration.HangingEntity) || this.tickCount > 0 || this.entity instanceof AbstractArrow) { // Paper - Always update position to fix first-tick teleports
long k = this.positionCodec.encodeX(vec3d);
long l = this.positionCodec.encodeY(vec3d);
long i1 = this.positionCodec.encodeZ(vec3d);
boolean flag6 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L;
- if (!flag6 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.onGround()&& !(io.papermc.paper.configuration.GlobalConfiguration.get().collisions.sendFullPosForHardCollidingEntities && this.entity.hardCollides())) { // Paper - send full pos for hard colliding entities to prevent collision problems due to desync
+ if (!this.forceStateResync && !flag6 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.onGround()&& !(io.papermc.paper.configuration.GlobalConfiguration.get().collisions.sendFullPosForHardCollidingEntities && this.entity.hardCollides())) { // Paper - send full pos for hard colliding entities to prevent collision problems due to desync
if ((!flag2 || !flag3) && !(this.entity instanceof AbstractArrow)) {
if (flag2) {
packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.onGround());
@@ -240,6 +247,7 @@ public class ServerEntity {
}
this.entity.hasImpulse = false;
+ this.forceStateResync = false; // Paper - fix desync when a player is added to the tracker
}
++this.tickCount;