Update Paper

This commit is contained in:
Spottedleaf 2024-04-11 17:03:29 -07:00
parent ef2c697189
commit 6b9a96f604
14 changed files with 184 additions and 180 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.11" id("io.papermc.paperweight.patcher") version "1.5.12"
} }
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"

View File

@ -2,7 +2,7 @@ group=dev.folia
version=1.20.4-R0.1-SNAPSHOT version=1.20.4-R0.1-SNAPSHOT
mcVersion=1.20.4 mcVersion=1.20.4
paperRef=b6001403e9703cadaa6e8c8558e732b91c3c6d6e paperRef=5436d44bf2509ff89129f8790ee4643f09c72871
org.gradle.caching=true org.gradle.caching=true
org.gradle.parallel=true org.gradle.parallel=true

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

20
gradlew.bat vendored
View File

@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail

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 db46e3233edf18bd91a6da8612ccc9f0080d5c17..4d6de4f2c67b1f122768806443766bd20c5ae617 100644 index 9a428153f34291bdc026a71f7e60e285b7794b0c..c37904d1aae749030620e1bbdb955e25c91ab1f8 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
@@ -2873,6 +2873,14 @@ public final class Bukkit { @@ -2879,6 +2879,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 db46e3233edf18bd91a6da8612ccc9f0080d5c17..4d6de4f2c67b1f122768806443766bd2
@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 0eb61b090d6f8fa6d99735ff3680dac774c52c1f..d46f932b595495816ea038cf161bc7f2d85f177e 100644 index 4ff1b38eb65f97344257204cf018f176f247ed36..15395ef52505087e7eef3b1a5981e787dcc16508 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
@@ -2512,4 +2512,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2518,4 +2518,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,7 +5,7 @@ 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 241808d8619e17c0681f79acbbc98af5bf52dd89..905262067dabc7cbe5b08639fcefd3a996a937e0 100644 index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..12f9f9d46c098c5c88058cb1f73ae39a7d1debd5 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) { @@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
@ -32,7 +32,7 @@ index 241808d8619e17c0681f79acbbc98af5bf52dd89..905262067dabc7cbe5b08639fcefd3a9
"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,
@@ -155,7 +159,7 @@ fun TaskContainer.registerRunTask( @@ -150,7 +154,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,7 +93,7 @@ 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 93b661e9cb7743aeff7da3972942cb73049a5e4c..c220b116b62e783d42364bae3d499e66a52241d1 100644 index c8772c773f9933ed1d1debfe707af4373c458152..50055e362a0de853c169a38c6cbd8681b73fc96d 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 @@ -1865,7 +1865,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -2370,10 +2370,10 @@ index bd68139ae635f2ad7ec8e7a21e0056a139c4c62e..48a43341b17247355a531164019d5cc9
} }
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index f2e30d8743a97c0541808dc5c03300c0d881b843..6f44ba7d4f8a4b12c0d5792b1fd2f4b53cbd334d 100644 index 0cc2307636279915c1f8529e62174cc696e185ee..59aad39f2381d9cc72aa0bb0a2b86e4d06994c09 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -344,4 +344,18 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -346,4 +346,18 @@ public class GlobalConfiguration extends ConfigurationPart {
public boolean disableChorusPlantUpdates = false; public boolean disableChorusPlantUpdates = false;
public boolean disableMushroomBlockUpdates = false; public boolean disableMushroomBlockUpdates = false;
} }
@ -10042,7 +10042,7 @@ index 4716f8bd8a64d4f20f0d5957c1e7fabf63020f43..18b8651147dedcf80d9baf04e87fb25c
private static class InnerUtil { // Attempt to hide these methods from ProtocolLib, so it doesn't accidently pick them up. private static class InnerUtil { // Attempt to hide these methods from ProtocolLib, so it doesn't accidently pick them up.
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 3e2d5dcd62775b6ed7c0ce0ba51a71b635b1d644..98fb69a9adeb6eaab199aec127692acb07f56808 100644 index 32838f87978c0694bdb573236b7cdf72b2e363cd..1192503d2729b3f14aa2936c2060df9884870cb4 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
@@ -44,7 +44,7 @@ public class PacketUtils { @@ -44,7 +44,7 @@ public class PacketUtils {
@ -10053,7 +10053,7 @@ index 3e2d5dcd62775b6ed7c0ce0ba51a71b635b1d644..98fb69a9adeb6eaab199aec127692acb
+ Runnable run = () -> { // Folia - region threading + Runnable run = () -> { // Folia - region threading
packetProcessing.push(listener); // Paper - detailed watchdog information packetProcessing.push(listener); // Paper - detailed watchdog information
try { // Paper - detailed watchdog information try { // Paper - detailed watchdog information
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590 if (listener instanceof ServerCommonPacketListenerImpl serverCommonPacketListener && serverCommonPacketListener.processedDisconnect) return; // CraftBukkit - Don't handle sync packets for kicked players
@@ -91,7 +91,21 @@ public class PacketUtils { @@ -91,7 +91,21 @@ public class PacketUtils {
} }
// Paper end - detailed watchdog information // Paper end - detailed watchdog information
@ -10075,10 +10075,10 @@ index 3e2d5dcd62775b6ed7c0ce0ba51a71b635b1d644..98fb69a9adeb6eaab199aec127692acb
+ } + }
+ // Folia end - region threading + // Folia end - region threading
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD; throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD;
// CraftBukkit start - SPIGOT-5477, MC-142590 }
} else if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) { }
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 c220b116b62e783d42364bae3d499e66a52241d1..1e658114879ad9bdb679b9230ac3eab643375f8b 100644 index 50055e362a0de853c169a38c6cbd8681b73fc96d..cf06989ad1ab55bf6836abe4cdeed2fff31ac93f 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
@@ -203,7 +203,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -203,7 +203,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -10841,7 +10841,7 @@ index c220b116b62e783d42364bae3d499e66a52241d1..1e658114879ad9bdb679b9230ac3eab6
} }
public long[] getTickTimesNanos() { public long[] getTickTimesNanos() {
@@ -2791,14 +2886,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2793,14 +2888,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
public ProfileResults stopTimeProfiler() { public ProfileResults stopTimeProfiler() {
@ -13186,7 +13186,7 @@ index 366c0c9b45a819f7f94ebe3e49b8ab7f9edf9ce7..d532043f33825ce2971d9e53f290cdea
} }
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 bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29e08912cf 100644 index 502bdc726b7890b00ee36871d905dea44e8719e3..e32c4b49bc3081af2c811dac3aec3cce8efd6661 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
@@ -193,37 +193,35 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -193,37 +193,35 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -13819,7 +13819,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
return true; return true;
} }
// Paper end - capture all item additions to the world // Paper end - capture all item additions to the world
@@ -1835,7 +1991,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1846,7 +2002,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override @Override
public void sendBlockUpdated(BlockPos pos, BlockState oldState, BlockState newState, int flags) { public void sendBlockUpdated(BlockPos pos, BlockState oldState, BlockState newState, int flags) {
@ -13828,7 +13828,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
String s = "recursive call to sendBlockUpdated"; String s = "recursive call to sendBlockUpdated";
Util.logAndPauseIfInIde("recursive call to sendBlockUpdated", new IllegalStateException("recursive call to sendBlockUpdated")); Util.logAndPauseIfInIde("recursive call to sendBlockUpdated", new IllegalStateException("recursive call to sendBlockUpdated"));
@@ -1848,7 +2004,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1859,7 +2015,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (Shapes.joinIsNotEmpty(voxelshape, voxelshape1, BooleanOp.NOT_SAME)) { if (Shapes.joinIsNotEmpty(voxelshape, voxelshape1, BooleanOp.NOT_SAME)) {
List<PathNavigation> list = new ObjectArrayList(); List<PathNavigation> list = new ObjectArrayList();
@ -13837,7 +13837,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
while (iterator.hasNext()) { while (iterator.hasNext()) {
// CraftBukkit start - fix SPIGOT-6362 // CraftBukkit start - fix SPIGOT-6362
@@ -1871,7 +2027,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1882,7 +2038,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
try { try {
@ -13846,7 +13846,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
iterator = list.iterator(); iterator = list.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1880,7 +2036,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1891,7 +2047,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
navigationabstract1.recomputePath(); navigationabstract1.recomputePath();
} }
} finally { } finally {
@ -13855,7 +13855,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
} }
} }
@@ -1889,23 +2045,23 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1900,23 +2056,23 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override @Override
public void updateNeighborsAt(BlockPos pos, Block sourceBlock) { public void updateNeighborsAt(BlockPos pos, Block sourceBlock) {
@ -13884,7 +13884,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
} }
@Override @Override
@@ -1936,7 +2092,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1947,7 +2103,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
explosion.clearToBlow(); explosion.clearToBlow();
} }
@ -13893,7 +13893,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
while (iterator.hasNext()) { while (iterator.hasNext()) {
ServerPlayer entityplayer = (ServerPlayer) iterator.next(); ServerPlayer entityplayer = (ServerPlayer) iterator.next();
@@ -1951,25 +2107,28 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1962,25 +2118,28 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override @Override
public void blockEvent(BlockPos pos, Block block, int type, int data) { public void blockEvent(BlockPos pos, Block block, int type, int data) {
@ -13928,7 +13928,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
} }
private boolean doBlockEvent(BlockEventData event) { private boolean doBlockEvent(BlockEventData event) {
@@ -1980,12 +2139,12 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1991,12 +2150,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override @Override
public LevelTicks<Block> getBlockTicks() { public LevelTicks<Block> getBlockTicks() {
@ -13943,7 +13943,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
} }
@Nonnull @Nonnull
@@ -2009,7 +2168,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2020,7 +2179,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public <T extends ParticleOptions> int sendParticles(ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) { public <T extends ParticleOptions> int sendParticles(ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) {
// Paper start - Particle API // Paper start - Particle API
@ -13952,7 +13952,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
} }
public <T extends ParticleOptions> int sendParticles(List<ServerPlayer> receivers, @Nullable ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) { public <T extends ParticleOptions> int sendParticles(List<ServerPlayer> receivers, @Nullable ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) {
// Paper end - Particle API // Paper end - Particle API
@@ -2062,7 +2221,14 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2073,7 +2232,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
public Entity getEntityOrPart(int id) { public Entity getEntityOrPart(int id) {
Entity entity = (Entity) this.getEntities().get(id); Entity entity = (Entity) this.getEntities().get(id);
@ -13968,7 +13968,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
} }
@Nullable @Nullable
@@ -2240,6 +2406,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2251,6 +2417,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
public boolean setChunkForced(int x, int z, boolean forced) { public boolean setChunkForced(int x, int z, boolean forced) {
@ -13976,7 +13976,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
ForcedChunksSavedData forcedchunk = (ForcedChunksSavedData) this.getDataStorage().computeIfAbsent(ForcedChunksSavedData.factory(), "chunks"); ForcedChunksSavedData forcedchunk = (ForcedChunksSavedData) this.getDataStorage().computeIfAbsent(ForcedChunksSavedData.factory(), "chunks");
ChunkPos chunkcoordintpair = new ChunkPos(x, z); ChunkPos chunkcoordintpair = new ChunkPos(x, z);
long k = chunkcoordintpair.toLong(); long k = chunkcoordintpair.toLong();
@@ -2248,7 +2415,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2259,7 +2426,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (forced) { if (forced) {
flag1 = forcedchunk.getChunks().add(k); flag1 = forcedchunk.getChunks().add(k);
if (flag1) { if (flag1) {
@ -13985,7 +13985,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
} }
} else { } else {
flag1 = forcedchunk.getChunks().remove(k); flag1 = forcedchunk.getChunks().remove(k);
@@ -2276,13 +2443,18 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2287,13 +2454,18 @@ public class ServerLevel extends Level implements WorldGenLevel {
BlockPos blockposition1 = pos.immutable(); BlockPos blockposition1 = pos.immutable();
optional.ifPresent((holder) -> { optional.ifPresent((holder) -> {
@ -14007,7 +14007,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
// Paper start - Remove stale POIs // Paper start - Remove stale POIs
if (optional.isEmpty() && this.getPoiManager().exists(blockposition1, poiType -> true)) { if (optional.isEmpty() && this.getPoiManager().exists(blockposition1, poiType -> true)) {
this.getPoiManager().remove(blockposition1); this.getPoiManager().remove(blockposition1);
@@ -2290,7 +2462,12 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2301,7 +2473,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper end - Remove stale POIs // Paper end - Remove stale POIs
this.getPoiManager().add(blockposition1, holder); this.getPoiManager().add(blockposition1, holder);
DebugPackets.sendPoiAddedPacket(this, blockposition1); DebugPackets.sendPoiAddedPacket(this, blockposition1);
@ -14021,7 +14021,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
}); });
} }
} }
@@ -2337,7 +2514,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2348,7 +2525,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
BufferedWriter bufferedwriter = Files.newBufferedWriter(path.resolve("stats.txt")); BufferedWriter bufferedwriter = Files.newBufferedWriter(path.resolve("stats.txt"));
try { try {
@ -14030,7 +14030,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
NaturalSpawner.SpawnState spawnercreature_d = this.getChunkSource().getLastSpawnState(); NaturalSpawner.SpawnState spawnercreature_d = this.getChunkSource().getLastSpawnState();
if (spawnercreature_d != null) { if (spawnercreature_d != null) {
@@ -2351,7 +2528,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2362,7 +2539,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
bufferedwriter.write(String.format(Locale.ROOT, "entities: %s\n", this.entityLookup.getDebugInfo())); // Paper - rewrite chunk system bufferedwriter.write(String.format(Locale.ROOT, "entities: %s\n", this.entityLookup.getDebugInfo())); // Paper - rewrite chunk system
@ -14039,7 +14039,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
bufferedwriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count())); bufferedwriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count()));
bufferedwriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count())); bufferedwriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count()));
bufferedwriter.write("distance_manager: " + playerchunkmap.getDistanceManager().getDebugStatus() + "\n"); bufferedwriter.write("distance_manager: " + playerchunkmap.getDistanceManager().getDebugStatus() + "\n");
@@ -2497,7 +2674,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2508,7 +2685,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
private void dumpBlockEntityTickers(Writer writer) throws IOException { private void dumpBlockEntityTickers(Writer writer) throws IOException {
CsvOutput csvwriter = CsvOutput.builder().addColumn("x").addColumn("y").addColumn("z").addColumn("type").build(writer); CsvOutput csvwriter = CsvOutput.builder().addColumn("x").addColumn("y").addColumn("z").addColumn("type").build(writer);
@ -14048,7 +14048,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
while (iterator.hasNext()) { while (iterator.hasNext()) {
TickingBlockEntity tickingblockentity = (TickingBlockEntity) iterator.next(); TickingBlockEntity tickingblockentity = (TickingBlockEntity) iterator.next();
@@ -2510,7 +2687,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2521,7 +2698,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@VisibleForTesting @VisibleForTesting
public void clearBlockEvents(BoundingBox box) { public void clearBlockEvents(BoundingBox box) {
@ -14057,7 +14057,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
return box.isInside(blockactiondata.pos()); return box.isInside(blockactiondata.pos());
}); });
} }
@@ -2519,7 +2696,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2530,7 +2707,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void blockUpdated(BlockPos pos, Block block) { public void blockUpdated(BlockPos pos, Block block) {
if (!this.isDebug()) { if (!this.isDebug()) {
// CraftBukkit start // CraftBukkit start
@ -14066,7 +14066,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
return; return;
} }
// CraftBukkit end // CraftBukkit end
@@ -2562,9 +2739,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2573,9 +2750,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@VisibleForTesting @VisibleForTesting
public String getWatchdogStats() { public String getWatchdogStats() {
@ -14077,7 +14077,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
} }
private static <T> String getTypeCount(Iterable<T> items, Function<T, String> classifier) { private static <T> String getTypeCount(Iterable<T> items, Function<T, String> classifier) {
@@ -2597,6 +2772,12 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2608,6 +2783,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
public static void makeObsidianPlatform(ServerLevel worldserver, Entity entity) { public static void makeObsidianPlatform(ServerLevel worldserver, Entity entity) {
// CraftBukkit end // CraftBukkit end
BlockPos blockposition = ServerLevel.END_SPAWN_POINT; BlockPos blockposition = ServerLevel.END_SPAWN_POINT;
@ -14090,7 +14090,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
int i = blockposition.getX(); int i = blockposition.getX();
int j = blockposition.getY() - 2; int j = blockposition.getY() - 2;
int k = blockposition.getZ(); int k = blockposition.getZ();
@@ -2609,11 +2790,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2620,11 +2801,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
BlockPos.betweenClosed(i - 2, j, k - 2, i + 2, j, k + 2).forEach((blockposition1) -> { BlockPos.betweenClosed(i - 2, j, k - 2, i + 2, j, k + 2).forEach((blockposition1) -> {
blockList.setBlock(blockposition1, Blocks.OBSIDIAN.defaultBlockState(), 3); blockList.setBlock(blockposition1, Blocks.OBSIDIAN.defaultBlockState(), 3);
}); });
@ -14103,7 +14103,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
blockList.updateList(); blockList.updateList();
} }
// CraftBukkit end // CraftBukkit end
@@ -2634,13 +2811,14 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2645,13 +2822,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
public void startTickingChunk(LevelChunk chunk) { public void startTickingChunk(LevelChunk chunk) {
@ -14122,7 +14122,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
} }
@Override @Override
@@ -2662,7 +2840,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2673,7 +2851,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper end - rewrite chunk system // Paper end - rewrite chunk system
} }
@ -14131,7 +14131,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
// Paper start - optimize is ticking ready type functions // Paper start - optimize is ticking ready type functions
io.papermc.paper.chunk.system.scheduling.NewChunkHolder chunkHolder = this.chunkTaskScheduler.chunkHolderManager.getChunkHolder(chunkPos); io.papermc.paper.chunk.system.scheduling.NewChunkHolder chunkHolder = this.chunkTaskScheduler.chunkHolderManager.getChunkHolder(chunkPos);
// isTicking implies the chunk is loaded, and the chunk is loaded now implies the entities are loaded // isTicking implies the chunk is loaded, and the chunk is loaded now implies the entities are loaded
@@ -2717,7 +2895,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2728,7 +2906,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper start - optimize redstone (Alternate Current) // Paper start - optimize redstone (Alternate Current)
@Override @Override
public alternate.current.wire.WireHandler getWireHandler() { public alternate.current.wire.WireHandler getWireHandler() {
@ -14140,7 +14140,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
} }
// Paper end - optimize redstone (Alternate Current) // Paper end - optimize redstone (Alternate Current)
@@ -2728,16 +2906,16 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2739,16 +2917,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void onCreated(Entity entity) {} public void onCreated(Entity entity) {}
public void onDestroyed(Entity entity) { public void onDestroyed(Entity entity) {
@ -14160,7 +14160,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
// Paper start - Reset pearls when they stop being ticked // Paper start - Reset pearls when they stop being ticked
if (paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) { if (paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) {
pearl.cachedOwner = null; pearl.cachedOwner = null;
@@ -2748,6 +2926,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2759,6 +2937,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void onTrackingStart(Entity entity) { public void onTrackingStart(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot
@ -14168,7 +14168,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
// ServerLevel.this.getChunkSource().addEntity(entity); // Paper - ignore and warn about illegal addEntity calls instead of crashing server; moved down below valid=true // ServerLevel.this.getChunkSource().addEntity(entity); // Paper - ignore and warn about illegal addEntity calls instead of crashing server; moved down below valid=true
if (entity instanceof ServerPlayer) { if (entity instanceof ServerPlayer) {
ServerPlayer entityplayer = (ServerPlayer) entity; ServerPlayer entityplayer = (ServerPlayer) entity;
@@ -2765,7 +2944,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2776,7 +2955,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration")); Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
} }
@ -14177,7 +14177,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
} }
if (entity instanceof EnderDragon) { if (entity instanceof EnderDragon) {
@@ -2776,7 +2955,9 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2787,7 +2966,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
EnderDragonPart entitycomplexpart = aentitycomplexpart[j]; EnderDragonPart entitycomplexpart = aentitycomplexpart[j];
@ -14187,7 +14187,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
} }
} }
@@ -2798,16 +2979,24 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2809,16 +2990,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void onTrackingEnd(Entity entity) { public void onTrackingEnd(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity unregister"); // Spigot org.spigotmc.AsyncCatcher.catchOp("entity unregister"); // Spigot
@ -14213,7 +14213,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
map.carriedByPlayers.remove( (Player) entity ); map.carriedByPlayers.remove( (Player) entity );
for ( Iterator<MapItemSavedData.HoldingPlayer> iter = (Iterator<MapItemSavedData.HoldingPlayer>) map.carriedBy.iterator(); iter.hasNext(); ) for ( Iterator<MapItemSavedData.HoldingPlayer> iter = (Iterator<MapItemSavedData.HoldingPlayer>) map.carriedBy.iterator(); iter.hasNext(); )
{ {
@@ -2817,6 +3006,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2828,6 +3017,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
iter.remove(); iter.remove();
} }
} }
@ -14221,7 +14221,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
} }
} }
} ); } );
@@ -2851,7 +3041,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2862,7 +3052,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration")); Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
} }
@ -14230,7 +14230,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
} }
if (entity instanceof EnderDragon) { if (entity instanceof EnderDragon) {
@@ -2862,13 +3052,16 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2873,13 +3063,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
EnderDragonPart entitycomplexpart = aentitycomplexpart[j]; EnderDragonPart entitycomplexpart = aentitycomplexpart[j];
@ -14248,7 +14248,7 @@ index bf5e47e8c3706590fdc0731bd9a5858b56d06136..f72e3d2decf8eb2a5a802bb1c6c8aa29
for (ServerPlayer player : ServerLevel.this.players) { for (ServerPlayer player : ServerLevel.this.players) {
player.getBukkitEntity().onEntityRemove(entity); player.getBukkitEntity().onEntityRemove(entity);
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 58591bf2f63b9c5e97d9ce4188dff3366968a178..add6fc106d3c38d97b48ec0df3ac2515c8c0486e 100644 index b3781efbd3edcf102fe1bda5d6149915dc1127c6..36d074d1abed62b09ca808dc2774bc83a6fd5df7 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
@@ -191,7 +191,7 @@ import org.bukkit.inventory.MainHand; @@ -191,7 +191,7 @@ import org.bukkit.inventory.MainHand;
@ -14967,7 +14967,7 @@ index 658e63ebde81dc14c8ab5850fb246dc0aab25dea..7e1f15ac8d2f7c86d4aba1be5df71705
public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) { public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) {
return new TicketType<>(name, argumentComparator, 0L); return new TicketType<>(name, argumentComparator, 0L);
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
index 5ece375eaf6bcc61864997a389bb5e24625e4505..33c1ef45ed620f8424c2c83dd30b674892ddffe3 100644 index 9c3f8f79c2b3389a118dce9a1558edda52446833..8c455cda45ca2d724fbc140d53ffc7ecba3ca44c 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -84,6 +84,13 @@ public class WorldGenRegion implements WorldGenLevel { @@ -84,6 +84,13 @@ public class WorldGenRegion implements WorldGenLevel {
@ -15166,7 +15166,7 @@ index 586521a2cbb1d4dcfb912029f65e4363ec7674a7..6e95017f4c36208abdf344e3b7d55efe
Collections.shuffle( this.connections ); Collections.shuffle( this.connections );
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 87e5ee042ab2c052d25ab4c2521a68cf2e2d67b6..3b2508dc6cd4f70b09dce3b7e745e6efabaaa74e 100644 index 860d33ac56680babd87358b1d7d2216dac3f7865..954809d8997750959541e6462668f17efd0b0f70 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -291,7 +291,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -291,7 +291,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -16402,7 +16402,7 @@ index ea27b46eec01bda427653335f922ccd068cffcb5..e551d3b875eab6851b75041f418c9a08
return blockToFallLocation(blockState); return blockToFallLocation(blockState);
} else { } else {
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 b2eff51f1ad1e702525ef298807ea7d2083f6218..79e9039d77a993d8f1e02942f87fac2a0bd9e8a8 100644 index 0b4ed99658b083a83a90db1b32edb358da9e9514..518487d4cd489110bebcf75078935a95b5d3e9cf 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
@@ -170,7 +170,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -170,7 +170,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -17409,7 +17409,7 @@ index b2eff51f1ad1e702525ef298807ea7d2083f6218..79e9039d77a993d8f1e02942f87fac2a
/** /**
* Invoked only when the entity is truly removed from the server, never to be added to any world. * Invoked only when the entity is truly removed from the server, never to be added to any world.
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 23570a0b1227a840b9c1e6ae326827ea655bb5f7..a8b47867f05af2a1a4409be5ff49ad0d95bebcae 100644 index e9bb7feb591032904516d1b9374f486d8a7d066c..73e0c2ec5ab8cf54767755f31d1a8d0a168ee46f 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
@@ -246,7 +246,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -246,7 +246,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -18037,7 +18037,7 @@ index c34701f95580e4cf45fe086115563127432a28c5..fe95aa9389f7d11e1380445a1eeca50c
}); });
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index c7f06c3cfb737bd17a706798bf9cf0e1af5f0cc0..14fc53880808df4954575d3270b1f587eb6ac83b 100644 index 29ce703a79f7893ac990ad80e0f1c1cf63546e6c..51bc4c0c8505e900cd3268048ac8cf71b2d22e6b 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -55,7 +55,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -55,7 +55,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@ -19335,7 +19335,7 @@ index 90a82bd7977ebe520bdcc2ab99e11452d5cf4a21..b937437d4446fbf80376399067fd04dc
private final double posX, posY, posZ; private final double posX, posY, posZ;
private final double minX, minY, minZ; private final double minX, minY, minZ;
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 bc89f9e90af3d69872a58c47a4c2545ba91b6ba5..52a7775e7aa375a043438d23204acd030ad35372 100644 index ca89d1593bf1b46c79a882db528cbca1359dc9d4..2c0ce270c947c7fc1d7e0163a43467129a65f999 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
@@ -115,10 +115,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -115,10 +115,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -19482,8 +19482,8 @@ index bc89f9e90af3d69872a58c47a4c2545ba91b6ba5..52a7775e7aa375a043438d23204acd03
- this.capturedBlockStates.put(pos.immutable(), blockstate); - this.capturedBlockStates.put(pos.immutable(), blockstate);
+ worldData.capturedBlockStates.put(pos.immutable(), blockstate); // Folia - region threading + worldData.capturedBlockStates.put(pos.immutable(), blockstate); // Folia - region threading
} }
blockstate.setFlag(flags); // Paper - update the flag also
blockstate.setData(state); blockstate.setData(state);
blockstate.setFlag(flags);
@@ -937,10 +956,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -937,10 +956,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit start - capture blockstates // CraftBukkit start - capture blockstates
@ -21046,7 +21046,7 @@ index b8b78494449c0cd638f9706a803dc54e184d981f..b31f1e0522ff18fa5853af6104d46f98
return true; return true;
} else { } else {
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 6ec3fc801453fd54c25b642e6fa71c19b463311d..852fef18497435827a03e0056a09e5deb2525ed9 100644 index 465458e8a7dbaf9afb32709a71c7b2620d1e1fd2..ff1a7b78fa010857daab7a306cb9483c98560b79 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
@@ -59,6 +59,13 @@ public class LevelChunk extends ChunkAccess { @@ -59,6 +59,13 @@ public class LevelChunk extends ChunkAccess {
@ -21896,10 +21896,10 @@ index b63effd92be5a8a75db6c37e5a1b91541020ec75..350fc61fd709453a86c9f7f6e4bccc43
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1ac7d84381 100644 index 01797d9791f19dfda4b168218eadeaae97f11eab..becb3b07876715d7c39ba4e7289cc5ac85f84412 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -192,7 +192,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -193,7 +193,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public int getTickableTileEntityCount() { public int getTickableTileEntityCount() {
@ -21908,7 +21908,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
} }
@Override @Override
@@ -254,7 +254,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -255,7 +255,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Paper start - per world spawn limits // Paper start - per world spawn limits
for (SpawnCategory spawnCategory : SpawnCategory.values()) { for (SpawnCategory spawnCategory : SpawnCategory.values()) {
if (CraftSpawnCategory.isValidForLimits(spawnCategory)) { if (CraftSpawnCategory.isValidForLimits(spawnCategory)) {
@ -21917,7 +21917,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
} }
} }
// Paper end - per world spawn limits // Paper end - per world spawn limits
@@ -341,6 +341,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -342,6 +342,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public Chunk getChunkAt(int x, int z) { public Chunk getChunkAt(int x, int z) {
@ -21925,7 +21925,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
warnUnsafeChunk("getting a faraway chunk", x, z); // Paper warnUnsafeChunk("getting a faraway chunk", x, z); // Paper
// Paper start - add ticket to hold chunk for a little while longer if plugin accesses it // Paper start - add ticket to hold chunk for a little while longer if plugin accesses it
net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z); net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z);
@@ -364,7 +365,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -365,7 +366,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Paper start // Paper start
private void addTicket(int x, int z) { private void addTicket(int x, int z) {
@ -21934,7 +21934,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
} }
// Paper end // Paper end
@@ -383,10 +384,10 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -384,10 +385,10 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public boolean isChunkGenerated(int x, int z) { public boolean isChunkGenerated(int x, int z) {
// Paper start - Fix this method // Paper start - Fix this method
@ -21947,7 +21947,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
} }
ChunkAccess chunk = world.getChunkSource().getChunkAtImmediately(x, z); ChunkAccess chunk = world.getChunkSource().getChunkAtImmediately(x, z);
if (chunk == null) { if (chunk == null) {
@@ -440,7 +441,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -441,7 +442,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
} }
private boolean unloadChunk0(int x, int z, boolean save) { private boolean unloadChunk0(int x, int z, boolean save) {
@ -21956,7 +21956,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
if (!this.isChunkLoaded(x, z)) { if (!this.isChunkLoaded(x, z)) {
return true; return true;
} }
@@ -455,7 +456,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -456,7 +457,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public boolean regenerateChunk(int x, int z) { public boolean regenerateChunk(int x, int z) {
@ -21965,7 +21965,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
warnUnsafeChunk("regenerating a faraway chunk", x, z); // Paper warnUnsafeChunk("regenerating a faraway chunk", x, z); // Paper
// Paper start - implement regenerateChunk method // Paper start - implement regenerateChunk method
final ServerLevel serverLevel = this.world; final ServerLevel serverLevel = this.world;
@@ -518,6 +519,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -519,6 +520,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public boolean refreshChunk(int x, int z) { public boolean refreshChunk(int x, int z) {
@ -21973,7 +21973,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z)); ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z));
if (playerChunk == null) return false; if (playerChunk == null) return false;
@@ -553,7 +555,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -554,7 +556,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public boolean loadChunk(int x, int z, boolean generate) { public boolean loadChunk(int x, int z, boolean generate) {
@ -21982,7 +21982,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
warnUnsafeChunk("loading a faraway chunk", x, z); // Paper warnUnsafeChunk("loading a faraway chunk", x, z); // Paper
// Paper start - Optimize this method // Paper start - Optimize this method
ChunkPos chunkPos = new ChunkPos(x, z); ChunkPos chunkPos = new ChunkPos(x, z);
@@ -622,7 +624,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -623,7 +625,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager; DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager;
if (chunkDistanceManager.addRegionTicketAtDistance(TicketType.PLUGIN_TICKET, new ChunkPos(x, z), 2, plugin)) { // keep in-line with force loading, add at level 31 if (chunkDistanceManager.addRegionTicketAtDistance(TicketType.PLUGIN_TICKET, new ChunkPos(x, z), 2, plugin)) { // keep in-line with force loading, add at level 31
@ -21991,7 +21991,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
return true; return true;
} }
@@ -813,13 +815,15 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -833,13 +835,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) { public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
@ -22012,7 +22012,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
BlockPos position = ((CraftBlockState) blockstate).getPosition(); BlockPos position = ((CraftBlockState) blockstate).getPosition();
net.minecraft.world.level.block.state.BlockState oldBlock = this.world.getBlockState(position); net.minecraft.world.level.block.state.BlockState oldBlock = this.world.getBlockState(position);
int flag = ((CraftBlockState) blockstate).getFlag(); int flag = ((CraftBlockState) blockstate).getFlag();
@@ -827,10 +831,10 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -847,10 +851,10 @@ public class CraftWorld extends CraftRegionAccessor implements World {
net.minecraft.world.level.block.state.BlockState newBlock = this.world.getBlockState(position); net.minecraft.world.level.block.state.BlockState newBlock = this.world.getBlockState(position);
this.world.notifyAndUpdatePhysics(position, null, oldBlock, newBlock, newBlock, flag, 512); this.world.notifyAndUpdatePhysics(position, null, oldBlock, newBlock, newBlock, flag, 512);
} }
@ -22025,7 +22025,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
return false; return false;
} }
} }
@@ -864,6 +868,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -884,6 +888,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setTime(long time) { public void setTime(long time) {
@ -22033,7 +22033,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
long margin = (time - this.getFullTime()) % 24000; long margin = (time - this.getFullTime()) % 24000;
if (margin < 0) margin += 24000; if (margin < 0) margin += 24000;
this.setFullTime(this.getFullTime() + margin); this.setFullTime(this.getFullTime() + margin);
@@ -876,6 +881,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -896,6 +901,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setFullTime(long time) { public void setFullTime(long time) {
@ -22041,7 +22041,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
// Notify anyone who's listening // Notify anyone who's listening
TimeSkipEvent event = new TimeSkipEvent(this, TimeSkipEvent.SkipReason.CUSTOM, time - this.world.getDayTime()); TimeSkipEvent event = new TimeSkipEvent(this, TimeSkipEvent.SkipReason.CUSTOM, time - this.world.getDayTime());
this.server.getPluginManager().callEvent(event); this.server.getPluginManager().callEvent(event);
@@ -903,7 +909,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -923,7 +929,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public long getGameTime() { public long getGameTime() {
@ -22050,7 +22050,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
} }
@Override @Override
@@ -923,11 +929,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -943,11 +949,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) { public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) {
@ -22064,7 +22064,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
return !world.explode(source != null ? ((org.bukkit.craftbukkit.entity.CraftEntity) source).getHandle() : null, loc.getX(), loc.getY(), loc.getZ(), power, setFire, breakBlocks ? net.minecraft.world.level.Level.ExplosionInteraction.MOB : net.minecraft.world.level.Level.ExplosionInteraction.NONE).wasCanceled; return !world.explode(source != null ? ((org.bukkit.craftbukkit.entity.CraftEntity) source).getHandle() : null, loc.getX(), loc.getY(), loc.getZ(), power, setFire, breakBlocks ? net.minecraft.world.level.Level.ExplosionInteraction.MOB : net.minecraft.world.level.Level.ExplosionInteraction.NONE).wasCanceled;
} }
// Paper end // Paper end
@@ -1004,6 +1012,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1024,6 +1032,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) { public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) {
@ -22072,7 +22072,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
warnUnsafeChunk("getting a faraway chunk", x >> 4, z >> 4); // Paper warnUnsafeChunk("getting a faraway chunk", x >> 4, z >> 4); // Paper
// Transient load for this tick // Transient load for this tick
return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z); return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z);
@@ -1034,6 +1043,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1054,6 +1063,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setBiome(int x, int y, int z, Holder<net.minecraft.world.level.biome.Biome> bb) { public void setBiome(int x, int y, int z, Holder<net.minecraft.world.level.biome.Biome> bb) {
BlockPos pos = new BlockPos(x, 0, z); BlockPos pos = new BlockPos(x, 0, z);
@ -22080,7 +22080,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
if (this.world.hasChunkAt(pos)) { if (this.world.hasChunkAt(pos)) {
net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkAt(pos); net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkAt(pos);
@@ -1344,6 +1354,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1364,6 +1374,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setStorm(boolean hasStorm) { public void setStorm(boolean hasStorm) {
@ -22088,7 +22088,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.world.serverLevelData.setRaining(hasStorm, org.bukkit.event.weather.WeatherChangeEvent.Cause.PLUGIN); // Paper - Add cause to Weather/ThunderChangeEvents this.world.serverLevelData.setRaining(hasStorm, org.bukkit.event.weather.WeatherChangeEvent.Cause.PLUGIN); // Paper - Add cause to Weather/ThunderChangeEvents
this.setWeatherDuration(0); // Reset weather duration (legacy behaviour) this.setWeatherDuration(0); // Reset weather duration (legacy behaviour)
this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands) this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
@@ -1356,6 +1367,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1376,6 +1387,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setWeatherDuration(int duration) { public void setWeatherDuration(int duration) {
@ -22096,7 +22096,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.world.serverLevelData.setRainTime(duration); this.world.serverLevelData.setRainTime(duration);
} }
@@ -1366,6 +1378,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1386,6 +1398,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setThundering(boolean thundering) { public void setThundering(boolean thundering) {
@ -22104,7 +22104,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.world.serverLevelData.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.PLUGIN); // Paper - Add cause to Weather/ThunderChangeEvents this.world.serverLevelData.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.PLUGIN); // Paper - Add cause to Weather/ThunderChangeEvents
this.setThunderDuration(0); // Reset weather duration (legacy behaviour) this.setThunderDuration(0); // Reset weather duration (legacy behaviour)
this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands) this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
@@ -1378,6 +1391,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1398,6 +1411,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setThunderDuration(int duration) { public void setThunderDuration(int duration) {
@ -22112,7 +22112,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.world.serverLevelData.setThunderTime(duration); this.world.serverLevelData.setThunderTime(duration);
} }
@@ -1388,6 +1402,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1408,6 +1422,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setClearWeatherDuration(int duration) { public void setClearWeatherDuration(int duration) {
@ -22120,7 +22120,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.world.serverLevelData.setClearWeatherTime(duration); this.world.serverLevelData.setClearWeatherTime(duration);
} }
@@ -1582,6 +1597,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1602,6 +1617,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setKeepSpawnInMemory(boolean keepLoaded) { public void setKeepSpawnInMemory(boolean keepLoaded) {
@ -22128,7 +22128,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
// Paper start - Configurable spawn radius // Paper start - Configurable spawn radius
if (keepLoaded == this.world.keepSpawnInMemory) { if (keepLoaded == this.world.keepSpawnInMemory) {
// do nothing, nothing has changed // do nothing, nothing has changed
@@ -1660,6 +1676,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1680,6 +1696,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setHardcore(boolean hardcore) { public void setHardcore(boolean hardcore) {
@ -22136,7 +22136,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.world.serverLevelData.settings.hardcore = hardcore; this.world.serverLevelData.settings.hardcore = hardcore;
} }
@@ -1672,6 +1689,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1692,6 +1709,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
@Deprecated @Deprecated
public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) { public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) {
@ -22144,7 +22144,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.setTicksPerSpawns(SpawnCategory.ANIMAL, ticksPerAnimalSpawns); this.setTicksPerSpawns(SpawnCategory.ANIMAL, ticksPerAnimalSpawns);
} }
@@ -1684,6 +1702,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1704,6 +1722,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
@Deprecated @Deprecated
public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) { public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) {
@ -22152,7 +22152,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.setTicksPerSpawns(SpawnCategory.MONSTER, ticksPerMonsterSpawns); this.setTicksPerSpawns(SpawnCategory.MONSTER, ticksPerMonsterSpawns);
} }
@@ -1696,6 +1715,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1716,6 +1735,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
@Deprecated @Deprecated
public void setTicksPerWaterSpawns(int ticksPerWaterSpawns) { public void setTicksPerWaterSpawns(int ticksPerWaterSpawns) {
@ -22160,7 +22160,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.setTicksPerSpawns(SpawnCategory.WATER_ANIMAL, ticksPerWaterSpawns); this.setTicksPerSpawns(SpawnCategory.WATER_ANIMAL, ticksPerWaterSpawns);
} }
@@ -1708,6 +1728,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1728,6 +1748,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
@Deprecated @Deprecated
public void setTicksPerWaterAmbientSpawns(int ticksPerWaterAmbientSpawns) { public void setTicksPerWaterAmbientSpawns(int ticksPerWaterAmbientSpawns) {
@ -22168,7 +22168,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.setTicksPerSpawns(SpawnCategory.WATER_AMBIENT, ticksPerWaterAmbientSpawns); this.setTicksPerSpawns(SpawnCategory.WATER_AMBIENT, ticksPerWaterAmbientSpawns);
} }
@@ -1720,6 +1741,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1740,6 +1761,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
@Deprecated @Deprecated
public void setTicksPerWaterUndergroundCreatureSpawns(int ticksPerWaterUndergroundCreatureSpawns) { public void setTicksPerWaterUndergroundCreatureSpawns(int ticksPerWaterUndergroundCreatureSpawns) {
@ -22176,7 +22176,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.setTicksPerSpawns(SpawnCategory.WATER_UNDERGROUND_CREATURE, ticksPerWaterUndergroundCreatureSpawns); this.setTicksPerSpawns(SpawnCategory.WATER_UNDERGROUND_CREATURE, ticksPerWaterUndergroundCreatureSpawns);
} }
@@ -1732,11 +1754,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1752,11 +1774,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
@Deprecated @Deprecated
public void setTicksPerAmbientSpawns(int ticksPerAmbientSpawns) { public void setTicksPerAmbientSpawns(int ticksPerAmbientSpawns) {
@ -22190,7 +22190,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null"); Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory); Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory);
@@ -1753,21 +1777,25 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1773,21 +1797,25 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) { public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
@ -22216,7 +22216,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.server.getWorldMetadata().removeMetadata(this, metadataKey, owningPlugin); this.server.getWorldMetadata().removeMetadata(this, metadataKey, owningPlugin);
} }
@@ -1780,6 +1808,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1800,6 +1828,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
@Deprecated @Deprecated
public void setMonsterSpawnLimit(int limit) { public void setMonsterSpawnLimit(int limit) {
@ -22224,7 +22224,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.setSpawnLimit(SpawnCategory.MONSTER, limit); this.setSpawnLimit(SpawnCategory.MONSTER, limit);
} }
@@ -1792,6 +1821,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1812,6 +1841,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
@Deprecated @Deprecated
public void setAnimalSpawnLimit(int limit) { public void setAnimalSpawnLimit(int limit) {
@ -22232,7 +22232,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.setSpawnLimit(SpawnCategory.ANIMAL, limit); this.setSpawnLimit(SpawnCategory.ANIMAL, limit);
} }
@@ -1804,6 +1834,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1824,6 +1854,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
@Deprecated @Deprecated
public void setWaterAnimalSpawnLimit(int limit) { public void setWaterAnimalSpawnLimit(int limit) {
@ -22240,7 +22240,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.setSpawnLimit(SpawnCategory.WATER_ANIMAL, limit); this.setSpawnLimit(SpawnCategory.WATER_ANIMAL, limit);
} }
@@ -1816,6 +1847,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1836,6 +1867,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
@Deprecated @Deprecated
public void setWaterAmbientSpawnLimit(int limit) { public void setWaterAmbientSpawnLimit(int limit) {
@ -22248,7 +22248,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.setSpawnLimit(SpawnCategory.WATER_AMBIENT, limit); this.setSpawnLimit(SpawnCategory.WATER_AMBIENT, limit);
} }
@@ -1828,6 +1860,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1848,6 +1880,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
@Deprecated @Deprecated
public void setWaterUndergroundCreatureSpawnLimit(int limit) { public void setWaterUndergroundCreatureSpawnLimit(int limit) {
@ -22256,7 +22256,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.setSpawnLimit(SpawnCategory.WATER_UNDERGROUND_CREATURE, limit); this.setSpawnLimit(SpawnCategory.WATER_UNDERGROUND_CREATURE, limit);
} }
@@ -1840,6 +1873,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1860,6 +1893,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
@Deprecated @Deprecated
public void setAmbientSpawnLimit(int limit) { public void setAmbientSpawnLimit(int limit) {
@ -22264,7 +22264,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
this.setSpawnLimit(SpawnCategory.AMBIENT, limit); this.setSpawnLimit(SpawnCategory.AMBIENT, limit);
} }
@@ -1862,6 +1896,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1882,6 +1916,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setSpawnLimit(SpawnCategory spawnCategory, int limit) { public void setSpawnLimit(SpawnCategory spawnCategory, int limit) {
@ -22272,7 +22272,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null"); Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory); Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory);
@@ -1944,7 +1979,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1964,7 +1999,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
if (!(entity instanceof CraftEntity craftEntity) || entity.getWorld() != this || sound == null || category == null) return; if (!(entity instanceof CraftEntity craftEntity) || entity.getWorld() != this || sound == null || category == null) return;
ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(CraftSound.bukkitToMinecraftHolder(sound), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed); ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(CraftSound.bukkitToMinecraftHolder(sound), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed);
@ -22281,7 +22281,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
if (entityTracker != null) { if (entityTracker != null) {
entityTracker.broadcastAndSend(packet); entityTracker.broadcastAndSend(packet);
} }
@@ -1956,7 +1991,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1976,7 +2011,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
if (!(entity instanceof CraftEntity craftEntity) || entity.getWorld() != this || sound == null || category == null) return; if (!(entity instanceof CraftEntity craftEntity) || entity.getWorld() != this || sound == null || category == null) return;
ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(Holder.direct(SoundEvent.createVariableRangeEvent(new ResourceLocation(sound))), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed); ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(Holder.direct(SoundEvent.createVariableRangeEvent(new ResourceLocation(sound))), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed);
@ -22290,7 +22290,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
if (entityTracker != null) { if (entityTracker != null) {
entityTracker.broadcastAndSend(packet); entityTracker.broadcastAndSend(packet);
} }
@@ -2045,6 +2080,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2065,6 +2100,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public boolean setGameRuleValue(String rule, String value) { public boolean setGameRuleValue(String rule, String value) {
@ -22298,7 +22298,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
// No null values allowed // No null values allowed
if (rule == null || value == null) return false; if (rule == null || value == null) return false;
@@ -2087,6 +2123,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2107,6 +2143,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public <T> boolean setGameRule(GameRule<T> rule, T newValue) { public <T> boolean setGameRule(GameRule<T> rule, T newValue) {
@ -22306,7 +22306,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
Preconditions.checkArgument(rule != null, "GameRule cannot be null"); Preconditions.checkArgument(rule != null, "GameRule cannot be null");
Preconditions.checkArgument(newValue != null, "GameRule value cannot be null"); Preconditions.checkArgument(newValue != null, "GameRule value cannot be null");
@@ -2339,6 +2376,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2359,6 +2396,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void sendGameEvent(Entity sourceEntity, org.bukkit.GameEvent gameEvent, Vector position) { public void sendGameEvent(Entity sourceEntity, org.bukkit.GameEvent gameEvent, Vector position) {
@ -22319,7 +22319,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
getHandle().gameEvent(sourceEntity != null ? ((CraftEntity) sourceEntity).getHandle(): null, net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT.get(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(gameEvent.getKey())), org.bukkit.craftbukkit.util.CraftVector.toBlockPos(position)); getHandle().gameEvent(sourceEntity != null ? ((CraftEntity) sourceEntity).getHandle(): null, net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT.get(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(gameEvent.getKey())), org.bukkit.craftbukkit.util.CraftVector.toBlockPos(position));
} }
// Paper end // Paper end
@@ -2459,7 +2502,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2479,7 +2522,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Paper start // Paper start
public java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent) { public java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent) {
warnUnsafeChunk("getting a faraway chunk async", x, z); // Paper warnUnsafeChunk("getting a faraway chunk async", x, z); // Paper
@ -22328,7 +22328,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..379c10e791a961d25d7de571f81ace1a
net.minecraft.world.level.chunk.LevelChunk immediate = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z); net.minecraft.world.level.chunk.LevelChunk immediate = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z);
if (immediate != null) { if (immediate != null) {
return java.util.concurrent.CompletableFuture.completedFuture(new CraftChunk(immediate)); return java.util.concurrent.CompletableFuture.completedFuture(new CraftChunk(immediate));
@@ -2476,7 +2519,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2496,7 +2539,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
java.util.concurrent.CompletableFuture<Chunk> ret = new java.util.concurrent.CompletableFuture<>(); java.util.concurrent.CompletableFuture<Chunk> ret = new java.util.concurrent.CompletableFuture<>();
io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> { io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> {
@ -22543,7 +22543,7 @@ index 4b42ef2a876ea210d948238e63fd7a2b7035bb5b..b451b9df3233355fb16092edc3a4dd63
net.minecraft.server.level.ServerLevel level = this.world.getMinecraftWorld(); net.minecraft.server.level.ServerLevel level = this.world.getMinecraftWorld();
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
index d11d854ae90b99aa2ce227994d07fe1fe9b4a60a..6a6d95dcad917dd60b47236a130bcd2c9425a529 100644 index 2cfaa59a0bb6b5253b5a8dcc38ae65e0f085fd3f..5cf33427847068fc589ada9f731b985f791ac013 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
@@ -210,6 +210,12 @@ public class CraftBlockState implements BlockState { @@ -210,6 +210,12 @@ public class CraftBlockState implements BlockState {
@ -22559,16 +22559,16 @@ index d11d854ae90b99aa2ce227994d07fe1fe9b4a60a..6a6d95dcad917dd60b47236a130bcd2c
if (block.getType() != this.getType()) { if (block.getType() != this.getType()) {
if (!force) { if (!force) {
return false; return false;
@@ -350,6 +356,9 @@ public class CraftBlockState implements BlockState { @@ -340,6 +346,9 @@ public class CraftBlockState implements BlockState {
@Override @Override
public java.util.Collection<org.bukkit.inventory.ItemStack> getDrops(org.bukkit.inventory.ItemStack item, org.bukkit.entity.Entity entity) { public java.util.Collection<org.bukkit.inventory.ItemStack> getDrops(org.bukkit.inventory.ItemStack item, org.bukkit.entity.Entity entity) {
+ // Folia start - region threading + // Folia start - region threading
+ io.papermc.paper.util.TickThread.ensureTickThread(world.getHandle(), position, "Cannot modify world asynchronously"); + io.papermc.paper.util.TickThread.ensureTickThread(world.getHandle(), position, "Cannot modify world asynchronously");
+ // Folia end - region threading + // Folia end - region threading
this.requirePlaced();
net.minecraft.world.item.ItemStack nms = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item); net.minecraft.world.item.ItemStack nms = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item);
// Modelled off EntityHuman#hasBlock
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
index 3e93a6c489972ff2b4ecff3d83cc72b2d5c970f8..66dc7e20544c7000f4824b02cc3a31bc5c87f74c 100644 index 3e93a6c489972ff2b4ecff3d83cc72b2d5c970f8..66dc7e20544c7000f4824b02cc3a31bc5c87f74c 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java --- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
@ -22592,7 +22592,7 @@ index 3e93a6c489972ff2b4ecff3d83cc72b2d5c970f8..66dc7e20544c7000f4824b02cc3a31bc
List<String> offers = waitable.get(); List<String> offers = waitable.get();
if (offers == null) { if (offers == null) {
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 7cd7912cecbbbe2c32bfd9b85181115c6d316eb8..55ed79a802efa7a28cd487770a689119c64b7f40 100644 index e8e4489bcd64fde1b3226bdc7a7cc612508bda3f..1cfe604573000fa9b32237313aa467875a891f3c 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
@@ -234,6 +234,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -234,6 +234,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@ -22625,11 +22625,10 @@ index 7cd7912cecbbbe2c32bfd9b85181115c6d316eb8..55ed79a802efa7a28cd487770a689119
if (entityTracker == null) { if (entityTracker == null) {
return; return;
@@ -1062,30 +1067,43 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -1032,29 +1037,43 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
Preconditions.checkArgument(location != null, "location");
location.checkFinite(); location.checkFinite();
Location locationClone = location.clone(); // clone so we don't need to worry about mutations after this call. Location locationClone = location.clone(); // clone so we don't need to worry about mutations after this call.
-
- net.minecraft.server.level.ServerLevel world = ((CraftWorld)locationClone.getWorld()).getHandle(); - net.minecraft.server.level.ServerLevel world = ((CraftWorld)locationClone.getWorld()).getHandle();
+ // Folia start - region threading + // Folia start - region threading
java.util.concurrent.CompletableFuture<Boolean> ret = new java.util.concurrent.CompletableFuture<>(); java.util.concurrent.CompletableFuture<Boolean> ret = new java.util.concurrent.CompletableFuture<>();
@ -22639,26 +22638,26 @@ index 7cd7912cecbbbe2c32bfd9b85181115c6d316eb8..55ed79a802efa7a28cd487770a689119
- net.minecraft.server.level.ServerChunkCache chunkProviderServer = world.getChunkSource(); - net.minecraft.server.level.ServerChunkCache chunkProviderServer = world.getChunkSource();
- for (net.minecraft.world.level.chunk.ChunkAccess chunk : list) { - for (net.minecraft.world.level.chunk.ChunkAccess chunk : list) {
- chunkProviderServer.addTicketAtLevel(net.minecraft.server.level.TicketType.POST_TELEPORT, chunk.getPos(), 33, CraftEntity.this.getEntityId()); - chunkProviderServer.addTicketAtLevel(net.minecraft.server.level.TicketType.POST_TELEPORT, chunk.getPos(), 33, CraftEntity.this.getEntityId());
- }
- net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
- try {
- ret.complete(CraftEntity.this.teleport(locationClone, cause) ? Boolean.TRUE : Boolean.FALSE);
- } catch (Throwable throwable) {
- if (throwable instanceof ThreadDeath) {
- throw (ThreadDeath)throwable;
- }
- net.minecraft.server.MinecraftServer.LOGGER.error("Failed to teleport entity " + CraftEntity.this, throwable);
- ret.completeExceptionally(throwable);
+ java.util.function.Consumer<Entity> run = (Entity nmsEntity) -> { + java.util.function.Consumer<Entity> run = (Entity nmsEntity) -> {
+ boolean success = nmsEntity.teleportAsync( + boolean success = nmsEntity.teleportAsync(
+ ((CraftWorld)locationClone.getWorld()).getHandle(), + ((CraftWorld)locationClone.getWorld()).getHandle(),
+ new net.minecraft.world.phys.Vec3(locationClone.getX(), locationClone.getY(), locationClone.getZ()), + new net.minecraft.world.phys.Vec3(locationClone.getX(), locationClone.getY(), locationClone.getZ()),
+ locationClone.getYaw(), locationClone.getPitch(), net.minecraft.world.phys.Vec3.ZERO, + locationClone.getYaw(), locationClone.getPitch(), net.minecraft.world.phys.Vec3.ZERO,
+ cause == null ? TeleportCause.UNKNOWN : cause, + cause == null ? TeleportCause.UNKNOWN : cause,
+ Entity.TELEPORT_FLAG_LOAD_CHUNK | Entity.TELEPORT_FLAG_UNMOUNT, // preserve behavior with old API: dismount the entity so it can teleport + Entity.TELEPORT_FLAG_LOAD_CHUNK | Entity.TELEPORT_FLAG_TELEPORT_PASSENGERS, // preserve behavior with old API: dismount the entity so it can teleport
+ (Entity entityTp) -> { + (Entity entityTp) -> {
+ ret.complete(Boolean.TRUE); + ret.complete(Boolean.TRUE);
} }
- net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
- try {
- ret.complete(CraftEntity.this.teleport(locationClone, cause, teleportFlags) ? Boolean.TRUE : Boolean.FALSE);
- } catch (Throwable throwable) {
- if (throwable instanceof ThreadDeath) {
- throw (ThreadDeath)throwable;
- }
- net.minecraft.server.MinecraftServer.LOGGER.error("Failed to teleport entity " + CraftEntity.this, throwable);
- ret.completeExceptionally(throwable);
- }
- }); - });
- }); - });
+ ); + );
@ -22687,10 +22686,10 @@ index 7cd7912cecbbbe2c32bfd9b85181115c6d316eb8..55ed79a802efa7a28cd487770a689119
return ret; return ret;
+ // Folia end - region threading + // Folia end - region threading
} }
// Paper end - more teleport API / async chunk API
@Override
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 616d2e479d91673695ade0db151a0099b568904f..14a5eda367dd46fe7c9b5f76df80840f938c06ea 100644 index e77bf7f432387bdfa7f69d31b014e8cd254fd4ca..8db8ceb161557b9803c3bda80f3e57b8626191c3 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
@@ -560,7 +560,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -560,7 +560,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -22733,10 +22732,10 @@ index 616d2e479d91673695ade0db151a0099b568904f..14a5eda367dd46fe7c9b5f76df80840f
entry.updatePlayer(this.getHandle()); entry.updatePlayer(this.getHandle());
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index cb3e9672f375a1a660757a05362729ddb5ca7504..eb9146287d8d241273a3edec1ca8bd955106c186 100644 index c0823c612de9dc2a64cc797f061eef25c5f31359..ccab0ec21a6827475d97654f1b54c166ccb99085 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -942,7 +942,7 @@ public class CraftEventFactory { @@ -943,7 +943,7 @@ public class CraftEventFactory {
return CraftEventFactory.handleBlockSpreadEvent(world, source, target, block, 2); return CraftEventFactory.handleBlockSpreadEvent(world, source, target, block, 2);
} }
@ -22745,7 +22744,7 @@ index cb3e9672f375a1a660757a05362729ddb5ca7504..eb9146287d8d241273a3edec1ca8bd95
public static boolean handleBlockSpreadEvent(LevelAccessor world, BlockPos source, BlockPos target, net.minecraft.world.level.block.state.BlockState block, int flag) { public static boolean handleBlockSpreadEvent(LevelAccessor world, BlockPos source, BlockPos target, net.minecraft.world.level.block.state.BlockState block, int flag) {
// Suppress during worldgen // Suppress during worldgen
@@ -954,7 +954,7 @@ public class CraftEventFactory { @@ -955,7 +955,7 @@ public class CraftEventFactory {
CraftBlockState state = CraftBlockStates.getBlockState(world, target, flag); CraftBlockState state = CraftBlockStates.getBlockState(world, target, flag);
state.setData(block); state.setData(block);
@ -22754,7 +22753,7 @@ index cb3e9672f375a1a660757a05362729ddb5ca7504..eb9146287d8d241273a3edec1ca8bd95
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
@@ -2140,7 +2140,7 @@ public class CraftEventFactory { @@ -2146,7 +2146,7 @@ public class CraftEventFactory {
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemStack.copyWithCount(1)); CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemStack.copyWithCount(1));
org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(bukkitBlock, craftItem.clone(), CraftVector.toBukkit(to)); org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(bukkitBlock, craftItem.clone(), CraftVector.toBukkit(to));
@ -22776,7 +22775,7 @@ index e85b9bb3f9c225d289a4959921970b9963881199..b00e3b9b628f3d2a2fdbf1d2c7790496
if (!this.isAsyncScheduler && !task.isSync()) { if (!this.isAsyncScheduler && !task.isSync()) {
this.asyncScheduler.handle(task, delay); this.asyncScheduler.handle(task, delay);
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 1324f05de8106032ce290e928cf106fb4f450517..20178003ee9a0314266d4fc6a589e9d509a25072 100644 index 3c7a771c48cc2732cc038ca11bb93ec5f8c2d667..d365e26799822f39af2d5a27761bb8b41308297e 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -382,6 +382,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -382,6 +382,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@ -22811,7 +22810,7 @@ index 86a20c91beff6b27e6ec886e49ba902b216106f2..96007426144b78f91c12614f04350855
return this.handle; return this.handle;
} }
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index c39894e824334f1dc52e0466cf9d84f7e219be70..f8718d91f4c15c74d6e6dd5f60f7f05f45f63655 100644 index 3283ed99c35ffed6805567705e0518d9f84feedc..4fc4690d03fd5f39e019f16845954052210c7361 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java --- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -52,7 +52,7 @@ public class ActivationRange @@ -52,7 +52,7 @@ public class ActivationRange
@ -22869,7 +22868,7 @@ index c39894e824334f1dc52e0466cf9d84f7e219be70..f8718d91f4c15c74d6e6dd5f60f7f05f
/** /**
* Initializes an entities type on construction to specify what group this * Initializes an entities type on construction to specify what group this
@@ -174,10 +175,11 @@ public class ActivationRange @@ -176,10 +177,11 @@ public class ActivationRange
final int waterActivationRange = world.spigotConfig.waterActivationRange; final int waterActivationRange = world.spigotConfig.waterActivationRange;
final int flyingActivationRange = world.spigotConfig.flyingMonsterActivationRange; final int flyingActivationRange = world.spigotConfig.flyingMonsterActivationRange;
final int villagerActivationRange = world.spigotConfig.villagerActivationRange; final int villagerActivationRange = world.spigotConfig.villagerActivationRange;
@ -22885,7 +22884,7 @@ index c39894e824334f1dc52e0466cf9d84f7e219be70..f8718d91f4c15c74d6e6dd5f60f7f05f
final ServerChunkCache chunkProvider = (ServerChunkCache) world.getChunkSource(); final ServerChunkCache chunkProvider = (ServerChunkCache) world.getChunkSource();
// Paper end // Paper end
@@ -191,9 +193,9 @@ public class ActivationRange @@ -193,9 +195,9 @@ public class ActivationRange
// Paper end // Paper end
maxRange = Math.min( ( world.spigotConfig.simulationDistance << 4 ) - 8, maxRange ); maxRange = Math.min( ( world.spigotConfig.simulationDistance << 4 ) - 8, maxRange );
@ -22897,7 +22896,7 @@ index c39894e824334f1dc52e0466cf9d84f7e219be70..f8718d91f4c15c74d6e6dd5f60f7f05f
if ( world.spigotConfig.ignoreSpectatorActivation && player.isSpectator() ) if ( world.spigotConfig.ignoreSpectatorActivation && player.isSpectator() )
{ {
continue; continue;
@@ -201,26 +203,33 @@ public class ActivationRange @@ -203,26 +205,33 @@ public class ActivationRange
// Paper start // Paper start
int worldHeight = world.getHeight(); int worldHeight = world.getHeight();
@ -22941,7 +22940,7 @@ index c39894e824334f1dc52e0466cf9d84f7e219be70..f8718d91f4c15c74d6e6dd5f60f7f05f
} }
// Paper end // Paper end
} }
@@ -232,18 +241,18 @@ public class ActivationRange @@ -234,18 +243,18 @@ public class ActivationRange
* *
* @param chunk * @param chunk
*/ */
@ -22965,7 +22964,7 @@ index c39894e824334f1dc52e0466cf9d84f7e219be70..f8718d91f4c15c74d6e6dd5f60f7f05f
} }
} }
} }
@@ -266,10 +275,10 @@ public class ActivationRange @@ -268,10 +277,10 @@ public class ActivationRange
if (entity.getRemainingFireTicks() > 0) { if (entity.getRemainingFireTicks() > 0) {
return 2; return 2;
} }
@ -22978,7 +22977,7 @@ index c39894e824334f1dc52e0466cf9d84f7e219be70..f8718d91f4c15c74d6e6dd5f60f7f05f
// Paper end // Paper end
// quick checks. // quick checks.
if ( (entity.activationType != ActivationType.WATER && entity.wasTouchingWater && entity.isPushedByFluid()) ) // Paper if ( (entity.activationType != ActivationType.WATER && entity.wasTouchingWater && entity.isPushedByFluid()) ) // Paper
@@ -392,19 +401,19 @@ public class ActivationRange @@ -394,19 +403,19 @@ public class ActivationRange
} }
// Paper end // Paper end

View File

@ -29,7 +29,7 @@ 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 79e9039d77a993d8f1e02942f87fac2a0bd9e8a8..1d77bc6bdb87de1ad6c8740376391dedcaa73089 100644 index 518487d4cd489110bebcf75078935a95b5d3e9cf..1119b6a7f307763c13ef48bcd7643539082aebdc 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 @@ -2930,6 +2930,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -288,10 +288,10 @@ 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 3a749f78be3968e499e096196eaaa0b433a53c06..6b2907f9fb74e5a5bbc7084d22318794b97dd1b7 100644 index 0fd2677181d741e553b9825c8c319a209194ec46..a3a5c77b264a40911ddcee9b8c593fd07b3041d7 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
@@ -133,8 +133,16 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow { @@ -135,6 +135,13 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
this.getHandle().setShotFromCrossbow(shotFromCrossbow); this.getHandle().setShotFromCrossbow(shotFromCrossbow);
} }
@ -302,6 +302,11 @@ index 3a749f78be3968e499e096196eaaa0b433a53c06..6b2907f9fb74e5a5bbc7084d22318794
+ } + }
+ // Folia end - region threading + // Folia end - region threading
+ +
@Override
public ItemStack getItem() {
return CraftItemStack.asBukkitCopy(this.getHandle().pickupItemStack);
@@ -149,6 +156,7 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
@Override @Override
public net.minecraft.world.entity.projectile.AbstractArrow getHandle() { 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 + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading
@ -897,7 +902,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 55ed79a802efa7a28cd487770a689119c64b7f40..73316307666674f9f6e7ddb964e2ec2583743c79 100644 index 1cfe604573000fa9b32237313aa467875a891f3c..8c7e01972888df4ccbaccc4eebceeeb5ab357f4c 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 {
@ -1359,10 +1364,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 acbb64010cd59668aa1bcb52ff1220789cadb1d3..35958bb85389ca0ed02f567e0fd9f4a9dbc66ff2 100644 index 7984365c8290ac9e526a413b56e1c8c0841e330c..0c468a1324996137eba5d1927d38a39859b705f0 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
@@ -291,8 +291,16 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @@ -292,8 +292,16 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
this.mode = mode; this.mode = mode;
} }
@ -1590,10 +1595,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 993844ee3d76591be38e8d27eba37ff8723443b1..ac46baf473a9cf366b9b1ab3d59e8ab7097bc656 100644 index c4a166a0c226c6083c25c58145d9631d4296e615..ee1d3f33cf5f3cfc7909dbc33178df69bd656ab8 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
@@ -454,6 +454,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -470,6 +470,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
this.getHandle().invulnerableTime = ticks; this.getHandle().invulnerableTime = ticks;
} }
@ -1607,7 +1612,7 @@ index 993844ee3d76591be38e8d27eba37ff8723443b1..ac46baf473a9cf366b9b1ab3d59e8ab7
@Override @Override
public int getNoActionTicks() { public int getNoActionTicks() {
return this.getHandle().getNoActionTime(); return this.getHandle().getNoActionTime();
@@ -467,6 +474,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -483,6 +490,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override @Override
public net.minecraft.world.entity.LivingEntity getHandle() { public net.minecraft.world.entity.LivingEntity getHandle() {
@ -2135,7 +2140,7 @@ 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 14a5eda367dd46fe7c9b5f76df80840f938c06ea..d2902fc7f3b7af59f181bd1e12435d946db7ad23 100644 index 8db8ceb161557b9803c3bda80f3e57b8626191c3..b0a70287ff1fc9b3d5eba322d949aaf510b165d2 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
@@ -580,7 +580,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -580,7 +580,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -2147,7 +2152,7 @@ index 14a5eda367dd46fe7c9b5f76df80840f938c06ea..d2902fc7f3b7af59f181bd1e12435d94
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 { @@ -2207,9 +2207,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this; return this;
} }
@ -2165,7 +2170,7 @@ index 14a5eda367dd46fe7c9b5f76df80840f938c06ea..d2902fc7f3b7af59f181bd1e12435d94
} }
public void setHandle(final ServerPlayer entity) { public void setHandle(final ServerPlayer entity) {
@@ -3266,7 +3273,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -3264,7 +3271,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
{ {
if ( CraftPlayer.this.getHealth() <= 0 && CraftPlayer.this.isOnline() ) if ( CraftPlayer.this.getHealth() <= 0 && CraftPlayer.this.isOnline() )
{ {

View File

@ -10,7 +10,7 @@ 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 1e658114879ad9bdb679b9230ac3eab643375f8b..6b07179212ec0bdb6b68294c996b9dfee8fc81cb 100644 index cf06989ad1ab55bf6836abe4cdeed2fff31ac93f..82b18aebb7c1472efdadc4b2e959fbdb3116fbe3 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 @@ -1476,6 +1476,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -9,7 +9,7 @@ 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 52a7775e7aa375a043438d23204acd030ad35372..55f4fc731b5bde0bbac681a0902af1506ad87762 100644 index 2c0ce270c947c7fc1d7e0163a43467129a65f999..38ff839aa25fa2b7397f6fc6e3eadda7ae600d48 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 { @@ -1762,7 +1762,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

View File

@ -9,7 +9,7 @@ data deserialization and is racey even in Vanilla. But in Folia,
some accesses may throw and as such we need to fix this directly. 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 add6fc106d3c38d97b48ec0df3ac2515c8c0486e..cbc89b8898f9243776af88c2b04ad3c2e4e23fb6 100644 index 36d074d1abed62b09ca808dc2774bc83a6fd5df7..9d7837f90340a96edbd544826ae2241c61ae72c4 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 { @@ -644,7 +644,7 @@ public class ServerPlayer extends Player {
@ -22,7 +22,7 @@ index add6fc106d3c38d97b48ec0df3ac2515c8c0486e..cbc89b8898f9243776af88c2b04ad3c2
// 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 a8b47867f05af2a1a4409be5ff49ad0d95bebcae..fdb5ef574c14fafa1af50f4f656763119695f00e 100644 index 73e0c2ec5ab8cf54767755f31d1a8d0a168ee46f..b9f6e599afd4bdfb97e7f1b1881730cbed781bba 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 { @@ -4390,6 +4390,11 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@ -1361,7 +1361,7 @@ 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 98fb69a9adeb6eaab199aec127692acb07f56808..7cc624505931dcb6696c3ef3ee3bbea74f77ad06 100644 index 1192503d2729b3f14aa2936c2060df9884870cb4..632c5ba694a37159d5297f6af885408a5cb76330 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 { @@ -51,7 +51,10 @@ public class PacketUtils {
@ -1376,7 +1376,7 @@ index 98fb69a9adeb6eaab199aec127692acb07f56808..7cc624505931dcb6696c3ef3ee3bbea7
label25: label25:
{ {
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 6b07179212ec0bdb6b68294c996b9dfee8fc81cb..d6a7188227cee9072976db98613324ee2d3dcdc8 100644 index 82b18aebb7c1472efdadc4b2e959fbdb3116fbe3..453bb595d31c6dea1cfb135f43ffe71e4ae44112 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 @@ -1592,6 +1592,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -1635,7 +1635,7 @@ 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 f72e3d2decf8eb2a5a802bb1c6c8aa29e08912cf..81749b8da7182abd1bf35629f33388e813dbeac0 100644 index e32c4b49bc3081af2c811dac3aec3cce8efd6661..cb8e660865975c39facad39ee57f6f858ad89e78 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 { @@ -891,6 +891,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -1832,7 +1832,7 @@ 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 55f4fc731b5bde0bbac681a0902af1506ad87762..a9921af214c596ef2601ccdbf37b4234bcf4ea1d 100644 index 38ff839aa25fa2b7397f6fc6e3eadda7ae600d48..3cd8573db9dadb2e32f3c107f4812b525db014b1 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 { @@ -232,6 +232,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -1923,7 +1923,7 @@ index 2e110da3502a7ac5ec4cc20510a3fac933569895..5aac65f37a0190c5d6a7175073fb0cc0
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java 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 852fef18497435827a03e0056a09e5deb2525ed9..4847f7caa9147a63f85a86c1c45500f45ff48fbb 100644 index ff1a7b78fa010857daab7a306cb9483c98560b79..8c6ade7cf14e367d6390849ef1b2a1bfef0d52ac 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 { @@ -1181,11 +1181,14 @@ public class LevelChunk extends ChunkAccess {
@ -1941,9 +1941,9 @@ index 852fef18497435827a03e0056a09e5deb2525ed9..4847f7caa9147a63f85a86c1c45500f4
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
if (this.blockEntity.getType().isValid(iblockdata)) { if (this.blockEntity.getType().isValid(iblockdata)) {
@@ -1195,6 +1198,7 @@ public class LevelChunk extends ChunkAccess { @@ -1200,6 +1203,7 @@ public class LevelChunk extends ChunkAccess {
this.loggedInvalidBlockState = true; }
LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata}); // Paper end - Remove the Block Entity if it's invalid
} }
+ } finally { profiler.stopTimer(timerId); } // Folia - profiler + } finally { profiler.stopTimer(timerId); } // Folia - profiler

View File

@ -8,7 +8,7 @@ pluginManagement {
} }
plugins { plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
} }
if (!file(".git").exists()) { if (!file(".git").exists()) {