diff --git a/build.gradle.kts b/build.gradle.kts index 83f28bb8a..39dae2546 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -56,7 +56,7 @@ repositories { } dependencies { - paramMappings("net.fabricmc:yarn:1.18.1+build.22:mergedv2") + paramMappings("net.fabricmc:yarn:1.18.2+build.1:mergedv2") remapper("net.fabricmc:tiny-remapper:0.8.1:fat") decompiler("net.minecraftforge:forgeflower:1.5.498.22") paperclip("io.papermc:paperclip:3.0.2") diff --git a/gradle.properties b/gradle.properties index a0297b8e1..398db6bb6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ group=io.papermc.paper -version=1.18.1-R0.1-SNAPSHOT +version=1.18.2-R0.1-SNAPSHOT -mcVersion=1.18.1 +mcVersion=1.18.2 org.gradle.caching=true org.gradle.parallel=true diff --git a/patches/api/0001-Convert-project-to-Gradle.patch b/patches/api/0001-Convert-project-to-Gradle.patch index c17159863..3627d13b6 100644 --- a/patches/api/0001-Convert-project-to-Gradle.patch +++ b/patches/api/0001-Convert-project-to-Gradle.patch @@ -27,7 +27,7 @@ index e431e3435737e28394d81b56568a08b3c3148b9b..b23bde3b5e881f146539a307d0a59f21 +/.factorypath diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 -index 0000000000000000000000000000000000000000..c76bfbcfbe034700bdbd9396643cfca625273a14 +index 0000000000000000000000000000000000000000..bf1f5a8151ac0a4b25370142fef37145033140ef --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,66 @@ @@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..c76bfbcfbe034700bdbd9396643cfca6 + // api dependencies are listed transitively to API consumers + api("commons-lang:commons-lang:2.6") + api("com.google.guava:guava:31.0.1-jre") -+ api("com.google.code.gson:gson:2.8.8") ++ api("com.google.code.gson:gson:2.8.9") + api("net.md-5:bungeecord-chat:1.16-R0.4") + api("org.yaml:snakeyaml:1.30") + @@ -99,7 +99,7 @@ index 0000000000000000000000000000000000000000..c76bfbcfbe034700bdbd9396643cfca6 +} diff --git a/pom.xml b/pom.xml deleted file mode 100644 -index 2bd4a47e18c0fb798d52d204a4315a889b0e64b4..0000000000000000000000000000000000000000 +index 7a34ef5514a30bcb61e657970bf087bdf9c2db90..0000000000000000000000000000000000000000 --- a/pom.xml +++ /dev/null @@ -1,263 +0,0 @@ @@ -110,7 +110,7 @@ index 2bd4a47e18c0fb798d52d204a4315a889b0e64b4..00000000000000000000000000000000 - - org.spigotmc - spigot-api -- 1.18.1-R0.1-SNAPSHOT +- 1.18.2-R0.1-SNAPSHOT - jar - - Spigot-API @@ -153,7 +153,7 @@ index 2bd4a47e18c0fb798d52d204a4315a889b0e64b4..00000000000000000000000000000000 - - com.google.code.gson - gson -- 2.8.8 +- 2.8.9 - compile - - diff --git a/patches/api/0002-Build-system-changes.patch b/patches/api/0002-Build-system-changes.patch index b9c0bae06..95ce3fbbe 100644 --- a/patches/api/0002-Build-system-changes.patch +++ b/patches/api/0002-Build-system-changes.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Build system changes diff --git a/build.gradle.kts b/build.gradle.kts -index c76bfbcfbe034700bdbd9396643cfca625273a14..1f680baffba17265e8ce38b3516624bffd034075 100644 +index bf1f5a8151ac0a4b25370142fef37145033140ef..709f9c3a562729970813f47b531bfc51ba192f55 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,15 +15,27 @@ dependencies { - api("com.google.code.gson:gson:2.8.8") + api("com.google.code.gson:gson:2.8.9") api("net.md-5:bungeecord-chat:1.16-R0.4") api("org.yaml:snakeyaml:1.30") + // Paper start diff --git a/patches/api/0259-Added-Vanilla-Entity-Tags.patch b/patches/api/0259-Added-Vanilla-Entity-Tags.patch index 68465846a..9358072a1 100644 --- a/patches/api/0259-Added-Vanilla-Entity-Tags.patch +++ b/patches/api/0259-Added-Vanilla-Entity-Tags.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Added Vanilla Entity Tags diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java -index 34d23f53acf00620223731c4fdacffde9cff41a8..ddd195a834d1756c903644fc1faffe7ebcb238ed 100644 +index 42d0f31c2be2d39c4481f98c0756c4f1ae337717..20f033b9eda656cf0bdc91c3cf046f90a4be87fd 100644 --- a/src/main/java/org/bukkit/Tag.java +++ b/src/main/java/org/bukkit/Tag.java -@@ -698,6 +698,44 @@ public interface Tag extends Keyed { +@@ -702,6 +702,44 @@ public interface Tag extends Keyed { * Vanilla tag representing entities extra susceptible to freezing. */ Tag ENTITY_TYPES_FREEZE_HURTS_EXTRA_TYPES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("freeze_hurts_extra_types"), EntityType.class); diff --git a/patches/api/0363-Expand-the-Registry-API.patch b/patches/api/0363-Expand-the-Registry-API.patch index 8dfa94388..43d9ced4d 100644 --- a/patches/api/0363-Expand-the-Registry-API.patch +++ b/patches/api/0363-Expand-the-Registry-API.patch @@ -34,27 +34,3 @@ index 6242336de18fdd708cc3d7b745cbbace13140bc0..661d424c609a01ad9bee837b4069d9e4 // Paper end /** -diff --git a/src/main/java/org/bukkit/StructureType.java b/src/main/java/org/bukkit/StructureType.java -index 8acb2b9de398ab5f4b18c46e9ab9eb964df8be3f..5558daa9512212a4b05f174b64c4c998ebbccfcc 100644 ---- a/src/main/java/org/bukkit/StructureType.java -+++ b/src/main/java/org/bukkit/StructureType.java -@@ -19,7 +19,7 @@ import org.jetbrains.annotations.Nullable; - * The registration of new {@link StructureType}s is case-sensitive. - */ - // Order is retrieved from WorldGenFactory --public final class StructureType { -+public final class StructureType implements Keyed { // Paper - implement keyed - - private static final Map structureTypeMap = new HashMap<>(); - -@@ -244,4 +244,10 @@ public final class StructureType { - public static Map getStructureTypes() { - return ImmutableMap.copyOf(structureTypeMap); - } -+ // Paper start -+ @Override -+ public @NotNull NamespacedKey getKey() { -+ return NamespacedKey.minecraft(this.name); -+ } -+ // Paper end - } diff --git a/patches/api/0367-Add-GameEvent-tags.patch b/patches/api/0367-Add-GameEvent-tags.patch index c0f7113f5..668a19903 100644 --- a/patches/api/0367-Add-GameEvent-tags.patch +++ b/patches/api/0367-Add-GameEvent-tags.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add GameEvent tags diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java -index ddd195a834d1756c903644fc1faffe7ebcb238ed..43ab88bb3721ed499549a9d328be352d6f639871 100644 +index 20f033b9eda656cf0bdc91c3cf046f90a4be87fd..fbe2da7aa0d135a35eab3a81599d5df1b709b8ac 100644 --- a/src/main/java/org/bukkit/Tag.java +++ b/src/main/java/org/bukkit/Tag.java -@@ -735,6 +735,18 @@ public interface Tag extends Keyed { +@@ -739,6 +739,18 @@ public interface Tag extends Keyed { */ @Deprecated(forRemoval = true) Tag SKELETONS = ENTITY_TYPES_SKELETONS; diff --git a/patches/server/0831-Fix-entity-type-tags-suggestions-in-selectors.patch b/patches/removed/1.18.2/0831-Fix-entity-type-tags-suggestions-in-selectors.patch similarity index 100% rename from patches/server/0831-Fix-entity-type-tags-suggestions-in-selectors.patch rename to patches/removed/1.18.2/0831-Fix-entity-type-tags-suggestions-in-selectors.patch diff --git a/patches/server/0840-Fix-riding-distance-statistics.patch b/patches/removed/1.18.2/0840-Fix-riding-distance-statistics.patch similarity index 100% rename from patches/server/0840-Fix-riding-distance-statistics.patch rename to patches/removed/1.18.2/0840-Fix-riding-distance-statistics.patch diff --git a/patches/server/0851-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch b/patches/removed/1.18.2/0851-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch similarity index 100% rename from patches/server/0851-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch rename to patches/removed/1.18.2/0851-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch diff --git a/patches/server/0858-Add-config-for-stronghold-seed.patch b/patches/removed/1.18.2/0858-Add-config-for-stronghold-seed.patch similarity index 100% rename from patches/server/0858-Add-config-for-stronghold-seed.patch rename to patches/removed/1.18.2/0858-Add-config-for-stronghold-seed.patch diff --git a/patches/server/0001-Setup-Gradle-project.patch b/patches/server/0001-Setup-Gradle-project.patch index 4e3a71618..8eaf53124 100644 --- a/patches/server/0001-Setup-Gradle-project.patch +++ b/patches/server/0001-Setup-Gradle-project.patch @@ -28,7 +28,7 @@ index 67fb370cad6924895a6b27052dbd5c1767e3f0c9..bb338269c9e3bef4c274157c490d8b8f +/.factorypath diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 -index 0000000000000000000000000000000000000000..ce1c653cac81f0d681547a68704a41bbb700f148 +index 0000000000000000000000000000000000000000..be24f2f1c72ffcb033fe99bd9197af2c0bed4e69 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,141 @@ @@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..ce1c653cac81f0d681547a68704a41bb +dependencies { + implementation(project(":paper-api")) + implementation("jline:jline:2.12.1") -+ implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") { ++ implementation("org.apache.logging.log4j:log4j-iostreams:2.17.0") { + exclude(group = "org.apache.logging.log4j", module = "log4j-api") + } + implementation("org.ow2.asm:asm:9.2") @@ -175,17 +175,17 @@ index 0000000000000000000000000000000000000000..ce1c653cac81f0d681547a68704a41bb +} diff --git a/pom.xml b/pom.xml deleted file mode 100644 -index 5d1e2c51c814281bf50c352f7fa9f99465100068..0000000000000000000000000000000000000000 +index ac2dbe041d8a286ed7a34bf20c88464693f32a25..0000000000000000000000000000000000000000 --- a/pom.xml +++ /dev/null -@@ -1,540 +0,0 @@ +@@ -1,546 +0,0 @@ - - 4.0.0 - org.spigotmc - spigot - jar -- 1.18.1-R0.1-SNAPSHOT +- 1.18.2-R0.1-SNAPSHOT - Spigot - https://www.spigotmc.org/ - @@ -201,7 +201,7 @@ index 5d1e2c51c814281bf50c352f7fa9f99465100068..00000000000000000000000000000000 - UTF-8 - unknown - git -- 1_18_R1 +- 1_18_R2 - 16 - 16 - @@ -236,7 +236,7 @@ index 5d1e2c51c814281bf50c352f7fa9f99465100068..00000000000000000000000000000000 - - org.apache.logging.log4j - log4j-iostreams -- 2.14.1 +- 2.17.0 - compile - - @@ -249,13 +249,13 @@ index 5d1e2c51c814281bf50c352f7fa9f99465100068..00000000000000000000000000000000 - - com.github.oshi - oshi-core -- 5.8.2 +- 5.8.5 - compile - - - com.mojang - authlib -- 3.2.38 +- 3.3.39 - compile - - @@ -267,7 +267,7 @@ index 5d1e2c51c814281bf50c352f7fa9f99465100068..00000000000000000000000000000000 - - com.mojang - datafixerupper -- 4.0.26 +- 4.1.27 - compile - - @@ -277,6 +277,12 @@ index 5d1e2c51c814281bf50c352f7fa9f99465100068..00000000000000000000000000000000 - compile - - +- com.mojang +- logging +- 1.0.0 +- compile +- +- - commons-io - commons-io - 2.11.0 @@ -309,13 +315,13 @@ index 5d1e2c51c814281bf50c352f7fa9f99465100068..00000000000000000000000000000000 - - org.apache.logging.log4j - log4j-core -- 2.14.1 +- 2.17.0 - compile - - - org.apache.logging.log4j - log4j-slf4j18-impl -- 2.14.1 +- 2.17.0 - compile - - diff --git a/patches/server/0002-Remap-fixes.patch b/patches/server/0002-Remap-fixes.patch index 68bd5b35f..1a29bd528 100644 --- a/patches/server/0002-Remap-fixes.patch +++ b/patches/server/0002-Remap-fixes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remap fixes diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index a492a3ff23a6e4bd1a47bdfbe295163ac3ef66c9..dc88152a1458dadd102989d4fc5ffd5bbc7eb523 100644 +index 885445d353b7abc87f4ff863da357dfe480d9ada..8aecabe25510a58041194b0b798236bd652991dc 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java @@ -270,9 +270,11 @@ public class BlockPos extends Vec3i { @@ -78,10 +78,10 @@ index 88258cc1971c0764912d2f3cbfcd426d8f26cd62..e51a78e52969ec687956d16566494fc5 entityliving1 = entityliving2; } else { diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index e235729577a80475eaf6e33487363822691d2dce..28d35bde3207b1c06bd97e7c1cdc3f687a28bbf6 100644 +index babb59497fcd9b5e20d8b3b13ceb9a7856edbb63..92650d816113a0f1c2b589691895ebba3424d661 100644 --- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -@@ -175,7 +175,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { +@@ -174,7 +174,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { Builder> builder = ImmutableMap.builder(); recipes.forEach((irecipe) -> { diff --git a/patches/server/0003-Build-system-changes.patch b/patches/server/0003-Build-system-changes.patch index 3a265b19f..9ca9d1a8d 100644 --- a/patches/server/0003-Build-system-changes.patch +++ b/patches/server/0003-Build-system-changes.patch @@ -5,17 +5,17 @@ Subject: [PATCH] Build system changes diff --git a/build.gradle.kts b/build.gradle.kts -index dc8f0a7ac3387323428f71139ac07ec98cd33ed8..4db0cc3f8505747e77d314320545eb71904b4eac 100644 +index be24f2f1c72ffcb033fe99bd9197af2c0bed4e69..c1f97f5bb806e3c92a2b4633142d3214e11f7074 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,10 +13,9 @@ repositories { dependencies { implementation(project(":paper-api")) implementation("jline:jline:2.12.1") -- implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") { +- implementation("org.apache.logging.log4j:log4j-iostreams:2.17.0") { - exclude(group = "org.apache.logging.log4j", module = "log4j-api") - } -+ implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper ++ implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper implementation("org.ow2.asm:asm:9.2") + implementation("org.ow2.asm:asm-commons:9.2") // Paper - ASM event executor generation runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") @@ -39,7 +39,7 @@ index dc8f0a7ac3387323428f71139ac07ec98cd33ed8..4db0cc3f8505747e77d314320545eb71 for (tld in setOf("net", "com", "org")) { attributes("$tld/bukkit", "Sealed" to true) diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 38851269bc9eff80f5593e63b61a4b25c328a3cc..0607f13dd2a568e368f96768259e8cba9c25e9c1 100644 +index 3067833570c62e4d135b11b8637b52b8167ab269..b698d6a8d6b59eefd721639b62bfd8bcffcf5c6f 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -190,7 +190,7 @@ public class Main { @@ -50,7 +50,7 @@ index 38851269bc9eff80f5593e63b61a4b25c328a3cc..0607f13dd2a568e368f96768259e8cba + Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -28); + deadline.add(Calendar.DAY_OF_YEAR, -3); diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java index 93046379d0cefd5d3236fc59e698809acdc18f80..774556a62eb240da42e84db4502e2ed43495be17 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/patches/server/0004-Paper-config-files.patch b/patches/server/0004-Paper-config-files.patch index acf5a0132..6be759aa3 100644 --- a/patches/server/0004-Paper-config-files.patch +++ b/patches/server/0004-Paper-config-files.patch @@ -591,10 +591,10 @@ index 0000000000000000000000000000000000000000..4adf44026fc6269934dfa4513f06a7f8 + } +} diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 82d04f803201e39b48cd514cd8d9e2b90b28c1d4..156fa293626119caf0cf414505fdf0e96eaa08b7 100644 +index 9e4cca119722c2edc478fdd1a34af4370649aa5c..b49528d8a2c577def4f74ee694ffd53b481acb32 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -106,6 +106,12 @@ public class Main { +@@ -109,6 +109,12 @@ public class Main { DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support dedicatedserversettings.forceSave(); @@ -607,7 +607,7 @@ index 82d04f803201e39b48cd514cd8d9e2b90b28c1d4..156fa293626119caf0cf414505fdf0e9 Path path1 = Paths.get("eula.txt"); Eula eula = new Eula(path1); -@@ -261,6 +267,20 @@ public class Main { +@@ -284,6 +290,20 @@ public class Main { } @@ -629,10 +629,10 @@ index 82d04f803201e39b48cd514cd8d9e2b90b28c1d4..156fa293626119caf0cf414505fdf0e9 Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, generatorOptions, eraseCache); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d75a598576d87644a4226216dcfd685c25b29f12..b3c1373f281adfdd9fa513b597941b60b71bb06c 100644 +index 2a7a6a21d22bec6457845ec972f12321f534800f..8754e5899067bc5e8e83a6264c6fcc38846f6baa 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -602,6 +602,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements EntityTypeTest { +@@ -674,4 +674,10 @@ public class EntityType implements EntityTypeTest { T create(EntityType type, Level world); } @@ -693,10 +693,10 @@ index 1bee6fc5b9fa70adf2f7cac792778f5ed203d291..e688949fc2f3031dc9c9817bc59554e9 + // Paper end } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index c3afe1e60535241bf5f643034d1858de53e3a422..8de437c79e105331165efaf1b154287e16e1b8ef 100644 +index 3dce5044332ee4a8f685ab1cde02cd4c72a85b63..6ded806628f2f3fd5b357eed41990abd7e06a372 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -146,6 +146,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -144,6 +144,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public boolean populating; public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot @@ -705,19 +705,19 @@ index c3afe1e60535241bf5f643034d1858de53e3a422..8de437c79e105331165efaf1b154287e public final SpigotTimings.WorldTimingsHandler timings; // Spigot public static BlockPos lastPhysicsProblem; // Spigot private org.spigotmc.TickLimiter entityLimiter; -@@ -164,6 +166,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -162,6 +164,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, final DimensionType dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) { + protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) { this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot + this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper this.generator = gen; this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 269f5dd75cc51549af1b50e6ec2dd066ca0dbdf6..355a6af98163079bc60c77d6fb88cd7023264a1b 100644 +index d27dac2620a1b0700db76a1498ed8267c5b5828c..eac877cda0cd37d8717c770b86b590213ee0567e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -869,6 +869,7 @@ public final class CraftServer implements Server { +@@ -865,6 +865,7 @@ public final class CraftServer implements Server { } org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot @@ -725,7 +725,7 @@ index 269f5dd75cc51549af1b50e6ec2dd066ca0dbdf6..355a6af98163079bc60c77d6fb88cd70 for (ServerLevel world : this.console.getAllLevels()) { world.serverLevelData.setDifficulty(config.difficulty); world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals); -@@ -884,12 +885,14 @@ public final class CraftServer implements Server { +@@ -880,12 +881,14 @@ public final class CraftServer implements Server { } } world.spigotConfig.init(); // Spigot @@ -740,7 +740,7 @@ index 269f5dd75cc51549af1b50e6ec2dd066ca0dbdf6..355a6af98163079bc60c77d6fb88cd70 this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); -@@ -2316,4 +2319,35 @@ public final class CraftServer implements Server { +@@ -2308,4 +2311,35 @@ public final class CraftServer implements Server { return this.spigot; } // Spigot end @@ -777,7 +777,7 @@ index 269f5dd75cc51549af1b50e6ec2dd066ca0dbdf6..355a6af98163079bc60c77d6fb88cd70 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 0607f13dd2a568e368f96768259e8cba9c25e9c1..399e878210606e9addb535e4efed0ddb424160e8 100644 +index b698d6a8d6b59eefd721639b62bfd8bcffcf5c6f..70aa37fe043f56ef1b2f722ca946c4ac2cf4a98b 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -129,6 +129,14 @@ public class Main { @@ -796,7 +796,7 @@ index 0607f13dd2a568e368f96768259e8cba9c25e9c1..399e878210606e9addb535e4efed0ddb }; diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 4520eda5308575aa02ef059bb2efd776f56e352b..1d802f0e81b3880e9bb7799ecd46826f4bdcee03 100644 +index a04da0a7d690fe3fcf10810b4e8c92a8ae027b86..feef74e3a6d50344245c4a61ece5b2194af1072f 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -58,8 +58,14 @@ public class SpigotWorldConfig diff --git a/patches/server/0005-MC-Dev-fixes.patch b/patches/server/0005-MC-Dev-fixes.patch index 62c73e1c0..6082088c6 100644 --- a/patches/server/0005-MC-Dev-fixes.patch +++ b/patches/server/0005-MC-Dev-fixes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] MC Dev fixes diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 820ba0832fb2a7afe37f461a126e90613d775ff4..1851b36f978330651627f902f1c123337cdf9075 100644 +index de0f7cee98ae376ebcb1a48aed5ab5375681f53b..ddef1810b4ffe4623b46157ed0505ff97648867d 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -354,7 +354,7 @@ public class Util { +@@ -352,7 +352,7 @@ public class Util { } public static Strategy identityStrategy() { @@ -16,9 +16,9 @@ index 820ba0832fb2a7afe37f461a126e90613d775ff4..1851b36f978330651627f902f1c12333 + return (Strategy) Util.IdentityStrategy.INSTANCE; // Paper - decompile fix } - public static CompletableFuture> sequence(List> futures) { + public static CompletableFuture> sequence(List> futures) { diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index dc88152a1458dadd102989d4fc5ffd5bbc7eb523..53f438b3747ff20dd18bc757b5b672aaa9db7b81 100644 +index 8aecabe25510a58041194b0b798236bd652991dc..c656633870c99cc383d95fadcc0ec7b0f18a3682 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java @@ -375,12 +375,12 @@ public class BlockPos extends Vec3i { @@ -39,21 +39,6 @@ index dc88152a1458dadd102989d4fc5ffd5bbc7eb523..53f438b3747ff20dd18bc757b5b672aa } } }; -diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java -index ed7c3ab78516056bf50a6d885b98ba5c8d8ae0cf..25a6d195c5d6ee456258d2167f8acc5eb717e187 100644 ---- a/src/main/java/net/minecraft/core/MappedRegistry.java -+++ b/src/main/java/net/minecraft/core/MappedRegistry.java -@@ -249,10 +249,5 @@ public class MappedRegistry extends WritableRegistry { - } - - static record RegistryEntry(ResourceKey key, int id, T value) { -- RegistryEntry(ResourceKey key, int rawId, T entry) { -- this.key = key; -- this.id = rawId; -- this.value = entry; -- } - } - } diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java index 8c37ed1d70c5874bb1bd96fe33b087d4ddc2d68e..ea68b26e506e48d8238b7ee4266e61b211d52bd2 100644 --- a/src/main/java/net/minecraft/nbt/ListTag.java @@ -80,10 +65,10 @@ index 8c37ed1d70c5874bb1bd96fe33b087d4ddc2d68e..ea68b26e506e48d8238b7ee4266e61b2 private byte type; diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java -index 1f70fdaf08541ad57b2046e85e156be9446b372d..ea69f11e3cd9775998679baaccdaf980ee8fd498 100644 +index f10ea89e64aac2c11ed442ac7f2ffd15b793ac76..5df72f16e6b954ecee23a6f8daa29de0d3d991fe 100644 --- a/src/main/java/net/minecraft/network/ConnectionProtocol.java +++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java -@@ -15,6 +15,7 @@ import javax.annotation.Nullable; +@@ -16,6 +16,7 @@ import javax.annotation.Nullable; import net.minecraft.Util; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketFlow; @@ -91,7 +76,7 @@ index 1f70fdaf08541ad57b2046e85e156be9446b372d..ea69f11e3cd9775998679baaccdaf980 import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; import net.minecraft.network.protocol.game.ClientboundAddExperienceOrbPacket; import net.minecraft.network.protocol.game.ClientboundAddMobPacket; -@@ -117,6 +118,7 @@ import net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket; +@@ -118,6 +119,7 @@ import net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket; import net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket; import net.minecraft.network.protocol.game.ClientboundUpdateRecipesPacket; import net.minecraft.network.protocol.game.ClientboundUpdateTagsPacket; @@ -99,7 +84,7 @@ index 1f70fdaf08541ad57b2046e85e156be9446b372d..ea69f11e3cd9775998679baaccdaf980 import net.minecraft.network.protocol.game.ServerboundAcceptTeleportationPacket; import net.minecraft.network.protocol.game.ServerboundBlockEntityTagQuery; import net.minecraft.network.protocol.game.ServerboundChangeDifficultyPacket; -@@ -163,26 +165,33 @@ import net.minecraft.network.protocol.game.ServerboundTeleportToEntityPacket; +@@ -164,26 +166,33 @@ import net.minecraft.network.protocol.game.ServerboundTeleportToEntityPacket; import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket; import net.minecraft.network.protocol.game.ServerboundUseItemPacket; import net.minecraft.network.protocol.handshake.ClientIntentionPacket; @@ -121,7 +106,7 @@ index 1f70fdaf08541ad57b2046e85e156be9446b372d..ea69f11e3cd9775998679baaccdaf980 import net.minecraft.network.protocol.status.ServerboundPingRequestPacket; import net.minecraft.network.protocol.status.ServerboundStatusRequestPacket; import net.minecraft.util.VisibleForDebug; - import org.apache.logging.log4j.LogManager; + import org.slf4j.Logger; public enum ConnectionProtocol { - HANDSHAKING(-1, protocol().addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientIntentionPacket.class, ClientIntentionPacket::new))), @@ -138,21 +123,21 @@ index 1f70fdaf08541ad57b2046e85e156be9446b372d..ea69f11e3cd9775998679baaccdaf980 private static final int MIN_PROTOCOL_ID = -1; private static final int MAX_PROTOCOL_ID = 2; diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLoginPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLoginPacket.java -index 11d3d7d1a42f342bcbdc313fd39b379ceec3c0eb..f6e043810e654db6497be6720a9fbfb93aff12f6 100644 +index 2a6969baca7c07c52223672de58886dd05c032eb..a620e53021e02da1663b8d8b68d429b22814567f 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLoginPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLoginPacket.java -@@ -19,25 +19,6 @@ public record ClientboundLoginPacket(int playerId, boolean hardcore, GameType ga - }), buf.readWithCodec(RegistryAccess.RegistryHolder.NETWORK_CODEC), buf.readWithCodec(DimensionType.CODEC).get(), ResourceKey.create(Registry.DIMENSION_REGISTRY, buf.readResourceLocation()), buf.readLong(), buf.readVarInt(), buf.readVarInt(), buf.readVarInt(), buf.readBoolean(), buf.readBoolean(), buf.readBoolean(), buf.readBoolean()); +@@ -20,25 +20,6 @@ public record ClientboundLoginPacket(int playerId, boolean hardcore, GameType ga + }), buf.readWithCodec(RegistryAccess.NETWORK_CODEC).freeze(), buf.readWithCodec(DimensionType.CODEC), ResourceKey.create(Registry.DIMENSION_REGISTRY, buf.readResourceLocation()), buf.readLong(), buf.readVarInt(), buf.readVarInt(), buf.readVarInt(), buf.readBoolean(), buf.readBoolean(), buf.readBoolean(), buf.readBoolean()); } -- public ClientboundLoginPacket(int playerEntityId, boolean bl, GameType previousGameMode, @Nullable GameType gameType, Set> set, RegistryAccess.RegistryHolder registryHolder, DimensionType dimensionType, ResourceKey resourceKey, long l, int maxPlayers, int chunkLoadDistance, int i, boolean bl2, boolean bl3, boolean bl4, boolean bl5) { +- public ClientboundLoginPacket(int playerEntityId, boolean bl, GameType previousGameMode, @Nullable GameType gameType, Set> set, RegistryAccess.Frozen frozen, Holder holder, ResourceKey resourceKey, long l, int maxPlayers, int chunkLoadDistance, int i, boolean bl2, boolean bl3, boolean bl4, boolean bl5) { - this.playerId = playerEntityId; - this.hardcore = bl; - this.gameType = previousGameMode; - this.previousGameType = gameType; - this.levels = set; -- this.registryHolder = registryHolder; -- this.dimensionType = dimensionType; +- this.registryHolder = frozen; +- this.dimensionType = holder; - this.dimension = resourceKey; - this.seed = l; - this.maxPlayers = maxPlayers; @@ -168,18 +153,18 @@ index 11d3d7d1a42f342bcbdc313fd39b379ceec3c0eb..f6e043810e654db6497be6720a9fbfb9 public void write(FriendlyByteBuf buf) { buf.writeInt(this.playerId); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b3629065ebbe601802703b8671b24c7156f12d03..4d13345f3caa0c8ec55de465fc486d50b43d1e24 100644 +index 8754e5899067bc5e8e83a6264c6fcc38846f6baa..425fe208a1bf5490421d4256a8c47c16e47362d0 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1728,7 +1728,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoopmap(resourcepackrepository::getPack).filter(Objects::nonNull).map(Pack::open).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error // Paper - decompile error // todo: is this needed anymore? }, this).thenCompose((immutablelist) -> { - return ServerResources.loadResources(immutablelist, this.registryHolder, this.isDedicatedServer() ? Commands.CommandSelection.DEDICATED : Commands.CommandSelection.INTEGRATED, this.getFunctionCompilationLevel(), this.executor, this); - }).thenAcceptAsync((datapackresources) -> { + MultiPackResourceManager resourcemanager = new MultiPackResourceManager(PackType.SERVER_DATA, immutablelist); + diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java index 062da1bddd9704f5fbc46e974e13e60cd500bbe2..ffc43e5d3d0563c9e9c171064511b2c65ddf67e1 100644 --- a/src/main/java/net/minecraft/server/level/Ticket.java @@ -207,7 +192,7 @@ index d0f6eb3981a171c0f34870cb0472599d6cca9642..d1b2ba24ef54e01c6249c3b2ca16e80f public static SortedArraySet create(Comparator comparator) { diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java -index 93d9b14eb8793b8ee2193f7525306a5e4f1900f6..63f283f32bdad02299d4a16c305a28c3bfbce9a8 100644 +index 3d0b05a9ac049cf751dad0b0df46b5152b0cc9a5..3959eeb9090e8e4c999d89ec32fac8c46d5cdc75 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java @@ -30,7 +30,7 @@ public class PoiSection { @@ -220,10 +205,10 @@ index 93d9b14eb8793b8ee2193f7525306a5e4f1900f6..63f283f32bdad02299d4a16c305a28c3 return poiSet.isValid; }), PoiRecord.codec(updateListener).listOf().fieldOf("Records").forGetter((poiSet) -> { diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index 8daab331dd33c7095ddd9582b091310551003fd7..ef7bde78c134ec4ad464b5b6516626109c362989 100644 +index 92650d816113a0f1c2b589691895ebba3424d661..7ef0075cc16613709e145714204a728d8d8dd82b 100644 --- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -@@ -77,7 +77,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { +@@ -76,7 +76,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { } this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> { @@ -233,13 +218,13 @@ index 8daab331dd33c7095ddd9582b091310551003fd7..ef7bde78c134ec4ad464b5b651662610 this.byName = Maps.newHashMap(builder.build()); // CraftBukkit RecipeManager.LOGGER.info("Loaded {} recipes", map1.size()); diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java -index 0f7950458dc2dfac51ed0d56f1790395f0b03bc2..fa4544541b9c5f163b633596e73a5197cd081eb8 100644 +index 0422d787593cc65aadcae9f7517ec67a52f1f72b..95bbc1b6964614f3cf520034156e97a0ef32af40 100644 --- a/src/main/java/net/minecraft/world/level/biome/Biome.java +++ b/src/main/java/net/minecraft/world/level/biome/Biome.java -@@ -39,8 +39,32 @@ import org.apache.logging.log4j.Logger; +@@ -35,8 +35,32 @@ import net.minecraft.world.level.material.FluidState; + import net.minecraft.world.level.material.Fluids; public final class Biome { - public static final Logger LOGGER = LogManager.getLogger(); - public static final Codec DIRECT_CODEC; - public static final Codec NETWORK_CODEC; + // Paper start - decompile fix: move up verbatim from static block @@ -256,23 +241,23 @@ index 0f7950458dc2dfac51ed0d56f1790395f0b03bc2..fa4544541b9c5f163b633596e73a5197 + return biome.mobSettings; + })).apply(instance, Biome::new); + }); -+ public static final Codec NETWORK_CODEC = RecordCodecBuilder.create((instance) -> { ++ public static final Codec NETWORK_CODE = RecordCodecBuilder.create((instance) -> { + return instance.group(Biome.ClimateSettings.CODEC.forGetter((biome) -> { + return biome.climateSettings; + }), Biome.BiomeCategory.CODEC.fieldOf("category").forGetter((biome) -> { + return biome.biomeCategory; + }), BiomeSpecialEffects.CODEC.fieldOf("effects").forGetter((biome) -> { + return biome.specialEffects; -+ })).apply(instance, (climateSettings, biomeCategory, biomeSpecialEffects) -> { -+ return new Biome(climateSettings, biomeCategory, biomeSpecialEffects, BiomeGenerationSettings.EMPTY, MobSpawnSettings.EMPTY); ++ })).apply(instance, (weather, category, effects) -> { ++ return new Biome(weather, category, effects, BiomeGenerationSettings.EMPTY, MobSpawnSettings.EMPTY); + }); + }); + // Paper end - public static final Codec> CODEC = RegistryFileCodec.create(Registry.BIOME_REGISTRY, DIRECT_CODEC); - public static final Codec>> LIST_CODEC = RegistryFileCodec.homogeneousList(Registry.BIOME_REGISTRY, DIRECT_CODEC); + public static final Codec> CODEC = RegistryFileCodec.create(Registry.BIOME_REGISTRY, DIRECT_CODEC); + public static final Codec> LIST_CODEC = RegistryCodecs.homogeneousList(Registry.BIOME_REGISTRY, DIRECT_CODEC); private static final PerlinSimplexNoise TEMPERATURE_NOISE = new PerlinSimplexNoise(new WorldgenRandom(new LegacyRandomSource(1234L)), ImmutableList.of(0)); -@@ -257,33 +281,6 @@ public final class Biome { - return resourceLocation == null ? super.toString() : resourceLocation.toString(); +@@ -253,33 +277,6 @@ public final class Biome { + return biomeEntry.value().getBiomeCategory(); } - static { @@ -296,8 +281,8 @@ index 0f7950458dc2dfac51ed0d56f1790395f0b03bc2..fa4544541b9c5f163b633596e73a5197 - return biome.biomeCategory; - }), BiomeSpecialEffects.CODEC.fieldOf("effects").forGetter((biome) -> { - return biome.specialEffects; -- })).apply(instance, (climateSettings, biomeCategory, biomeSpecialEffects) -> { -- return new Biome(climateSettings, biomeCategory, biomeSpecialEffects, BiomeGenerationSettings.EMPTY, MobSpawnSettings.EMPTY); +- })).apply(instance, (weather, category, effects) -> { +- return new Biome(weather, category, effects, BiomeGenerationSettings.EMPTY, MobSpawnSettings.EMPTY); - }); - }); - } diff --git a/patches/server/0006-MC-Utils.patch b/patches/server/0006-MC-Utils.patch index 23c12fb33..31374dfb5 100644 --- a/patches/server/0006-MC-Utils.patch +++ b/patches/server/0006-MC-Utils.patch @@ -4414,10 +4414,10 @@ index 0000000000000000000000000000000000000000..4d3dc8fba51bf5c0dceb06744781d1df + } +} diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 0b73c98a880d535b615f89d47f4bc3a22348a195..2a06617cd484f378e87660b11a5eb78052348f39 100644 +index ddef1810b4ffe4623b46157ed0505ff97648867d..90d22b75fd33d8355e59b6bab79757c5b436c9d7 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -107,7 +107,7 @@ public class Util { +@@ -105,7 +105,7 @@ public class Util { } public static long getNanos() { @@ -4427,7 +4427,7 @@ index 0b73c98a880d535b615f89d47f4bc3a22348a195..2a06617cd484f378e87660b11a5eb780 public static long getEpochMillis() { diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index 53f438b3747ff20dd18bc757b5b672aaa9db7b81..5f23b9ab6540530acac623d2cd8e9ec5d0064f39 100644 +index c656633870c99cc383d95fadcc0ec7b0f18a3682..85bdeafd92aff5d694c4b5dff0b5796f3467a886 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java @@ -531,6 +531,7 @@ public class BlockPos extends Vec3i { @@ -4471,14 +4471,14 @@ index cbe273a012bedc3914b8cf1f5ad1fee1dfee6a7e..d0b523387a194d1649469e8d861b0b78 return NbtUtils.loadUUID(this.get(key)); } diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index 4ea6c2f0ac4703a5d67137073a5da0c39d77bdce..b964121f19e6a28df7675e65441c551a55316753 100644 +index 207f1c1fc9d4451d27047bb8362bded8cd53e32f..021a26a6b1c258deffc26c035ab52a4ea027d9a1 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java -@@ -48,7 +48,7 @@ public class PacketEncoder extends MessageToByteEncoder> { +@@ -45,7 +45,7 @@ public class PacketEncoder extends MessageToByteEncoder> { JvmProfiler.INSTANCE.onPacketSent(k, integer, channelHandlerContext.channel().remoteAddress(), j); } } catch (Throwable var10) { -- LOGGER.error(var10); +- LOGGER.error("Error receiving packet {}", integer, var10); + LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", integer, packet.isSkippable(), var10); // Paper - Give proper error message if (packet.isSkippable()) { throw new SkipPacketException(var10); @@ -5001,10 +5001,10 @@ index 0000000000000000000000000000000000000000..9f292deee1b793d52b5774304318e940 + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2b76a87213ea8880ede32a6f3bb91f59ed54e681..8c2b1d1a1e7f2716ee27aa10165b94550dccd19a 100644 +index 425fe208a1bf5490421d4256a8c47c16e47362d0..32dbb6e7add72ca8068e431e607a9ff570157ff8 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -295,6 +295,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function serverFactory) { AtomicReference atomicreference = new AtomicReference(); -@@ -949,6 +950,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop>> futures; private final LevelHeightAccessor levelHeightAccessor; @@ -5068,7 +5068,7 @@ index 40dd2077f26a2c1fa15f21861204faa53748140e..45de5e508540b4ba622985d530f1aada private CompletableFuture chunkToSave; @Nullable private final DebugBuffer chunkToSaveHistory; -@@ -70,6 +70,8 @@ public class ChunkHolder { +@@ -73,6 +73,8 @@ public class ChunkHolder { private boolean resendLight; private CompletableFuture pendingFullStateConfirmation; @@ -5077,24 +5077,20 @@ index 40dd2077f26a2c1fa15f21861204faa53748140e..45de5e508540b4ba622985d530f1aada public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) { this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size()); this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; -@@ -90,10 +92,11 @@ public class ChunkHolder { +@@ -93,8 +95,30 @@ public class ChunkHolder { this.queueLevel = this.oldTicketLevel; this.setTicketLevel(level); this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()]; + this.chunkMap = (ChunkMap)playersWatchingChunkProvider; // Paper - } - - // CraftBukkit start -- public LevelChunk getFullChunk() { -+ public final LevelChunk getFullChunk() { // Paper - final for inline - if (!ChunkHolder.getFullChunkStatus(this.oldTicketLevel).isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) return null; // note: using oldTicketLevel for isLoaded checks - return this.getFullChunkUnchecked(); - } -@@ -105,6 +108,21 @@ public class ChunkHolder { - } - // CraftBukkit end - ++ } ++ + // Paper start ++ public LevelChunk getFullChunkUnchecked() { ++ CompletableFuture> statusFuture = this.getFutureIfPresentUnchecked(ChunkStatus.FULL); ++ Either either = (Either) statusFuture.getNow(null); ++ return (either == null) ? null : (LevelChunk) either.left().orElse(null); + } + + public ChunkAccess getAvailableChunkNow() { + // TODO can we just getStatusFuture(EMPTY)? + for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) { @@ -5112,7 +5108,7 @@ index 40dd2077f26a2c1fa15f21861204faa53748140e..45de5e508540b4ba622985d530f1aada public CompletableFuture> getFutureIfPresentUnchecked(ChunkStatus leastStatus) { CompletableFuture> completablefuture = (CompletableFuture) this.futures.get(leastStatus.getIndex()); -@@ -115,20 +133,20 @@ public class ChunkHolder { +@@ -105,20 +129,20 @@ public class ChunkHolder { return ChunkHolder.getStatus(this.ticketLevel).isOrAfter(leastStatus) ? this.getFutureIfPresentUnchecked(leastStatus) : ChunkHolder.UNLOADED_CHUNK_FUTURE; } @@ -5137,7 +5133,16 @@ index 40dd2077f26a2c1fa15f21861204faa53748140e..45de5e508540b4ba622985d530f1aada CompletableFuture> completablefuture = this.getTickingChunkFuture(); Either either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error -@@ -149,6 +167,21 @@ public class ChunkHolder { +@@ -126,7 +150,7 @@ public class ChunkHolder { + } + + @Nullable +- public LevelChunk getFullChunk() { ++ public final LevelChunk getFullChunk() { // Paper - final for inline + CompletableFuture> completablefuture = this.getFullChunkFuture(); + Either either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error + +@@ -147,6 +171,21 @@ public class ChunkHolder { return null; } @@ -5159,7 +5164,7 @@ index 40dd2077f26a2c1fa15f21861204faa53748140e..45de5e508540b4ba622985d530f1aada @Nullable public ChunkAccess getLastAvailable() { for (int i = ChunkHolder.CHUNK_STATUSES.size() - 1; i >= 0; --i) { -@@ -167,7 +200,7 @@ public class ChunkHolder { +@@ -165,7 +204,7 @@ public class ChunkHolder { return null; } @@ -5168,7 +5173,7 @@ index 40dd2077f26a2c1fa15f21861204faa53748140e..45de5e508540b4ba622985d530f1aada return this.chunkToSave; } -@@ -335,11 +368,11 @@ public class ChunkHolder { +@@ -342,11 +381,11 @@ public class ChunkHolder { return ChunkHolder.getFullChunkStatus(this.ticketLevel); } @@ -5182,7 +5187,7 @@ index 40dd2077f26a2c1fa15f21861204faa53748140e..45de5e508540b4ba622985d530f1aada return this.ticketLevel; } -@@ -428,14 +461,27 @@ public class ChunkHolder { +@@ -435,14 +474,27 @@ public class ChunkHolder { this.wasAccessibleSinceLastSave |= flag3; if (!flag2 && flag3) { @@ -5210,7 +5215,7 @@ index 40dd2077f26a2c1fa15f21861204faa53748140e..45de5e508540b4ba622985d530f1aada } boolean flag4 = playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.TICKING); -@@ -444,12 +490,29 @@ public class ChunkHolder { +@@ -451,12 +503,29 @@ public class ChunkHolder { if (!flag4 && flag5) { this.tickingChunkFuture = chunkStorage.prepareTickingChunk(this); this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, ChunkHolder.FullChunkStatus.TICKING); @@ -5241,7 +5246,7 @@ index 40dd2077f26a2c1fa15f21861204faa53748140e..45de5e508540b4ba622985d530f1aada } boolean flag6 = playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.ENTITY_TICKING); -@@ -462,12 +525,28 @@ public class ChunkHolder { +@@ -469,12 +538,28 @@ public class ChunkHolder { this.entityTickingChunkFuture = chunkStorage.prepareEntityTickingChunk(this.pos); this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, ChunkHolder.FullChunkStatus.ENTITY_TICKING); @@ -5271,7 +5276,7 @@ index 40dd2077f26a2c1fa15f21861204faa53748140e..45de5e508540b4ba622985d530f1aada } if (!playerchunk_state1.isOrAfter(playerchunk_state)) { -@@ -573,4 +652,18 @@ public class ChunkHolder { +@@ -590,4 +675,18 @@ public class ChunkHolder { } }; } @@ -5291,10 +5296,10 @@ index 40dd2077f26a2c1fa15f21861204faa53748140e..45de5e508540b4ba622985d530f1aada + // Paper end } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 09f5ce03f842e357bbe0dd6b0fffde8ec5851f1d..504492c3889fab7b95eec3bcd9b0d1bcd619e8cf 100644 +index 27592093939d3ee3d0395527eead160ecec9330c..a5eb77f3d7cdbf656d11e97f4c27054b1d38b5d2 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -59,6 +59,7 @@ import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket; +@@ -62,6 +62,7 @@ import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket; import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket; import net.minecraft.network.protocol.game.DebugPackets; @@ -5302,7 +5307,7 @@ index 09f5ce03f842e357bbe0dd6b0fffde8ec5851f1d..504492c3889fab7b95eec3bcd9b0d1bc import net.minecraft.server.level.progress.ChunkProgressListener; import net.minecraft.server.network.ServerPlayerConnection; import net.minecraft.util.CsvOutput; -@@ -158,6 +159,56 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -162,6 +163,56 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }; // CraftBukkit end @@ -5359,7 +5364,7 @@ index 09f5ce03f842e357bbe0dd6b0fffde8ec5851f1d..504492c3889fab7b95eec3bcd9b0d1bc public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) { super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); this.visibleChunkMap = this.updatingChunkMap.clone(); -@@ -193,6 +244,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -198,6 +249,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.overworldDataStorage = persistentStateManagerFactory; this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, world); this.setViewDistance(viewDistance); @@ -5370,7 +5375,7 @@ index 09f5ce03f842e357bbe0dd6b0fffde8ec5851f1d..504492c3889fab7b95eec3bcd9b0d1bc } protected ChunkGenerator generator() { -@@ -282,6 +337,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -287,6 +342,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } @@ -5385,7 +5390,7 @@ index 09f5ce03f842e357bbe0dd6b0fffde8ec5851f1d..504492c3889fab7b95eec3bcd9b0d1bc private CompletableFuture, ChunkHolder.ChunkLoadingFailure>> getChunkRangeFuture(ChunkPos centerChunk, int margin, IntFunction distanceToStatus) { List>> list = new ArrayList(); List list1 = new ArrayList(); -@@ -382,6 +445,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -418,6 +481,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider holder.setTicketLevel(level); } else { holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this); @@ -5397,7 +5402,7 @@ index 09f5ce03f842e357bbe0dd6b0fffde8ec5851f1d..504492c3889fab7b95eec3bcd9b0d1bc } this.updatingChunkMap.put(pos, holder); -@@ -507,7 +575,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -547,7 +615,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (completablefuture1 != completablefuture) { this.scheduleUnload(pos, holder); } else { @@ -5412,20 +5417,19 @@ index 09f5ce03f842e357bbe0dd6b0fffde8ec5851f1d..504492c3889fab7b95eec3bcd9b0d1bc if (ichunkaccess instanceof LevelChunk) { ((LevelChunk) ichunkaccess).setLoaded(false); } -@@ -522,7 +596,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - this.lightEngine.updateChunkStatus(ichunkaccess.getPos()); +@@ -563,7 +637,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lightEngine.tryScheduleUpdate(); this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null); -- } + this.chunkSaveCooldowns.remove(ichunkaccess.getPos().toLong()); + } else if (removed) { // Paper start -+ for (int index = 0, len = this.regionManagers.size(); index < len; ++index) { -+ this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z); -+ } -+ } // Paper end ++ for (int index = 0, len = this.regionManagers.size(); index < len; ++index) { ++ this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z); + } ++ } // Paper end } }; -@@ -1057,6 +1135,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1111,6 +1189,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (!flag1) { this.distanceManager.addPlayer(SectionPos.of((Entity) player), player); } @@ -5433,7 +5437,7 @@ index 09f5ce03f842e357bbe0dd6b0fffde8ec5851f1d..504492c3889fab7b95eec3bcd9b0d1bc } else { SectionPos sectionposition = player.getLastSectionPos(); -@@ -1064,6 +1143,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1118,6 +1197,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (!flag2) { this.distanceManager.removePlayer(sectionposition, player); } @@ -5441,7 +5445,7 @@ index 09f5ce03f842e357bbe0dd6b0fffde8ec5851f1d..504492c3889fab7b95eec3bcd9b0d1bc } for (int k = i - this.viewDistance - 1; k <= i + this.viewDistance + 1; ++k) { -@@ -1176,6 +1256,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1230,6 +1310,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } @@ -5450,7 +5454,7 @@ index 09f5ce03f842e357bbe0dd6b0fffde8ec5851f1d..504492c3889fab7b95eec3bcd9b0d1bc } @Override -@@ -1379,7 +1461,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1433,7 +1515,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public class ChunkDistanceManager extends DistanceManager { protected ChunkDistanceManager(Executor workerExecutor, Executor mainThreadExecutor) { @@ -5460,10 +5464,10 @@ index 09f5ce03f842e357bbe0dd6b0fffde8ec5851f1d..504492c3889fab7b95eec3bcd9b0d1bc @Override diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index ef87c37633cee4ab438f1991144188ade1c4e65f..19d3802becd353e130b785f8286e595e08dc5c5f 100644 +index 6c98676827ceb6999f340fa2b06a0b3e1cb4cae2..2012831c4e9573118209672c8a0170573566b491 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -59,8 +59,9 @@ public abstract class DistanceManager { +@@ -60,8 +60,9 @@ public abstract class DistanceManager { final Executor mainThreadExecutor; private long ticketTickCounter; private int simulationDistance = 10; @@ -5474,7 +5478,7 @@ index ef87c37633cee4ab438f1991144188ade1c4e65f..19d3802becd353e130b785f8286e595e Objects.requireNonNull(mainThreadExecutor); ProcessorHandle mailbox = ProcessorHandle.of("player ticket throttler", mainThreadExecutor::execute); ChunkTaskPriorityQueueSorter chunktaskqueuesorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(mailbox), workerExecutor, 4); -@@ -69,6 +70,7 @@ public abstract class DistanceManager { +@@ -70,6 +71,7 @@ public abstract class DistanceManager { this.ticketThrottlerInput = chunktaskqueuesorter.getProcessor(mailbox, true); this.ticketThrottlerReleaser = chunktaskqueuesorter.getReleaseProcessor(mailbox); this.mainThreadExecutor = mainThreadExecutor; @@ -5483,25 +5487,24 @@ index ef87c37633cee4ab438f1991144188ade1c4e65f..19d3802becd353e130b785f8286e595e protected void purgeStaleTickets() { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 0d23c92af7aa381976c45d36e07d965819f19707..9dd0eb49048ceccd82e139dac5d658d168694dda 100644 +index 2015e527044db26bed960b2915b5422a7d7ad0e3..94d717f43336ace9375409b48d1e0e4291072656 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -48,6 +48,8 @@ import net.minecraft.world.level.storage.LevelData; - import net.minecraft.world.level.storage.LevelStorageSource; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -+import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper -+import java.util.function.Function; // Paper +@@ -49,6 +49,7 @@ import net.minecraft.world.level.storage.LevelStorageSource; public class ServerChunkCache extends ChunkSource { -@@ -70,6 +72,334 @@ public class ServerChunkCache extends ChunkSource { ++ public static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); // Paper + public static final List CHUNK_STATUSES = ChunkStatus.getStatusList(); + private final DistanceManager distanceManager; + final ServerLevel level; +@@ -67,6 +68,334 @@ public class ServerChunkCache extends ChunkSource { @Nullable @VisibleForDebug private NaturalSpawner.SpawnState lastSpawnState; + // Paper start + final com.destroystokyo.paper.util.concurrent.WeakSeqLock loadedChunkMapSeqLock = new com.destroystokyo.paper.util.concurrent.WeakSeqLock(); -+ final Long2ObjectOpenHashMap loadedChunkMap = new Long2ObjectOpenHashMap<>(8192, 0.5f); ++ final it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap loadedChunkMap = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>(8192, 0.5f); + + private final LevelChunk[] lastLoadedChunks = new LevelChunk[4 * 4]; + @@ -5602,13 +5605,13 @@ index 0d23c92af7aa381976c45d36e07d965819f19707..9dd0eb49048ceccd82e139dac5d658d1 + this.getChunkFutureAsynchronously(x, z, 33, ChunkHolder::getFullChunkFuture, onLoad); + } + -+ private void getChunkFutureAsynchronously(int x, int z, int ticketLevel, Function>> futureGet, java.util.function.Consumer onLoad) { ++ private void getChunkFutureAsynchronously(int x, int z, int ticketLevel, java.util.function.Function>> futureGet, java.util.function.Consumer onLoad) { + if (Thread.currentThread() != this.mainThread) { + throw new IllegalStateException(); + } + ChunkPos chunkPos = new ChunkPos(x, z); + Long identifier = this.chunkFutureAwaitCounter++; -+ this.distanceManager.addTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); ++ this.distanceManager.addTicket(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); + this.runDistanceManagerUpdates(); + + ChunkHolder chunk = this.chunkMap.getUpdatingChunkIfPresent(chunkPos.toLong()); @@ -5625,9 +5628,9 @@ index 0d23c92af7aa381976c45d36e07d965819f19707..9dd0eb49048ceccd82e139dac5d658d1 + if (throwable instanceof ThreadDeath) { + throw (ThreadDeath)throwable; + } -+ net.minecraft.server.MinecraftServer.LOGGER.fatal("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ServerChunkCache.this.level.getWorld().getName() + "'", throwable); ++ net.minecraft.server.MinecraftServer.LOGGER.error("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ServerChunkCache.this.level.getWorld().getName() + "'", throwable); + } else if (either.right().isPresent()) { -+ net.minecraft.server.MinecraftServer.LOGGER.fatal("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ServerChunkCache.this.level.getWorld().getName() + "': " + either.right().get().toString()); ++ net.minecraft.server.MinecraftServer.LOGGER.error("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ServerChunkCache.this.level.getWorld().getName() + "': " + either.right().get().toString()); + } + + try { @@ -5638,13 +5641,13 @@ index 0d23c92af7aa381976c45d36e07d965819f19707..9dd0eb49048ceccd82e139dac5d658d1 + if (thr instanceof ThreadDeath) { + throw (ThreadDeath)thr; + } -+ net.minecraft.server.MinecraftServer.LOGGER.fatal("Load callback for future await failed " + chunkPos.toString() + " in world '" + ServerChunkCache.this.level.getWorld().getName() + "'", thr); ++ net.minecraft.server.MinecraftServer.LOGGER.error("Load callback for future await failed " + chunkPos.toString() + " in world '" + ServerChunkCache.this.level.getWorld().getName() + "'", thr); + return; + } + } finally { + // due to odd behaviour with CB unload implementation we need to have these AFTER the load callback. -+ ServerChunkCache.this.distanceManager.addTicketAtLevel(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos); -+ ServerChunkCache.this.distanceManager.removeTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); ++ ServerChunkCache.this.distanceManager.addTicket(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos); ++ ServerChunkCache.this.distanceManager.removeTicket(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); + } + }, this.mainThreadProcessor); + } @@ -5726,9 +5729,9 @@ index 0d23c92af7aa381976c45d36e07d965819f19707..9dd0eb49048ceccd82e139dac5d658d1 + if (throwable instanceof ThreadDeath) { + throw (ThreadDeath)throwable; + } -+ LOGGER.fatal("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ServerChunkCache.this.level.getWorld().getName() + "'", throwable); ++ LOGGER.error("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ServerChunkCache.this.level.getWorld().getName() + "'", throwable); + } else if (either.right().isPresent()) { -+ LOGGER.fatal("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ServerChunkCache.this.level.getWorld().getName() + "': " + either.right().get().toString()); ++ LOGGER.error("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ServerChunkCache.this.level.getWorld().getName() + "': " + either.right().get().toString()); + } + + try { @@ -5739,7 +5742,7 @@ index 0d23c92af7aa381976c45d36e07d965819f19707..9dd0eb49048ceccd82e139dac5d658d1 + if (thr instanceof ThreadDeath) { + throw (ThreadDeath)thr; + } -+ LOGGER.fatal("Load callback for future await failed " + chunkPos.toString() + " in world '" + ServerChunkCache.this.level.getWorld().getName() + "'", thr); ++ LOGGER.error("Load callback for future await failed " + chunkPos.toString() + " in world '" + ServerChunkCache.this.level.getWorld().getName() + "'", thr); + return; + } + } finally { @@ -5751,11 +5754,11 @@ index 0d23c92af7aa381976c45d36e07d965819f19707..9dd0eb49048ceccd82e139dac5d658d1 + } + + public void addTicketAtLevel(TicketType ticketType, ChunkPos chunkPos, int ticketLevel, T identifier) { -+ this.distanceManager.addTicketAtLevel(ticketType, chunkPos, ticketLevel, identifier); ++ this.distanceManager.addTicket(ticketType, chunkPos, ticketLevel, identifier); + } + + public void removeTicketAtLevel(TicketType ticketType, ChunkPos chunkPos, int ticketLevel, T identifier) { -+ this.distanceManager.removeTicketAtLevel(ticketType, chunkPos, ticketLevel, identifier); ++ this.distanceManager.removeTicket(ticketType, chunkPos, ticketLevel, identifier); + } + + void chunkLoadAccept(int chunkX, int chunkZ, ChunkAccess chunk, java.util.function.Consumer consumer) { @@ -5830,7 +5833,7 @@ index 0d23c92af7aa381976c45d36e07d965819f19707..9dd0eb49048ceccd82e139dac5d658d1 public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, int simulationDistance, boolean dsync, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory) { this.level = world; -@@ -130,6 +460,49 @@ public class ServerChunkCache extends ChunkSource { +@@ -127,6 +456,49 @@ public class ServerChunkCache extends ChunkSource { this.lastChunk[0] = chunk; } @@ -5881,10 +5884,10 @@ index 0d23c92af7aa381976c45d36e07d965819f19707..9dd0eb49048ceccd82e139dac5d658d1 @Override public ChunkAccess getChunk(int x, int z, ChunkStatus leastStatus, boolean create) { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index b9ef6e33e584099b77b966774e1ae6aa497dfca1..073cea951644f25c276ba05ff1fc48fda08593da 100644 +index 1e9805b029abd8a59452b185af2eae8d1c9e7267..71e01e8f7b1aa5b607ad37297dbc49e9953aa9be 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -159,6 +159,7 @@ import org.bukkit.event.server.MapInitializeEvent; +@@ -160,6 +160,7 @@ import org.bukkit.event.server.MapInitializeEvent; import org.bukkit.event.weather.LightningStrikeEvent; import org.bukkit.event.world.TimeSkipEvent; // CraftBukkit end @@ -5892,7 +5895,7 @@ index b9ef6e33e584099b77b966774e1ae6aa497dfca1..073cea951644f25c276ba05ff1fc48fd public class ServerLevel extends Level implements WorldGenLevel { -@@ -215,6 +216,96 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -216,6 +217,96 @@ public class ServerLevel extends Level implements WorldGenLevel { return convertable.dimensionType; } @@ -5987,10 +5990,10 @@ index b9ef6e33e584099b77b966774e1ae6aa497dfca1..073cea951644f25c276ba05ff1fc48fd + // Paper end + // Add env and gen to constructor, WorldData -> WorldDataServer - public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { + public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey resourcekey, Holder holder, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index b64f9dc47d4f632624fc40bbbafd24cb5ae7cd9b..925ffbddd5475be7fe00570d861b615f707434b4 100644 +index 146d72d8d44cda5fc3f357f52e5fb3775be620f2..9d7d7a44616b2b7849c1abd3b9ac77305fdb0815 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -232,6 +232,8 @@ public class ServerPlayer extends Player { @@ -6024,10 +6027,10 @@ index 3a4f026c73cdd22d30bdadabbcf24bef969b73e4..0d536d72ac918fbd403397ff369d1014 private final String name; private final Comparator comparator; diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -index d679be6c3ce0d57fa2063a45baec1b108a0a2707..de5e18a331178da8f7e82aa2419a0ee606e801ee 100644 +index 0d33910768b111863816f84393613c0cc5142691..8fdda1e5805534d08c0a06b15e89d85b3d9c21e9 100644 --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -@@ -152,6 +152,26 @@ public class WorldGenRegion implements WorldGenLevel { +@@ -151,6 +151,26 @@ public class WorldGenRegion implements WorldGenLevel { return chunkX >= this.firstPos.x && chunkX <= this.lastPos.x && chunkZ >= this.firstPos.z && chunkZ <= this.lastPos.z; } @@ -6055,10 +6058,10 @@ index d679be6c3ce0d57fa2063a45baec1b108a0a2707..de5e18a331178da8f7e82aa2419a0ee6 public BlockState getBlockState(BlockPos pos) { return this.getChunk(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ())).getBlockState(pos); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8b406bc884a974cf46378a9fc38645e38e00f0ab..ee55db9770eb84792200b407defc04f0fd7b7e98 100644 +index c79c4e170a8213fd47e78c43827ddc86d24f7b61..c18bed4728f6813aa8d7cf4b1e5e53a092fb1354 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -217,9 +217,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -218,9 +218,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private final MinecraftServer server; public ServerPlayer player; private int tickCount; @@ -6072,7 +6075,7 @@ index 8b406bc884a974cf46378a9fc38645e38e00f0ab..ee55db9770eb84792200b407defc04f0 private final AtomicInteger chatSpamTickCount = new AtomicInteger(); // CraftBukkit end diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -index a4c5edee297af6d68d518b77f706732b5ccbe4de..7bf4bf5cb2c1b54a7e2733091f48f3a824336d36 100644 +index 288fdbef407d11ab430d5d7026dfad148c3c1065..6fefa619299d3202158490630d62c16aef71e831 100644 --- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java +++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java @@ -78,6 +78,13 @@ public abstract class BlockableEventLoop implements Profiler @@ -6090,10 +6093,10 @@ index a4c5edee297af6d68d518b77f706732b5ccbe4de..7bf4bf5cb2c1b54a7e2733091f48f3a8 @Override public void tell(R runnable) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 595a821e3dbbb0ecac8592356149d839624bcd50..78ea2df454919707a938ff75aa655f5bfa12fc99 100644 +index 2bebc5cc03ae34cf1d4003d24da42d0bc06f897b..e778f4da8b3e33b6fc9bbe21a7cbc1f185130e69 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -308,6 +308,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -311,6 +311,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return this.level.hasChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4); } // CraftBukkit end @@ -6106,10 +6109,10 @@ index 595a821e3dbbb0ecac8592356149d839624bcd50..78ea2df454919707a938ff75aa655f5b public Entity(EntityType type, Level world) { this.id = Entity.ENTITY_COUNTER.incrementAndGet(); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 1c5f30b199904c74aa3e473b7696c416d93f0efe..a3b6883d7fc856ed8550ffb7aa8dd929922853e2 100644 +index 197a27274c9277c41bb7fcda34afa7ef652e1a9b..c94c62e7e32f55d322ddfed930e1aaa6c1343b29 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -255,6 +255,7 @@ public abstract class LivingEntity extends Entity { +@@ -258,6 +258,7 @@ public abstract class LivingEntity extends Entity { public boolean collides = true; public Set collidableExemptions = new HashSet<>(); public boolean bukkitPickUpLoot; @@ -6118,7 +6121,7 @@ index 1c5f30b199904c74aa3e473b7696c416d93f0efe..a3b6883d7fc856ed8550ffb7aa8dd929 @Override public float getBukkitYaw() { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 59a54e99baf8219c3878b25a214508e09e819778..31f98763da600c34246d722cb92dda4442a3f046 100644 +index 351f7c08d5903113ba19205509e3fc68fc31e338..711c130a6d725d8a7f2a77e74b51c6123d7856d2 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -238,6 +238,7 @@ public abstract class Mob extends LivingEntity { @@ -6155,10 +6158,10 @@ index 6c3044b6194dfd3037389d717bbe6783f58b951d..457880c9e894a83d88505cf0b7235df9 super(type, world); this.xpReward = 5; diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 770520ace95a1fbc5bdaf5d9d62c09f0f7396602..8335880dbbb31a3f5d10c259b567baa0d5f381a1 100644 +index 62253b9fac567b515bafa06d00c6583b9ac1e216..1a52db84d9630a095347a85e136a9ad118f77325 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -727,6 +727,25 @@ public final class ItemStack { +@@ -737,6 +737,25 @@ public final class ItemStack { return this.tag != null ? this.tag.getList("Enchantments", 10) : new ListTag(); } @@ -6184,7 +6187,7 @@ index 770520ace95a1fbc5bdaf5d9d62c09f0f7396602..8335880dbbb31a3f5d10c259b567baa0 public void setTag(@Nullable CompoundTag nbt) { this.tag = nbt; if (this.getItem().canBeDepleted()) { -@@ -1127,6 +1146,7 @@ public final class ItemStack { +@@ -1135,6 +1154,7 @@ public final class ItemStack { // CraftBukkit start @Deprecated public void setItem(Item item) { @@ -6294,10 +6297,10 @@ index 3c707d6674b2594b09503b959a31c1f4ad3981e6..db61b6b0158a9bcc0e1d735e34fe3671 public BlockState getBlockState(BlockPos pos) { return Blocks.AIR.defaultBlockState(); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 8de437c79e105331165efaf1b154287e16e1b8ef..ff001049d71127a0b9e7a9d73996be02ec0ad044 100644 +index 6ded806628f2f3fd5b357eed41990abd7e06a372..47f625a30f3f2aa95d94f571abf5af95eee68912 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -85,6 +85,7 @@ import org.bukkit.craftbukkit.CraftServer; +@@ -83,6 +83,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.craftbukkit.block.CapturedBlockState; @@ -6305,7 +6308,7 @@ index 8de437c79e105331165efaf1b154287e16e1b8ef..ff001049d71127a0b9e7a9d73996be02 import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.craftbukkit.util.CraftSpawnCategory; import org.bukkit.craftbukkit.util.CraftNamespacedKey; -@@ -270,18 +271,51 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -269,18 +270,51 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return y < -20000000 || y >= 20000000; } @@ -6361,7 +6364,7 @@ index 8de437c79e105331165efaf1b154287e16e1b8ef..ff001049d71127a0b9e7a9d73996be02 ChunkAccess ichunkaccess = this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, create); if (ichunkaccess == null && create) { -@@ -292,7 +326,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -291,7 +325,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } @Override @@ -6370,7 +6373,7 @@ index 8de437c79e105331165efaf1b154287e16e1b8ef..ff001049d71127a0b9e7a9d73996be02 return this.setBlock(pos, state, flags, 512); } -@@ -597,7 +631,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -596,7 +630,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (this.isOutsideBuildHeight(pos)) { return Blocks.VOID_AIR.defaultBlockState(); } else { @@ -6380,10 +6383,10 @@ index 8de437c79e105331165efaf1b154287e16e1b8ef..ff001049d71127a0b9e7a9d73996be02 return chunk.getBlockState(pos); } diff --git a/src/main/java/net/minecraft/world/level/LevelReader.java b/src/main/java/net/minecraft/world/level/LevelReader.java -index a1cb8379ed4062d765659e829ba2262487ce7f8b..aa76f45d18f23997af5a9508559817964ef5e23c 100644 +index fb6ee169e6faa0dfc402f414ada10abbad57189e..34b26ee897209034c9be4d3e61acfd18d59e5e1e 100644 --- a/src/main/java/net/minecraft/world/level/LevelReader.java +++ b/src/main/java/net/minecraft/world/level/LevelReader.java -@@ -18,6 +18,7 @@ import net.minecraft.world.level.levelgen.Heightmap; +@@ -19,6 +19,7 @@ import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.phys.AABB; public interface LevelReader extends BlockAndTintGetter, CollisionGetter, BiomeManager.NoiseBiomeSource { @@ -6392,27 +6395,27 @@ index a1cb8379ed4062d765659e829ba2262487ce7f8b..aa76f45d18f23997af5a950855981796 ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create); diff --git a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java -index 47bd74f75f4c49a34a485d1963325a2152756c29..0dcf1c8926e471fa40517a5c92354116dad3c3c2 100644 +index ccf37eb05846f825d9acc874455cbbcdcdd2ecc2..138f5576a1df6714e754d9829f209f1a1678413f 100644 --- a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java +++ b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java -@@ -5,6 +5,7 @@ import javax.annotation.Nullable; - import net.minecraft.core.BlockPos; +@@ -9,6 +9,7 @@ import net.minecraft.core.Holder; + import net.minecraft.core.Registry; import net.minecraft.core.SectionPos; import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; - import net.minecraft.world.level.block.Blocks; - import net.minecraft.world.level.block.entity.BlockEntity; -@@ -60,7 +61,7 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { + import net.minecraft.world.level.biome.Biome; + import net.minecraft.world.level.biome.Biomes; +@@ -70,7 +71,7 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { private ChunkAccess getChunk(int chunkX, int chunkZ) { int i = chunkX - this.centerX; int j = chunkZ - this.centerZ; - if (i >= 0 && i < this.chunks.length && j >= 0 && j < this.chunks[i].length) { + if (i >= 0 && i < this.chunks.length && j >= 0 && j < this.chunks[i].length) { // Paper - if this changes, update getChunkIfLoaded below ChunkAccess chunkAccess = this.chunks[i][j]; - return (ChunkAccess)(chunkAccess != null ? chunkAccess : new EmptyLevelChunk(this.level, new ChunkPos(chunkX, chunkZ))); + return (ChunkAccess)(chunkAccess != null ? chunkAccess : new EmptyLevelChunk(this.level, new ChunkPos(chunkX, chunkZ), this.plains.get())); } else { -@@ -68,6 +69,30 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { +@@ -78,6 +79,30 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { } } @@ -6444,10 +6447,10 @@ index 47bd74f75f4c49a34a485d1963325a2152756c29..0dcf1c8926e471fa40517a5c92354116 public WorldBorder getWorldBorder() { return this.level.getWorldBorder(); diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 0cb0b6143e3307e546c78ecda2c35ac31a8a7001..a3f44e3a44b2ec21ef41f6d598b428448c847c5f 100644 +index 42d68e0df3ff4476a248044c7a727c0c2d3b828a..2b88ea323b7e179015751e87d1a4303bffed7f51 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -644,14 +644,14 @@ public abstract class BlockBehaviour { +@@ -646,14 +646,14 @@ public abstract class BlockBehaviour { public abstract static class BlockStateBase extends StateHolder { @@ -6465,7 +6468,7 @@ index 0cb0b6143e3307e546c78ecda2c35ac31a8a7001..a3f44e3a44b2ec21ef41f6d598b42844 private final BlockBehaviour.StatePredicate isRedstoneConductor; private final BlockBehaviour.StatePredicate isSuffocating; private final BlockBehaviour.StatePredicate isViewBlocking; -@@ -679,10 +679,18 @@ public abstract class BlockBehaviour { +@@ -681,10 +681,18 @@ public abstract class BlockBehaviour { this.emissiveRendering = blockbase_info.emissiveRendering; } @@ -6484,7 +6487,7 @@ index 0cb0b6143e3307e546c78ecda2c35ac31a8a7001..a3f44e3a44b2ec21ef41f6d598b42844 } -@@ -714,8 +722,8 @@ public abstract class BlockBehaviour { +@@ -716,8 +724,8 @@ public abstract class BlockBehaviour { return this.getBlock().getOcclusionShape(this.asState(), world, pos); } @@ -6496,10 +6499,10 @@ index 0cb0b6143e3307e546c78ecda2c35ac31a8a7001..a3f44e3a44b2ec21ef41f6d598b42844 public boolean useShapeForLightOcclusion() { diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index bfcaaa69991342f71fba4df46f69aea2ec6adca7..0ea0690ab1d45f60a2b13cf8a69e580256992cdc 100644 +index b629ce7f1aa4592748f3f47ae3637b20461549d2..847ac56f20ab9c5745f9c0fa0e6f16743ba5e471 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -58,7 +58,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -61,7 +61,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom protected final ShortList[] postProcessing; protected volatile boolean unsaved; private volatile boolean isLightCorrect; @@ -6508,7 +6511,7 @@ index bfcaaa69991342f71fba4df46f69aea2ec6adca7..0ea0690ab1d45f60a2b13cf8a69e5802 private long inhabitedTime; /** @deprecated */ @Nullable -@@ -83,7 +83,8 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -86,7 +86,8 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom // CraftBukkit end public ChunkAccess(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor heightLimitView, Registry biome, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable BlendingData blendingData) { @@ -6519,10 +6522,10 @@ index bfcaaa69991342f71fba4df46f69aea2ec6adca7..0ea0690ab1d45f60a2b13cf8a69e5802 this.levelHeightAccessor = heightLimitView; this.sections = new LevelChunkSection[heightLimitView.getSectionsCount()]; 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 28555314738ba891e0e36d3c85b1623116f743dd..f263022e1d15e78b51cfd148cf024b9a8c761898 100644 +index 5015d09de59cf184c98b1ea45f25a264c6dab1b1..73a99db6c31dec822514392a6102b7f8cc3b2738 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -24,6 +24,7 @@ import net.minecraft.nbt.CompoundTag; +@@ -25,6 +25,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; import net.minecraft.server.level.ChunkHolder; @@ -6718,10 +6721,10 @@ index 28555314738ba891e0e36d3c85b1623116f743dd..f263022e1d15e78b51cfd148cf024b9a @Override diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -index 37a75bb9b15356b6fb9c76c1bc1fff8e0a28b1dd..7c2e3331fac1de2e20974c8eed8aeeb9f2c92789 100644 +index 28e02151cb56141545c27d0cd9723e742fc420ad..ee0be5163811ea39efcb2092e5f126c3fd9b1523 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -73,6 +73,18 @@ public class ProtoChunk extends ChunkAccess { +@@ -74,6 +74,18 @@ public class ProtoChunk extends ChunkAccess { return new ChunkAccess.TicksToSave(this.blockTicks, this.fluidTicks); } @@ -6963,7 +6966,7 @@ index 0000000000000000000000000000000000000000..909b2c98e7a9117d2f737245e4661792 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 5c5a0c6695fd68f16792995f9537e05b446ad7e9..8cb510615bc8b4638b4aadfd9732c9a3d65b1fac 100644 +index 950a6238f31d2c76a93831eb025092ecd8ab3a9b..bc89c976e763ec137066f8517dbcc1a3d43303bd 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -97,8 +97,17 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -7000,10 +7003,10 @@ index 5c5a0c6695fd68f16792995f9537e05b446ad7e9..8cb510615bc8b4638b4aadfd9732c9a3 public static byte toLegacyData(BlockState data) { diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java -index 939789831f14621800c6792d20119079fc51b6f1..9ab8159975f58a0014edbe3a368490b3590882ea 100644 +index b8d50fd20fea9f84af77de69391d670c7b6cf132..13e887e9d06c3eb8649613d1ecb3d26de6b9d6ef 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java -@@ -212,7 +212,23 @@ public class DummyGeneratorAccess implements WorldGenLevel { +@@ -205,7 +205,23 @@ public class DummyGeneratorAccess implements WorldGenLevel { public FluidState getFluidState(BlockPos pos) { return Fluids.EMPTY.defaultFluidState(); // SPIGOT-6634 } diff --git a/patches/server/0009-Add-MinecraftKey-Information-to-Objects.patch b/patches/server/0009-Add-MinecraftKey-Information-to-Objects.patch index 74111ec18..a62b06ca6 100644 --- a/patches/server/0009-Add-MinecraftKey-Information-to-Objects.patch +++ b/patches/server/0009-Add-MinecraftKey-Information-to-Objects.patch @@ -36,10 +36,10 @@ index 0000000000000000000000000000000000000000..9f0c7fd903f085e70db1785fb8bcdb54 + } +} diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 52eb344feee9c3bc34a6d22a32de174c52736fb5..0736454dea12d8ffe8ef6873c5d25d17a96504b0 100644 +index e778f4da8b3e33b6fc9bbe21a7cbc1f185130e69..e191f080e781473481712e27763ab80c04fe60ab 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -145,7 +145,7 @@ import org.bukkit.event.player.PlayerTeleportEvent; +@@ -148,7 +148,7 @@ import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.plugin.PluginManager; // CraftBukkit end @@ -48,7 +48,7 @@ index 52eb344feee9c3bc34a6d22a32de174c52736fb5..0736454dea12d8ffe8ef6873c5d25d17 // CraftBukkit start private static final int CURRENT_LEVEL = 2; -@@ -1963,12 +1963,32 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1968,12 +1968,32 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return true; } @@ -83,7 +83,7 @@ index 52eb344feee9c3bc34a6d22a32de174c52736fb5..0736454dea12d8ffe8ef6873c5d25d17 protected abstract void readAdditionalSaveData(CompoundTag nbt); diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -index 30adcc82bc4e2e7145d29b64fde952d694cdf1e1..d33c2d2ec285179614d21a255cea394682e4cc2c 100644 +index dec38e58e30c84887e9d29436c0f76c70c0a627d..53a8e9a63b2ea5f698acbd80b2eca9e3e3cfedb8 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java @@ -23,7 +23,7 @@ import org.bukkit.inventory.InventoryHolder; diff --git a/patches/server/0010-Timings-v2.patch b/patches/server/0010-Timings-v2.patch index 8111b58bd..bb4baaa45 100644 --- a/patches/server/0010-Timings-v2.patch +++ b/patches/server/0010-Timings-v2.patch @@ -745,37 +745,24 @@ index ca1a9884ab09fc7e575b1d30e2dd0aaff324fb73..b94038e2da0f986403c1ec9b27384344 public CommandFunction(ResourceLocation id, CommandFunction.Entry[] elements) { this.id = id; diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -index b3a6aeba2363d283f03982cf749f25cfa11a5052..449f1b2f5dca350dc0912e14c8c2bf3eb4652b92 100644 +index 13421daa96b4ba302581f36abcd730952713d8cd..049e64c355d5f064009b1107ad15d28c44f999dd 100644 --- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java +++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -@@ -3,6 +3,8 @@ package net.minecraft.network.protocol; - import net.minecraft.network.PacketListener; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -+import co.aikar.timings.MinecraftTimings; // Paper -+import co.aikar.timings.Timing; // Paper - - // CraftBukkit start - import net.minecraft.server.MinecraftServer; -@@ -23,10 +25,13 @@ public class PacketUtils { - - public static void ensureRunningOnSameThread(Packet packet, T listener, BlockableEventLoop engine) throws RunningOnDifferentThreadException { - if (!engine.isSameThread()) { -+ Timing timing = MinecraftTimings.getPacketTiming(packet); // Paper - timings - engine.execute(() -> { +@@ -26,7 +26,8 @@ public class PacketUtils { + engine.executeIfPossible(() -> { if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590 if (listener.getConnection().isConnected()) { -+ try (Timing ignored = timing.startTiming()) { // Paper - timings - packet.handle(listener); -+ } // Paper - timings - } else { - PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet); - } +- try { ++ co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings ++ try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings + packet.handle(listener); + } catch (Exception exception) { + if (listener.shouldPropagateHandlingExceptions()) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 8c2b1d1a1e7f2716ee27aa10165b94550dccd19a..eba857195121c58d1b63c58904fd4754a8020219 100644 +index 32dbb6e7add72ca8068e431e607a9ff570157ff8..aca0adb9f714f96b10546b837d08fe9ef90b4d89 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -179,7 +179,7 @@ import org.bukkit.craftbukkit.generator.CustomWorldChunkManager; +@@ -180,7 +180,7 @@ import org.bukkit.craftbukkit.generator.CustomWorldChunkManager; import org.bukkit.event.server.ServerLoadEvent; // CraftBukkit end @@ -784,7 +771,7 @@ index 8c2b1d1a1e7f2716ee27aa10165b94550dccd19a..eba857195121c58d1b63c58904fd4754 import org.spigotmc.SlackActivityAccountant; // Spigot public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements CommandSource, AutoCloseable { -@@ -898,6 +898,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop= 5000000000L) { -@@ -1231,15 +1252,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % this.autosavePeriod == 0) { // CraftBukkit @@ -867,7 +854,7 @@ index 8c2b1d1a1e7f2716ee27aa10165b94550dccd19a..eba857195121c58d1b63c58904fd4754 this.profiler.push("tallying"); long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i; -@@ -1250,30 +1274,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { // CraftBukkit start - fire RemoteServerCommandEvent -@@ -704,10 +706,39 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -707,10 +709,39 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface if (event.isCancelled()) { return; } @@ -1041,7 +1028,7 @@ index 4dd57007af218ba1c0e666117a49939c5884f2c6..a6cb949b6f048455acc50c897fdd93d3 } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 504492c3889fab7b95eec3bcd9b0d1bcd619e8cf..5d1ac4e7afa0f1d9c9face049f768a2030eb411f 100644 +index a5eb77f3d7cdbf656d11e97f4c27054b1d38b5d2..9aaf392876119cfda46f3e80d02020d0e748ae44 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1,8 +1,10 @@ @@ -1055,7 +1042,7 @@ index 504492c3889fab7b95eec3bcd9b0d1bcd619e8cf..5d1ac4e7afa0f1d9c9face049f768a20 import com.google.common.collect.Lists; import com.google.common.collect.Queues; import com.google.common.collect.Sets; -@@ -652,11 +654,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -693,11 +695,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private CompletableFuture> scheduleChunkLoad(ChunkPos pos) { return CompletableFuture.supplyAsync(() -> { @@ -1073,7 +1060,7 @@ index 504492c3889fab7b95eec3bcd9b0d1bcd619e8cf..5d1ac4e7afa0f1d9c9face049f768a20 boolean flag = nbttagcompound.contains("Status", 8); if (flag) { -@@ -667,7 +672,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -708,7 +713,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } ChunkMap.LOGGER.error("Chunk file at {} is missing level data, skipping", pos); @@ -1082,7 +1069,7 @@ index 504492c3889fab7b95eec3bcd9b0d1bcd619e8cf..5d1ac4e7afa0f1d9c9face049f768a20 } catch (ReportedException reportedexception) { Throwable throwable = reportedexception.getCause(); -@@ -784,6 +789,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -825,6 +830,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ChunkStatus chunkstatus = ChunkHolder.getStatus(chunkHolder.getTicketLevel()); return !chunkstatus.isOrAfter(ChunkStatus.FULL) ? ChunkHolder.UNLOADED_CHUNK : either.mapLeft((ichunkaccess) -> { @@ -1090,7 +1077,7 @@ index 504492c3889fab7b95eec3bcd9b0d1bcd619e8cf..5d1ac4e7afa0f1d9c9face049f768a20 ChunkPos chunkcoordintpair = chunkHolder.getPos(); ProtoChunk protochunk = (ProtoChunk) ichunkaccess; LevelChunk chunk; -@@ -808,6 +814,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -849,6 +855,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } return chunk; @@ -1098,7 +1085,7 @@ index 504492c3889fab7b95eec3bcd9b0d1bcd619e8cf..5d1ac4e7afa0f1d9c9face049f768a20 }); }, (runnable) -> { ProcessorHandle mailbox = this.mainThreadMailbox; -@@ -1342,6 +1349,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1396,6 +1403,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider List list = Lists.newArrayList(); List list1 = this.level.players(); ObjectIterator objectiterator = this.entityMap.values().iterator(); @@ -1106,7 +1093,7 @@ index 504492c3889fab7b95eec3bcd9b0d1bcd619e8cf..5d1ac4e7afa0f1d9c9face049f768a20 ChunkMap.TrackedEntity playerchunkmap_entitytracker; -@@ -1366,14 +1374,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1420,14 +1428,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider playerchunkmap_entitytracker.serverEntity.sendChanges(); } } @@ -1125,10 +1112,10 @@ index 504492c3889fab7b95eec3bcd9b0d1bcd619e8cf..5d1ac4e7afa0f1d9c9face049f768a20 } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 9dd0eb49048ceccd82e139dac5d658d168694dda..a1740dd320967aa6d1ce84e081a1f2b9a1ee7d08 100644 +index 94d717f43336ace9375409b48d1e0e4291072656..3bbee4d08f4125a6499c0a8790c6bda6935e5ccc 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -528,13 +528,15 @@ public class ServerChunkCache extends ChunkSource { +@@ -524,13 +524,15 @@ public class ServerChunkCache extends ChunkSource { } gameprofilerfiller.incrementCounter("getChunkCacheMiss"); @@ -1146,7 +1133,7 @@ index 9dd0eb49048ceccd82e139dac5d658d168694dda..a1740dd320967aa6d1ce84e081a1f2b9 ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { return ichunkaccess1; }, (playerchunk_failure) -> { -@@ -732,7 +734,9 @@ public class ServerChunkCache extends ChunkSource { +@@ -728,7 +730,9 @@ public class ServerChunkCache extends ChunkSource { public void save(boolean flush) { this.runDistanceManagerUpdates(); @@ -1156,17 +1143,17 @@ index 9dd0eb49048ceccd82e139dac5d658d168694dda..a1740dd320967aa6d1ce84e081a1f2b9 } @Override -@@ -770,7 +774,9 @@ public class ServerChunkCache extends ChunkSource { - this.runDistanceManagerUpdates(); +@@ -767,7 +771,9 @@ public class ServerChunkCache extends ChunkSource { this.level.timings.doChunkMap.stopTiming(); // Spigot this.level.getProfiler().popPush("chunks"); -+ this.level.timings.chunks.startTiming(); // Paper - timings - this.tickChunks(); -+ this.level.timings.chunks.stopTiming(); // Paper - timings + if (tickChunks) { ++ this.level.timings.chunks.startTiming(); // Paper - timings + this.tickChunks(); ++ this.level.timings.chunks.stopTiming(); // Paper - timings + } + this.level.timings.doChunkUnload.startTiming(); // Spigot - this.level.getProfiler().popPush("unload"); - this.chunkMap.tick(shouldKeepTicking); -@@ -797,13 +803,16 @@ public class ServerChunkCache extends ChunkSource { +@@ -796,13 +802,16 @@ public class ServerChunkCache extends ChunkSource { boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit gameprofilerfiller.push("naturalSpawnCount"); @@ -1183,7 +1170,7 @@ index 9dd0eb49048ceccd82e139dac5d658d168694dda..a1740dd320967aa6d1ce84e081a1f2b9 while (iterator.hasNext()) { ChunkHolder playerchunk = (ChunkHolder) iterator.next(); -@@ -832,27 +841,27 @@ public class ServerChunkCache extends ChunkSource { +@@ -831,27 +840,27 @@ public class ServerChunkCache extends ChunkSource { } if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { @@ -1217,7 +1204,7 @@ index 9dd0eb49048ceccd82e139dac5d658d168694dda..a1740dd320967aa6d1ce84e081a1f2b9 } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 073cea951644f25c276ba05ff1fc48fda08593da..c7fe4b6aa8d68bd5dc394752a5ae635eb46c5f31 100644 +index 71e01e8f7b1aa5b607ad37297dbc49e9953aa9be..d491d91e639028fdf9ee75da849d3084b665d93c 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1,6 +1,8 @@ @@ -1228,16 +1215,16 @@ index 073cea951644f25c276ba05ff1fc48fda08593da..c7fe4b6aa8d68bd5dc394752a5ae635e +import co.aikar.timings.Timings; // Paper import com.google.common.collect.Lists; import com.mojang.datafixers.DataFixer; - import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -@@ -151,7 +153,6 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; + import com.mojang.datafixers.util.Pair; +@@ -152,7 +154,6 @@ import net.minecraft.world.ticks.LevelTicks; + import org.slf4j.Logger; import org.bukkit.Bukkit; import org.bukkit.WeatherType; -import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.util.WorldUUID; import org.bukkit.event.entity.CreatureSpawnEvent; -@@ -424,7 +425,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -427,7 +428,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.updateSkyBrightness(); this.tickTime(); gameprofilerfiller.popPush("tickPending"); @@ -1246,7 +1233,7 @@ index 073cea951644f25c276ba05ff1fc48fda08593da..c7fe4b6aa8d68bd5dc394752a5ae635e if (!this.isDebug()) { j = this.getGameTime(); gameprofilerfiller.push("blockTicks"); -@@ -433,12 +434,16 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -436,12 +437,16 @@ public class ServerLevel extends Level implements WorldGenLevel { this.fluidTicks.tick(j, 65536, this::tickFluid); gameprofilerfiller.pop(); } @@ -1259,12 +1246,12 @@ index 073cea951644f25c276ba05ff1fc48fda08593da..c7fe4b6aa8d68bd5dc394752a5ae635e + this.timings.raids.stopTiming(); // Paper - timings gameprofilerfiller.popPush("chunkSource"); + this.timings.chunkProviderTick.startTiming(); // Paper - timings - this.getChunkSource().tick(shouldKeepTicking); + this.getChunkSource().tick(shouldKeepTicking, true); + this.timings.chunkProviderTick.stopTiming(); // Paper - timings gameprofilerfiller.popPush("blockEvents"); timings.doSounds.startTiming(); // Spigot this.runBlockEvents(); -@@ -603,6 +608,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -606,6 +611,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } gameprofilerfiller.popPush("tickBlocks"); @@ -1272,7 +1259,7 @@ index 073cea951644f25c276ba05ff1fc48fda08593da..c7fe4b6aa8d68bd5dc394752a5ae635e if (randomTickSpeed > 0) { LevelChunkSection[] achunksection = chunk.getSections(); int l = achunksection.length; -@@ -635,6 +641,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -638,6 +644,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } @@ -1280,7 +1267,7 @@ index 073cea951644f25c276ba05ff1fc48fda08593da..c7fe4b6aa8d68bd5dc394752a5ae635e gameprofilerfiller.pop(); } -@@ -869,14 +876,22 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -872,14 +879,22 @@ public class ServerLevel extends Level implements WorldGenLevel { } public void tickNonPassenger(Entity entity) { @@ -1304,7 +1291,7 @@ index 073cea951644f25c276ba05ff1fc48fda08593da..c7fe4b6aa8d68bd5dc394752a5ae635e entity.setOldPosAndRot(); ProfilerFiller gameprofilerfiller = this.getProfiler(); -@@ -895,7 +910,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -898,7 +913,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(entity, entity1); } @@ -1313,7 +1300,7 @@ index 073cea951644f25c276ba05ff1fc48fda08593da..c7fe4b6aa8d68bd5dc394752a5ae635e } -@@ -937,6 +952,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -940,6 +955,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (!savingDisabled) { org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit @@ -1321,7 +1308,7 @@ index 073cea951644f25c276ba05ff1fc48fda08593da..c7fe4b6aa8d68bd5dc394752a5ae635e if (progressListener != null) { progressListener.progressStartNoAbort(new TranslatableComponent("menu.savingLevel")); } -@@ -946,7 +962,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -949,7 +965,10 @@ public class ServerLevel extends Level implements WorldGenLevel { progressListener.progressStage(new TranslatableComponent("menu.savingChunks")); } @@ -1333,10 +1320,10 @@ index 073cea951644f25c276ba05ff1fc48fda08593da..c7fe4b6aa8d68bd5dc394752a5ae635e this.entityManager.saveAll(); } else { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ee55db9770eb84792200b407defc04f0fd7b7e98..ea652f6394c7e575ce06a6b691d8b2c442eafb03 100644 +index c18bed4728f6813aa8d7cf4b1e5e53a092fb1354..443124a72eef9f60e2941b932a13471dbf1c4f72 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -207,6 +207,7 @@ import org.bukkit.inventory.CraftingInventory; +@@ -208,6 +208,7 @@ import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.InventoryView; import org.bukkit.inventory.SmithingInventory; @@ -1344,7 +1331,7 @@ index ee55db9770eb84792200b407defc04f0fd7b7e98..ea652f6394c7e575ce06a6b691d8b2c4 // CraftBukkit end public class ServerGamePacketListenerImpl implements ServerPlayerConnection, ServerGamePacketListener { -@@ -285,7 +286,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -286,7 +287,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // CraftBukkit end public void tick() { @@ -1352,7 +1339,7 @@ index ee55db9770eb84792200b407defc04f0fd7b7e98..ea652f6394c7e575ce06a6b691d8b2c4 this.resetPosition(); this.player.xo = this.player.getX(); this.player.yo = this.player.getY(); -@@ -361,7 +361,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -362,7 +362,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854 this.disconnect(new TranslatableComponent("multiplayer.disconnect.idling")); } @@ -1360,7 +1347,7 @@ index ee55db9770eb84792200b407defc04f0fd7b7e98..ea652f6394c7e575ce06a6b691d8b2c4 } -@@ -1919,7 +1918,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1934,7 +1933,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // CraftBukkit end private void handleCommand(String input) { @@ -1369,7 +1356,7 @@ index ee55db9770eb84792200b407defc04f0fd7b7e98..ea652f6394c7e575ce06a6b691d8b2c4 // CraftBukkit start - whole method if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + input); -@@ -1930,7 +1929,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1945,7 +1944,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.cserver.getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -1378,7 +1365,7 @@ index ee55db9770eb84792200b407defc04f0fd7b7e98..ea652f6394c7e575ce06a6b691d8b2c4 return; } -@@ -1943,7 +1942,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1958,7 +1957,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); return; } finally { @@ -1388,7 +1375,7 @@ index ee55db9770eb84792200b407defc04f0fd7b7e98..ea652f6394c7e575ce06a6b691d8b2c4 // this.server.getCommands().performCommand(this.player.createCommandSourceStack(), s); // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 8e4325abb2dda74c38b17bb27f9dcfcf97ba2de6..1be4b3ad18d314b0460ce61e01afd0d7d16aee69 100644 +index ea119e5849c90b25b7e836eb5e7454a391865b81..5fa0ce6a7f6b8df8993315a9784764f57d59bcf4 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -1,5 +1,6 @@ @@ -1412,10 +1399,10 @@ index 8e4325abb2dda74c38b17bb27f9dcfcf97ba2de6..1be4b3ad18d314b0460ce61e01afd0d7 public UserWhiteList getWhiteList() { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 521e525cac2109a79370321163f4f27ffefb49ad..c9ab40355f02a2abfe10d9c02595e6b761b1a779 100644 +index e191f080e781473481712e27763ab80c04fe60ab..04692fe4e7f2107ffc8c48cebdf88e18e58f4ce9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -125,7 +125,6 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent; +@@ -128,7 +128,6 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent; import org.bukkit.entity.Hanging; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Vehicle; @@ -1423,7 +1410,7 @@ index 521e525cac2109a79370321163f4f27ffefb49ad..c9ab40355f02a2abfe10d9c02595e6b7 import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; -@@ -292,7 +291,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -295,7 +294,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public boolean lastDamageCancelled; // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Keep track if the event was canceled public boolean persistentInvisibility = false; public BlockPos lastLavaContact; @@ -1431,7 +1418,7 @@ index 521e525cac2109a79370321163f4f27ffefb49ad..c9ab40355f02a2abfe10d9c02595e6b7 // Spigot start public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -740,7 +738,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -744,7 +742,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public void move(MoverType movementType, Vec3 movement) { @@ -1439,7 +1426,7 @@ index 521e525cac2109a79370321163f4f27ffefb49ad..c9ab40355f02a2abfe10d9c02595e6b7 if (this.noPhysics) { this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); } else { -@@ -893,7 +890,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -906,7 +903,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i this.level.getProfiler().pop(); } } @@ -1448,10 +1435,10 @@ index 521e525cac2109a79370321163f4f27ffefb49ad..c9ab40355f02a2abfe10d9c02595e6b7 protected boolean isHorizontalCollisionMinor(Vec3 adjustedMovement) { diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index e688949fc2f3031dc9c9817bc59554e9f5a436af..20cfdba68c200e87d00995a6a4e25a5fa8171f6c 100644 +index d790c37753f019b682fe00bea392359ba18bf204..8699a3bd63e2df83615ae39a6873d9874f0fb8da 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -293,7 +293,14 @@ public class EntityType implements EntityTypeTest { +@@ -296,7 +296,14 @@ public class EntityType implements EntityTypeTest { return Registry.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(id)); } @@ -1463,10 +1450,10 @@ index e688949fc2f3031dc9c9817bc59554e9f5a436af..20cfdba68c200e87d00995a6a4e25a5f + } + public EntityType(EntityType.EntityFactory factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnInside, EntityDimensions dimensions, int maxTrackDistance, int trackTickInterval, String id) { + // Paper end + this.builtInRegistryHolder = Registry.ENTITY_TYPE.createIntrusiveHolder(this); this.factory = factory; this.category = spawnGroup; - this.canSpawnFarFromPlayer = spawnableFarFromPlayer; -@@ -304,6 +311,14 @@ public class EntityType implements EntityTypeTest { +@@ -308,6 +315,14 @@ public class EntityType implements EntityTypeTest { this.dimensions = dimensions; this.clientTrackingRange = maxTrackDistance; this.updateInterval = trackTickInterval; @@ -1481,7 +1468,7 @@ index e688949fc2f3031dc9c9817bc59554e9f5a436af..20cfdba68c200e87d00995a6a4e25a5f } @Nullable -@@ -564,6 +579,12 @@ public class EntityType implements EntityTypeTest { +@@ -568,6 +583,12 @@ public class EntityType implements EntityTypeTest { return this.updateInterval; } @@ -1494,7 +1481,7 @@ index e688949fc2f3031dc9c9817bc59554e9f5a436af..20cfdba68c200e87d00995a6a4e25a5f public boolean trackDeltas() { return this != EntityType.PLAYER && this != EntityType.LLAMA_SPIT && this != EntityType.WITHER && this != EntityType.BAT && this != EntityType.ITEM_FRAME && this != EntityType.GLOW_ITEM_FRAME && this != EntityType.LEASH_KNOT && this != EntityType.PAINTING && this != EntityType.END_CRYSTAL && this != EntityType.EVOKER_FANGS; } -@@ -656,7 +677,7 @@ public class EntityType implements EntityTypeTest { +@@ -666,7 +687,7 @@ public class EntityType implements EntityTypeTest { Util.fetchChoiceType(References.ENTITY_TREE, id); } @@ -1504,10 +1491,10 @@ index e688949fc2f3031dc9c9817bc59554e9f5a436af..20cfdba68c200e87d00995a6a4e25a5f } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index a3b6883d7fc856ed8550ffb7aa8dd929922853e2..59bb2aafcbc1a4a5c963ef0391b4e9b4f670ff72 100644 +index c94c62e7e32f55d322ddfed930e1aaa6c1343b29..d9244b1d0ac1ae52aa9692884260cce5e2bc74bb 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -137,7 +137,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; +@@ -139,7 +139,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; // CraftBukkit end @@ -1516,7 +1503,7 @@ index a3b6883d7fc856ed8550ffb7aa8dd929922853e2..59bb2aafcbc1a4a5c963ef0391b4e9b4 public abstract class LivingEntity extends Entity { -@@ -2759,7 +2759,6 @@ public abstract class LivingEntity extends Entity { +@@ -2762,7 +2762,6 @@ public abstract class LivingEntity extends Entity { @Override public void tick() { @@ -1524,7 +1511,7 @@ index a3b6883d7fc856ed8550ffb7aa8dd929922853e2..59bb2aafcbc1a4a5c963ef0391b4e9b4 super.tick(); this.updatingUsingItem(); this.updateSwimAmount(); -@@ -2800,9 +2799,7 @@ public abstract class LivingEntity extends Entity { +@@ -2803,9 +2802,7 @@ public abstract class LivingEntity extends Entity { } } @@ -1534,7 +1521,7 @@ index a3b6883d7fc856ed8550ffb7aa8dd929922853e2..59bb2aafcbc1a4a5c963ef0391b4e9b4 double d0 = this.getX() - this.xo; double d1 = this.getZ() - this.zo; float f = (float) (d0 * d0 + d1 * d1); -@@ -2882,8 +2879,6 @@ public abstract class LivingEntity extends Entity { +@@ -2885,8 +2882,6 @@ public abstract class LivingEntity extends Entity { if (this.isSleeping()) { this.setXRot(0.0F); } @@ -1543,7 +1530,7 @@ index a3b6883d7fc856ed8550ffb7aa8dd929922853e2..59bb2aafcbc1a4a5c963ef0391b4e9b4 } public void detectEquipmentUpdates() { -@@ -3065,7 +3060,6 @@ public abstract class LivingEntity extends Entity { +@@ -3068,7 +3063,6 @@ public abstract class LivingEntity extends Entity { this.setDeltaMovement(d4, d5, d6); this.level.getProfiler().push("ai"); @@ -1551,7 +1538,7 @@ index a3b6883d7fc856ed8550ffb7aa8dd929922853e2..59bb2aafcbc1a4a5c963ef0391b4e9b4 if (this.isImmobile()) { this.jumping = false; this.xxa = 0.0F; -@@ -3075,7 +3069,6 @@ public abstract class LivingEntity extends Entity { +@@ -3078,7 +3072,6 @@ public abstract class LivingEntity extends Entity { this.serverAiStep(); this.level.getProfiler().pop(); } @@ -1559,7 +1546,7 @@ index a3b6883d7fc856ed8550ffb7aa8dd929922853e2..59bb2aafcbc1a4a5c963ef0391b4e9b4 this.level.getProfiler().pop(); this.level.getProfiler().push("jump"); -@@ -3110,9 +3103,9 @@ public abstract class LivingEntity extends Entity { +@@ -3113,9 +3106,9 @@ public abstract class LivingEntity extends Entity { this.updateFallFlying(); AABB axisalignedbb = this.getBoundingBox(); @@ -1571,7 +1558,7 @@ index a3b6883d7fc856ed8550ffb7aa8dd929922853e2..59bb2aafcbc1a4a5c963ef0391b4e9b4 this.level.getProfiler().pop(); this.level.getProfiler().push("freezing"); boolean flag1 = this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES); -@@ -3141,9 +3134,7 @@ public abstract class LivingEntity extends Entity { +@@ -3144,9 +3137,7 @@ public abstract class LivingEntity extends Entity { this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox()); } @@ -1582,10 +1569,10 @@ index a3b6883d7fc856ed8550ffb7aa8dd929922853e2..59bb2aafcbc1a4a5c963ef0391b4e9b4 if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { this.hurt(DamageSource.DROWN, 1.0F); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index ff001049d71127a0b9e7a9d73996be02ec0ad044..72fd18a307a7e1f769195c7ef44a12bb47f2f49c 100644 +index 47f625a30f3f2aa95d94f571abf5af95eee68912..d097223e30de74d5347792fb6d0eecb254099f73 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -83,7 +83,6 @@ import org.bukkit.Bukkit; +@@ -81,7 +81,6 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; @@ -1593,7 +1580,7 @@ index ff001049d71127a0b9e7a9d73996be02ec0ad044..72fd18a307a7e1f769195c7ef44a12bb import org.bukkit.craftbukkit.block.CapturedBlockState; import org.bukkit.craftbukkit.block.CraftBlockState; import org.bukkit.craftbukkit.block.data.CraftBlockData; -@@ -149,7 +148,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -147,7 +146,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper @@ -1602,7 +1589,7 @@ index ff001049d71127a0b9e7a9d73996be02ec0ad044..72fd18a307a7e1f769195c7ef44a12bb public static BlockPos lastPhysicsProblem; // Spigot private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter tileLimiter; -@@ -239,7 +238,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -238,7 +237,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {} }); // CraftBukkit end @@ -1611,7 +1598,7 @@ index ff001049d71127a0b9e7a9d73996be02ec0ad044..72fd18a307a7e1f769195c7ef44a12bb this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } -@@ -728,15 +727,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -727,15 +726,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { timings.tileEntityTick.stopTiming(); // Spigot this.tickingBlockEntities = false; @@ -1629,10 +1616,10 @@ index ff001049d71127a0b9e7a9d73996be02ec0ad044..72fd18a307a7e1f769195c7ef44a12bb CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking entity"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being ticked"); diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index c9e6cb9f5c3eae53140236e09768ff759e27ace0..5147f67c87ba3b8912a8ae24f876a9e996504600 100644 +index e72f44910f7390da9e2d78c5bb8f14d5abf9562b..54125cf5957f8165551e077c47d02b7daa578efb 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -88,6 +88,15 @@ public class Block extends BlockBehaviour implements ItemLike { +@@ -89,6 +89,15 @@ public class Block extends BlockBehaviour implements ItemLike { public static final int UPDATE_LIMIT = 512; protected final StateDefinition stateDefinition; private BlockState defaultBlockState; @@ -1649,7 +1636,7 @@ index c9e6cb9f5c3eae53140236e09768ff759e27ace0..5147f67c87ba3b8912a8ae24f876a9e9 private String descriptionId; @Nullable diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -index d33c2d2ec285179614d21a255cea394682e4cc2c..65aedffad9bef4ab80eb835e9c05b6d411f6bb15 100644 +index 53a8e9a63b2ea5f698acbd80b2eca9e3e3cfedb8..a35e3f54cbec83e8c691b6f61d4e1ac1ece6156d 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java @@ -22,10 +22,12 @@ import org.bukkit.inventory.InventoryHolder; @@ -1667,7 +1654,7 @@ index d33c2d2ec285179614d21a255cea394682e4cc2c..65aedffad9bef4ab80eb835e9c05b6d4 private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); public CraftPersistentDataContainer persistentDataContainer; 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 f263022e1d15e78b51cfd148cf024b9a8c761898..52eda58a085d0a7b6329dd4791e05edf2f644df3 100644 +index 73a99db6c31dec822514392a6102b7f8cc3b2738..5496c9ae4af9658164098356532da47351808b51 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -661,6 +661,7 @@ public class LevelChunk extends ChunkAccess { @@ -1687,10 +1674,10 @@ index f263022e1d15e78b51cfd148cf024b9a8c761898..52eda58a085d0a7b6329dd4791e05edf } } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index ed639dbb4ea94839390778654c7dd0437bac41ac..1729af83b979e35a585c8d049b14dc23ddf23803 100644 +index 95abf42577725383a2b49242c28b81beef487ee5..4e5cfc508e356691a9a249013553f97e77c213b0 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -488,13 +488,10 @@ public class ChunkSerializer { +@@ -490,13 +490,10 @@ public class ChunkSerializer { ListTag nbttaglist1 = ChunkSerializer.getListOfCompoundsOrNull(nbt, "block_entities"); return nbttaglist == null && nbttaglist1 == null ? null : (chunk) -> { @@ -1704,7 +1691,7 @@ index ed639dbb4ea94839390778654c7dd0437bac41ac..1729af83b979e35a585c8d049b14dc23 if (nbttaglist1 != null) { for (int i = 0; i < nbttaglist1.size(); ++i) { CompoundTag nbttagcompound1 = nbttaglist1.getCompound(i); -@@ -512,7 +509,6 @@ public class ChunkSerializer { +@@ -514,7 +511,6 @@ public class ChunkSerializer { } } } @@ -1713,10 +1700,10 @@ index ed639dbb4ea94839390778654c7dd0437bac41ac..1729af83b979e35a585c8d049b14dc23 }; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 355a6af98163079bc60c77d6fb88cd7023264a1b..20d80a7320c6ab9f9e9bd245c4a6e0542b670758 100644 +index eac877cda0cd37d8717c770b86b590213ee0567e..14b028b75470b164e64a60cc47a2938ba54b3652 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2288,12 +2288,31 @@ public final class CraftServer implements Server { +@@ -2280,12 +2280,31 @@ public final class CraftServer implements Server { private final org.bukkit.Server.Spigot spigot = new org.bukkit.Server.Spigot() { @@ -2114,7 +2101,7 @@ index e52ef47b783785dc214746b678e7b549aea9a274..3d90b3426873a3528af14f7f1ab0adae this.value = value; } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 8cb510615bc8b4638b4aadfd9732c9a3d65b1fac..e0ba1608d83c6007717df3323b916a92906f5a17 100644 +index bc89c976e763ec137066f8517dbcc1a3d43303bd..c7a8e3b4ff46727d7f186497ff0288284eaa6d3b 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -182,6 +182,12 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0011-Add-command-line-option-to-load-extra-plugin-jars-no.patch b/patches/server/0011-Add-command-line-option-to-load-extra-plugin-jars-no.patch index b7607423b..3dc766b22 100644 --- a/patches/server/0011-Add-command-line-option-to-load-extra-plugin-jars-no.patch +++ b/patches/server/0011-Add-command-line-option-to-load-extra-plugin-jars-no.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Add command line option to load extra plugin jars not in the ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 20d80a7320c6ab9f9e9bd245c4a6e0542b670758..c9521d383c77eab823072c0d7569b76b75678d28 100644 +index 14b028b75470b164e64a60cc47a2938ba54b3652..1fe657645c118bc381aeeda0265893a3d4644025 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -402,10 +402,15 @@ public final class CraftServer implements Server { +@@ -398,10 +398,15 @@ public final class CraftServer implements Server { public void loadPlugins() { this.pluginManager.registerInterface(JavaPluginLoader.class); @@ -29,7 +29,7 @@ index 20d80a7320c6ab9f9e9bd245c4a6e0542b670758..c9521d383c77eab823072c0d7569b76b for (Plugin plugin : plugins) { try { String message = String.format("Loading %s", plugin.getDescription().getFullName()); -@@ -420,6 +425,35 @@ public final class CraftServer implements Server { +@@ -416,6 +421,35 @@ public final class CraftServer implements Server { } } @@ -66,7 +66,7 @@ index 20d80a7320c6ab9f9e9bd245c4a6e0542b670758..c9521d383c77eab823072c0d7569b76b if (type == PluginLoadOrder.STARTUP) { this.helpMap.clear(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 399e878210606e9addb535e4efed0ddb424160e8..707544dfd83839634dc4c1afc8e21c5c6c3d8140 100644 +index 70aa37fe043f56ef1b2f722ca946c4ac2cf4a98b..cf85183a4026fca981fcb44896d7210b5fc31c2f 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -136,6 +136,12 @@ public class Main { diff --git a/patches/server/0012-Adventure.patch b/patches/server/0012-Adventure.patch index 2549aab06..66087b2ec 100644 --- a/patches/server/0012-Adventure.patch +++ b/patches/server/0012-Adventure.patch @@ -7,7 +7,7 @@ Co-authored-by: zml Co-authored-by: Jake Potrebic diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 756a2ab6ad416f55fa3864cff9818473840b04fc..701a2ffd04df48d437b2cb963dd150af99725b6e 100644 +index cc4c008a99bf5a16614d445d2a5e75ce2d5dedb5..043fd38598e36bb96e6d3ab1ab0966435c9aa61b 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -225,4 +225,13 @@ public class PaperConfig { @@ -1045,10 +1045,10 @@ index d5d94ea8070ab5f66f0a3244a5a953b9c9d5c527..0053474ab7c25de6d86c16e3079feb21 public > T readEnum(Class enumClass) { diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index b964121f19e6a28df7675e65441c551a55316753..dfeff0da932b0d66b70f3a5dd281c926c048f2f0 100644 +index 021a26a6b1c258deffc26c035ab52a4ea027d9a1..00d432bd395e7f7fb6ee24e371818d13892b2f0c 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java -@@ -3,6 +3,7 @@ package net.minecraft.network; +@@ -4,6 +4,7 @@ import com.mojang.logging.LogUtils; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToByteEncoder; @@ -1056,7 +1056,7 @@ index b964121f19e6a28df7675e65441c551a55316753..dfeff0da932b0d66b70f3a5dd281c926 import java.io.IOException; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketFlow; -@@ -36,6 +37,7 @@ public class PacketEncoder extends MessageToByteEncoder> { +@@ -33,6 +34,7 @@ public class PacketEncoder extends MessageToByteEncoder> { } else { FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf); friendlyByteBuf.writeVarInt(integer); @@ -1218,7 +1218,7 @@ index 762a9392ffac3042356709dddd15bb3516048bed..3544e2dc2522e9d6305d727d56e73490 buf.writeComponent(this.footer); } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 925ffbddd5475be7fe00570d861b615f707434b4..a3436596d05547a60c9906c92f709bb56a9175bd 100644 +index 9d7d7a44616b2b7849c1abd3b9ac77305fdb0815..592b288c5ded992dc3fdf0db5ed0845884c5be93 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -145,6 +145,7 @@ import net.minecraft.world.scores.Score; @@ -1292,11 +1292,11 @@ index 925ffbddd5475be7fe00570d861b615f707434b4..a3436596d05547a60c9906c92f709bb5 // CraftBukkit end this.chatVisibility = packet.chatVisibility(); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ea652f6394c7e575ce06a6b691d8b2c442eafb03..306af349e96967d21ee0dda9cac04d4507bf5b00 100644 +index 443124a72eef9f60e2941b932a13471dbf1c4f72..9b47d8ab57c3b290173247ba25ad7668f3529903 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -154,6 +154,8 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -155,6 +155,8 @@ import org.apache.commons.lang3.StringUtils; + import org.slf4j.Logger; // CraftBukkit start +import io.papermc.paper.adventure.ChatProcessor; // Paper @@ -1304,7 +1304,7 @@ index ea652f6394c7e575ce06a6b691d8b2c442eafb03..306af349e96967d21ee0dda9cac04d45 import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicInteger; import net.minecraft.world.entity.animal.Bucketable; -@@ -382,21 +384,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -383,21 +385,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser return this.server.isSingleplayerOwner(this.player.getGameProfile()); } @@ -1337,7 +1337,7 @@ index ea652f6394c7e575ce06a6b691d8b2c442eafb03..306af349e96967d21ee0dda9cac04d45 if (this.cserver.getServer().isRunning()) { this.cserver.getPluginManager().callEvent(event); -@@ -407,8 +412,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -408,8 +413,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser return; } // Send the possibly modified leave message @@ -1347,7 +1347,7 @@ index ea652f6394c7e575ce06a6b691d8b2c442eafb03..306af349e96967d21ee0dda9cac04d45 // CraftBukkit end this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), (future) -> { -@@ -1669,9 +1673,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1684,9 +1688,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser */ this.player.disconnect(); @@ -1362,7 +1362,7 @@ index ea652f6394c7e575ce06a6b691d8b2c442eafb03..306af349e96967d21ee0dda9cac04d45 } // CraftBukkit end this.player.getTextFilter().leave(); -@@ -1853,7 +1859,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1868,7 +1874,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.handleCommand(s); } else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { // Do nothing, this is coming from a plugin @@ -1376,7 +1376,7 @@ index ea652f6394c7e575ce06a6b691d8b2c442eafb03..306af349e96967d21ee0dda9cac04d45 Player player = this.getCraftPlayer(); AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server)); this.cserver.getPluginManager().callEvent(event); -@@ -2643,30 +2654,30 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2667,30 +2678,30 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser return; } @@ -1416,18 +1416,10 @@ index ea652f6394c7e575ce06a6b691d8b2c442eafb03..306af349e96967d21ee0dda9cac04d45 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 8cf42a52732301d0216a348f588d58877d60cb0d..08e7fd48514f9a6e89efc0d8adcbcf14bc92b103 100644 +index 2b9b60c0010069916dbecd22efdb9cec71180363..627931ec09bfb1a84f0659981491cf3b6425aa32 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -36,6 +36,7 @@ import net.minecraft.world.entity.player.Player; - import org.apache.commons.lang3.Validate; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -+import io.papermc.paper.adventure.PaperAdventure; // Paper - import org.bukkit.craftbukkit.util.Waitable; - import org.bukkit.event.player.AsyncPlayerPreLoginEvent; - import org.bukkit.event.player.PlayerPreLoginEvent; -@@ -316,7 +317,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -323,7 +323,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) { final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId); if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) { @@ -1436,18 +1428,18 @@ index 8cf42a52732301d0216a348f588d58877d60cb0d..08e7fd48514f9a6e89efc0d8adcbcf14 } Waitable waitable = new Waitable() { @Override -@@ -327,12 +328,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -334,12 +334,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener ServerLoginPacketListenerImpl.this.server.processQueue.add(waitable); if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { - ServerLoginPacketListenerImpl.this.disconnect(event.getKickMessage()); -+ ServerLoginPacketListenerImpl.this.disconnect(PaperAdventure.asVanilla(event.kickMessage())); // Paper - Adventure ++ ServerLoginPacketListenerImpl.this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.kickMessage())); // Paper - Adventure return; } } else { if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) { - ServerLoginPacketListenerImpl.this.disconnect(asyncEvent.getKickMessage()); -+ ServerLoginPacketListenerImpl.this.disconnect(PaperAdventure.asVanilla(asyncEvent.kickMessage())); // Paper - Adventure ++ ServerLoginPacketListenerImpl.this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(asyncEvent.kickMessage())); // Paper - Adventure return; } } @@ -1465,10 +1457,10 @@ index c9a8d64ef23def0ad8e986a97c34331b8d54c205..2b24a41587fbe1fba70a0ab42d3dc333 @Override diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 1be4b3ad18d314b0460ce61e01afd0d7d16aee69..96e1618a55597b0a3ac533a3610ba146395b5725 100644 +index 5fa0ce6a7f6b8df8993315a9784764f57d59bcf4..bfec1beb0af39e2af6be7c6423bf1eaab32e1062 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -8,6 +8,7 @@ import com.mojang.authlib.GameProfile; +@@ -9,6 +9,7 @@ import com.mojang.logging.LogUtils; import com.mojang.serialization.DataResult; import com.mojang.serialization.Dynamic; import io.netty.buffer.Unpooled; @@ -1476,8 +1468,8 @@ index 1be4b3ad18d314b0460ce61e01afd0d7d16aee69..96e1618a55597b0a3ac533a3610ba146 import java.io.File; import java.net.SocketAddress; import java.nio.file.Path; -@@ -91,6 +92,7 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -91,6 +92,7 @@ import net.minecraft.world.scores.Team; + import org.slf4j.Logger; // CraftBukkit start +import io.papermc.paper.adventure.PaperAdventure; // Paper @@ -1589,7 +1581,7 @@ index 1be4b3ad18d314b0460ce61e01afd0d7d16aee69..96e1618a55597b0a3ac533a3610ba146 // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/BossEvent.java b/src/main/java/net/minecraft/world/BossEvent.java -index d289e8321a62f7c8d1e5b83f038e7331a26fc24e..58716ba8f8d12a410bdc66ccef6a61c62fddfbb7 100644 +index 4c62df5a3781ec9df4a5c5f1b528649e6e8a62d1..affd1b8c7589ba59330dc0b6fc803cce4ee57397 100644 --- a/src/main/java/net/minecraft/world/BossEvent.java +++ b/src/main/java/net/minecraft/world/BossEvent.java @@ -13,6 +13,7 @@ public abstract class BossEvent { @@ -1618,9 +1610,9 @@ index d289e8321a62f7c8d1e5b83f038e7331a26fc24e..58716ba8f8d12a410bdc66ccef6a61c6 return this.progress; } - public void setProgress(float percentage) { -+ if (this.adventure != null) this.adventure.progress(percentage); // Paper - this.progress = percentage; + public void setProgress(float percent) { ++ if (this.adventure != null) this.adventure.progress(percent); // Paper + this.progress = percent; } public BossEvent.BossBarColor getColor() { @@ -1677,11 +1669,11 @@ index d289e8321a62f7c8d1e5b83f038e7331a26fc24e..58716ba8f8d12a410bdc66ccef6a61c6 } diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index 9af14095fa8dbc75fadb84c5a1d263039994e441..3b35ec1df648a3de920ea0c15962388044737bbc 100644 +index 595b56b2ab9a813ba71399d306117294fa90dc65..3527d40102d512d0e276edc969ea3c189aa34ec2 100644 --- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -@@ -33,6 +33,7 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -33,6 +33,7 @@ import net.minecraft.world.level.saveddata.SavedData; + import org.slf4j.Logger; // CraftBukkit start +import io.papermc.paper.adventure.PaperAdventure; // Paper @@ -1698,10 +1690,10 @@ index 9af14095fa8dbc75fadb84c5a1d263039994e441..3b35ec1df648a3de920ea0c159623880 } collection = icons; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c9521d383c77eab823072c0d7569b76b75678d28..66bceb7bd8aa4aa1d398d4d011d59f8441276c7b 100644 +index 1fe657645c118bc381aeeda0265893a3d4644025..e577c2fb100c217faeaf2d85d6a4374d6de047e1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -623,8 +623,10 @@ public final class CraftServer implements Server { +@@ -619,8 +619,10 @@ public final class CraftServer implements Server { } @Override @@ -1712,7 +1704,7 @@ index c9521d383c77eab823072c0d7569b76b75678d28..66bceb7bd8aa4aa1d398d4d011d59f84 } @Override -@@ -1457,7 +1459,15 @@ public final class CraftServer implements Server { +@@ -1449,7 +1451,15 @@ public final class CraftServer implements Server { return this.configuration.getInt("settings.spawn-radius", -1); } @@ -1728,7 +1720,7 @@ index c9521d383c77eab823072c0d7569b76b75678d28..66bceb7bd8aa4aa1d398d4d011d59f84 public String getShutdownMessage() { return this.configuration.getString("settings.shutdown-message"); } -@@ -1615,7 +1625,20 @@ public final class CraftServer implements Server { +@@ -1607,7 +1617,20 @@ public final class CraftServer implements Server { } @Override @@ -1749,7 +1741,7 @@ index c9521d383c77eab823072c0d7569b76b75678d28..66bceb7bd8aa4aa1d398d4d011d59f84 Set recipients = new HashSet<>(); for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) { if (permissible instanceof CommandSender && permissible.hasPermission(permission)) { -@@ -1623,14 +1646,14 @@ public final class CraftServer implements Server { +@@ -1615,14 +1638,14 @@ public final class CraftServer implements Server { } } @@ -1766,7 +1758,7 @@ index c9521d383c77eab823072c0d7569b76b75678d28..66bceb7bd8aa4aa1d398d4d011d59f84 for (CommandSender recipient : recipients) { recipient.sendMessage(message); -@@ -1881,6 +1904,14 @@ public final class CraftServer implements Server { +@@ -1873,6 +1896,14 @@ public final class CraftServer implements Server { return CraftInventoryCreator.INSTANCE.createInventory(owner, type); } @@ -1781,7 +1773,7 @@ index c9521d383c77eab823072c0d7569b76b75678d28..66bceb7bd8aa4aa1d398d4d011d59f84 @Override public Inventory createInventory(InventoryHolder owner, InventoryType type, String title) { Validate.isTrue(type.isCreatable(), "Cannot open an inventory of type ", type); -@@ -1893,13 +1924,28 @@ public final class CraftServer implements Server { +@@ -1885,13 +1916,28 @@ public final class CraftServer implements Server { return CraftInventoryCreator.INSTANCE.createInventory(owner, size); } @@ -1810,7 +1802,7 @@ index c9521d383c77eab823072c0d7569b76b75678d28..66bceb7bd8aa4aa1d398d4d011d59f84 public Merchant createMerchant(String title) { return new CraftMerchantCustom(title == null ? InventoryType.MERCHANT.getDefaultTitle() : title); } -@@ -1959,6 +2005,12 @@ public final class CraftServer implements Server { +@@ -1951,6 +1997,12 @@ public final class CraftServer implements Server { return Thread.currentThread().equals(console.serverThread) || this.console.hasStopped() || !org.spigotmc.AsyncCatcher.enabled; // All bets are off if we have shut down (e.g. due to watchdog) } @@ -1823,7 +1815,7 @@ index c9521d383c77eab823072c0d7569b76b75678d28..66bceb7bd8aa4aa1d398d4d011d59f84 @Override public String getMotd() { return this.console.getMotd(); -@@ -2402,5 +2454,15 @@ public final class CraftServer implements Server { +@@ -2394,5 +2446,15 @@ public final class CraftServer implements Server { return null; } } @@ -1840,10 +1832,10 @@ index c9521d383c77eab823072c0d7569b76b75678d28..66bceb7bd8aa4aa1d398d4d011d59f84 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 962ee738a4cce4d3bd87bfb9b481c6f158ee9756..1d0c745673bfb14966c6d644825604260f2bc69f 100644 +index 794ed40db102370338ee227ffa4e1801fd741284..5963fa56e7dcd61336a14fa1035c6c14143989ad 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -139,6 +139,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -142,6 +142,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { private final BlockMetadataStore blockMetadata = new BlockMetadataStore(this); private final Object2IntOpenHashMap spawnCategoryLimit = new Object2IntOpenHashMap<>(); private final CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftWorld.DATA_TYPE_REGISTRY); @@ -1851,7 +1843,7 @@ index 962ee738a4cce4d3bd87bfb9b481c6f158ee9756..1d0c745673bfb14966c6d64482560426 private static final Random rand = new Random(); -@@ -1859,4 +1860,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1862,4 +1863,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { return this.spigot; } // Spigot end @@ -1871,7 +1863,7 @@ index 962ee738a4cce4d3bd87bfb9b481c6f158ee9756..1d0c745673bfb14966c6d64482560426 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 707544dfd83839634dc4c1afc8e21c5c6c3d8140..c508bfb68bb4bfd06aa0cefa5bfc0bec725a6b03 100644 +index cf85183a4026fca981fcb44896d7210b5fc31c2f..7e5fc58f43836edab3696b9644264434c5a95a2f 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -19,6 +19,12 @@ public class Main { @@ -3520,7 +3512,7 @@ index f9b7b8f7ccc95b73967a51420fd6ce88d80d75fe..0de5a46423ae0403dcbfca630dfd7c5a boolean hadFormat = false; diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index e0ba1608d83c6007717df3323b916a92906f5a17..aea6f16d767a7cc7934688b550376338c63fd807 100644 +index c7a8e3b4ff46727d7f186497ff0288284eaa6d3b..964d15cd3b61a33868e5a9e38d21d97ec144bcad 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -66,6 +66,38 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0013-Configurable-cactus-bamboo-and-reed-growth-heights.patch b/patches/server/0013-Configurable-cactus-bamboo-and-reed-growth-heights.patch index 94ed00ecd..43e88d37d 100644 --- a/patches/server/0013-Configurable-cactus-bamboo-and-reed-growth-heights.patch +++ b/patches/server/0013-Configurable-cactus-bamboo-and-reed-growth-heights.patch @@ -28,10 +28,10 @@ index 4adf44026fc6269934dfa4513f06a7f8a3b41f90..791ccdebd5d37afd83eb87671034b355 + } } diff --git a/src/main/java/net/minecraft/world/level/block/BambooBlock.java b/src/main/java/net/minecraft/world/level/block/BambooBlock.java -index 517140666109ae27177c70ca0a41b0a9f636c9c6..1f2d9ae9593193b478375b7b03d6f9fda80a8bca 100644 +index f088f866b8f28d2627e4a60527a1f8dfa243bb47..482d6cd1065df5b0703301d403efb42ca4d5363b 100644 --- a/src/main/java/net/minecraft/world/level/block/BambooBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BambooBlock.java -@@ -136,7 +136,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -135,7 +135,7 @@ public class BambooBlock extends Block implements BonemealableBlock { if (random.nextInt(Math.max(1, (int) (100.0F / world.spigotConfig.bambooModifier) * 3)) == 0 && world.isEmptyBlock(pos.above()) && world.getRawBrightness(pos.above(), 0) >= 9) { // Spigot int i = this.getHeightBelowUpToMax(world, pos) + 1; @@ -40,7 +40,7 @@ index 517140666109ae27177c70ca0a41b0a9f636c9c6..1f2d9ae9593193b478375b7b03d6f9fd this.growBamboo(state, world, pos, random, i); } } -@@ -167,7 +167,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -166,7 +166,7 @@ public class BambooBlock extends Block implements BonemealableBlock { int i = this.getHeightAboveUpToMax(world, pos); int j = this.getHeightBelowUpToMax(world, pos); @@ -49,7 +49,7 @@ index 517140666109ae27177c70ca0a41b0a9f636c9c6..1f2d9ae9593193b478375b7b03d6f9fd } @Override -@@ -186,7 +186,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -185,7 +185,7 @@ public class BambooBlock extends Block implements BonemealableBlock { BlockPos blockposition1 = pos.above(i); BlockState iblockdata1 = world.getBlockState(blockposition1); @@ -58,7 +58,7 @@ index 517140666109ae27177c70ca0a41b0a9f636c9c6..1f2d9ae9593193b478375b7b03d6f9fd return; } -@@ -227,7 +227,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -226,7 +226,7 @@ public class BambooBlock extends Block implements BonemealableBlock { } int j = (Integer) state.getValue(BambooBlock.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1; @@ -67,7 +67,7 @@ index 517140666109ae27177c70ca0a41b0a9f636c9c6..1f2d9ae9593193b478375b7b03d6f9fd // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, pos.above(), (BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(BambooBlock.AGE, j)).setValue(BambooBlock.LEAVES, blockpropertybamboosize)).setValue(BambooBlock.STAGE, k), 3)) { -@@ -242,7 +242,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -241,7 +241,7 @@ public class BambooBlock extends Block implements BonemealableBlock { protected int getHeightAboveUpToMax(BlockGetter world, BlockPos pos) { int i; @@ -76,7 +76,7 @@ index 517140666109ae27177c70ca0a41b0a9f636c9c6..1f2d9ae9593193b478375b7b03d6f9fd ; } -@@ -252,7 +252,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -251,7 +251,7 @@ public class BambooBlock extends Block implements BonemealableBlock { protected int getHeightBelowUpToMax(BlockGetter world, BlockPos pos) { int i; @@ -86,10 +86,10 @@ index 517140666109ae27177c70ca0a41b0a9f636c9c6..1f2d9ae9593193b478375b7b03d6f9fd } diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java -index a851df8e25781963edb066c46ae75a87ef63a66d..00ada22889dafb7ae8e8740cd3eb8370fbb417eb 100644 +index b6b769fb354187cb31f878b87cce63049c0c7cf8..f1bbfc85582d29a50a82f9207509985dcb76b693 100644 --- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java -@@ -56,7 +56,7 @@ public class CactusBlock extends Block { +@@ -55,7 +55,7 @@ public class CactusBlock extends Block { ; } @@ -99,10 +99,10 @@ index a851df8e25781963edb066c46ae75a87ef63a66d..00ada22889dafb7ae8e8740cd3eb8370 if (j >= (byte) range(3, ((100.0F / world.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot diff --git a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java -index f57884fa5f0fbbdbf35c22e692da4f9b6f3f98cc..9b30b359f1559e5f97c3b2a7acffda5b39605e6b 100644 +index d40492e9729f165ed944ab2c9fa81cde042ce49c..66c06e0f7c8d223a2b00bab57a15e3a705fe176a 100644 --- a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java -@@ -53,7 +53,7 @@ public class SugarCaneBlock extends Block { +@@ -52,7 +52,7 @@ public class SugarCaneBlock extends Block { ; } diff --git a/patches/server/0015-Configurable-fishing-time-ranges.patch b/patches/server/0015-Configurable-fishing-time-ranges.patch index d392e44e3..9b62e01db 100644 --- a/patches/server/0015-Configurable-fishing-time-ranges.patch +++ b/patches/server/0015-Configurable-fishing-time-ranges.patch @@ -22,10 +22,10 @@ index ec3fb557fa31b153de20c4990066182a774dd489..5896b4e4646d722db5622a424fa26f42 + } } diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index 73c5a0e6f1db6bf438fe516e213f40f0645ed954..b11f97e4ecc8d623d8a8a69e9e7a6205b96072f1 100644 +index 67fe1a436ca7b0069fabc3a1bfd0206babf07b8a..24192a91d9f5c890a316ec150d4aec84073cb61a 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -@@ -82,6 +82,10 @@ public class FishingHook extends Projectile { +@@ -85,6 +85,10 @@ public class FishingHook extends Projectile { this.noCulling = true; this.luck = Math.max(0, luckOfTheSeaLevel); this.lureSpeed = Math.max(0, lureLevel); @@ -36,7 +36,7 @@ index 73c5a0e6f1db6bf438fe516e213f40f0645ed954..b11f97e4ecc8d623d8a8a69e9e7a6205 } public FishingHook(EntityType type, Level world) { -@@ -397,7 +401,7 @@ public class FishingHook extends Projectile { +@@ -400,7 +404,7 @@ public class FishingHook extends Projectile { } else { // CraftBukkit start - logic to modify fishing wait time this.timeUntilLured = Mth.nextInt(this.random, this.minWaitTime, this.maxWaitTime); diff --git a/patches/server/0016-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/patches/server/0016-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch index ad53f41d0..6da6ebc0b 100644 --- a/patches/server/0016-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch +++ b/patches/server/0016-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch @@ -19,10 +19,10 @@ index 5896b4e4646d722db5622a424fa26f42d3f8d9ff..0a6e98ca5534430540044a32c280e568 + } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 68ccbc193ff6682f505928dc0a29ee990349d299..3321df3bcc0b92277dc18b7f6efa42393e657a52 100644 +index 04692fe4e7f2107ffc8c48cebdf88e18e58f4ce9..8a4f4582a6bd69016a36d611f9c4ac2262f7f3ec 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1265,6 +1265,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1278,6 +1278,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i return this.isInWater() || this.isInRain(); } @@ -31,7 +31,7 @@ index 68ccbc193ff6682f505928dc0a29ee990349d299..3321df3bcc0b92277dc18b7f6efa4239 return this.isInWater() || this.isInRain() || this.isInBubbleColumn(); } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 31f98763da600c34246d722cb92dda4442a3f046..1703bc12cd2c04fb34ebe025f305dc7fb2de1864 100644 +index 711c130a6d725d8a7f2a77e74b51c6123d7856d2..84ac8d7dca08495c2d1be9901c59546245a84c11 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -105,6 +105,7 @@ public abstract class Mob extends LivingEntity { diff --git a/patches/server/0018-Allow-for-toggling-of-spawn-chunks.patch b/patches/server/0018-Allow-for-toggling-of-spawn-chunks.patch index a5337bb7b..da729250d 100644 --- a/patches/server/0018-Allow-for-toggling-of-spawn-chunks.patch +++ b/patches/server/0018-Allow-for-toggling-of-spawn-chunks.patch @@ -20,10 +20,10 @@ index 6ee62d06cc2b59c06d0f7acfb59384075aa6521c..9b908c5c66dc454faa479430a908dda0 + } } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 72fd18a307a7e1f769195c7ef44a12bb47f2f49c..3914d0e21b36a480c68c091478ab282826d2b1ae 100644 +index d097223e30de74d5347792fb6d0eecb254099f73..1cb128fb60636016db826ab3120d586346d88cec 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -239,6 +239,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -238,6 +238,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { }); // CraftBukkit end timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings diff --git a/patches/server/0019-Drop-falling-block-and-tnt-entities-at-the-specified.patch b/patches/server/0019-Drop-falling-block-and-tnt-entities-at-the-specified.patch index fb63af439..760b6c69a 100644 --- a/patches/server/0019-Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ b/patches/server/0019-Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -25,10 +25,10 @@ index 9b908c5c66dc454faa479430a908dda0745638c8..6dec1bb96d695f28aae6517e4d782491 + } } diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index a292a449deb820ce1d7cbeb5d04702b10643ee50..1cc849fadd1e1cf4ef1d1009c8e42febe92a6e28 100644 +index eb67ba3ce1ea68eb5db62f68bf48853fe5023f12..8e7479afd3579e6b732feca059c1e4df1160e450 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -136,6 +136,17 @@ public class FallingBlockEntity extends Entity { +@@ -130,6 +130,17 @@ public class FallingBlockEntity extends Entity { } this.move(MoverType.SELF, this.getDeltaMovement()); @@ -44,7 +44,7 @@ index a292a449deb820ce1d7cbeb5d04702b10643ee50..1cc849fadd1e1cf4ef1d1009c8e42feb + } + // Paper end if (!this.level.isClientSide) { - blockposition = this.blockPosition(); + BlockPos blockposition = this.blockPosition(); boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock; diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java index 9fa752370a43f6d91c019316914a033f213e7126..1f61dcc3d6f33f69fbebaaaee0554403c3e13adf 100644 diff --git a/patches/server/0020-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/0020-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index a285680f9..4ff448a67 100644 --- a/patches/server/0020-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/patches/server/0020-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang diff --git a/src/main/java/net/minecraft/server/Eula.java b/src/main/java/net/minecraft/server/Eula.java -index 2c53a400611c78236c5a1c1270d27c02e94251bf..a1d5c0f8fe2adb2ee56f3217e089211ec7c61eb0 100644 +index f092497b6defd28c94393e483a9288d121158a1e..df44790b1c342d0a6ff794bea86319fa7498cbae 100644 --- a/src/main/java/net/minecraft/server/Eula.java +++ b/src/main/java/net/minecraft/server/Eula.java @@ -64,7 +64,7 @@ public class Eula { @@ -19,10 +19,10 @@ index 2c53a400611c78236c5a1c1270d27c02e94251bf..a1d5c0f8fe2adb2ee56f3217e089211e if (outputStream != null) { try { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index eba857195121c58d1b63c58904fd4754a8020219..6b9d947484f0b55a86c3ee27c199669153c0a5ea 100644 +index aca0adb9f714f96b10546b837d08fe9ef90b4d89..905dbf6bb3fbbdf7b463c9b9baa59f54b83c3687 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1427,7 +1427,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop withinDistance(double x, double y, double z, double max) { double d4 = max * max; diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 07f37c1ca6a98ad8199c873556aac2e9de60fe81..0c0886fe46ad65678a6c6da89659e5991908ba7a 100644 +index 9b06b17c36b76447e75d0d790ba3e352442286da..321276281134ef692f9e50d21a84a135e09a0754 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -774,7 +774,7 @@ public abstract class Mob extends LivingEntity { @@ -34,10 +34,10 @@ index 07f37c1ca6a98ad8199c873556aac2e9de60fe81..0c0886fe46ad65678a6c6da89659e599 if (entityhuman != null) { double d0 = entityhuman.distanceToSqr((Entity) this); diff --git a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java -index 53106d7bbfeaaf52bbe69471e70670412e8bdfd3..195cdae3f3a9fe8ecab2895a6000f6f855e9a9b8 100644 +index 6eaedfabf70b604705ad9a772a2e602c8590b500..97c2c1647fa12650e5963c7c1c746fec2429e3d7 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java +++ b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java -@@ -125,7 +125,7 @@ public class Silverfish extends Monster { +@@ -127,7 +127,7 @@ public class Silverfish extends Monster { if (checkAnyLightMonsterSpawnRules(type, world, spawnReason, pos, random)) { Player entityhuman = world.getNearestPlayer((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, 5.0D, true); @@ -47,10 +47,10 @@ index 53106d7bbfeaaf52bbe69471e70670412e8bdfd3..195cdae3f3a9fe8ecab2895a6000f6f8 return false; } diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index ebe55b9c8e93fec1a1f7efca86d5d3968d1df200..90eb40ee3bf20dcbeb69ead753d424387a0ef42f 100644 +index 612de4e8c26fd41d300ac09eb59d1ceac248778e..71610fa70cdaf3c5a54250a5814809013a6d228e 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -174,6 +174,9 @@ public abstract class Player extends LivingEntity { +@@ -175,6 +175,9 @@ public abstract class Player extends LivingEntity { private final ItemCooldowns cooldowns; @Nullable public FishingHook fishing; @@ -61,7 +61,7 @@ index ebe55b9c8e93fec1a1f7efca86d5d3968d1df200..90eb40ee3bf20dcbeb69ead753d42438 // CraftBukkit start public boolean fauxSleeping; diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index a30780611b6842e35579f0ca11d75161bf365c70..4be2833b03d24e5d87c23f04c248fbe4b0ca9e59 100644 +index 212b23a380a4bcdb1d2995ca2ccfc8a1709691bd..31bfc0c491c9a4cc6782b6c284121f96972517ea 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -51,7 +51,7 @@ public abstract class BaseSpawner { diff --git a/patches/server/0025-Further-improve-server-tick-loop.patch b/patches/server/0025-Further-improve-server-tick-loop.patch index 64dda56b6..3dab3a285 100644 --- a/patches/server/0025-Further-improve-server-tick-loop.patch +++ b/patches/server/0025-Further-improve-server-tick-loop.patch @@ -12,10 +12,10 @@ Previous implementation did not calculate TPS correctly. Switch to a realistic rolling average and factor in std deviation as an extra reporting variable diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6b9d947484f0b55a86c3ee27c199669153c0a5ea..b16c2c8e173d906097ee9ac3edace1334da11a4b 100644 +index 905dbf6bb3fbbdf7b463c9b9baa59f54b83c3687..9f7d562131c7b4e5bf1e5028c6e4734f73b395d8 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -282,7 +282,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; public Commands vanillaCommandDispatcher; -@@ -291,7 +291,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop playerView; public int reloadCount; @@ -17,7 +17,7 @@ index c50fdc09494895eaf6813493bdc6a370089d4240..c77db10a1c33266da8d4578e828ff039 static { ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index fdbcf4989f72e1604a2841f565adfeebf8d45622..1e0b8314ef388763aa43055909e48778f0d421a3 100644 +index fdbcf4989f72e1604a2841f565adfeebf8d45622..4ebd7609ec2bf62586feef4da7605dbb89569567 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -438,10 +438,40 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -25,7 +25,7 @@ index fdbcf4989f72e1604a2841f565adfeebf8d45622..1e0b8314ef388763aa43055909e48778 Preconditions.checkArgument(velocity != null, "velocity"); velocity.checkFinite(); + // Paper start - Warn server owners when plugins try to set super high velocities -+ if (!(this instanceof org.bukkit.entity.Projectile || this instanceof org.bukkit.entity.Minecart) && isUnsafeVelocity(velocity)) { ++ if (!(this instanceof org.bukkit.entity.Projectile) && isUnsafeVelocity(velocity)) { + CraftServer.excessiveVelEx = new Exception("Excessive velocity set detected: tried to set velocity of entity " + entity.getScoreboardName() + " id #" + getEntityId() + " to (" + velocity.getX() + "," + velocity.getY() + "," + velocity.getZ() + ")."); + } + // Paper end diff --git a/patches/server/0056-Add-exception-reporting-event.patch b/patches/server/0056-Add-exception-reporting-event.patch index f3252eb16..43d56e253 100644 --- a/patches/server/0056-Add-exception-reporting-event.patch +++ b/patches/server/0056-Add-exception-reporting-event.patch @@ -49,19 +49,19 @@ index 0000000000000000000000000000000000000000..f699ce18ca044f813e194ef2786b7ea8 + } +} diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 5d1ac4e7afa0f1d9c9face049f768a2030eb411f..85af59ffb6b11ae1980fef5ef449031c78626b9a 100644 +index 9aaf392876119cfda46f3e80d02020d0e748ae44..a10848e6899853f447f101675e3a6aba9d3d43f3 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -919,6 +919,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -973,6 +973,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return true; } catch (Exception exception) { - ChunkMap.LOGGER.error("Failed to save chunk {},{}", chunkcoordintpair.x, chunkcoordintpair.z, exception); + ChunkMap.LOGGER.error("Failed to save chunk {},{}", new Object[]{chunkcoordintpair.x, chunkcoordintpair.z, exception}); + com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper return false; } } diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java -index 38403f62a9539382d5330f9231fe9ef618b87c21..876658b685ea09adb4c01d436da56daadb7eedaa 100644 +index 7b84b20a4de0d6e95a1d47cb077abd0e00a2336c..b7b98832be6178a2bca534bf974519ede977b282 100644 --- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java +++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java @@ -1,5 +1,6 @@ @@ -88,27 +88,19 @@ index 38403f62a9539382d5330f9231fe9ef618b87c21..876658b685ea09adb4c01d436da56daa } // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java -index 4cde8d630a0951f297622af4ef781f5b3fabf9af..7044d8c71e85551e11bf2d96b767e08811bdb9fe 100644 +index 1a9dfd8411bb8affdb3ff4c003433ecab203b004..5e526d0feda11d6b73f71b965aa098e0a79457d1 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java -@@ -1,5 +1,7 @@ - package net.minecraft.world.entity.ai.village; - -+import com.destroystokyo.paper.exception.ServerInternalException; -+ - import java.util.Iterator; - import javax.annotation.Nullable; - import net.minecraft.core.BlockPos; -@@ -118,6 +120,7 @@ public class VillageSiege implements CustomSpawner { +@@ -118,6 +118,7 @@ public class VillageSiege implements CustomSpawner { entityzombie.finalizeSpawn(world, world.getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.EVENT, (SpawnGroupData) null, (CompoundTag) null); } catch (Exception exception) { VillageSiege.LOGGER.warn("Failed to create zombie for village siege at {}", vec3d, exception); -+ ServerInternalException.reportInternalException(exception); // Paper ++ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper return; } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 0e5142f6479787ab26a22b9ec935c3d09a8dfd2c..389cb85aa369dff606b21c10fcbf4825c17bbd4f 100644 +index 922b234865ff5d64049d634d0356f9a068bc8a8c..d923cc91a8f1e71831be8ded1b4818ac3b48fc34 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -1,5 +1,10 @@ @@ -122,7 +114,7 @@ index 0e5142f6479787ab26a22b9ec935c3d09a8dfd2c..389cb85aa369dff606b21c10fcbf4825 import com.google.common.collect.Lists; import com.mojang.serialization.Codec; import java.io.IOException; -@@ -739,6 +744,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -738,6 +743,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Paper start - Prevent tile entity and entity crashes final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level.getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); MinecraftServer.LOGGER.error(msg, throwable); @@ -131,7 +123,7 @@ index 0e5142f6479787ab26a22b9ec935c3d09a8dfd2c..389cb85aa369dff606b21c10fcbf4825 // Paper end } diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 5e2a3baf46175dd92958f47c4503bb8d6f6a0941..373fbdf56dddbae5f793585e31c7e4ff6d31823b 100644 +index 8d4efe65baf28760ee68cecd7ef7c8e65a2912ba..b8666d46e85bc7e9e3a05b4ebd65f59138ac55d1 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -289,6 +289,7 @@ public final class NaturalSpawner { @@ -142,7 +134,7 @@ index 5e2a3baf46175dd92958f47c4503bb8d6f6a0941..373fbdf56dddbae5f793585e31c7e4ff return null; } } -@@ -395,6 +396,7 @@ public final class NaturalSpawner { +@@ -401,6 +402,7 @@ public final class NaturalSpawner { entity = biomesettingsmobs_c.type.create(world.getLevel()); } catch (Exception exception) { NaturalSpawner.LOGGER.warn("Failed to create mob", exception); @@ -151,7 +143,7 @@ index 5e2a3baf46175dd92958f47c4503bb8d6f6a0941..373fbdf56dddbae5f793585e31c7e4ff } 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 949d8cc16c91390ea573dd566bec566dc95efc18..3ba9f8d7dc12709670dcd94df5d82b8d44f983fa 100644 +index 98fe6a1d2866d029383a5a5d60a2635d2d421f1e..1ddc917772d701ac7b8800df44da890b9b6a6113 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -1,6 +1,7 @@ @@ -161,7 +153,7 @@ index 949d8cc16c91390ea573dd566bec566dc95efc18..3ba9f8d7dc12709670dcd94df5d82b8d +import com.destroystokyo.paper.exception.ServerInternalException; import com.google.common.collect.Maps; import com.google.common.collect.UnmodifiableIterator; - import it.unimi.dsi.fastutil.ints.Int2ObjectMap; + import com.mojang.logging.LogUtils; @@ -549,10 +550,15 @@ public class LevelChunk extends ChunkAccess { this.removeBlockEntity(blockEntity.getBlockPos()); // Paper end @@ -182,7 +174,7 @@ index 949d8cc16c91390ea573dd566bec566dc95efc18..3ba9f8d7dc12709670dcd94df5d82b8d // CraftBukkit end } } -@@ -1034,6 +1040,7 @@ public class LevelChunk extends ChunkAccess { +@@ -1032,6 +1038,7 @@ public class LevelChunk extends ChunkAccess { // Paper start - Prevent tile entity and entity crashes final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable); @@ -191,7 +183,7 @@ index 949d8cc16c91390ea573dd566bec566dc95efc18..3ba9f8d7dc12709670dcd94df5d82b8d // Paper end // Spigot start diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index c30d7b04e8383aed7d5f3e93f42c612c685a4df7..fd70133714990ad44b4b2b80c52ffc55be8c9b63 100644 +index d51bafd2f5a763b8a49c835ab74a7cf60caa1ab6..fbf5f01a9a7968194fc85589ca7f9fa328da4881 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -274,6 +274,7 @@ public class RegionFile implements AutoCloseable { @@ -211,7 +203,7 @@ index c30d7b04e8383aed7d5f3e93f42c612c685a4df7..fd70133714990ad44b4b2b80c52ffc55 try { filechannel.close(); diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java -index 68b1a5b6b27f70b0185bb8f0ed924d6d21b43323..e84b99ca10621cb1021d7ec17ba21df24e8c7474 100644 +index 5272a718178b5a2cb1df263ce0c5500c92c9ebda..0465b397b628b11a6fc52e3375945c94d68cfdd5 100644 --- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java @@ -120,6 +120,7 @@ public class DimensionDataStorage { diff --git a/patches/server/0058-Disable-Scoreboards-for-non-players-by-default.patch b/patches/server/0058-Disable-Scoreboards-for-non-players-by-default.patch index 840919ac2..06d446566 100644 --- a/patches/server/0058-Disable-Scoreboards-for-non-players-by-default.patch +++ b/patches/server/0058-Disable-Scoreboards-for-non-players-by-default.patch @@ -25,10 +25,10 @@ index ada624b5f58381122e59568c2087cf38fd2baf3e..5b55fce59db9ac3ab6030ebe8374c514 + } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index de15a2231057217fbbf723cf25e869998a1016f1..69f820aa1f29e626c0ae0322281063efae53c470 100644 +index 413de81d30fe4ee6cf7aba88805e0e536f498565..78fd9e84e24b163b4918ba0580abca18806f4988 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2561,6 +2561,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2577,6 +2577,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i @Nullable public Team getTeam() { @@ -37,10 +37,10 @@ index de15a2231057217fbbf723cf25e869998a1016f1..69f820aa1f29e626c0ae0322281063ef } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index b14e9a629430070071b498f719b649af1d4bb926..9168826ac85bc7cd355e73b2d02b7cce9c4c9cee 100644 +index 4ec047456f45bfceb9ba7a249a0fc0774e20b126..3bdc374b604ef1edb4e2925bef5a9586d4d8346a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -797,6 +797,7 @@ public abstract class LivingEntity extends Entity { +@@ -800,6 +800,7 @@ public abstract class LivingEntity extends Entity { if (nbt.contains("Team", 8)) { String s = nbt.getString("Team"); PlayerTeam scoreboardteam = this.level.getScoreboard().getPlayerTeam(s); diff --git a/patches/server/0061-Complete-resource-pack-API.patch b/patches/server/0061-Complete-resource-pack-API.patch index e45aa508b..99fc857bb 100644 --- a/patches/server/0061-Complete-resource-pack-API.patch +++ b/patches/server/0061-Complete-resource-pack-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Complete resource pack API diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 979ece36de5c160a188b4c14b2bf991924f6fd98..18854aaa1359dd5c944d7e3a6177152bff9614a2 100644 +index 28c4e16e202876e58447b1f766619e3cee329aaa..8125b2d736594018e89bb3be32262f5e1e8791d5 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1638,8 +1638,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1653,8 +1653,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName()); this.disconnect(new TranslatableComponent("multiplayer.requiredTexturePrompt.disconnect")); } diff --git a/patches/server/0062-Default-loading-permissions.yml-before-plugins.patch b/patches/server/0062-Default-loading-permissions.yml-before-plugins.patch index 6c8c76df9..c66666dfb 100644 --- a/patches/server/0062-Default-loading-permissions.yml-before-plugins.patch +++ b/patches/server/0062-Default-loading-permissions.yml-before-plugins.patch @@ -30,10 +30,10 @@ index 701a2ffd04df48d437b2cb963dd150af99725b6e..817d4572c9991992b720b3ba163188ac + } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b6e9c6fc7f31b06f77cf108ee0f5548cd530ba5a..b06542f4b79bffda579ab91cb3b463063a34d472 100644 +index 02674288c62493c22e5e21b42a2d4386b5a42a1d..c30eb1c910147ddd6237078367ce29f9e015af9e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -459,6 +459,7 @@ public final class CraftServer implements Server { +@@ -455,6 +455,7 @@ public final class CraftServer implements Server { if (type == PluginLoadOrder.STARTUP) { this.helpMap.clear(); this.helpMap.initializeGeneralTopics(); @@ -41,7 +41,7 @@ index b6e9c6fc7f31b06f77cf108ee0f5548cd530ba5a..b06542f4b79bffda579ab91cb3b46306 } Plugin[] plugins = this.pluginManager.getPlugins(); -@@ -478,7 +479,7 @@ public final class CraftServer implements Server { +@@ -474,7 +475,7 @@ public final class CraftServer implements Server { this.commandMap.registerServerAliases(); DefaultPermissions.registerCorePermissions(); CraftDefaultPermissions.registerCorePermissions(); diff --git a/patches/server/0063-Allow-Reloading-of-Custom-Permissions.patch b/patches/server/0063-Allow-Reloading-of-Custom-Permissions.patch index 3b7f9b820..50b690d23 100644 --- a/patches/server/0063-Allow-Reloading-of-Custom-Permissions.patch +++ b/patches/server/0063-Allow-Reloading-of-Custom-Permissions.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Custom Permissions https://github.com/PaperMC/Paper/issues/49 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b06542f4b79bffda579ab91cb3b463063a34d472..01d99c5f916d93375f701a5fe9e250102ff57e8a 100644 +index c30eb1c910147ddd6237078367ce29f9e015af9e..39c847d68b9195d082d324485fee83332e07f59a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2500,5 +2500,23 @@ public final class CraftServer implements Server { +@@ -2492,5 +2492,23 @@ public final class CraftServer implements Server { } return this.adventure$audiences; } diff --git a/patches/server/0064-Remove-Metadata-on-reload.patch b/patches/server/0064-Remove-Metadata-on-reload.patch index a8b92e779..827228649 100644 --- a/patches/server/0064-Remove-Metadata-on-reload.patch +++ b/patches/server/0064-Remove-Metadata-on-reload.patch @@ -7,10 +7,10 @@ Metadata is not meant to persist reload as things break badly with non primitive This will remove metadata on reload so it does not crash everything if a plugin uses it. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 01d99c5f916d93375f701a5fe9e250102ff57e8a..1065f69322bb9d068f4ec63e40cc4db6f5425c40 100644 +index 39c847d68b9195d082d324485fee83332e07f59a..ad851aa3a29b6aabfcfe7f95df15303437c48eaa 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -948,8 +948,16 @@ public final class CraftServer implements Server { +@@ -944,8 +944,16 @@ public final class CraftServer implements Server { world.paperConfig.init(); // Paper } diff --git a/patches/server/0065-Handle-Item-Meta-Inconsistencies.patch b/patches/server/0065-Handle-Item-Meta-Inconsistencies.patch index da1b99160..91d8e83c3 100644 --- a/patches/server/0065-Handle-Item-Meta-Inconsistencies.patch +++ b/patches/server/0065-Handle-Item-Meta-Inconsistencies.patch @@ -18,10 +18,10 @@ For consistency, the old API methods now forward to use the ItemMeta API equivalents, and should deprecate the old API's. diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 8335880dbbb31a3f5d10c259b567baa0d5f381a1..74e4990888d88f18cb3d800724d9156e9d1ae21d 100644 +index 1a52db84d9630a095347a85e136a9ad118f77325..d66cc030dcd3d98f57803938c8c06342a028ee88 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -12,6 +12,8 @@ import java.text.DecimalFormatSymbols; +@@ -14,6 +14,8 @@ import java.text.DecimalFormatSymbols; import java.util.Collection; import java.util.Iterator; import java.util.List; @@ -30,7 +30,7 @@ index 8335880dbbb31a3f5d10c259b567baa0d5f381a1..74e4990888d88f18cb3d800724d9156e import java.util.Locale; import java.util.Map.Entry; import java.util.Optional; -@@ -151,6 +153,23 @@ public final class ItemStack { +@@ -153,6 +155,23 @@ public final class ItemStack { return this.getItem().getTooltipImage(this); } @@ -54,7 +54,7 @@ index 8335880dbbb31a3f5d10c259b567baa0d5f381a1..74e4990888d88f18cb3d800724d9156e public ItemStack(ItemLike item) { this(item, 1); } -@@ -194,6 +213,7 @@ public final class ItemStack { +@@ -200,6 +219,7 @@ public final class ItemStack { // CraftBukkit start - make defensive copy as this data may be coming from the save thread this.tag = nbttagcompound.getCompound("tag").copy(); // CraftBukkit end @@ -62,7 +62,7 @@ index 8335880dbbb31a3f5d10c259b567baa0d5f381a1..74e4990888d88f18cb3d800724d9156e this.getItem().verifyTagAfterLoad(this.tag); } -@@ -748,6 +768,7 @@ public final class ItemStack { +@@ -758,6 +778,7 @@ public final class ItemStack { public void setTag(@Nullable CompoundTag nbt) { this.tag = nbt; @@ -70,7 +70,7 @@ index 8335880dbbb31a3f5d10c259b567baa0d5f381a1..74e4990888d88f18cb3d800724d9156e if (this.getItem().canBeDepleted()) { this.setDamageValue(this.getDamageValue()); } -@@ -1055,6 +1076,7 @@ public final class ItemStack { +@@ -1063,6 +1084,7 @@ public final class ItemStack { ListTag nbttaglist = this.tag.getList("Enchantments", 10); nbttaglist.add(EnchantmentHelper.storeEnchantment(EnchantmentHelper.getEnchantmentId(enchantment), (byte) level)); diff --git a/patches/server/0067-Add-World-Util-Methods.patch b/patches/server/0067-Add-World-Util-Methods.patch index cafe64537..8e2545490 100644 --- a/patches/server/0067-Add-World-Util-Methods.patch +++ b/patches/server/0067-Add-World-Util-Methods.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add World Util Methods Methods that can be used for other patches to help improve logic. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 7a536f30a1ff7f93bad14f734aeb5d5ff69a5c9a..767a48000e41c43ccaf71be521348fcd1c71ee11 100644 +index 6c2e53cf3c3fa5bf2df38d4e87e4d0ee52f3c088..d1b9e82b9c4b90a96d2ae8930b8e33e8d1a55bdb 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -208,7 +208,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -209,7 +209,7 @@ public class ServerLevel extends Level implements WorldGenLevel { public final LevelStorageSource.LevelStorageAccess convertable; public final UUID uuid; @@ -19,10 +19,10 @@ index 7a536f30a1ff7f93bad14f734aeb5d5ff69a5c9a..767a48000e41c43ccaf71be521348fcd } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 389cb85aa369dff606b21c10fcbf4825c17bbd4f..c2fe955b23383effca7a8d712a08e346d648d2a8 100644 +index d923cc91a8f1e71831be8ded1b4818ac3b48fc34..cccce52ef5a1ac7284bc878c7b8f0d2a312fac57 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -319,6 +319,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -318,6 +318,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return chunk == null ? null : chunk.getFluidState(blockposition); } diff --git a/patches/server/0068-Custom-replacement-for-eaten-items.patch b/patches/server/0068-Custom-replacement-for-eaten-items.patch index 84cae5400..1bd6dd4cf 100644 --- a/patches/server/0068-Custom-replacement-for-eaten-items.patch +++ b/patches/server/0068-Custom-replacement-for-eaten-items.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Custom replacement for eaten items diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 9168826ac85bc7cd355e73b2d02b7cce9c4c9cee..e94344170190ae9429b744ec7878c3aa093f01b6 100644 +index 3bdc374b604ef1edb4e2925bef5a9586d4d8346a..f364978ff256aecb078cca2b6c3fd433d9a4820b 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3562,9 +3562,10 @@ public abstract class LivingEntity extends Entity { +@@ -3552,9 +3552,10 @@ public abstract class LivingEntity extends Entity { this.triggerItemUseEffects(this.useItem, 16); // CraftBukkit start - fire PlayerItemConsumeEvent ItemStack itemstack; @@ -20,7 +20,7 @@ index 9168826ac85bc7cd355e73b2d02b7cce9c4c9cee..e94344170190ae9429b744ec7878c3aa level.getCraftServer().getPluginManager().callEvent(event); if (event.isCancelled()) { -@@ -3578,6 +3579,13 @@ public abstract class LivingEntity extends Entity { +@@ -3568,6 +3569,13 @@ public abstract class LivingEntity extends Entity { } else { itemstack = this.useItem.finishUsingItem(this.level, this); } @@ -34,7 +34,7 @@ index 9168826ac85bc7cd355e73b2d02b7cce9c4c9cee..e94344170190ae9429b744ec7878c3aa // CraftBukkit end if (itemstack != this.useItem) { -@@ -3585,6 +3593,11 @@ public abstract class LivingEntity extends Entity { +@@ -3575,6 +3583,11 @@ public abstract class LivingEntity extends Entity { } this.stopUsingItem(); diff --git a/patches/server/0069-handle-NaN-health-absorb-values-and-repair-bad-data.patch b/patches/server/0069-handle-NaN-health-absorb-values-and-repair-bad-data.patch index 1988d44a0..dc0fcfa0b 100644 --- a/patches/server/0069-handle-NaN-health-absorb-values-and-repair-bad-data.patch +++ b/patches/server/0069-handle-NaN-health-absorb-values-and-repair-bad-data.patch @@ -5,10 +5,10 @@ Subject: [PATCH] handle NaN health/absorb values and repair bad data diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index e94344170190ae9429b744ec7878c3aa093f01b6..e13808657e0c7dc94fcd2844690a31d0691b6a7b 100644 +index f364978ff256aecb078cca2b6c3fd433d9a4820b..5f7a16651a0ca5497b20d8723e9c170506668267 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -758,7 +758,13 @@ public abstract class LivingEntity extends Entity { +@@ -761,7 +761,13 @@ public abstract class LivingEntity extends Entity { @Override public void readAdditionalSaveData(CompoundTag nbt) { @@ -23,7 +23,7 @@ index e94344170190ae9429b744ec7878c3aa093f01b6..e13808657e0c7dc94fcd2844690a31d0 if (nbt.contains("Attributes", 9) && this.level != null && !this.level.isClientSide) { this.getAttributes().load(nbt.getList("Attributes", 10)); } -@@ -1245,6 +1251,10 @@ public abstract class LivingEntity extends Entity { +@@ -1248,6 +1254,10 @@ public abstract class LivingEntity extends Entity { } public void setHealth(float health) { @@ -34,7 +34,7 @@ index e94344170190ae9429b744ec7878c3aa093f01b6..e13808657e0c7dc94fcd2844690a31d0 // CraftBukkit start - Handle scaled health if (this instanceof ServerPlayer) { org.bukkit.craftbukkit.entity.CraftPlayer player = ((ServerPlayer) this).getBukkitEntity(); -@@ -3396,7 +3406,7 @@ public abstract class LivingEntity extends Entity { +@@ -3386,7 +3396,7 @@ public abstract class LivingEntity extends Entity { } public void setAbsorptionAmount(float amount) { diff --git a/patches/server/0070-Use-a-Shared-Random-for-Entities.patch b/patches/server/0070-Use-a-Shared-Random-for-Entities.patch index 559824e9f..505022ba2 100644 --- a/patches/server/0070-Use-a-Shared-Random-for-Entities.patch +++ b/patches/server/0070-Use-a-Shared-Random-for-Entities.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Use a Shared Random for Entities Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 69f820aa1f29e626c0ae0322281063efae53c470..415c746b497d19f359705721874ed65d7e7ca817 100644 +index 78fd9e84e24b163b4918ba0580abca18806f4988..f12e282dc4683d0430b9dba552757c4da5dee988 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -152,6 +152,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -155,6 +155,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; } @@ -31,7 +31,7 @@ index 69f820aa1f29e626c0ae0322281063efae53c470..415c746b497d19f359705721874ed65d private CraftEntity bukkitEntity; public CraftEntity getBukkitEntity() { -@@ -339,7 +354,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -342,7 +357,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i this.bb = Entity.INITIAL_AABB; this.stuckSpeedMultiplier = Vec3.ZERO; this.nextStep = 1.0F; @@ -39,12 +39,12 @@ index 69f820aa1f29e626c0ae0322281063efae53c470..415c746b497d19f359705721874ed65d + this.random = SHARED_RANDOM; // Paper this.remainingFireTicks = -this.getFireImmuneTicks(); this.fluidHeight = new Object2DoubleArrayMap(2); - this.firstTick = true; + this.fluidOnEyes = new HashSet(); diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java -index 09ec4d66aaa5b9e4ef09750a76cebc389a4306fd..370513fbc39f178f903ce140ced1a97029dd39db 100644 +index 8e63ab510e4c2e458da726ca67be4d3b5274e7b7..a51424d29ac353cf1bec4d1484db0acb63bebba5 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Squid.java +++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java -@@ -47,7 +47,7 @@ public class Squid extends WaterAnimal { +@@ -46,7 +46,7 @@ public class Squid extends WaterAnimal { public Squid(EntityType type, Level world) { super(type, world); diff --git a/patches/server/0071-Configurable-spawn-chances-for-skeleton-horses.patch b/patches/server/0071-Configurable-spawn-chances-for-skeleton-horses.patch index 6e19d6467..166b4d09e 100644 --- a/patches/server/0071-Configurable-spawn-chances-for-skeleton-horses.patch +++ b/patches/server/0071-Configurable-spawn-chances-for-skeleton-horses.patch @@ -22,10 +22,10 @@ index 71c672eafdce3547eaeb8e31fddcb142ad213094..aa8cd5965632626e4cbd4952acf9b349 + } } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index b106dfc16820d89b9c9792ad85d09fd66b7204b6..4e896cdc395cfb2b976e13ee3f0228d9f475069f 100644 +index d1b9e82b9c4b90a96d2ae8930b8e33e8d1a55bdb..d9198cf7aff9b1c0f05277fb9f1a3276e2292775 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -562,7 +562,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -565,7 +565,7 @@ public class ServerLevel extends Level implements WorldGenLevel { blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15)); if (this.isRainingAt(blockposition)) { DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); diff --git a/patches/server/0072-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch b/patches/server/0072-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch index 53d5374cb..bc12e7753 100644 --- a/patches/server/0072-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch +++ b/patches/server/0072-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch @@ -12,7 +12,7 @@ Replace all calls to the new place to the unnecessary forward. Optimize getType and getBlockData to manually inline and optimize the calls diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java -index dba7872cf337a5c3dc5a6fe508dd50b93462fae5..75aa5df03c162fa10046fbad806b81051fb5765b 100644 +index 4587a3668b6be9222cdd74a38229f89f611d1af6..9f32861d791f7e4cb39d2ad01f48e1916fc2b4b1 100644 --- a/src/main/java/net/minecraft/core/Vec3i.java +++ b/src/main/java/net/minecraft/core/Vec3i.java @@ -33,6 +33,12 @@ public class Vec3i implements Comparable { @@ -29,10 +29,10 @@ index dba7872cf337a5c3dc5a6fe508dd50b93462fae5..75aa5df03c162fa10046fbad806b8105 this.x = x; this.y = y; diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index c2fe955b23383effca7a8d712a08e346d648d2a8..85d3ece733d78897f85a7a02d323fdb025193622 100644 +index cccce52ef5a1ac7284bc878c7b8f0d2a312fac57..f1f713c892e1843fdf5adec6714dc72f8fd4d354 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -262,7 +262,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -261,7 +261,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } public boolean isInWorldBounds(BlockPos pos) { @@ -42,10 +42,10 @@ index c2fe955b23383effca7a8d712a08e346d648d2a8..85d3ece733d78897f85a7a02d323fdb0 public static boolean isInSpawnableBounds(BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index 0ea0690ab1d45f60a2b13cf8a69e580256992cdc..b3b3fa7ece66e1ab467c8ed550d150db541fd02a 100644 +index 847ac56f20ab9c5745f9c0fa0e6f16743ba5e471..eea6816c52e6c0329f3bea0e7789cda9dd4a5a08 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -119,6 +119,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -122,6 +122,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom return GameEventDispatcher.NOOP; } @@ -54,11 +54,11 @@ index 0ea0690ab1d45f60a2b13cf8a69e580256992cdc..b3b3fa7ece66e1ab467c8ed550d150db public abstract BlockState setBlockState(BlockPos pos, BlockState state, boolean moved); diff --git a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java -index 31d01f8df394e718f1f2a268ddccee77b6706eb9..7b0da3956be23e974d3bc2f50f9004046923635f 100644 +index 80e383e9a2d12f9f1b0b0d9ae71a0add9b51c9d4..a9c65c8d36e5c7080133706df1363b3ce52e3370 100644 --- a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java -@@ -18,6 +18,12 @@ public class EmptyLevelChunk extends LevelChunk { - super(world, pos); +@@ -21,6 +21,12 @@ public class EmptyLevelChunk extends LevelChunk { + this.biome = holder; } + // Paper start @@ -71,10 +71,10 @@ index 31d01f8df394e718f1f2a268ddccee77b6706eb9..7b0da3956be23e974d3bc2f50f900404 public BlockState getBlockState(BlockPos pos) { return Blocks.VOID_AIR.defaultBlockState(); diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -index ef74f37cae96e61d5648fce7bbd793fb67ba9e4a..e15263a152c88371ebc65b47f0be938f7c19a8f2 100644 +index 82a4f5fb84884d229d258134fbfe62d34ad30d80..37e7f766e0de7b47c7240c9365bb134fda26a756 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -@@ -46,6 +46,12 @@ public class ImposterProtoChunk extends ProtoChunk { +@@ -47,6 +47,12 @@ public class ImposterProtoChunk extends ProtoChunk { public BlockState getBlockState(BlockPos pos) { return this.wrapped.getBlockState(pos); } @@ -88,7 +88,7 @@ index ef74f37cae96e61d5648fce7bbd793fb67ba9e4a..e15263a152c88371ebc65b47f0be938f @Override public FluidState getFluidState(BlockPos pos) { 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 3ba9f8d7dc12709670dcd94df5d82b8d44f983fa..cbffb4eb93ba1888666d4b0de98b2fb05c1400a0 100644 +index 1ddc917772d701ac7b8800df44da890b9b6a6113..aff826fb06a16adac8173efcaad0da1724db95c4 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -288,12 +288,29 @@ public class LevelChunk extends ChunkAccess { @@ -125,10 +125,10 @@ index 3ba9f8d7dc12709670dcd94df5d82b8d44f983fa..cbffb4eb93ba1888666d4b0de98b2fb0 BlockState iblockdata = null; diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -index 6abd3cf0a388b158252628d8031b92bb8a6d65fb..50b6ecfea7a342be0d21e37ae87777a4b4860026 100644 +index a17d38d08a1f4b3e7ba4ef233a4acaf75177ac4c..c696358102086257033b55adbef84b1a259cb46e 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -@@ -20,7 +20,7 @@ public class LevelChunkSection { +@@ -21,7 +21,7 @@ public class LevelChunkSection { public static final int SECTION_SIZE = 4096; public static final int BIOME_CONTAINER_BITS = 2; private final int bottomBlockY; @@ -138,10 +138,10 @@ index 6abd3cf0a388b158252628d8031b92bb8a6d65fb..50b6ecfea7a342be0d21e37ae87777a4 private short tickingFluidCount; public final PalettedContainer states; diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -index 7c2e3331fac1de2e20974c8eed8aeeb9f2c92789..acfd46c7035b4009d61bda8a7c8dd6953e4836e6 100644 +index ee0be5163811ea39efcb2092e5f126c3fd9b1523..d3d2bd5ea57254a4af0572d5dab460127718ce09 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -87,14 +87,18 @@ public class ProtoChunk extends ChunkAccess { +@@ -88,14 +88,18 @@ public class ProtoChunk extends ChunkAccess { @Override public BlockState getBlockState(BlockPos pos) { diff --git a/patches/server/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch b/patches/server/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch index 91630a4ba..ef34955e4 100644 --- a/patches/server/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch +++ b/patches/server/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener Saves on some object allocation and processing when no plugin listens to this diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 4db15f60a5da9594cfc313f6fa97032ffc9259e0..b807bd1e53f39a1d635800f02f6772f0fc878f7a 100644 +index 26646df983507bfb1d75a7a3a9f4c12c7bf9fd49..99478fe8f16783e7d2ae128f32199fa4b465dc83 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1367,6 +1367,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { return worldserver + " " + worldserver.dimension().location(); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index ddf2468fe4adb5115f21c7eb0d695c999f1c3efe..db3f50d7bdfff919cfaee3b035f6ae4e79beb000 100644 +index d9198cf7aff9b1c0f05277fb9f1a3276e2292775..ca7c4a297e577bf9f0bf9cfd88a56ad87ac88684 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -207,6 +207,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -208,6 +208,7 @@ public class ServerLevel extends Level implements WorldGenLevel { private int tickPosition; public final LevelStorageSource.LevelStorageAccess convertable; public final UUID uuid; @@ -30,10 +30,10 @@ index ddf2468fe4adb5115f21c7eb0d695c999f1c3efe..db3f50d7bdfff919cfaee3b035f6ae4e @Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI return this.chunkSource.getChunk(x, z, false); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 85d3ece733d78897f85a7a02d323fdb025193622..c91652cf949c099145587e758b259e2b3dfbe8c5 100644 +index f1f713c892e1843fdf5adec6714dc72f8fd4d354..b2965b136405bce16f1433411df5beab15231113 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -474,7 +474,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -473,7 +473,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // CraftBukkit start iblockdata1.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam CraftWorld world = ((ServerLevel) this).getWorld(); @@ -42,7 +42,7 @@ index 85d3ece733d78897f85a7a02d323fdb025193622..c91652cf949c099145587e758b259e2b BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata)); this.getCraftServer().getPluginManager().callEvent(event); -@@ -587,7 +587,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -586,7 +586,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { try { // CraftBukkit start CraftWorld world = ((ServerLevel) this).getWorld(); @@ -52,23 +52,15 @@ index 85d3ece733d78897f85a7a02d323fdb025193622..c91652cf949c099145587e758b259e2b this.getCraftServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/world/level/block/BushBlock.java b/src/main/java/net/minecraft/world/level/block/BushBlock.java -index 24227939493f852a88477c84160bda1605291eb0..1f8cf302d2309aec2955832ffafd87f14934e141 100644 +index d40e791529911ca81398ac267a819415da91502a..03fde6e47c4a347c62fe9b4a3351769aedf874f6 100644 --- a/src/main/java/net/minecraft/world/level/block/BushBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BushBlock.java -@@ -4,6 +4,7 @@ import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; - import net.minecraft.tags.BlockTags; - import net.minecraft.tags.Tag; -+import net.minecraft.server.level.ServerLevel; - import net.minecraft.world.level.BlockGetter; - import net.minecraft.world.level.LevelAccessor; - import net.minecraft.world.level.LevelReader; -@@ -25,7 +26,7 @@ public class BushBlock extends Block { +@@ -24,7 +24,7 @@ public class BushBlock extends Block { public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { // CraftBukkit start if (!state.canSurvive(world, pos)) { - if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, pos).isCancelled()) { -+ if (!(world instanceof ServerLevel && ((ServerLevel) world).hasPhysicsEvent) || !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, pos).isCancelled()) { // Paper ++ if (!(world instanceof net.minecraft.server.level.ServerLevel && ((net.minecraft.server.level.ServerLevel) world).hasPhysicsEvent) || !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, pos).isCancelled()) { // Paper return Blocks.AIR.defaultBlockState(); } } diff --git a/patches/server/0074-Entity-AddTo-RemoveFrom-World-Events.patch b/patches/server/0074-Entity-AddTo-RemoveFrom-World-Events.patch index 34cf38f5b..d1ce4c724 100644 --- a/patches/server/0074-Entity-AddTo-RemoveFrom-World-Events.patch +++ b/patches/server/0074-Entity-AddTo-RemoveFrom-World-Events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 419f539109ca0b8103475e52d0fdda40a7b99cc7..ce13b2b9bcf0984732b3309ec3f14731cc6aef5f 100644 +index ca7c4a297e577bf9f0bf9cfd88a56ad87ac88684..22ba7b534c450a4f9e608c331344e948a0fbf1f9 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2026,6 +2026,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2033,6 +2033,7 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.setOrigin(entity.getOriginVector().toLocation(getWorld())); } // Paper end @@ -16,7 +16,7 @@ index 419f539109ca0b8103475e52d0fdda40a7b99cc7..ce13b2b9bcf0984732b3309ec3f14731 } public void onTrackingEnd(Entity entity) { -@@ -2106,6 +2107,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2113,6 +2114,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } // CraftBukkit end diff --git a/patches/server/0078-Do-not-load-chunks-for-Pathfinding.patch b/patches/server/0078-Do-not-load-chunks-for-Pathfinding.patch index bd65a975c..0a002dd1f 100644 --- a/patches/server/0078-Do-not-load-chunks-for-Pathfinding.patch +++ b/patches/server/0078-Do-not-load-chunks-for-Pathfinding.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Do not load chunks for Pathfinding diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -index 9e4d43b5846ebebf9169ad906db68804292e7fe0..e23679b8c2bc35de82cb3245f35b53b44058f53d 100644 +index ca45dfc6c05760e00987c09b697efb1f9ff0e78a..2d42df635b1ce8d975278fb36f00fe9b8b8f060f 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -453,7 +453,12 @@ public class WalkNodeEvaluator extends NodeEvaluator { +@@ -457,7 +457,12 @@ public class WalkNodeEvaluator extends NodeEvaluator { for(int n = -1; n <= 1; ++n) { if (l != 0 || n != 0) { pos.set(i + l, j + m, k + n); @@ -22,7 +22,7 @@ index 9e4d43b5846ebebf9169ad906db68804292e7fe0..e23679b8c2bc35de82cb3245f35b53b4 if (blockState.is(Blocks.CACTUS)) { return BlockPathTypes.DANGER_CACTUS; } -@@ -469,6 +474,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { +@@ -473,6 +478,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { if (world.getFluidState(pos).is(FluidTags.WATER)) { return BlockPathTypes.WATER_BORDER; } @@ -30,7 +30,7 @@ index 9e4d43b5846ebebf9169ad906db68804292e7fe0..e23679b8c2bc35de82cb3245f35b53b4 } } } -@@ -478,7 +484,8 @@ public class WalkNodeEvaluator extends NodeEvaluator { +@@ -482,7 +488,8 @@ public class WalkNodeEvaluator extends NodeEvaluator { } protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) { diff --git a/patches/server/0079-Add-PlayerUseUnknownEntityEvent.patch b/patches/server/0079-Add-PlayerUseUnknownEntityEvent.patch index 4825a680d..31423cadc 100644 --- a/patches/server/0079-Add-PlayerUseUnknownEntityEvent.patch +++ b/patches/server/0079-Add-PlayerUseUnknownEntityEvent.patch @@ -20,10 +20,10 @@ index 8834ed411a7db86b4d2b88183a1315317107d719..c45b5ab6776f3ac79f856c3a6467c510 static final ServerboundInteractPacket.Action ATTACK_ACTION = new ServerboundInteractPacket.Action() { @Override diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 18854aaa1359dd5c944d7e3a6177152bff9614a2..bacb8ff97a6745847b5e3eb82dd08bde934e8d1f 100644 +index 8125b2d736594018e89bb3be32262f5e1e8791d5..024f6b5bf84a4e55f6237107ae8f8958caa9ef72 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2204,8 +2204,37 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2219,8 +2219,37 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser }); } } diff --git a/patches/server/0080-Configurable-Grass-Spread-Tick-Rate.patch b/patches/server/0080-Configurable-Grass-Spread-Tick-Rate.patch index 6e3b12f45..cc11565d1 100644 --- a/patches/server/0080-Configurable-Grass-Spread-Tick-Rate.patch +++ b/patches/server/0080-Configurable-Grass-Spread-Tick-Rate.patch @@ -20,7 +20,7 @@ index e7534ed3f995be64c99399ab76e98086cf37bb7f..c008f1f7f0a1e1b8bf34f2702cb44c5f + } } diff --git a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java -index 954defe131bdcd81178e3bd31755eb18b9aef026..29f4da5962bf596da7c557d9aa61677f5604b0a0 100644 +index 4ba446351d8b8b97ebfab1436d8f313f2747901e..b642ced1bc4dd819210db291cfc1837d011431ab 100644 --- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java @@ -3,6 +3,7 @@ package net.minecraft.world.level.block; @@ -30,8 +30,8 @@ index 954defe131bdcd81178e3bd31755eb18b9aef026..29f4da5962bf596da7c557d9aa61677f +import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.FluidTags; - import net.minecraft.tags.Tag; -@@ -40,6 +41,7 @@ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock { + import net.minecraft.world.level.LevelReader; +@@ -39,6 +40,7 @@ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock { @Override public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) { diff --git a/patches/server/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/patches/server/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index 8932404de..9e15d0278 100644 --- a/patches/server/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/patches/server/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index c91652cf949c099145587e758b259e2b3dfbe8c5..46f8fff21c0d91b9326b9270def43bd99c54b3ac 100644 +index b2965b136405bce16f1433411df5beab15231113..522b33f8d78468f07786dc7d6f184d2bc49dfc3f 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -545,6 +545,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -544,6 +544,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public void setBlocksDirty(BlockPos pos, BlockState old, BlockState updated) {} public void updateNeighborsAt(BlockPos pos, Block block) { diff --git a/patches/server/0085-Configurable-Player-Collision.patch b/patches/server/0085-Configurable-Player-Collision.patch index 97eeb56d5..430487b50 100644 --- a/patches/server/0085-Configurable-Player-Collision.patch +++ b/patches/server/0085-Configurable-Player-Collision.patch @@ -32,18 +32,18 @@ index 8993d8809c109212ab278e15c09cebab9e89342f..005a3058c51a41a39f050b1817e2079b buf.writeComponent(this.playerPrefix); buf.writeComponent(this.playerSuffix); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b8938c4118b61758874624229b6986956f30cc8e..8ba4af81f19e20c7d949edc72c0827bab22c19cb 100644 +index 99478fe8f16783e7d2ae128f32199fa4b465dc83..0f743a46195ce83bb3d96a5a65067cfab3a369e8 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -159,6 +159,7 @@ import net.minecraft.world.level.storage.loot.LootTables; +@@ -162,6 +162,7 @@ import net.minecraft.world.level.storage.loot.LootTables; import net.minecraft.world.level.storage.loot.PredicateManager; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.scores.PlayerTeam; // Paper import org.apache.commons.lang3.Validate; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -609,6 +610,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop playersByName = new java.util.HashMap<>(); + public @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule - public PlayerList(MinecraftServer server, RegistryAccess.RegistryHolder registryManager, PlayerDataStorage saveHandler, int maxPlayers) { + public PlayerList(MinecraftServer server, RegistryAccess.Frozen registryManager, PlayerDataStorage saveHandler, int maxPlayers) { this.cserver = server.server = new CraftServer((DedicatedServer) server, this); @@ -385,6 +387,13 @@ public abstract class PlayerList { diff --git a/patches/server/0087-Configurable-RCON-IP-address.patch b/patches/server/0087-Configurable-RCON-IP-address.patch index 4b840100c..1dc723e8a 100644 --- a/patches/server/0087-Configurable-RCON-IP-address.patch +++ b/patches/server/0087-Configurable-RCON-IP-address.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Configurable RCON IP address For servers with multiple IP's, ability to bind to a specific interface. diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -index 9682a149d996cc19d7bc0e9506acb1346e5c222e..07fd3da4de300f80516961ae22700dbc741e81dc 100644 +index 703403222763e42566552f2c6f3852e07f727f76..a7938420f6840b9d3880fb895aaf709ebd844312 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -@@ -70,6 +70,8 @@ public class DedicatedServerProperties extends Settings { + return s.toLowerCase(Locale.ROOT); + }, "default")); + // Paper start - Configurable rcon ip + final String rconIp = this.getStringRaw("rcon.ip"); + this.rconIp = rconIp == null ? this.serverIp : rconIp; @@ -30,7 +30,7 @@ index 9682a149d996cc19d7bc0e9506acb1346e5c222e..07fd3da4de300f80516961ae22700dbc // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/rcon/thread/RconThread.java b/src/main/java/net/minecraft/server/rcon/thread/RconThread.java -index 5e642ab9947f054c1741e13170a36f8fe300cdbe..a93e0eb67a78abb2eabd549cd5240095a24e5545 100644 +index cb61eaf8447c8340c4b4e1079c0a6aecd41a6116..3bf60f640aa9fa4cabd2b3e5d3931e8467b9df24 100644 --- a/src/main/java/net/minecraft/server/rcon/thread/RconThread.java +++ b/src/main/java/net/minecraft/server/rcon/thread/RconThread.java @@ -60,7 +60,7 @@ public class RconThread extends GenericThread { diff --git a/patches/server/0088-EntityRegainHealthEvent-isFastRegen-API.patch b/patches/server/0088-EntityRegainHealthEvent-isFastRegen-API.patch index d5de7b5e3..c698f6670 100644 --- a/patches/server/0088-EntityRegainHealthEvent-isFastRegen-API.patch +++ b/patches/server/0088-EntityRegainHealthEvent-isFastRegen-API.patch @@ -6,10 +6,10 @@ Subject: [PATCH] EntityRegainHealthEvent isFastRegen API Don't even get me started diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index e13808657e0c7dc94fcd2844690a31d0691b6a7b..fcf9206ef317aa22cd644ccb415c2156fd9f2af2 100644 +index 5f7a16651a0ca5497b20d8723e9c170506668267..2ce597f594142d64a239649e1b812b3b7b0af340 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1224,10 +1224,16 @@ public abstract class LivingEntity extends Entity { +@@ -1227,10 +1227,16 @@ public abstract class LivingEntity extends Entity { } public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) { diff --git a/patches/server/0090-remove-null-possibility-for-getServer-singleton.patch b/patches/server/0090-remove-null-possibility-for-getServer-singleton.patch index db7b1d93d..8725cd0c1 100644 --- a/patches/server/0090-remove-null-possibility-for-getServer-singleton.patch +++ b/patches/server/0090-remove-null-possibility-for-getServer-singleton.patch @@ -6,26 +6,26 @@ Subject: [PATCH] remove null possibility for getServer singleton to stop IDE complaining about potential NPE diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 8ba4af81f19e20c7d949edc72c0827bab22c19cb..375045935b7b9a3a8fd8f8f897763caf75e59813 100644 +index 0f743a46195ce83bb3d96a5a65067cfab3a369e8..0eaa13cf0f452fe6604767e40d8c9b6664df31bb 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -185,6 +185,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot +@@ -186,6 +186,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements CommandSource, AutoCloseable { + private static MinecraftServer SERVER; // Paper - public static final Logger LOGGER = LogManager.getLogger(); + public static final Logger LOGGER = LogUtils.getLogger(); public static final String VANILLA_BRAND = "vanilla"; private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F; -@@ -320,6 +321,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop registryreadops, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable GameProfileCache usercache, ChunkProgressListenerFactory worldloadlistenerfactory) { super("Server"); + SERVER = this; // Paper - better singleton this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; this.profiler = this.metricsRecorder.getProfiler(); this.onMetricsRecordingStopped = (methodprofilerresults) -> { -@@ -2259,7 +2261,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions diff --git a/patches/server/0099-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch b/patches/server/0099-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch index 3b713c18d..e7dc00e60 100644 --- a/patches/server/0099-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch +++ b/patches/server/0099-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Only send Dragon/Wither Death sounds to same world Also fix view distance lookup diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -index 7de279a1bef44a76173a1b71b98425ca6aa219aa..2584c02a5f6511ade260986a6aacef401c294549 100644 +index 10da58381202f8ec3d49aa2ed08faf30c435883b..89bd094fc31969284d831eaab47a131914d4fb13 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -640,8 +640,9 @@ public class EnderDragon extends Mob implements Enemy { +@@ -637,8 +637,9 @@ public class EnderDragon extends Mob implements Enemy { if (this.dragonDeathTime == 1 && !this.isSilent()) { // CraftBukkit start - Use relative location for far away sounds // this.world.b(1028, this.getChunkCoordinates(), 0); @@ -22,10 +22,10 @@ index 7de279a1bef44a76173a1b71b98425ca6aa219aa..2584c02a5f6511ade260986a6aacef40 double deltaZ = this.getZ() - player.getZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -index 6fde138a3da49fee4fdbf36e0ab58438e114e196..4f9f64def9b5da5bd2714c5f3ba36a4339623758 100644 +index 78bffaddbc9e478fb53639396e9c4970e9961b21..32b302aad0319ce3ee412912425c1c8db9979f8a 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -272,8 +272,9 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob +@@ -271,8 +271,9 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob if (!this.isSilent()) { // CraftBukkit start - Use relative location for far away sounds // this.world.globalLevelEvent(1023, new BlockPosition(this), 0); diff --git a/patches/server/0100-Fix-Old-Sign-Conversion.patch b/patches/server/0100-Fix-Old-Sign-Conversion.patch index 63115c0bc..eb0457168 100644 --- a/patches/server/0100-Fix-Old-Sign-Conversion.patch +++ b/patches/server/0100-Fix-Old-Sign-Conversion.patch @@ -9,17 +9,17 @@ Subject: [PATCH] Fix Old Sign Conversion This causes Igloos and such to render broken signs. We fix this by ignoring sign conversion for Defined Structures diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -index 14ac3c7b47525b7fd0345d817c9020b5a59d2ebc..1e416b23a38458f16add472cea09b0ac5ac91869 100644 +index 5c2ac7a1de96d9b4830955c2ff108c0881b5949b..32a2fbf4a11a84d5a55e02d3ba21e6f4430379c0 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -@@ -33,6 +33,7 @@ public abstract class BlockEntity implements io.papermc.paper.util.KeyedObject { +@@ -32,6 +32,7 @@ public abstract class BlockEntity implements io.papermc.paper.util.KeyedObject { + private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); public CraftPersistentDataContainer persistentDataContainer; // CraftBukkit end - private static final Logger LOGGER = LogManager.getLogger(); + public boolean isLoadingStructure = false; // Paper + private static final Logger LOGGER = LogUtils.getLogger(); private final BlockEntityType type; @Nullable - protected Level level; diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java index e390cfea5bed64284a97c88a717503f07f073a30..3a2e2adeefe73981b443216724270023408c1feb 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java @@ -34,7 +34,7 @@ index e390cfea5bed64284a97c88a717503f07f073a30..3a2e2adeefe73981b443216724270023 continue; } diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -index 2aaa7bb03ab200a5df1ae1aab7b81ac8ce85d64c..ef8dd3fa4f7ac8f85ae508999264850659bf9606 100644 +index cf8a38b7d55d229ac556f8a93b25c155381df3a2..129ebb095c2280376a59b54920e5ff90cf1f465a 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java @@ -284,7 +284,9 @@ public class StructureTemplate { diff --git a/patches/server/0103-Add-setting-for-proxy-online-mode-status.patch b/patches/server/0103-Add-setting-for-proxy-online-mode-status.patch index e5e736fdc..c84f4c5ce 100644 --- a/patches/server/0103-Add-setting-for-proxy-online-mode-status.patch +++ b/patches/server/0103-Add-setting-for-proxy-online-mode-status.patch @@ -32,7 +32,7 @@ index c6ca15a5cc53995ca0ada9c9ac9dc1d084963eb5..728835cddd413d778e9628360989724f + } } diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 6914ab77fc868844c391ac41ba2d344a26012208..00f783aafd81fa7e836e4eea5bfeac7434f33b0f 100644 +index 920a1ded577aa1c265137dd72a6f3d13a431d5c8..c3e3a9950ee05dc97f15ab128e40854901f38a2f 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java @@ -98,6 +98,7 @@ public class GameProfileCache { @@ -53,7 +53,7 @@ index 6914ab77fc868844c391ac41ba2d344a26012208..00f783aafd81fa7e836e4eea5bfeac74 public synchronized void add(GameProfile profile) { // Paper - synchronize diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java -index 876658b685ea09adb4c01d436da56daadb7eedaa..5445cb5910ec63408dc4379eec5e12d305182527 100644 +index b7b98832be6178a2bca534bf974519ede977b282..aa3caccc58f1cec8d5f396813d7fc40b05985cc8 100644 --- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java +++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java @@ -66,7 +66,8 @@ public class OldUsersConverter { @@ -67,10 +67,10 @@ index 876658b685ea09adb4c01d436da56daadb7eedaa..5445cb5910ec63408dc4379eec5e12d3 } else { String[] astring1 = astring; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1065f69322bb9d068f4ec63e40cc4db6f5425c40..88315ebb3b5e698ecc8332951ad72ef538bc44fd 100644 +index ad851aa3a29b6aabfcfe7f95df15303437c48eaa..2b6df52d586acf28aaf531c39073cf9448c589f9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1705,7 +1705,7 @@ public final class CraftServer implements Server { +@@ -1697,7 +1697,7 @@ public final class CraftServer implements Server { // Spigot Start GameProfile profile = null; // Only fetch an online UUID in online mode diff --git a/patches/server/0105-Configurable-packet-in-spam-threshold.patch b/patches/server/0105-Configurable-packet-in-spam-threshold.patch index f7827b058..1be2ad9b6 100644 --- a/patches/server/0105-Configurable-packet-in-spam-threshold.patch +++ b/patches/server/0105-Configurable-packet-in-spam-threshold.patch @@ -23,10 +23,10 @@ index 728835cddd413d778e9628360989724f65335b46..6c13fe725ca2b2a6f0f375b80f6c2cb6 + } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index bacb8ff97a6745847b5e3eb82dd08bde934e8d1f..035920097271ce50b21eddbed7c874b9628ac28a 100644 +index 024f6b5bf84a4e55f6237107ae8f8958caa9ef72..6547de3f54ac69af84430d0277f156adacdaa3e7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1494,13 +1494,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1502,13 +1502,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Spigot start - limit place/interactions private int limitedPackets; private long lastLimitedPacket = -1; diff --git a/patches/server/0106-Configurable-flying-kick-messages.patch b/patches/server/0106-Configurable-flying-kick-messages.patch index 117a151ad..fa67571d7 100644 --- a/patches/server/0106-Configurable-flying-kick-messages.patch +++ b/patches/server/0106-Configurable-flying-kick-messages.patch @@ -21,11 +21,11 @@ index 6c13fe725ca2b2a6f0f375b80f6c2cb643b9913d..5e23ff0c5e44427a996281ae42fc12c2 + } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 035920097271ce50b21eddbed7c874b9628ac28a..16bb1d2d5f168d45bef86fad6e9ebc68f2e822f4 100644 +index 6547de3f54ac69af84430d0277f156adacdaa3e7..df5282a1bb7d685f0f322f5976d8cf7d31abed49 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -299,7 +299,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser - if (this.clientIsFloating && !this.player.isSleeping()) { +@@ -300,7 +300,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger()) { if (++this.aboveGroundTickCount > 80) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString()); - this.disconnect(new TranslatableComponent("multiplayer.disconnect.flying")); @@ -33,7 +33,7 @@ index 035920097271ce50b21eddbed7c874b9628ac28a..16bb1d2d5f168d45bef86fad6e9ebc68 return; } } else { -@@ -318,7 +318,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -319,7 +319,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) { if (++this.aboveGroundVehicleTickCount > 80) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString()); diff --git a/patches/server/0109-Add-EntityZapEvent.patch b/patches/server/0109-Add-EntityZapEvent.patch index d6adf42ff..d3e5095d8 100644 --- a/patches/server/0109-Add-EntityZapEvent.patch +++ b/patches/server/0109-Add-EntityZapEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add EntityZapEvent diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index e2ac5290751b8c219add3823251e0131c0d2b52e..8785a112519de49e0d61eab5ab5325f9b2068d7e 100644 +index 819f694e96dd21bbc47f345fcd9c5714ab44040f..32a961075b41cd84b24398b9d1a4d58f88439d73 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -834,9 +834,17 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -836,9 +836,17 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @Override public void thunderHit(ServerLevel world, LightningBolt lightning) { if (world.getDifficulty() != Difficulty.PEACEFUL) { diff --git a/patches/server/0110-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch b/patches/server/0110-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch index 5c61ef4f9..6b19770c9 100644 --- a/patches/server/0110-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch +++ b/patches/server/0110-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch @@ -22,10 +22,10 @@ index 80345730b8ccc11d3d0833485d25b03f614aeee2..6eb3678177834a4b34b78ba8e359528d + } } diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 0366303a986ae6da8e95ed3051610c432a790194..a8a9cbcece45c3480120cb2fa0fa03523a87d317 100644 +index 2bc46e02779d22adedc1fd9e5c9130c209bd58f7..c1de9740d199dc862f8e85251a5de021499e0031 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -324,6 +324,18 @@ public class FallingBlockEntity extends Entity { +@@ -309,6 +309,18 @@ public class FallingBlockEntity extends Entity { @Override protected void readAdditionalSaveData(CompoundTag nbt) { this.blockState = NbtUtils.readBlockState(nbt.getCompound("BlockState")); diff --git a/patches/server/0111-Cache-user-authenticator-threads.patch b/patches/server/0111-Cache-user-authenticator-threads.patch index 2acf35612..a2659f2b4 100644 --- a/patches/server/0111-Cache-user-authenticator-threads.patch +++ b/patches/server/0111-Cache-user-authenticator-threads.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Cache user authenticator threads diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 08e7fd48514f9a6e89efc0d8adcbcf14bc92b103..afa04bbf778e5dd0823a0aab0573e4cc3787858d 100644 +index 627931ec09bfb1a84f0659981491cf3b6425aa32..58ef6874cd6c90e6ccc7c39881cc3bf68fba284b 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -117,6 +117,18 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -116,6 +116,18 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } @@ -48,7 +48,7 @@ index 08e7fd48514f9a6e89efc0d8adcbcf14bc92b103..afa04bbf778e5dd0823a0aab0573e4cc // Spigot end } -@@ -251,7 +264,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -257,7 +270,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener throw new IllegalStateException("Protocol error", cryptographyexception); } @@ -58,7 +58,7 @@ index 08e7fd48514f9a6e89efc0d8adcbcf14bc92b103..afa04bbf778e5dd0823a0aab0573e4cc public void run() { GameProfile gameprofile = ServerLoginPacketListenerImpl.this.gameProfile; -@@ -296,10 +310,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -302,10 +316,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener return ServerLoginPacketListenerImpl.this.server.getPreventProxyConnections() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null; } diff --git a/patches/server/0112-Allow-Reloading-of-Command-Aliases.patch b/patches/server/0112-Allow-Reloading-of-Command-Aliases.patch index df81c4e81..d14d3142e 100644 --- a/patches/server/0112-Allow-Reloading-of-Command-Aliases.patch +++ b/patches/server/0112-Allow-Reloading-of-Command-Aliases.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases Reload the aliases stored in commands.yml diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 88315ebb3b5e698ecc8332951ad72ef538bc44fd..903e4d866ffd2711c540c8982fe189d6992361f3 100644 +index 2b6df52d586acf28aaf531c39073cf9448c589f9..eacf4e00d7ce0c1458428237e6c67aaddb45b77a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2526,5 +2526,24 @@ public final class CraftServer implements Server { +@@ -2518,5 +2518,24 @@ public final class CraftServer implements Server { DefaultPermissions.registerCorePermissions(); CraftDefaultPermissions.registerCorePermissions(); } diff --git a/patches/server/0113-Add-source-to-PlayerExpChangeEvent.patch b/patches/server/0113-Add-source-to-PlayerExpChangeEvent.patch index 77a201483..55ccd362c 100644 --- a/patches/server/0113-Add-source-to-PlayerExpChangeEvent.patch +++ b/patches/server/0113-Add-source-to-PlayerExpChangeEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add source to PlayerExpChangeEvent diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index 687904d3e1b3ee7b514c707d9b2eeccabbf56603..f7cbe6819b8c4f7eaca2389de8eaceb50bce4b15 100644 +index dba0bc7dc8fd1993f45716a398b1ccf52d3d868b..b3433ce9c722bdab81848a6c2d121ca510c48509 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -@@ -246,7 +246,7 @@ public class ExperienceOrb extends Entity { +@@ -247,7 +247,7 @@ public class ExperienceOrb extends Entity { int i = this.repairPlayerItems(player, this.value); if (i > 0) { diff --git a/patches/server/0114-Don-t-let-fishinghooks-use-portals.patch b/patches/server/0114-Don-t-let-fishinghooks-use-portals.patch index 24eb5689a..dfedf4f2e 100644 --- a/patches/server/0114-Don-t-let-fishinghooks-use-portals.patch +++ b/patches/server/0114-Don-t-let-fishinghooks-use-portals.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't let fishinghooks use portals diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index eaa3ed52a57b56fc0f260aadfd23c2fd6dfc0f51..54bd343def9f1ebc987640c5d756db906593f320 100644 +index 24192a91d9f5c890a316ec150d4aec84073cb61a..3b23279ce994b9684dbc10157839f5fc47edfabd 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -@@ -252,6 +252,11 @@ public class FishingHook extends Projectile { +@@ -255,6 +255,11 @@ public class FishingHook extends Projectile { this.setDeltaMovement(this.getDeltaMovement().scale(0.92D)); this.reapplyPosition(); diff --git a/patches/server/0117-Optimize-World.isLoaded-BlockPosition-Z.patch b/patches/server/0117-Optimize-World.isLoaded-BlockPosition-Z.patch index ccae63f6f..c6fb2bcab 100644 --- a/patches/server/0117-Optimize-World.isLoaded-BlockPosition-Z.patch +++ b/patches/server/0117-Optimize-World.isLoaded-BlockPosition-Z.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z Reduce method invocations for World.isLoaded(BlockPosition)Z diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index e33c9116ebd8ad751774fd0fa736c42214aed654..d65fcf365a2c24c099e70597c843562ec341df3a 100644 +index 9abe4b8bbd97c30d84964d3c66a61e8b43140adb..567cc347af00eed98fdf8832ef6c9468332b94e4 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -320,6 +320,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -319,6 +319,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return chunk == null ? null : chunk.getFluidState(blockposition); } diff --git a/patches/server/0118-Bound-Treasure-Maps-to-World-Border.patch b/patches/server/0118-Bound-Treasure-Maps-to-World-Border.patch index 0e66af94a..3985c7f8a 100644 --- a/patches/server/0118-Bound-Treasure-Maps-to-World-Border.patch +++ b/patches/server/0118-Bound-Treasure-Maps-to-World-Border.patch @@ -33,15 +33,15 @@ index 6ec5a1525d0b8ced8fe78d3eab29c5eb82996844..2442c287a7f26cfee10a19e9015558cd public boolean isWithinBounds(ChunkPos pos) { return (double) pos.getMaxBlockX() > this.getMinX() && (double) pos.getMinBlockX() < this.getMaxX() && (double) pos.getMaxBlockZ() > this.getMinZ() && (double) pos.getMinBlockZ() < this.getMaxZ(); } -diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java -index cea24d53d94973218d947ece41be722f1ee79b7e..461464a4208bbb09800d87bcdb54978758863c7b 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java -@@ -168,6 +168,7 @@ public class StructureFeature { - int o = j + i * m; - int p = k + i * n; - ChunkPos chunkPos = this.getPotentialFeatureChunk(config, worldSeed, o, p); -+ if (!world.getWorldBorder().isChunkInBounds(chunkPos.x, chunkPos.z)) { continue; } // Paper - StructureCheckResult structureCheckResult = structureAccessor.checkStructurePresence(chunkPos, this, skipExistingChunks); - if (structureCheckResult != StructureCheckResult.START_NOT_PRESENT) { - if (!skipExistingChunks && structureCheckResult == StructureCheckResult.START_PRESENT) { +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +index ebdf71c5dc31dc002c5bb222e954c39e69ac7449..f9fc2fc63080a60fe61ebb08ddd93c4f189df84d 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +@@ -432,6 +432,7 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { + int l1 = i + i1 * j1; + int i2 = j + i1 * k1; + ChunkPos chunkcoordintpair = randomspreadstructureplacement.getPotentialFeatureChunk(l, l1, i2); ++ if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper + Iterator iterator = set.iterator(); + + while (iterator.hasNext()) { diff --git a/patches/server/0119-Configurable-Cartographer-Treasure-Maps.patch b/patches/server/0119-Configurable-Cartographer-Treasure-Maps.patch index a869fa0af..2e6f72a1a 100644 --- a/patches/server/0119-Configurable-Cartographer-Treasure-Maps.patch +++ b/patches/server/0119-Configurable-Cartographer-Treasure-Maps.patch @@ -28,10 +28,10 @@ index 6eb3678177834a4b34b78ba8e359528de7c0d2f0..f383f30b9dd1a7c6cf69d342f99118be + } } diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java -index a75236c1374919f7640e3b705f696dd8568eb3dc..90d77153d818534b1cb53ce80ea5409a709a2384 100644 +index 7eda0af21ce7662e9bb6d47c79e175a060a8bb13..52382b5b8149351ecf981d5414a0a50025f181c7 100644 --- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java -@@ -383,7 +383,8 @@ public class VillagerTrades { +@@ -386,7 +386,8 @@ public class VillagerTrades { return null; } else { ServerLevel serverLevel = (ServerLevel)entity.level; @@ -42,10 +42,10 @@ index a75236c1374919f7640e3b705f696dd8568eb3dc..90d77153d818534b1cb53ce80ea5409a ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), (byte)2, true, true); MapItem.renderBiomePreviewMap(serverLevel, itemStack); diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java -index bdc0de577d3acca7d9e03d184ac65b97c5b3e68a..6dc8d85f4b8a0aa24ae22d46da4a3f89c7e01871 100644 +index 385cae45ef8cbaf9f09472585e6f639eea3e0331..722930d400a35140542b742ae8ae1784ecfa0e33 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java -@@ -65,7 +65,16 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { +@@ -68,7 +68,16 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { Vec3 vec3 = context.getParamOrNull(LootContextParams.ORIGIN); if (vec3 != null) { ServerLevel serverLevel = context.getLevel(); diff --git a/patches/server/0120-Optimize-ItemStack.isEmpty.patch b/patches/server/0120-Optimize-ItemStack.isEmpty.patch index b3f1e45f9..d850c3dd8 100644 --- a/patches/server/0120-Optimize-ItemStack.isEmpty.patch +++ b/patches/server/0120-Optimize-ItemStack.isEmpty.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize ItemStack.isEmpty() Remove hashMap lookup every check, simplify code to remove ternary diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 74e4990888d88f18cb3d800724d9156e9d1ae21d..ce082016d841e3e7ba46b722b85edae9acc3f290 100644 +index d66cc030dcd3d98f57803938c8c06342a028ee88..65189af7acc3e60fc7f2bfe82128ada981bf1271 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -239,7 +239,7 @@ public final class ItemStack { +@@ -245,7 +245,7 @@ public final class ItemStack { } public boolean isEmpty() { diff --git a/patches/server/0123-Properly-fix-item-duplication-bug.patch b/patches/server/0123-Properly-fix-item-duplication-bug.patch index 108516c04..c4ab6603a 100644 --- a/patches/server/0123-Properly-fix-item-duplication-bug.patch +++ b/patches/server/0123-Properly-fix-item-duplication-bug.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Properly fix item duplication bug Credit to prplz for figuring out the real issue diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 3a97690a1e65db9a1c184fa4df5899cfda3d44bc..ab73818893b00551f8137704a727e33046d43a6a 100644 +index fa3344c71a9715ad465f39be92cb724368ae2b03..2fbe90ba893393e04b72b9feeff5f6be09d65e16 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -2158,7 +2158,7 @@ public class ServerPlayer extends Player { +@@ -2156,7 +2156,7 @@ public class ServerPlayer extends Player { @Override public boolean isImmobile() { @@ -19,10 +19,10 @@ index 3a97690a1e65db9a1c184fa4df5899cfda3d44bc..ab73818893b00551f8137704a727e330 @Override diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 16bb1d2d5f168d45bef86fad6e9ebc68f2e822f4..1a29ea597de65689b5e374e98da988e86afb4d11 100644 +index df5282a1bb7d685f0f322f5976d8cf7d31abed49..0b15188c1357926f72265411eb776726a5aa21f6 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2821,7 +2821,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2845,7 +2845,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } public final boolean isDisconnected() { diff --git a/patches/server/0124-Firework-API-s.patch b/patches/server/0124-Firework-API-s.patch index d4441c92d..326eaa749 100644 --- a/patches/server/0124-Firework-API-s.patch +++ b/patches/server/0124-Firework-API-s.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Firework API's diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index 60d60e368191038537f6a18f336565994a6b23ec..fe502e148e218ae404e0049c0251d3e3ca08c825 100644 +index 231d5923a2df7f1e7428555a3f28b83f95fc4b44..9930f7a0681899017329bd2c599db7308310b395 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java @@ -39,6 +39,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { @@ -16,7 +16,7 @@ index 60d60e368191038537f6a18f336565994a6b23ec..fe502e148e218ae404e0049c0251d3e3 public FireworkRocketEntity(EntityType type, Level world) { super(type, world); -@@ -315,6 +316,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { +@@ -318,6 +319,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { } nbt.putBoolean("ShotAtAngle", (Boolean) this.entityData.get(FireworkRocketEntity.DATA_SHOT_AT_ANGLE)); @@ -28,7 +28,7 @@ index 60d60e368191038537f6a18f336565994a6b23ec..fe502e148e218ae404e0049c0251d3e3 } @Override -@@ -331,7 +337,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { +@@ -334,7 +340,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { if (nbt.contains("ShotAtAngle")) { this.entityData.set(FireworkRocketEntity.DATA_SHOT_AT_ANGLE, nbt.getBoolean("ShotAtAngle")); } diff --git a/patches/server/0125-PlayerTeleportEndGatewayEvent.patch b/patches/server/0125-PlayerTeleportEndGatewayEvent.patch index a668335f0..16c800730 100644 --- a/patches/server/0125-PlayerTeleportEndGatewayEvent.patch +++ b/patches/server/0125-PlayerTeleportEndGatewayEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] PlayerTeleportEndGatewayEvent Allows you to access the Gateway being used in a teleport event diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -index 1001c318be6e57f5f55a842c148d29cf09d1e138..8af71dd1b916be666ee163904118db46fd3c9850 100644 +index 5b6b827db29756b2db0aaa26c84ddb4bccaade19..d336cf8f845a4d35a2d0a4cbe3b1b373fb00a970 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -@@ -11,6 +11,7 @@ import net.minecraft.data.worldgen.features.EndFeatures; +@@ -12,6 +12,7 @@ import net.minecraft.data.worldgen.features.EndFeatures; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; @@ -17,7 +17,7 @@ index 1001c318be6e57f5f55a842c148d29cf09d1e138..8af71dd1b916be666ee163904118db46 import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.Mth; -@@ -209,7 +210,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { +@@ -210,7 +211,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { location.setPitch(player.getLocation().getPitch()); location.setYaw(player.getLocation().getYaw()); diff --git a/patches/server/0126-Provide-E-TE-Chunk-count-stat-methods.patch b/patches/server/0126-Provide-E-TE-Chunk-count-stat-methods.patch index a13384e25..5cd92db02 100644 --- a/patches/server/0126-Provide-E-TE-Chunk-count-stat-methods.patch +++ b/patches/server/0126-Provide-E-TE-Chunk-count-stat-methods.patch @@ -7,10 +7,10 @@ Provides counts without the ineffeciency of using .getEntities().size() which creates copy of the collections. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index d65fcf365a2c24c099e70597c843562ec341df3a..41e7474588d8e5ba4cd4af0fed1e62e452389a3e 100644 +index 567cc347af00eed98fdf8832ef6c9468332b94e4..d22b7edc9ddea765c11e82346afd3942e37831de 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -113,7 +113,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -110,7 +110,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public static final int TICKS_PER_DAY = 24000; public static final int MAX_ENTITY_SPAWN_Y = 20000000; public static final int MIN_ENTITY_SPAWN_Y = -20000000; @@ -20,10 +20,10 @@ index d65fcf365a2c24c099e70597c843562ec341df3a..41e7474588d8e5ba4cd4af0fed1e62e4 private boolean tickingBlockEntities; public final Thread thread; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index deeb4afbbe6d4b6f44dfe20265a1a2d7d7e66e2e..e2289fbfbb59b0b1d2a09d6bb0e17664de209ebb 100644 +index 48812a4fe0c12689dd9d7829019cdf70e0bda65b..e90773c4824edf29a553827dd986209b2dd3f985 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -141,6 +141,57 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -144,6 +144,57 @@ public class CraftWorld extends CraftRegionAccessor implements World { private final CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftWorld.DATA_TYPE_REGISTRY); private net.kyori.adventure.pointer.Pointers adventure$pointers; // Paper - implement pointers diff --git a/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch b/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch index ef3e224b2..038c5c2f9 100644 --- a/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch +++ b/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't allow entities to ride themselves - #572 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 31d5d69ba7e78158bf854a25e2bf43b119e0bf88..ebf9e06b4fdd64d22ad2b56c26b4c994c1a84833 100644 +index 6f33e481e70a7b34a25d1413079288ca59b058c1..5a98227902dfd87cda7c046f6fde0aeb4462353f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2256,6 +2256,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2260,6 +2260,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } protected boolean addPassenger(Entity entity) { // CraftBukkit diff --git a/patches/server/0129-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/0129-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index e373959ab..f75549faf 100644 --- a/patches/server/0129-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/patches/server/0129-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -8,10 +8,10 @@ Adds lots of information about why this orb exists. Replaces isFromBottle() with logic that persists entity reloads too. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 252613e3c4c496bd4f6fd061e36fac06c32323c9..12c9efc409e5306fb24b8338d4c60286cff1435c 100644 +index 5a041f178184550a5b839bfa45fa271816e52e3d..c0f712fd4dd57080044341c7c7c8faf09572c2c5 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -416,7 +416,7 @@ public class ServerPlayerGameMode { +@@ -426,7 +426,7 @@ public class ServerPlayerGameMode { // Drop event experience if (flag && event != null) { @@ -21,10 +21,10 @@ index 252613e3c4c496bd4f6fd061e36fac06c32323c9..12c9efc409e5306fb24b8338d4c60286 return true; diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index f7cbe6819b8c4f7eaca2389de8eaceb50bce4b15..90692df7e02346d4ba785d2eaf724d06b98b4438 100644 +index b3433ce9c722bdab81848a6c2d121ca510c48509..227aca795efc99c4f81dfb30c00d31d2d7524542 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -@@ -38,13 +38,63 @@ public class ExperienceOrb extends Entity { +@@ -37,13 +37,63 @@ public class ExperienceOrb extends Entity { public int value; private int count; private Player followingPlayer; @@ -90,7 +90,7 @@ index f7cbe6819b8c4f7eaca2389de8eaceb50bce4b15..90692df7e02346d4ba785d2eaf724d06 } public ExperienceOrb(EntityType type, Level world) { -@@ -154,12 +204,20 @@ public class ExperienceOrb extends Entity { +@@ -153,12 +203,20 @@ public class ExperienceOrb extends Entity { } public static void award(ServerLevel world, Vec3 pos, int amount) { @@ -112,7 +112,7 @@ index f7cbe6819b8c4f7eaca2389de8eaceb50bce4b15..90692df7e02346d4ba785d2eaf724d06 } } -@@ -227,6 +285,7 @@ public class ExperienceOrb extends Entity { +@@ -228,6 +286,7 @@ public class ExperienceOrb extends Entity { nbt.putShort("Age", (short) this.age); nbt.putShort("Value", (short) this.value); nbt.putInt("Count", this.count); @@ -120,7 +120,7 @@ index f7cbe6819b8c4f7eaca2389de8eaceb50bce4b15..90692df7e02346d4ba785d2eaf724d06 } @Override -@@ -235,6 +294,7 @@ public class ExperienceOrb extends Entity { +@@ -236,6 +295,7 @@ public class ExperienceOrb extends Entity { this.age = nbt.getShort("Age"); this.value = nbt.getShort("Value"); this.count = Math.max(nbt.getInt("Count"), 1); @@ -129,10 +129,10 @@ index f7cbe6819b8c4f7eaca2389de8eaceb50bce4b15..90692df7e02346d4ba785d2eaf724d06 @Override diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index fcf9206ef317aa22cd644ccb415c2156fd9f2af2..3490b9f1803ea852ad0682e22524b58c3b050510 100644 +index 2ce597f594142d64a239649e1b812b3b7b0af340..7df80e251dbdaff32cdc0f3e7dffc9ea6d163b09 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1697,7 +1697,8 @@ public abstract class LivingEntity extends Entity { +@@ -1700,7 +1700,8 @@ public abstract class LivingEntity extends Entity { protected void dropExperience() { // CraftBukkit start - Update getExpReward() above if the removed if() changes! if (true) { @@ -143,10 +143,10 @@ index fcf9206ef317aa22cd644ccb415c2156fd9f2af2..3490b9f1803ea852ad0682e22524b58c } // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/animal/Animal.java b/src/main/java/net/minecraft/world/entity/animal/Animal.java -index 4f18af2691e149e42567c45b934adf62a589ebe0..2bc77858b4a78e24227b4b096fd44177202d5292 100644 +index 884491126f9a0b1436953ea1721746e9690ca250..3d76b91f43fb2d261e270ba52fafe2648ba6abc9 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Animal.java +++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java -@@ -272,7 +272,7 @@ public abstract class Animal extends AgeableMob { +@@ -271,7 +271,7 @@ public abstract class Animal extends AgeableMob { if (world.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // CraftBukkit start - use event experience if (experience > 0) { @@ -156,10 +156,10 @@ index 4f18af2691e149e42567c45b934adf62a589ebe0..2bc77858b4a78e24227b4b096fd44177 // CraftBukkit end } diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java -index 5220c9512c2a3e12a183b3c5ee42346f073661d9..2caf3aa6ca876d59deb98ee917e8228df140b414 100644 +index 483703458a374a27a1e30ea1fb1f08ec451046a7..6ffd1aec3563e92f5d5975d3fb4d3d89feec1416 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Fox.java +++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java -@@ -888,7 +888,7 @@ public class Fox extends Animal { +@@ -890,7 +890,7 @@ public class Fox extends Animal { if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // CraftBukkit start - use event experience if (experience > 0) { @@ -169,10 +169,10 @@ index 5220c9512c2a3e12a183b3c5ee42346f073661d9..2caf3aa6ca876d59deb98ee917e8228d // CraftBukkit end } diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java -index 29ced58a41889b63282ac5abf984e14f007407c3..44679e3b44b03dc20b3763af84df655d81680c06 100644 +index 6af8773e80351f14204b969d7bbdd976b39e99d7..ea1bb6924043dfd05452b793afd7651c867de5dc 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java +++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java -@@ -452,7 +452,7 @@ public class Turtle extends Animal { +@@ -450,7 +450,7 @@ public class Turtle extends Animal { Random random = this.animal.getRandom(); if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { @@ -182,10 +182,10 @@ index 29ced58a41889b63282ac5abf984e14f007407c3..44679e3b44b03dc20b3763af84df655d } diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -index 2584c02a5f6511ade260986a6aacef401c294549..19e594757fca90c64c4dc59233ff956e7c316da9 100644 +index 89bd094fc31969284d831eaab47a131914d4fb13..139c98ab86589027873418601dbc7f4ed6358906 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -634,7 +634,7 @@ public class EnderDragon extends Mob implements Enemy { +@@ -631,7 +631,7 @@ public class EnderDragon extends Mob implements Enemy { if (this.level instanceof ServerLevel) { if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && flag) { @@ -194,7 +194,7 @@ index 2584c02a5f6511ade260986a6aacef401c294549..19e594757fca90c64c4dc59233ff956e } if (this.dragonDeathTime == 1 && !this.isSilent()) { -@@ -665,7 +665,7 @@ public class EnderDragon extends Mob implements Enemy { +@@ -662,7 +662,7 @@ public class EnderDragon extends Mob implements Enemy { this.yBodyRot = this.getYRot(); if (this.dragonDeathTime == 200 && this.level instanceof ServerLevel) { if (flag) { @@ -204,10 +204,10 @@ index 2584c02a5f6511ade260986a6aacef401c294549..19e594757fca90c64c4dc59233ff956e if (this.dragonFight != null) { diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 8785a112519de49e0d61eab5ab5325f9b2068d7e..bd073ac603be130e649d206992c01860ee72d531 100644 +index 32a961075b41cd84b24398b9d1a4d58f88439d73..ac44ba98d0acc9aa2a75088d8a9a145fdbcbd911 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -622,7 +622,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -624,7 +624,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } if (offer.shouldRewardExp()) { @@ -217,10 +217,10 @@ index 8785a112519de49e0d61eab5ab5325f9b2068d7e..bd073ac603be130e649d206992c01860 } diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -index 9001d627060b9691b703b4c0e157124b0cdee6bb..1101989e93758294c1adebbef0ab12a3c046e326 100644 +index b9a0fc52460ce0c50deea25112dee20c977e99c5..d7cb3d8b37f225ee4796246aa907da1092fa9a0d 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java +++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -@@ -187,7 +187,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill +@@ -186,7 +186,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill if (offer.shouldRewardExp()) { int i = 3 + this.random.nextInt(4); @@ -230,10 +230,10 @@ index 9001d627060b9691b703b4c0e157124b0cdee6bb..1101989e93758294c1adebbef0ab12a3 } diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index c4126c0ced9cd8f7f23f91e2d141c37ba85da6af..c51dbef3bf17405be368d4caec72b713e06bafbc 100644 +index 3b23279ce994b9684dbc10157839f5fc47edfabd..90a5a5ede2c65d74dec4ac247e8411636fc20f78 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -@@ -515,7 +515,7 @@ public class FishingHook extends Projectile { +@@ -518,7 +518,7 @@ public class FishingHook extends Projectile { this.level.addFreshEntity(entityitem); // CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop() if (playerFishEvent.getExpToDrop() > 0) { @@ -241,7 +241,7 @@ index c4126c0ced9cd8f7f23f91e2d141c37ba85da6af..c51dbef3bf17405be368d4caec72b713 + entityhuman.level.addFreshEntity(new ExperienceOrb(entityhuman.level, entityhuman.getX(), entityhuman.getY() + 0.5D, entityhuman.getZ() + 0.5D, playerFishEvent.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.FISHING, this.getPlayerOwner(), this)); // Paper } // CraftBukkit end - if (itemstack1.is((Tag) ItemTags.FISHES)) { + if (itemstack1.is(ItemTags.FISHES)) { diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java index db6b1a9804a6d75dce22b780044beb04ca69cc94..dcbbff3a8dfcac869f07025e0e8e3d9c47956093 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java @@ -269,10 +269,10 @@ index dbdba510d8ff3c622ed928151cf525cfd1d1b1b5..aa0ba9c7dcb0ee81c9081031c447eeab world.levelEvent(1042, blockposition, 0); diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index 5147f67c87ba3b8912a8ae24f876a9e996504600..b77eda6af8b430311e502465a2590d83555ff6cf 100644 +index 54125cf5957f8165551e077c47d02b7daa578efb..59a8d1984f3bcc94048a4ce3e530d21cc3f39d7f 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -372,8 +372,13 @@ public class Block extends BlockBehaviour implements ItemLike { +@@ -374,8 +374,13 @@ public class Block extends BlockBehaviour implements ItemLike { } public void popExperience(ServerLevel world, BlockPos pos, int size) { @@ -288,10 +288,10 @@ index 5147f67c87ba3b8912a8ae24f876a9e996504600..b77eda6af8b430311e502465a2590d83 } diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index 16c272856bf9d8f8f2bf18f408cea2de94177f37..d39546b3f8d0c97fefdcc90f638eee60a5db409e 100644 +index b44216c8f5a938a92fda4156ac67988d1c399c99..c3c53a34f645a834256c31951e465ae33aa1a9ff 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -627,7 +627,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -629,7 +629,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit j = event.getExpToDrop(); // CraftBukkit end @@ -301,10 +301,10 @@ index 16c272856bf9d8f8f2bf18f408cea2de94177f37..d39546b3f8d0c97fefdcc90f638eee60 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java -index caccb8d7b30e616a4fb367e2e1c42845dd9a1880..ef3874fccb5d8b99c2b6753e7c60b83f5e3f316b 100644 +index 67223f63fdad5c53008c51b774917882c83ab707..8fb3e18303abbedb9c07319d11619c39743cbaf8 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java -@@ -883,7 +883,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor { +@@ -884,7 +884,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor { } else if (TNTPrimed.class.isAssignableFrom(clazz)) { entity = new PrimedTnt(world, x, y, z, null); } else if (ExperienceOrb.class.isAssignableFrom(clazz)) { diff --git a/patches/server/0130-Cap-Entity-Collisions.patch b/patches/server/0130-Cap-Entity-Collisions.patch index 1de881f65..916e6315f 100644 --- a/patches/server/0130-Cap-Entity-Collisions.patch +++ b/patches/server/0130-Cap-Entity-Collisions.patch @@ -27,10 +27,10 @@ index f383f30b9dd1a7c6cf69d342f99118beec70b206..47b717e8741bb2b8f3aa776dcdc73a3e + } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index ebf9e06b4fdd64d22ad2b56c26b4c994c1a84833..fb7487b52af00ae44e669242a4182a49e9b00428 100644 +index 5a98227902dfd87cda7c046f6fde0aeb4462353f..9bf0d7dca8abee27ca5757bc3e56c723d910623b 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -314,6 +314,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -317,6 +317,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public void inactiveTick() { } // Spigot end // Paper start @@ -39,10 +39,10 @@ index ebf9e06b4fdd64d22ad2b56c26b4c994c1a84833..fb7487b52af00ae44e669242a4182a49 private org.bukkit.util.Vector origin; @javax.annotation.Nullable diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 3490b9f1803ea852ad0682e22524b58c3b050510..9c175c28d152d4a6af9a720cfd95df7fdcc1be81 100644 +index 7df80e251dbdaff32cdc0f3e7dffc9ea6d163b09..f7d100d5fa85cd2e705e78be8dc6373f02d0adc0 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3225,8 +3225,11 @@ public abstract class LivingEntity extends Entity { +@@ -3228,8 +3228,11 @@ public abstract class LivingEntity extends Entity { } } diff --git a/patches/server/0133-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch b/patches/server/0133-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch index dcbdf3eaf..a1b0e025a 100644 --- a/patches/server/0133-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch +++ b/patches/server/0133-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch @@ -5,19 +5,20 @@ Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index c72d19a903a5cbb48d38f493e00e8c54a8e23b9c..065ee0486ec275f9b61dc18afa86023183f0c73b 100644 +index a10848e6899853f447f101675e3a6aba9d3d43f3..50b2dc91f4926ebc4511e44e3aa3062eadc40ea0 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -221,7 +221,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - this.playerMap = new PlayerMap(); +@@ -226,8 +226,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.entityMap = new Int2ObjectOpenHashMap(); this.chunkTypeCache = new Long2ByteOpenHashMap(); + this.chunkSaveCooldowns = new Long2LongOpenHashMap(); - this.unloadQueue = Queues.newConcurrentLinkedQueue(); -+ this.unloadQueue = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Paper - need constant-time size() this.structureManager = structureManager; ++ this.unloadQueue = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Paper - need constant-time size() Path path = session.getDimensionPath(world.dimension()); -@@ -529,7 +529,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + this.storageName = path.getFileName().toString(); +@@ -569,7 +569,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // Spigot start org.spigotmc.SlackActivityAccountant activityAccountant = this.level.getServer().slackActivityAccountant; activityAccountant.startActivity(0.5); @@ -26,7 +27,7 @@ index c72d19a903a5cbb48d38f493e00e8c54a8e23b9c..065ee0486ec275f9b61dc18afa860231 // Spigot end while (longiterator.hasNext()) { // Spigot long j = longiterator.nextLong(); -@@ -549,7 +549,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -589,7 +589,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } activityAccountant.endActivity(); // Spigot diff --git a/patches/server/0134-Properly-handle-async-calls-to-restart-the-server.patch b/patches/server/0134-Properly-handle-async-calls-to-restart-the-server.patch index d82ad563d..6ca594aa9 100644 --- a/patches/server/0134-Properly-handle-async-calls-to-restart-the-server.patch +++ b/patches/server/0134-Properly-handle-async-calls-to-restart-the-server.patch @@ -30,10 +30,10 @@ will have plugins and worlds saving to the disk has a high potential to result in corruption/dataloss. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 370e9a840a9c8abf8804755c0395d51fd576ee49..0cf83ee46754197b2b639d07bff9a0d21566a641 100644 +index 3e858ae243eaf9e145cbc5288ac2e3467082e369..fc64c29058e68239e25c51cefe97627be2a13d33 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -229,6 +229,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, ServerLevel> levels; private PlayerList playerList; private volatile boolean running; @@ -41,7 +41,7 @@ index 370e9a840a9c8abf8804755c0395d51fd576ee49..0cf83ee46754197b2b639d07bff9a0d2 private boolean stopped; private int tickCount; protected final Proxy proxy; -@@ -929,7 +930,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0.5F || this.isInWater()) || this.abilities.flying || this.isSleeping() || this.isInPowderSnow) { diff --git a/patches/server/0136-Add-configuration-option-to-prevent-player-names-fro.patch b/patches/server/0136-Add-configuration-option-to-prevent-player-names-fro.patch index e5cc70d5f..00da544c8 100644 --- a/patches/server/0136-Add-configuration-option-to-prevent-player-names-fro.patch +++ b/patches/server/0136-Add-configuration-option-to-prevent-player-names-fro.patch @@ -20,10 +20,10 @@ index 5e23ff0c5e44427a996281ae42fc12c28649e158..7a69f9d9bb9c05474d8fbab22d626529 + } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 903e4d866ffd2711c540c8982fe189d6992361f3..2d782eb547136e1dae123044b114bd77ca23383a 100644 +index eacf4e00d7ce0c1458428237e6c67aaddb45b77a..ef55ae870e341af0087bc99341a77c5d1b851328 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2545,5 +2545,10 @@ public final class CraftServer implements Server { +@@ -2537,5 +2537,10 @@ public final class CraftServer implements Server { commandMap.registerServerAliases(); return true; } diff --git a/patches/server/0137-Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/0137-Use-TerminalConsoleAppender-for-console-improvements.patch index 8906362c5..cd5ce96e3 100644 --- a/patches/server/0137-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/0137-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -19,7 +19,7 @@ Other changes: configuration diff --git a/build.gradle.kts b/build.gradle.kts -index 4db0cc3f8505747e77d314320545eb71904b4eac..8b424fb5e3c7e9169894438f680be1d43829d060 100644 +index c1f97f5bb806e3c92a2b4633142d3214e11f7074..03e00ea0e09e1b368d5803e094366fe7c38c6270 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,7 +12,17 @@ repositories { @@ -38,7 +38,7 @@ index 4db0cc3f8505747e77d314320545eb71904b4eac..8b424fb5e3c7e9169894438f680be1d4 + */ + runtimeOnly("org.apache.logging.log4j:log4j-core:2.14.1") + // Paper end - implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper + implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper implementation("org.ow2.asm:asm:9.2") implementation("org.ow2.asm:asm-commons:9.2") // Paper - ASM event executor generation diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java @@ -112,27 +112,19 @@ index 0000000000000000000000000000000000000000..685deaa0e5d1ddc13e3a7c0471b1cfcf + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 74792811da877dc59c25af5e46e3ab570895b6b6..c3e4aa076e2be77e5a48a4f0a12f26e67ea06476 100644 +index fc64c29058e68239e25c51cefe97627be2a13d33..72dd9c4c8a9266bdcf7f096ade9d6478f4ed30f0 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -9,6 +9,7 @@ import com.mojang.authlib.GameProfile; - import com.mojang.authlib.GameProfileRepository; - import com.mojang.authlib.minecraft.MinecraftSessionService; - import com.mojang.datafixers.DataFixer; -+import io.papermc.paper.adventure.PaperAdventure; // Paper - import it.unimi.dsi.fastutil.longs.LongIterator; - import java.awt.image.BufferedImage; - import java.io.BufferedWriter; -@@ -167,7 +168,7 @@ import org.apache.logging.log4j.Logger; +@@ -169,7 +169,7 @@ import org.slf4j.Logger; // CraftBukkit start import com.mojang.serialization.DynamicOps; import com.mojang.serialization.Lifecycle; -import jline.console.ConsoleReader; +// import jline.console.ConsoleReader; // Paper import joptsimple.OptionSet; - import net.minecraft.resources.RegistryReadOps; import net.minecraft.server.bossevents.CustomBossEvents; -@@ -284,7 +285,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; -@@ -368,7 +369,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0) { // Trim to filter lines which are just spaces @@ -201,7 +193,7 @@ index 2201aeecd9936402825200dd696dc5607fe0f880..eed1d77a91f19722c2d2a3a43184565c } // CraftBukkit end } -@@ -146,6 +149,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -149,6 +152,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface DedicatedServer.LOGGER.error("Exception handling console input", ioexception); } @@ -210,7 +202,7 @@ index 2201aeecd9936402825200dd696dc5607fe0f880..eed1d77a91f19722c2d2a3a43184565c } }; -@@ -157,6 +162,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -160,6 +165,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface } global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler()); @@ -220,7 +212,7 @@ index 2201aeecd9936402825200dd696dc5607fe0f880..eed1d77a91f19722c2d2a3a43184565c final org.apache.logging.log4j.core.Logger logger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()); for (org.apache.logging.log4j.core.Appender appender : logger.getAppenders().values()) { if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) { -@@ -165,6 +173,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -168,6 +176,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface } new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader).start(); @@ -230,12 +222,12 @@ index 2201aeecd9936402825200dd696dc5607fe0f880..eed1d77a91f19722c2d2a3a43184565c System.setOut(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream()); System.setErr(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream()); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index e47642c3164f7f7a358d2c7a9722643acf3e0089..dc891a463ec24b0b1b4c6c00b2c199e710204f61 100644 +index 5b1dcf148d24bbd61728d8c2af611b7c4f8dd166..03fc0bca0c1a11db43d315236ca05dfea137ddb3 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -155,8 +155,7 @@ public abstract class PlayerList { - public PlayerList(MinecraftServer server, RegistryAccess.RegistryHolder registryManager, PlayerDataStorage saveHandler, int maxPlayers) { + public PlayerList(MinecraftServer server, RegistryAccess.Frozen registryManager, PlayerDataStorage saveHandler, int maxPlayers) { this.cserver = server.server = new CraftServer((DedicatedServer) server, this); - server.console = org.bukkit.craftbukkit.command.ColouredConsoleSender.getInstance(); - server.reader.addCompleter(new org.bukkit.craftbukkit.command.ConsoleCommandCompleter(server.server)); @@ -244,10 +236,10 @@ index e47642c3164f7f7a358d2c7a9722643acf3e0089..dc891a463ec24b0b1b4c6c00b2c199e7 this.bans = new UserBanList(PlayerList.USERBANLIST_FILE); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 6efe539d3a19d5b4b673ec24f36111320daf772f..e5f4c6091e38a298c08dea09f77b9c5a8e61a2ba 100644 +index ef55ae870e341af0087bc99341a77c5d1b851328..89d9ac790b28fedc7d30b54f30cc6235f9b12a64 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -46,7 +46,6 @@ import java.util.logging.Level; +@@ -45,7 +45,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; import javax.imageio.ImageIO; @@ -255,7 +247,7 @@ index 6efe539d3a19d5b4b673ec24f36111320daf772f..e5f4c6091e38a298c08dea09f77b9c5a import net.minecraft.advancements.Advancement; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; -@@ -1290,9 +1289,13 @@ public final class CraftServer implements Server { +@@ -1282,9 +1281,13 @@ public final class CraftServer implements Server { return this.logger; } @@ -270,7 +262,7 @@ index 6efe539d3a19d5b4b673ec24f36111320daf772f..e5f4c6091e38a298c08dea09f77b9c5a @Override public PluginCommand getPluginCommand(String name) { diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index c73d785fce285d4f8eeb6f763ece21c4493071a4..77c065d74ae84f8e003141f050fe01ae582ae44c 100644 +index ff36d930a5fade32942a11f378d1c187f8f9f01a..1e49bff6e1ccd7cf8405785c73f56caada94e399 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -12,7 +12,7 @@ import java.util.logging.Level; @@ -452,7 +444,7 @@ index 6a073a9dc44d93eba296a0e18a9c7be8a7881725..b4a19d80bbf71591f25729fd0e985903 } } diff --git a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java -index 5b63604aeae9a54e2c61cc4a22115a72f34a56bd..fc07f6bd45712ec0f1aec5fe820034e6d54b39c1 100644 +index 1d8b279f3cbe6fde6bb1bfc4985c4133b0d4a95d..cdc52bbe5c6ae4688615a7732b10071f7f51718e 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java +++ b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java @@ -5,12 +5,12 @@ import java.io.IOException; diff --git a/patches/server/0140-PlayerPickupItemEvent-setFlyAtPlayer.patch b/patches/server/0140-PlayerPickupItemEvent-setFlyAtPlayer.patch index 5cfbdc55d..dcfbc30ee 100644 --- a/patches/server/0140-PlayerPickupItemEvent-setFlyAtPlayer.patch +++ b/patches/server/0140-PlayerPickupItemEvent-setFlyAtPlayer.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer 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 6df6204c9d4099afeb8ff07dd747f756d8e380d6..68fdfba22ebb35023299c776d4764d4f1555f435 100644 +index e5c97ffc4ceafcda2939d28fdc7cd729cf902db4..f5afd05e9011e05c4c49a903baa2d1d81e102bee 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -378,6 +378,7 @@ public class ItemEntity extends Entity { +@@ -380,6 +380,7 @@ public class ItemEntity extends Entity { // CraftBukkit start - fire PlayerPickupItemEvent int canHold = player.getInventory().canHold(itemstack); int remaining = i - canHold; @@ -16,7 +16,7 @@ index 6df6204c9d4099afeb8ff07dd747f756d8e380d6..68fdfba22ebb35023299c776d4764d4f if (this.pickupDelay <= 0 && canHold > 0) { itemstack.setCount(canHold); -@@ -385,8 +386,14 @@ public class ItemEntity extends Entity { +@@ -387,8 +388,14 @@ public class ItemEntity extends Entity { PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); playerEvent.setCancelled(!playerEvent.getPlayer().getCanPickupItems()); this.level.getCraftServer().getPluginManager().callEvent(playerEvent); @@ -31,7 +31,7 @@ index 6df6204c9d4099afeb8ff07dd747f756d8e380d6..68fdfba22ebb35023299c776d4764d4f return; } -@@ -416,7 +423,11 @@ public class ItemEntity extends Entity { +@@ -418,7 +425,11 @@ public class ItemEntity extends Entity { // CraftBukkit end if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(player.getUUID())) && player.getInventory().add(itemstack)) { diff --git a/patches/server/0141-PlayerAttemptPickupItemEvent.patch b/patches/server/0141-PlayerAttemptPickupItemEvent.patch index c026ee987..63863ce12 100644 --- a/patches/server/0141-PlayerAttemptPickupItemEvent.patch +++ b/patches/server/0141-PlayerAttemptPickupItemEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] PlayerAttemptPickupItemEvent 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 68fdfba22ebb35023299c776d4764d4f1555f435..db42d22f58df5daefc41720206405dda4f7ad633 100644 +index f5afd05e9011e05c4c49a903baa2d1d81e102bee..943c2bd2a0836eda5b4da382c459ade6cbe40fea 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -36,6 +36,7 @@ import net.minecraft.util.Mth; @@ -16,7 +16,7 @@ index 68fdfba22ebb35023299c776d4764d4f1555f435..db42d22f58df5daefc41720206405dda public class ItemEntity extends Entity { -@@ -380,6 +381,22 @@ public class ItemEntity extends Entity { +@@ -382,6 +383,22 @@ public class ItemEntity extends Entity { int remaining = i - canHold; boolean flyAtPlayer = false; // Paper diff --git a/patches/server/0142-Add-UnknownCommandEvent.patch b/patches/server/0142-Add-UnknownCommandEvent.patch index f88c26f68..a0d430345 100644 --- a/patches/server/0142-Add-UnknownCommandEvent.patch +++ b/patches/server/0142-Add-UnknownCommandEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add UnknownCommandEvent diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index e5f4c6091e38a298c08dea09f77b9c5a8e61a2ba..909724efb99f88f3de0967b85d539e0ab1bec8e8 100644 +index 89d9ac790b28fedc7d30b54f30cc6235f9b12a64..40d9766bbf53f858a3debd83319152cbd11ef7ed 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -889,7 +889,13 @@ public final class CraftServer implements Server { +@@ -885,7 +885,13 @@ public final class CraftServer implements Server { // Spigot start if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) { diff --git a/patches/server/0143-Basic-PlayerProfile-API.patch b/patches/server/0143-Basic-PlayerProfile-API.patch index 0095b6f6f..c378ccf96 100644 --- a/patches/server/0143-Basic-PlayerProfile-API.patch +++ b/patches/server/0143-Basic-PlayerProfile-API.patch @@ -586,10 +586,10 @@ index 9f292deee1b793d52b5774304318e940128d1e26..0cf818fceddd76e7704fdc6625456787 * Calculates distance between 2 entities * @param e1 diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 156fa293626119caf0cf414505fdf0e96eaa08b7..e98492adfb83c24e1baa6cab24cca55f3ec151bf 100644 +index b49528d8a2c577def4f74ee694ffd53b481acb32..8f5784ed4df46f3c7d4c6b4ff76ad839d436be1f 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -135,7 +135,7 @@ public class Main { +@@ -138,7 +138,7 @@ public class Main { } File file = (File) optionset.valueOf("universe"); // CraftBukkit @@ -599,7 +599,7 @@ index 156fa293626119caf0cf414505fdf0e96eaa08b7..e98492adfb83c24e1baa6cab24cca55f GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); GameProfileCache usercache = new GameProfileCache(gameprofilerepository, new File(file, MinecraftServer.USERID_CACHE_FILE.getName())); diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 00f783aafd81fa7e836e4eea5bfeac7434f33b0f..3789441e2df9410aa1c6efe59054aaba2c738633 100644 +index c3e3a9950ee05dc97f15ab128e40854901f38a2f..95974d78196397136179f8d6acf1597c557e5a23 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java @@ -135,6 +135,13 @@ public class GameProfileCache { @@ -617,10 +617,10 @@ index 00f783aafd81fa7e836e4eea5bfeac7434f33b0f..3789441e2df9410aa1c6efe59054aaba String s1 = name.toLowerCase(Locale.ROOT); GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 909724efb99f88f3de0967b85d539e0ab1bec8e8..e93c743500e3c439cd32757b16025804e0552181 100644 +index 40d9766bbf53f858a3debd83319152cbd11ef7ed..a380f59ea01cec492f2d2bef6bb6509a07998d07 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -247,6 +247,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; +@@ -243,6 +243,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; import net.md_5.bungee.api.chat.BaseComponent; // Spigot @@ -630,7 +630,7 @@ index 909724efb99f88f3de0967b85d539e0ab1bec8e8..e93c743500e3c439cd32757b16025804 public final class CraftServer implements Server { private final String serverName = "Paper"; // Paper private final String serverVersion; -@@ -286,6 +289,7 @@ public final class CraftServer implements Server { +@@ -282,6 +285,7 @@ public final class CraftServer implements Server { static { ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); ConfigurationSerialization.registerClass(CraftPlayerProfile.class); @@ -638,7 +638,7 @@ index 909724efb99f88f3de0967b85d539e0ab1bec8e8..e93c743500e3c439cd32757b16025804 CraftItemFactory.instance(); } -@@ -2559,5 +2563,24 @@ public final class CraftServer implements Server { +@@ -2551,5 +2555,24 @@ public final class CraftServer implements Server { public boolean suggestPlayerNamesWhenNullTabCompletions() { return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions; } diff --git a/patches/server/0144-Shoulder-Entities-Release-API.patch b/patches/server/0144-Shoulder-Entities-Release-API.patch index bcbf0f60d..146b44278 100644 --- a/patches/server/0144-Shoulder-Entities-Release-API.patch +++ b/patches/server/0144-Shoulder-Entities-Release-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Shoulder Entities Release API diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 51666c237abda8cce63997a655f4f621dd50ccca..3e007cb4cfef94af14800c47b3f19496c504eca8 100644 +index b15fd75ccbe54ea9169593e02631d2952b0d239a..ca9731d4d963f2615721e3e1f7e1a5e13c94cf52 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -1948,20 +1948,44 @@ public abstract class Player extends LivingEntity { +@@ -1961,20 +1961,44 @@ public abstract class Player extends LivingEntity { } diff --git a/patches/server/0146-Block-player-logins-during-server-shutdown.patch b/patches/server/0146-Block-player-logins-during-server-shutdown.patch index 6a0c80257..b22e55320 100644 --- a/patches/server/0146-Block-player-logins-during-server-shutdown.patch +++ b/patches/server/0146-Block-player-logins-during-server-shutdown.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Block player logins during server shutdown diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index afa04bbf778e5dd0823a0aab0573e4cc3787858d..2f512ca5314103d2f42c822c7bd1268f11161edf 100644 +index 58ef6874cd6c90e6ccc7c39881cc3bf68fba284b..03dc5ae09c46ad7be8e444211728a8418f594733 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -69,6 +69,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -68,6 +68,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } public void tick() { diff --git a/patches/server/0147-Entity-fromMobSpawner.patch b/patches/server/0147-Entity-fromMobSpawner.patch index 586267b7b..e2fce80f2 100644 --- a/patches/server/0147-Entity-fromMobSpawner.patch +++ b/patches/server/0147-Entity-fromMobSpawner.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity#fromMobSpawner() diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index e80cfab4b8c384067cf76667fb8ba1f0305f03cf..3e9e5736a6c357fbece9bebfeefbbc88b06e6adc 100644 +index 9bf0d7dca8abee27ca5757bc3e56c723d910623b..4473197fdcad7e6026797c6f494c4e2a90c2fb36 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -315,6 +315,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -318,6 +318,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i // Spigot end // Paper start protected int numCollisions = 0; // Paper @@ -16,7 +16,7 @@ index e80cfab4b8c384067cf76667fb8ba1f0305f03cf..3e9e5736a6c357fbece9bebfeefbbc88 @javax.annotation.Nullable private org.bukkit.util.Vector origin; @javax.annotation.Nullable -@@ -1866,6 +1867,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1871,6 +1872,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } @@ -27,7 +27,7 @@ index e80cfab4b8c384067cf76667fb8ba1f0305f03cf..3e9e5736a6c357fbece9bebfeefbbc88 // Paper end return nbt; } catch (Throwable throwable) { -@@ -2009,6 +2014,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2014,6 +2019,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i this.originWorld = originWorld; origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2)); } @@ -37,7 +37,7 @@ index e80cfab4b8c384067cf76667fb8ba1f0305f03cf..3e9e5736a6c357fbece9bebfeefbbc88 } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 002144601e8f75766b9e462579123559e4d651fe..1c5865ee2a9f3b142d92d63c19ffd785ffcf1235 100644 +index 6aab3df317a9612da9b83284aa6056f0c7cf436c..38abf49a86b0d33c6069c6a2b95edeb6c7019eb4 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -157,6 +157,7 @@ public abstract class BaseSpawner { diff --git a/patches/server/0152-Fix-this-stupid-bullshit.patch b/patches/server/0152-Fix-this-stupid-bullshit.patch index 0f99632d5..0e67ea083 100644 --- a/patches/server/0152-Fix-this-stupid-bullshit.patch +++ b/patches/server/0152-Fix-this-stupid-bullshit.patch @@ -9,10 +9,10 @@ modified in order to prevent merge conflicts when Spigot changes/disables the wa and to provide some level of hint without being disruptive. diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java -index bf42e5687935022fe5bcb1ed40bab09bfe189e88..b111200a8f5d3255de29c9836f70fc7ffd003c6e 100644 +index 9f23951f6b4c17c2a968fdcb3e8f9f65c296f34a..248b7ca7dbd75d4eab52fb937cace2b2d9ee3467 100644 --- a/src/main/java/net/minecraft/server/Bootstrap.java +++ b/src/main/java/net/minecraft/server/Bootstrap.java -@@ -48,7 +48,7 @@ public class Bootstrap { +@@ -47,7 +47,7 @@ public class Bootstrap { public static void bootStrap() { if (!Bootstrap.isBootstrapped) { // CraftBukkit start @@ -21,7 +21,7 @@ index bf42e5687935022fe5bcb1ed40bab09bfe189e88..b111200a8f5d3255de29c9836f70fc7f switch (name) { case "DispenserRegistry": break; -@@ -62,7 +62,7 @@ public class Bootstrap { +@@ -61,7 +61,7 @@ public class Bootstrap { System.err.println("*** WARNING: This server jar is unsupported, use at your own risk. ***"); System.err.println("**********************************************************************"); break; @@ -31,12 +31,12 @@ index bf42e5687935022fe5bcb1ed40bab09bfe189e88..b111200a8f5d3255de29c9836f70fc7f Bootstrap.isBootstrapped = true; if (Registry.REGISTRY.keySet().isEmpty()) { diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 77c065d74ae84f8e003141f050fe01ae582ae44c..6f86aa59fa8bcf1b340d7207c5b2be46678c96ec 100644 +index 1e49bff6e1ccd7cf8405785c73f56caada94e399..08f4ba483a6c61365310de6561b314e428a6b978 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -234,10 +234,12 @@ public class Main { Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -28); + deadline.add(Calendar.DAY_OF_YEAR, -3); if (buildDate.before(deadline.getTime())) { - System.err.println("*** Error, this build is outdated ***"); + // Paper start - This is some stupid bullshit diff --git a/patches/server/0154-Ocelot-despawns-should-honor-nametags-and-leash.patch b/patches/server/0154-Ocelot-despawns-should-honor-nametags-and-leash.patch index 3b58fc5d9..1e82429fc 100644 --- a/patches/server/0154-Ocelot-despawns-should-honor-nametags-and-leash.patch +++ b/patches/server/0154-Ocelot-despawns-should-honor-nametags-and-leash.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ocelot despawns should honor nametags and leash diff --git a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java -index b18546b6816ee77f1458a7ca44b32f76c33f2fe9..a781048b0c43e63e441e6afecec125d7f838c342 100644 +index 32c5dd9e53a0f421166dd3b84eb321b4e3e0c2fd..24d14c3a98453622e9805298c56625311f69e8dd 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java +++ b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java -@@ -134,7 +134,7 @@ public class Ocelot extends Animal { +@@ -133,7 +133,7 @@ public class Ocelot extends Animal { @Override public boolean removeWhenFarAway(double distanceSquared) { diff --git a/patches/server/0156-Allow-specifying-a-custom-authentication-servers-dow.patch b/patches/server/0156-Allow-specifying-a-custom-authentication-servers-dow.patch index 183a5a2e6..bc877ef71 100644 --- a/patches/server/0156-Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/patches/server/0156-Allow-specifying-a-custom-authentication-servers-dow.patch @@ -27,10 +27,10 @@ index 7a69f9d9bb9c05474d8fbab22d626529a41a66a1..f4735cc330822183e098a67f2c0f00f2 + } } diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 2f512ca5314103d2f42c822c7bd1268f11161edf..ad9fd830d94bdbcf0499861a46b7acdf08c433fc 100644 +index 03dc5ae09c46ad7be8e444211728a8418f594733..6834c67b38f0679497bef4b2174817d9688cbbd8 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -298,6 +298,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -304,6 +304,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener ServerLoginPacketListenerImpl.this.gameProfile = ServerLoginPacketListenerImpl.this.createFakeProfile(gameprofile); ServerLoginPacketListenerImpl.this.state = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT; } else { diff --git a/patches/server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch b/patches/server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch index 660da2ec8..49291a074 100644 --- a/patches/server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/patches/server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch @@ -15,7 +15,7 @@ This may cause additional prefixes to be disabled for plugins bypassing the plugin logger. diff --git a/build.gradle.kts b/build.gradle.kts -index f19ceb9aa0a4f1d59149ac4a933e191c78b55bda..a20994ee826d42e3b8dff35d3f67e8bcf8fb79a3 100644 +index 03e00ea0e09e1b368d5803e094366fe7c38c6270..31c19767848a3f7c1ef2c95d40d395950dff6fd5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,7 +21,7 @@ dependencies { @@ -25,10 +25,10 @@ index f19ceb9aa0a4f1d59149ac4a933e191c78b55bda..a20994ee826d42e3b8dff35d3f67e8bc - runtimeOnly("org.apache.logging.log4j:log4j-core:2.14.1") + implementation("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - implementation // Paper end - implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper + implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper implementation("org.ow2.asm:asm:9.2") diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 5a912528f82e8f97229a412b0bf72e04a520b556..1c887f152597cbcd83dd3dbcd18c874af4ddda7f 100644 +index 9d3d65de7cb0be25aa7fc40353390280943b55f4..cd5add5a38919dfcf7510758b2d3e2f7c40c18fd 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -290,7 +290,7 @@ public class SpigotConfig diff --git a/patches/server/0159-Add-PlayerJumpEvent.patch b/patches/server/0159-Add-PlayerJumpEvent.patch index 7c958b834..663d4b138 100644 --- a/patches/server/0159-Add-PlayerJumpEvent.patch +++ b/patches/server/0159-Add-PlayerJumpEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerJumpEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 92c9254335854067683d98e1576c7d06f28415b1..6c1f2be778b830bf01eb7a1ed01431dd5a568e51 100644 +index 00ab2135a53aecfe327d4fe95073db89936038a8..fb95c76877437710a5a89e8dfcbaa5cea27bda76 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1178,7 +1178,34 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1185,7 +1185,34 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser boolean flag = d8 > 0.0D; if (this.player.isOnGround() && !packet.isOnGround() && flag) { @@ -43,4 +43,4 @@ index 92c9254335854067683d98e1576c7d06f28415b1..6c1f2be778b830bf01eb7a1ed01431dd + // Paper end } - this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9)); + boolean flag1 = this.player.verticalCollisionBelow; diff --git a/patches/server/0160-handle-PacketPlayInKeepAlive-async.patch b/patches/server/0160-handle-PacketPlayInKeepAlive-async.patch index 3791aaa88..f76e611e0 100644 --- a/patches/server/0160-handle-PacketPlayInKeepAlive-async.patch +++ b/patches/server/0160-handle-PacketPlayInKeepAlive-async.patch @@ -15,10 +15,10 @@ also adding some additional logging in order to help work out what is causing random disconnections for clients. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6c1f2be778b830bf01eb7a1ed01431dd5a568e51..849b94665e20aca54bd1df0cd8f4e3d5be30e31c 100644 +index fb95c76877437710a5a89e8dfcbaa5cea27bda76..4a4a478e8964a9cec8bc61e2435333415b449f8c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2780,14 +2780,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2804,14 +2804,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handleKeepAlive(ServerboundKeepAlivePacket packet) { diff --git a/patches/server/0161-Expose-client-protocol-version-and-virtual-host.patch b/patches/server/0161-Expose-client-protocol-version-and-virtual-host.patch index 5d216a9ce..6131023aa 100644 --- a/patches/server/0161-Expose-client-protocol-version-and-virtual-host.patch +++ b/patches/server/0161-Expose-client-protocol-version-and-virtual-host.patch @@ -60,10 +60,10 @@ index 0000000000000000000000000000000000000000..a5a7624f1f372a26b982836cd31cff15 + +} diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 7d177d38f3311ab941dd126c844d22e0018e25a1..84fe0f6cfc928d95d0967ad368a38afb71543af7 100644 +index dac5ab91fca602cdc2dbc308b24e15ce411659a2..1a2184e23f1e1b8e39141689ebc5f1d13d364038 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -83,6 +83,10 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -93,6 +93,10 @@ public class Connection extends SimpleChannelInboundHandler> { private float averageSentPackets; private int tickCount; private boolean handlingFault; diff --git a/patches/server/0162-revert-serverside-behavior-of-keepalives.patch b/patches/server/0162-revert-serverside-behavior-of-keepalives.patch index 65c8f9b44..924168458 100644 --- a/patches/server/0162-revert-serverside-behavior-of-keepalives.patch +++ b/patches/server/0162-revert-serverside-behavior-of-keepalives.patch @@ -17,10 +17,10 @@ from networking or during connections flood of chunk packets on slower clients, at the cost of dead connections being kept open for longer. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 849b94665e20aca54bd1df0cd8f4e3d5be30e31c..5b8ecb96f0a6dbc9e396644b074b50ccb7b38e78 100644 +index 4a4a478e8964a9cec8bc61e2435333415b449f8c..e6cbeccfc1a471783c1b60bcb49df934b82fd36e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -220,9 +220,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -221,9 +221,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private final MinecraftServer server; public ServerPlayer player; private int tickCount; @@ -33,7 +33,7 @@ index 849b94665e20aca54bd1df0cd8f4e3d5be30e31c..5b8ecb96f0a6dbc9e396644b074b50cc // CraftBukkit start - multithreaded fields private final AtomicInteger chatSpamTickCount = new AtomicInteger(); // CraftBukkit end -@@ -251,6 +251,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -252,6 +252,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private int aboveGroundVehicleTickCount; private int receivedMovePacketCount; private int knownMovePacketCount; @@ -41,7 +41,7 @@ index 849b94665e20aca54bd1df0cd8f4e3d5be30e31c..5b8ecb96f0a6dbc9e396644b074b50cc public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { this.server = server; -@@ -332,18 +333,25 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -333,18 +334,25 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } this.server.getProfiler().push("keepAlive"); diff --git a/patches/server/0163-Send-attack-SoundEffects-only-to-players-who-can-see.patch b/patches/server/0163-Send-attack-SoundEffects-only-to-players-who-can-see.patch index f0882cb4c..2034d8b6c 100644 --- a/patches/server/0163-Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/patches/server/0163-Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 3e007cb4cfef94af14800c47b3f19496c504eca8..396c5040d5fc2b2d0955f2ffcf60deed29b710fc 100644 +index ca9731d4d963f2615721e3e1f7e1a5e13c94cf52..653dbaafb9247653a6d8f549b57f0a5d62b05265 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -30,6 +30,7 @@ import net.minecraft.network.chat.MutableComponent; +@@ -31,6 +31,7 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket; @@ -17,7 +17,7 @@ index 3e007cb4cfef94af14800c47b3f19496c504eca8..396c5040d5fc2b2d0955f2ffcf60deed import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; -@@ -1178,7 +1179,7 @@ public abstract class Player extends LivingEntity { +@@ -1191,7 +1192,7 @@ public abstract class Player extends LivingEntity { int i = b0 + EnchantmentHelper.getKnockbackBonus(this); if (this.isSprinting() && flag) { @@ -26,7 +26,7 @@ index 3e007cb4cfef94af14800c47b3f19496c504eca8..396c5040d5fc2b2d0955f2ffcf60deed ++i; flag1 = true; } -@@ -1253,7 +1254,7 @@ public abstract class Player extends LivingEntity { +@@ -1266,7 +1267,7 @@ public abstract class Player extends LivingEntity { } } @@ -35,7 +35,7 @@ index 3e007cb4cfef94af14800c47b3f19496c504eca8..396c5040d5fc2b2d0955f2ffcf60deed this.sweepAttack(); } -@@ -1281,15 +1282,15 @@ public abstract class Player extends LivingEntity { +@@ -1294,15 +1295,15 @@ public abstract class Player extends LivingEntity { } if (flag2) { @@ -54,7 +54,7 @@ index 3e007cb4cfef94af14800c47b3f19496c504eca8..396c5040d5fc2b2d0955f2ffcf60deed } } -@@ -1341,7 +1342,7 @@ public abstract class Player extends LivingEntity { +@@ -1354,7 +1355,7 @@ public abstract class Player extends LivingEntity { this.causeFoodExhaustion(level.spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value } else { @@ -63,7 +63,7 @@ index 3e007cb4cfef94af14800c47b3f19496c504eca8..396c5040d5fc2b2d0955f2ffcf60deed if (flag4) { target.clearFire(); } -@@ -1788,6 +1789,14 @@ public abstract class Player extends LivingEntity { +@@ -1801,6 +1802,14 @@ public abstract class Player extends LivingEntity { public int getXpNeededForNextLevel() { return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); } diff --git a/patches/server/0164-Add-PlayerArmorChangeEvent.patch b/patches/server/0164-Add-PlayerArmorChangeEvent.patch index 39f4dfcbc..0154d914e 100644 --- a/patches/server/0164-Add-PlayerArmorChangeEvent.patch +++ b/patches/server/0164-Add-PlayerArmorChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerArmorChangeEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 9c175c28d152d4a6af9a720cfd95df7fdcc1be81..0e1085dde127c943eda879b310182af60b8df16c 100644 +index f7d100d5fa85cd2e705e78be8dc6373f02d0adc0..41ffeca4a65a801a81bf7b7f37a39f6bf459e81a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1,5 +1,6 @@ @@ -15,7 +15,7 @@ index 9c175c28d152d4a6af9a720cfd95df7fdcc1be81..0e1085dde127c943eda879b310182af6 import com.google.common.base.Objects; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -@@ -2938,6 +2939,13 @@ public abstract class LivingEntity extends Entity { +@@ -2941,6 +2942,13 @@ public abstract class LivingEntity extends Entity { ItemStack itemstack1 = this.getItemBySlot(enumitemslot); if (!ItemStack.matches(itemstack1, itemstack)) { diff --git a/patches/server/0165-Prevent-logins-from-being-processed-when-the-player-.patch b/patches/server/0165-Prevent-logins-from-being-processed-when-the-player-.patch index 361845195..9be38dd14 100644 --- a/patches/server/0165-Prevent-logins-from-being-processed-when-the-player-.patch +++ b/patches/server/0165-Prevent-logins-from-being-processed-when-the-player-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Prevent logins from being processed when the player has diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index ad9fd830d94bdbcf0499861a46b7acdf08c433fc..cbe65d2516021946a6d759f91f03dcc886bcd237 100644 +index 6834c67b38f0679497bef4b2174817d9688cbbd8..73efc3084b04914f7f06875651269fd584b60989 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -76,7 +76,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -75,7 +75,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } // Paper end if (this.state == ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT) { diff --git a/patches/server/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch b/patches/server/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch index 1d3018cc8..bfd6705b7 100644 --- a/patches/server/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch +++ b/patches/server/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 41e7474588d8e5ba4cd4af0fed1e62e452389a3e..20f73254881e0ed2957329245acef58c99e93fcb 100644 +index d22b7edc9ddea765c11e82346afd3942e37831de..a7fbaa420bf18649cdcb94d53e7d5cfd704d9555 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -731,6 +731,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -730,6 +730,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Spigot start // Iterator iterator = this.blockEntityTickers.iterator(); int tilesThisCycle = 0; @@ -17,7 +17,7 @@ index 41e7474588d8e5ba4cd4af0fed1e62e452389a3e..20f73254881e0ed2957329245acef58c for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(tileTickPosition); -@@ -738,7 +740,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -737,7 +739,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (tickingblockentity == null) { this.getCraftServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash"); tilesThisCycle--; @@ -25,7 +25,7 @@ index 41e7474588d8e5ba4cd4af0fed1e62e452389a3e..20f73254881e0ed2957329245acef58c continue; } // Spigot end -@@ -746,12 +747,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -745,12 +746,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (tickingblockentity.isRemoved()) { // Spigot start tilesThisCycle--; diff --git a/patches/server/0167-use-CB-BlockState-implementations-for-captured-block.patch b/patches/server/0167-use-CB-BlockState-implementations-for-captured-block.patch index 13a86de97..b448867fd 100644 --- a/patches/server/0167-use-CB-BlockState-implementations-for-captured-block.patch +++ b/patches/server/0167-use-CB-BlockState-implementations-for-captured-block.patch @@ -18,10 +18,10 @@ the blockstate that will be valid for restoration, as opposed to dropping information on restoration when the event is cancelled. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 20f73254881e0ed2957329245acef58c99e93fcb..cd4c3be34647e772753dc68fbe50060365d8cd29 100644 +index a7fbaa420bf18649cdcb94d53e7d5cfd704d9555..46168d119d10231b8b946015245a476e0b56d567 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -144,7 +144,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -142,7 +142,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public boolean preventPoiUpdated = false; // CraftBukkit - SPIGOT-5710 public boolean captureBlockStates = false; public boolean captureTreeGeneration = false; @@ -30,7 +30,7 @@ index 20f73254881e0ed2957329245acef58c99e93fcb..cd4c3be34647e772753dc68fbe500603 public Map capturedTileEntities = new HashMap<>(); public List captureDrops; public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>(); -@@ -362,7 +362,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -361,7 +361,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { @@ -39,7 +39,7 @@ index 20f73254881e0ed2957329245acef58c99e93fcb..cd4c3be34647e772753dc68fbe500603 if (blockstate == null) { blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags); this.capturedBlockStates.put(pos.immutable(), blockstate); -@@ -382,7 +382,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -381,7 +381,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // CraftBukkit start - capture blockstates boolean captured = false; if (this.captureBlockStates && !this.capturedBlockStates.containsKey(pos)) { @@ -49,7 +49,7 @@ index 20f73254881e0ed2957329245acef58c99e93fcb..cd4c3be34647e772753dc68fbe500603 this.capturedBlockStates.put(pos.immutable(), blockstate); captured = true; } -@@ -651,7 +652,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -650,7 +651,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public BlockState getBlockState(BlockPos pos) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { diff --git a/patches/server/0168-API-to-get-a-BlockState-without-a-snapshot.patch b/patches/server/0168-API-to-get-a-BlockState-without-a-snapshot.patch index 538867c42..6805a47f5 100644 --- a/patches/server/0168-API-to-get-a-BlockState-without-a-snapshot.patch +++ b/patches/server/0168-API-to-get-a-BlockState-without-a-snapshot.patch @@ -13,7 +13,7 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE If Tile Entity was null, correct Sign to return empty lines instead of null diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -index 1e416b23a38458f16add472cea09b0ac5ac91869..6f61fd8224fb4094f38a851300ab55f94523c252 100644 +index 32a2fbf4a11a84d5a55e02d3ba21e6f4430379c0..a69bbc11b9e003aed1630a6f5cdbca521deb6ff5 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java @@ -45,6 +45,7 @@ public abstract class BlockEntity implements io.papermc.paper.util.KeyedObject { @@ -51,10 +51,10 @@ index 1e416b23a38458f16add472cea09b0ac5ac91869..6f61fd8224fb4094f38a851300ab55f9 return null; } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index c0af4b05b5d77aad99487fa7f8d840e797b6554c..40fc3268e7b662cdd45b569224ccd2abfad0a595 100644 +index f967388fa64aa9d4b2a390c86a2c98ac0fdd4523..7ce727c168a4c0fe6d7cd0bbaa8a4121adc96a90 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -320,6 +320,13 @@ public class CraftBlock implements Block { +@@ -322,6 +322,13 @@ public class CraftBlock implements Block { return CraftBlockStates.getBlockState(this); } diff --git a/patches/server/0169-AsyncTabCompleteEvent.patch b/patches/server/0169-AsyncTabCompleteEvent.patch index b8c715554..931c03d7e 100644 --- a/patches/server/0169-AsyncTabCompleteEvent.patch +++ b/patches/server/0169-AsyncTabCompleteEvent.patch @@ -14,10 +14,10 @@ completion, such as offline players. Also adds isCommand and getLocation to the sync TabCompleteEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5b8ecb96f0a6dbc9e396644b074b50ccb7b38e78..815901f857d283e2529c01ea81640c6b6d5716ea 100644 +index e6cbeccfc1a471783c1b60bcb49df934b82fd36e..fe414f1f84407574f6cae4f83c9e30caa7b16e33 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -700,10 +700,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -707,10 +707,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) { @@ -30,7 +30,7 @@ index 5b8ecb96f0a6dbc9e396644b074b50ccb7b38e78..815901f857d283e2529c01ea81640c6b return; } // CraftBukkit end -@@ -713,12 +713,35 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -720,12 +720,35 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser stringreader.skip(); } @@ -72,10 +72,10 @@ index 5b8ecb96f0a6dbc9e396644b074b50ccb7b38e78..815901f857d283e2529c01ea81640c6b @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index e93c743500e3c439cd32757b16025804e0552181..d8ae9ab815936712cde9d185d98728a77c0657d9 100644 +index a380f59ea01cec492f2d2bef6bb6509a07998d07..f57050098a49757927fbb4609b7f97c19f5747d1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2080,7 +2080,7 @@ public final class CraftServer implements Server { +@@ -2072,7 +2072,7 @@ public final class CraftServer implements Server { offers = this.tabCompleteChat(player, message); } diff --git a/patches/server/0170-PlayerPickupExperienceEvent.patch b/patches/server/0170-PlayerPickupExperienceEvent.patch index 32a0ed093..6b3e21f67 100644 --- a/patches/server/0170-PlayerPickupExperienceEvent.patch +++ b/patches/server/0170-PlayerPickupExperienceEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] PlayerPickupExperienceEvent Allows plugins to cancel a player picking up an experience orb diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index 90692df7e02346d4ba785d2eaf724d06b98b4438..8a3f2d2c9087b1a5f4dbde8e58af825e334f2432 100644 +index 227aca795efc99c4f81dfb30c00d31d2d7524542..6bf6d6629dfb9338d3e34f433a5698904a2acdad 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -@@ -300,7 +300,7 @@ public class ExperienceOrb extends Entity { +@@ -301,7 +301,7 @@ public class ExperienceOrb extends Entity { @Override public void playerTouch(Player player) { if (!this.level.isClientSide) { diff --git a/patches/server/0172-PlayerNaturallySpawnCreaturesEvent.patch b/patches/server/0172-PlayerNaturallySpawnCreaturesEvent.patch index 6a31762c8..3fb8ab5bf 100644 --- a/patches/server/0172-PlayerNaturallySpawnCreaturesEvent.patch +++ b/patches/server/0172-PlayerNaturallySpawnCreaturesEvent.patch @@ -9,10 +9,10 @@ from triggering monster spawns on a server. Also a highly more effecient way to blanket block spawns in a world diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 065ee0486ec275f9b61dc18afa86023183f0c73b..871c5839ec7ea39282380a42e1a45ea18897a507 100644 +index 50b2dc91f4926ebc4511e44e3aa3062eadc40ea0..610a1ce766d826f3fdca595dd4135f96ef9280d8 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1073,7 +1073,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1127,7 +1127,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange; chunkRange = (chunkRange > 8) ? 8 : chunkRange; @@ -23,7 +23,7 @@ index 065ee0486ec275f9b61dc18afa86023183f0c73b..871c5839ec7ea39282380a42e1a45ea1 // Spigot end long i = chunkcoordintpair.toLong(); -@@ -1090,6 +1092,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1144,6 +1146,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } entityplayer = (ServerPlayer) iterator.next(); @@ -40,10 +40,10 @@ index 065ee0486ec275f9b61dc18afa86023183f0c73b..871c5839ec7ea39282380a42e1a45ea1 return true; diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 8f5e9f1bdfd2e02512e1341f91b147b16e959e5b..87c9a7ffc69206554cf37c7d2c9939eb3cbea3a9 100644 +index 3bbee4d08f4125a6499c0a8790c6bda6935e5ccc..efb735f2cf0d232db83ade7332250e455c276bea 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -827,6 +827,15 @@ public class ServerChunkCache extends ChunkSource { +@@ -826,6 +826,15 @@ public class ServerChunkCache extends ChunkSource { boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit Collections.shuffle(list); @@ -60,7 +60,7 @@ index 8f5e9f1bdfd2e02512e1341f91b147b16e959e5b..87c9a7ffc69206554cf37c7d2c9939eb while (iterator1.hasNext()) { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index ab73818893b00551f8137704a727e33046d43a6a..90bff0dd400a67bcb84f8576bd8326793420919a 100644 +index 2fbe90ba893393e04b72b9feeff5f6be09d65e16..7f2d96722d3f835980ee841a285a585938acfe1a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1,5 +1,6 @@ @@ -70,7 +70,7 @@ index ab73818893b00551f8137704a727e33046d43a6a..90bff0dd400a67bcb84f8576bd832679 import com.google.common.collect.Lists; import com.mojang.authlib.GameProfile; import com.mojang.datafixers.util.Either; -@@ -236,6 +237,7 @@ public class ServerPlayer extends Player { +@@ -234,6 +235,7 @@ public class ServerPlayer extends Player { public boolean sentListPacket = false; public Integer clientViewDistance; // CraftBukkit end diff --git a/patches/server/0173-PreCreatureSpawnEvent.patch b/patches/server/0173-PreCreatureSpawnEvent.patch index e8d11ed82..06cb11ed0 100644 --- a/patches/server/0173-PreCreatureSpawnEvent.patch +++ b/patches/server/0173-PreCreatureSpawnEvent.patch @@ -15,10 +15,10 @@ instead and save a lot of server resources. See: https://github.com/PaperMC/Paper/issues/917 diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 20cfdba68c200e87d00995a6a4e25a5fa8171f6c..05ca012854100013714e3d6e8803a2959938cba4 100644 +index 8699a3bd63e2df83615ae39a6873d9874f0fb8da..05a3d736193775c1aa6ce3759e13a1f76f747d09 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -334,6 +334,20 @@ public class EntityType implements EntityTypeTest { +@@ -338,6 +338,20 @@ public class EntityType implements EntityTypeTest { @Nullable public T spawn(ServerLevel worldserver, @Nullable CompoundTag nbttagcompound, @Nullable Component ichatbasecomponent, @Nullable Player entityhuman, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { @@ -40,10 +40,10 @@ index 20cfdba68c200e87d00995a6a4e25a5fa8171f6c..05ca012854100013714e3d6e8803a295 if (t0 != null) { diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index bd073ac603be130e649d206992c01860ee72d531..6600272bfd5e5ae1699485b143a49a2471c561d9 100644 +index ac44ba98d0acc9aa2a75088d8a9a145fdbcbd911..ecd7083b40ce6230d49ea4487766a6f06b4e96d0 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -995,6 +995,21 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -997,6 +997,21 @@ public class Villager extends AbstractVillager implements ReputationEventHandler BlockPos blockposition1 = this.findSpawnPositionForGolemInColumn(blockposition, d0, d1); if (blockposition1 != null) { @@ -66,7 +66,7 @@ index bd073ac603be130e649d206992c01860ee72d531..6600272bfd5e5ae1699485b143a49a24 if (entityirongolem != null) { diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 9c27f69f5b8e95ee56428a597e67dc4e8beb6d29..33e7a9eb613a4984ebcb5f3cde5a1fa584f1695e 100644 +index 5bf68b03ddfc7c9554c467e2c0588084a796f6fa..18b1b7c05665ee1fb06670ceded719b19f3a4ee3 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -122,6 +122,27 @@ public abstract class BaseSpawner { @@ -98,7 +98,7 @@ index 9c27f69f5b8e95ee56428a597e67dc4e8beb6d29..33e7a9eb613a4984ebcb5f3cde5a1fa5 Entity entity = EntityType.loadEntityRecursive(nbttagcompound, world, (entity1) -> { entity1.moveTo(d0, d1, d2, entity1.getYRot(), entity1.getXRot()); diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 373fbdf56dddbae5f793585e31c7e4ff6d31823b..18166f773301bb4eeef9e6892fac85dd58dfd28c 100644 +index b8666d46e85bc7e9e3a05b4ebd65f59138ac55d1..12cd430e7041fab5c3d8a0aa1fe8b28866067088 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -212,7 +212,13 @@ public final class NaturalSpawner { @@ -117,7 +117,7 @@ index 373fbdf56dddbae5f793585e31c7e4ff6d31823b..18166f773301bb4eeef9e6892fac85dd if (entityinsentient == null) { @@ -259,9 +265,25 @@ public final class NaturalSpawner { - return squaredDistance <= 576.0D ? false : (world.getSharedSpawnPos().closerThan((Position) (new Vec3((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D)), 24.0D) ? false : Objects.equals(new ChunkPos(pos), chunk.getPos()) || world.isPositionEntityTicking((BlockPos) pos)); + return squaredDistance <= 576.0D ? false : (world.getSharedSpawnPos().closerToCenterThan(new Vec3((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D), 24.0D) ? false : Objects.equals(new ChunkPos(pos), chunk.getPos()) || world.isNaturalSpawningAllowed((BlockPos) pos)); } - private static boolean isValidSpawnPostitionForType(ServerLevel world, MobCategory group, StructureFeatureManager structureAccessor, ChunkGenerator chunkGenerator, MobSpawnSettings.SpawnerData spawnEntry, BlockPos.MutableBlockPos pos, double squaredDistance) { diff --git a/patches/server/0178-Extend-Player-Interact-cancellation.patch b/patches/server/0178-Extend-Player-Interact-cancellation.patch index 02f86edb1..f775b34e7 100644 --- a/patches/server/0178-Extend-Player-Interact-cancellation.patch +++ b/patches/server/0178-Extend-Player-Interact-cancellation.patch @@ -13,10 +13,10 @@ Update adjacent blocks of doors, double plants, pistons and beds when cancelling interaction. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 12c9efc409e5306fb24b8338d4c60286cff1435c..3ef782b69b9f21d12b1ef214e77bc8af8a94970b 100644 +index c0f712fd4dd57080044341c7c7c8faf09572c2c5..91d6885da13138e1def16e1876910ef893ce244d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -186,6 +186,11 @@ public class ServerPlayerGameMode { +@@ -196,6 +196,11 @@ public class ServerPlayerGameMode { PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, pos, direction, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND); if (event.isCancelled()) { // Let the client know the block still exists @@ -28,7 +28,7 @@ index 12c9efc409e5306fb24b8338d4c60286cff1435c..3ef782b69b9f21d12b1ef214e77bc8af this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos)); // Update any tile entity data for this block BlockEntity tileentity = this.level.getBlockEntity(pos); -@@ -503,7 +508,13 @@ public class ServerPlayerGameMode { +@@ -513,7 +518,13 @@ public class ServerPlayerGameMode { // send a correcting update to the client for the block above as well, this because of replaceable blocks (such as grass, sea grass etc) player.connection.send(new ClientboundBlockUpdatePacket(world, blockposition.above())); diff --git a/patches/server/0180-Toggleable-player-crits-helps-mitigate-hacked-client.patch b/patches/server/0180-Toggleable-player-crits-helps-mitigate-hacked-client.patch index 2857ef5bf..685496508 100644 --- a/patches/server/0180-Toggleable-player-crits-helps-mitigate-hacked-client.patch +++ b/patches/server/0180-Toggleable-player-crits-helps-mitigate-hacked-client.patch @@ -21,10 +21,10 @@ index 99d09ff7e9eea776f8c78eda3e89a9613a722172..3bb339658d3253b1cbdcfb789ef234f3 private void allChunksAreSlimeChunks() { allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 396c5040d5fc2b2d0955f2ffcf60deed29b710fc..7324f94c96dc9eb0a06b6475c26c0fcf74713895 100644 +index 653dbaafb9247653a6d8f549b57f0a5d62b05265..8978f3b53ce478d8aa078ac7a16784985f4a2744 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -1186,6 +1186,7 @@ public abstract class Player extends LivingEntity { +@@ -1199,6 +1199,7 @@ public abstract class Player extends LivingEntity { boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; diff --git a/patches/server/0181-Disable-Explicit-Network-Manager-Flushing.patch b/patches/server/0181-Disable-Explicit-Network-Manager-Flushing.patch index 7513b75ab..1ccb5ac58 100644 --- a/patches/server/0181-Disable-Explicit-Network-Manager-Flushing.patch +++ b/patches/server/0181-Disable-Explicit-Network-Manager-Flushing.patch @@ -12,10 +12,10 @@ flushing on the netty event loop, so it won't do the flush on the main thread. Renable flushing by passing -Dpaper.explicit-flush=true diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 84fe0f6cfc928d95d0967ad368a38afb71543af7..0aacf2e0155a9a7c9dfe9b368a251aee25ed24fc 100644 +index 1a2184e23f1e1b8e39141689ebc5f1d13d364038..7e7d33a843566440f815d779ef2f3db9efc3b92d 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -86,6 +86,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -96,6 +96,7 @@ public class Connection extends SimpleChannelInboundHandler> { // Paper start - NetworkClient implementation public int protocolVersion; public java.net.InetSocketAddress virtualHost; @@ -23,7 +23,7 @@ index 84fe0f6cfc928d95d0967ad368a38afb71543af7..0aacf2e0155a9a7c9dfe9b368a251aee // Paper end public Connection(PacketFlow side) { -@@ -259,7 +260,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -271,7 +272,7 @@ public class Connection extends SimpleChannelInboundHandler> { } if (this.channel != null) { diff --git a/patches/server/0182-Implement-extended-PaperServerListPingEvent.patch b/patches/server/0182-Implement-extended-PaperServerListPingEvent.patch index 4e408188c..13d4e9ca1 100644 --- a/patches/server/0182-Implement-extended-PaperServerListPingEvent.patch +++ b/patches/server/0182-Implement-extended-PaperServerListPingEvent.patch @@ -190,7 +190,7 @@ index 67455a5ba75c9b816213e44d6872c5ddf8e27e98..23efad80934930beadf15e65781551d4 public ClientboundStatusResponsePacket(ServerStatus metadata) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 123da97204af4bb40f98e09a5102227fb1359fd2..f6050e8ee4b43e0405933f6f7f0c234978c0639e 100644 +index 72dd9c4c8a9266bdcf7f096ade9d6478f4ed30f0..d48232d6bef4728242d2cde6b37d95a7041677d8 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2,6 +2,9 @@ package net.minecraft.server; @@ -203,7 +203,7 @@ index 123da97204af4bb40f98e09a5102227fb1359fd2..f6050e8ee4b43e0405933f6f7f0c2349 import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -@@ -1321,7 +1324,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop= this.targetChangeTime + 600) { float f = this.getBrightness(); @@ -33,7 +33,7 @@ index 186054f529cb743e1407fca027792ddb06645d79..18dbf2ad08b835c6e2be9062c0833b44 this.setTarget((LivingEntity) null); this.teleport(); } -@@ -375,17 +381,19 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -374,17 +380,19 @@ public class EnderMan extends Monster implements NeutralMob { flag = false; } @@ -54,7 +54,7 @@ index 186054f529cb743e1407fca027792ddb06645d79..18dbf2ad08b835c6e2be9062c0833b44 this.teleport(); } -@@ -605,7 +613,7 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -604,7 +612,7 @@ public class EnderMan extends Monster implements NeutralMob { } else { if (this.target != null && !this.enderman.isPassenger()) { if (this.enderman.isLookingAtMe((Player) this.target)) { diff --git a/patches/server/0195-Enderman.teleportRandomly.patch b/patches/server/0195-Enderman.teleportRandomly.patch index 5ea410652..86bca4b67 100644 --- a/patches/server/0195-Enderman.teleportRandomly.patch +++ b/patches/server/0195-Enderman.teleportRandomly.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Enderman.teleportRandomly() Ability to trigger the vanilla "teleport randomly" mechanic of an enderman. diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -index 18dbf2ad08b835c6e2be9062c0833b440e872e46..d427276e3556f1c8580ea15095424f76e07f0a99 100644 +index 1decbe53207e25ee34f9948c4dcc79fa6f1138bc..47f745bb54ab53674f371cb9dfc580fdb770541c 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -@@ -283,7 +283,7 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -282,7 +282,7 @@ public class EnderMan extends Monster implements NeutralMob { super.customServerAiStep(); } diff --git a/patches/server/0197-Expand-World.spawnParticle-API-and-add-Builder.patch b/patches/server/0197-Expand-World.spawnParticle-API-and-add-Builder.patch index 347307971..780f0a1b9 100644 --- a/patches/server/0197-Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/patches/server/0197-Expand-World.spawnParticle-API-and-add-Builder.patch @@ -10,10 +10,10 @@ Adds an option to control the force mode of the particle. This adds a new Builder API which is much friendlier to use. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index c90a3df46ce2d478d7e279a05cd1a876a54a791e..a8d80e2409a98f9e928454b56104295dbc86de7c 100644 +index 8672a2d9a62f091cae06073d57428766efc643bd..c38f6d789eea3bde1a71b14c3d070b000a9a297e 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1383,12 +1383,17 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1386,12 +1386,17 @@ public class ServerLevel extends Level implements WorldGenLevel { } public int sendParticles(ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) { @@ -34,10 +34,10 @@ index c90a3df46ce2d478d7e279a05cd1a876a54a791e..a8d80e2409a98f9e928454b56104295d if (this.sendParticles(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index e2289fbfbb59b0b1d2a09d6bb0e17664de209ebb..9d9915f2984f87c8cc9d6dd1d445dfcf127bc010 100644 +index e90773c4824edf29a553827dd986209b2dd3f985..681b91f047566c7b2220a2f30e11a55b7338dffe 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1809,11 +1809,17 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1812,11 +1812,17 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) { diff --git a/patches/server/0199-EndermanAttackPlayerEvent.patch b/patches/server/0199-EndermanAttackPlayerEvent.patch index e94d28a7d..be33ff581 100644 --- a/patches/server/0199-EndermanAttackPlayerEvent.patch +++ b/patches/server/0199-EndermanAttackPlayerEvent.patch @@ -8,10 +8,10 @@ Allow control over whether or not an enderman aggros a player. This allows you to override/extend the pumpkin/stare logic. diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -index d427276e3556f1c8580ea15095424f76e07f0a99..c7714824d8e85087397047cf9bcb0528968b1f93 100644 +index 47f745bb54ab53674f371cb9dfc580fdb770541c..102cab5a2104d32440ad489847bb7a443beead51 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -@@ -226,7 +226,15 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -225,7 +225,15 @@ public class EnderMan extends Monster implements NeutralMob { this.readPersistentAngerSaveData(this.level, nbt); } diff --git a/patches/server/0202-Allow-spawning-Item-entities-with-World.spawnEntity.patch b/patches/server/0202-Allow-spawning-Item-entities-with-World.spawnEntity.patch index bb7b83ee3..5cab56c18 100644 --- a/patches/server/0202-Allow-spawning-Item-entities-with-World.spawnEntity.patch +++ b/patches/server/0202-Allow-spawning-Item-entities-with-World.spawnEntity.patch @@ -8,7 +8,7 @@ This API has more capabilities than .dropItem with the Consumer function Item can be set inside of the Consumer pre spawn function. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java -index ef3874fccb5d8b99c2b6753e7c60b83f5e3f316b..2c5ca6e91269aa27d18358b6f9b6e146a23ad933 100644 +index 8fb3e18303abbedb9c07319d11619c39743cbaf8..9d247664e5867a31376b3681b7ed0c3404ea46d8 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java @@ -543,6 +543,10 @@ public abstract class CraftRegionAccessor implements RegionAccessor { @@ -20,5 +20,5 @@ index ef3874fccb5d8b99c2b6753e7c60b83f5e3f316b..2c5ca6e91269aa27d18358b6f9b6e146 + entity = new net.minecraft.world.entity.item.ItemEntity(world, x, y, z, new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Item.byBlock(net.minecraft.world.level.block.Blocks.DIRT))); + // Paper end } else if (FallingBlock.class.isAssignableFrom(clazz)) { - entity = new FallingBlockEntity(world, x, y, z, this.getHandle().getBlockState(new BlockPos(x, y, z))); - } else if (Projectile.class.isAssignableFrom(clazz)) { + BlockPos pos = new BlockPos(x, y, z); + entity = FallingBlockEntity.fall(world, pos, this.getHandle().getBlockState(pos)); diff --git a/patches/server/0205-Implement-EntityTeleportEndGatewayEvent.patch b/patches/server/0205-Implement-EntityTeleportEndGatewayEvent.patch index 309201c9c..541316c57 100644 --- a/patches/server/0205-Implement-EntityTeleportEndGatewayEvent.patch +++ b/patches/server/0205-Implement-EntityTeleportEndGatewayEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement EntityTeleportEndGatewayEvent diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -index 8af71dd1b916be666ee163904118db46fd3c9850..1d8af8475d0aac71a4ed8a2fed9861dd89d8319b 100644 +index d336cf8f845a4d35a2d0a4cbe3b1b373fb00a970..4e47b641a2aae8e82890cda1bdb209803472b1d4 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -@@ -223,9 +223,20 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { +@@ -224,9 +224,20 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { } // CraftBukkit end diff --git a/patches/server/0210-Make-shield-blocking-delay-configurable.patch b/patches/server/0210-Make-shield-blocking-delay-configurable.patch index e7dc5f72a..c1a7abb9e 100644 --- a/patches/server/0210-Make-shield-blocking-delay-configurable.patch +++ b/patches/server/0210-Make-shield-blocking-delay-configurable.patch @@ -19,10 +19,10 @@ index 8fc56818a2ba1aed73b8dda4da04ecac748c6ae6..1e9ffb5bc5c9d74c07be14435eb29ef9 + } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 0e1085dde127c943eda879b310182af60b8df16c..c347c4e6f957118198adb1de7633d369bd012b82 100644 +index 41ffeca4a65a801a81bf7b7f37a39f6bf459e81a..04ba5e773e2e1ecd54023370e986c4c85e54cde5 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3668,12 +3668,24 @@ public abstract class LivingEntity extends Entity { +@@ -3658,12 +3658,24 @@ public abstract class LivingEntity extends Entity { if (this.isUsingItem() && !this.useItem.isEmpty()) { Item item = this.useItem.getItem(); diff --git a/patches/server/0212-PlayerReadyArrowEvent.patch b/patches/server/0212-PlayerReadyArrowEvent.patch index 72a06078f..2d3e016e1 100644 --- a/patches/server/0212-PlayerReadyArrowEvent.patch +++ b/patches/server/0212-PlayerReadyArrowEvent.patch @@ -7,10 +7,10 @@ Called when a player is firing a bow and the server is choosing an arrow to use. Plugins can skip selection of certain arrows and control which is used. diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 4a5488a252bb885842f37cc5e98121e1e1713033..bfd454dfd450e5f9cb0e496ae654562169856de2 100644 +index f1ee710de043ad8b71c8c385a24ab4b7167f45a3..f0da841cf8e37884c40397bb4032eab35e9eec4f 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -2181,6 +2181,17 @@ public abstract class Player extends LivingEntity { +@@ -2194,6 +2194,17 @@ public abstract class Player extends LivingEntity { return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING); } @@ -28,7 +28,7 @@ index 4a5488a252bb885842f37cc5e98121e1e1713033..bfd454dfd450e5f9cb0e496ae6545621 @Override public ItemStack getProjectile(ItemStack stack) { if (!(stack.getItem() instanceof ProjectileWeaponItem)) { -@@ -2197,7 +2208,7 @@ public abstract class Player extends LivingEntity { +@@ -2210,7 +2221,7 @@ public abstract class Player extends LivingEntity { for (int i = 0; i < this.inventory.getContainerSize(); ++i) { ItemStack itemstack2 = this.inventory.getItem(i); diff --git a/patches/server/0213-Implement-EntityKnockbackByEntityEvent.patch b/patches/server/0213-Implement-EntityKnockbackByEntityEvent.patch index 98fcc1c3a..4d962853a 100644 --- a/patches/server/0213-Implement-EntityKnockbackByEntityEvent.patch +++ b/patches/server/0213-Implement-EntityKnockbackByEntityEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Implement EntityKnockbackByEntityEvent This event is called when an entity receives knockback by another entity. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index c347c4e6f957118198adb1de7633d369bd012b82..9b6fcaaafa84853804f6183d02bd90b4f988d418 100644 +index 04ba5e773e2e1ecd54023370e986c4c85e54cde5..7436cf1b9cce14494bd514cb7f4ed03536170c87 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1430,7 +1430,7 @@ public abstract class LivingEntity extends Entity { +@@ -1433,7 +1433,7 @@ public abstract class LivingEntity extends Entity { } this.hurtDir = (float) (Mth.atan2(d1, d0) * 57.2957763671875D - (double) this.getYRot()); @@ -18,7 +18,7 @@ index c347c4e6f957118198adb1de7633d369bd012b82..9b6fcaaafa84853804f6183d02bd90b4 } else { this.hurtDir = (float) ((int) (Math.random() * 2.0D) * 180); } -@@ -1478,7 +1478,7 @@ public abstract class LivingEntity extends Entity { +@@ -1481,7 +1481,7 @@ public abstract class LivingEntity extends Entity { } protected void blockedByShield(LivingEntity target) { @@ -27,7 +27,7 @@ index c347c4e6f957118198adb1de7633d369bd012b82..9b6fcaaafa84853804f6183d02bd90b4 } private boolean checkTotemDeathProtection(DamageSource source) { -@@ -1731,6 +1731,11 @@ public abstract class LivingEntity extends Entity { +@@ -1734,6 +1734,11 @@ public abstract class LivingEntity extends Entity { } public void knockback(double strength, double x, double z) { @@ -39,7 +39,7 @@ index c347c4e6f957118198adb1de7633d369bd012b82..9b6fcaaafa84853804f6183d02bd90b4 strength *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE); if (strength > 0.0D) { this.hasImpulse = true; -@@ -1738,6 +1743,15 @@ public abstract class LivingEntity extends Entity { +@@ -1741,6 +1746,15 @@ public abstract class LivingEntity extends Entity { Vec3 vec3d1 = (new Vec3(x, 0.0D, z)).normalize().scale(strength); this.setDeltaMovement(vec3d.x / 2.0D - vec3d1.x, this.onGround ? Math.min(0.4D, vec3d.y / 2.0D + strength) : vec3d.y, vec3d.z / 2.0D - vec3d1.z); @@ -56,7 +56,7 @@ index c347c4e6f957118198adb1de7633d369bd012b82..9b6fcaaafa84853804f6183d02bd90b4 } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 82b8f626f8fa4a446257df4fdc41f17c612c5b74..b937ffef296beed853b47ded1672a2f408be674f 100644 +index dddbc0497c9c6547c025162b0e6fcd865bff464c..d8af0c5977964b8953550120b69ed50198abf114 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -1554,7 +1554,7 @@ public abstract class Mob extends LivingEntity { @@ -82,10 +82,10 @@ index f6fd39823f04f8071c616d40a838b01e7159c5a1..e1cdf3ce38404d3f40be59e4cd3ad2b9 serverLevel.playSound((Player)null, pathfinderMob, this.getImpactSound.apply(pathfinderMob), SoundSource.HOSTILE, 1.0F, 1.0F); } else { diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index bfd454dfd450e5f9cb0e496ae654562169856de2..e72657009686461a28d27883573ecff09a77ccee 100644 +index f0da841cf8e37884c40397bb4032eab35e9eec4f..c522ecc74d2b204986716bccfa555cb54e8bd062 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -1229,7 +1229,7 @@ public abstract class Player extends LivingEntity { +@@ -1242,7 +1242,7 @@ public abstract class Player extends LivingEntity { if (flag5) { if (i > 0) { if (target instanceof LivingEntity) { @@ -94,7 +94,7 @@ index bfd454dfd450e5f9cb0e496ae654562169856de2..e72657009686461a28d27883573ecff0 } else { target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F)); } -@@ -1253,7 +1253,7 @@ public abstract class Player extends LivingEntity { +@@ -1266,7 +1266,7 @@ public abstract class Player extends LivingEntity { if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) { // CraftBukkit start - Only apply knockback if the damage hits if (entityliving.hurt(DamageSource.playerAttack(this).sweep(), f4)) { diff --git a/patches/server/0214-Expand-Explosions-API.patch b/patches/server/0214-Expand-Explosions-API.patch index bd066eee8..8b1566f61 100644 --- a/patches/server/0214-Expand-Explosions-API.patch +++ b/patches/server/0214-Expand-Explosions-API.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Expand Explosions API Add Entity as a Source capability, and add more API choices, and on Location. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 9d9915f2984f87c8cc9d6dd1d445dfcf127bc010..b084ac797e6512295c1adbf9226270b4607a4359 100644 +index 681b91f047566c7b2220a2f30e11a55b7338dffe..2ccf2315478f6809d4eddffc481c72c3dc618b4d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -697,6 +697,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -700,6 +700,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) { return !this.world.explode(source == null ? null : ((CraftEntity) source).getHandle(), x, y, z, power, setFire, breakBlocks ? Explosion.BlockInteraction.BREAK : Explosion.BlockInteraction.NONE).wasCanceled; } diff --git a/patches/server/0218-Implement-World.getEntity-UUID-API.patch b/patches/server/0218-Implement-World.getEntity-UUID-API.patch index 55826a714..d5832ace1 100644 --- a/patches/server/0218-Implement-World.getEntity-UUID-API.patch +++ b/patches/server/0218-Implement-World.getEntity-UUID-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement World.getEntity(UUID) API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index b084ac797e6512295c1adbf9226270b4607a4359..7b98b8639b48504096f8ab1a2cadf98d492b6789 100644 +index 2ccf2315478f6809d4eddffc481c72c3dc618b4d..15455d7be314d32cbda7adede326b33d3306c349 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1031,6 +1031,15 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1034,6 +1034,15 @@ public class CraftWorld extends CraftRegionAccessor implements World { return list; } diff --git a/patches/server/0219-InventoryCloseEvent-Reason-API.patch b/patches/server/0219-InventoryCloseEvent-Reason-API.patch index 3985bf455..7790a731e 100644 --- a/patches/server/0219-InventoryCloseEvent-Reason-API.patch +++ b/patches/server/0219-InventoryCloseEvent-Reason-API.patch @@ -7,10 +7,10 @@ Allows you to determine why an inventory was closed, enabling plugin developers to "confirm" things based on if it was player triggered close or not. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 11b0f1ef4aa02cf719e4d937c98d41b82ffca23a..9f3b3c34e625e27c9c56ccbfd244dd053c2e703f 100644 +index c38f6d789eea3bde1a71b14c3d070b000a9a297e..b2a4fd52eeead4dd2e20cfab47acc9d3fcabab98 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1130,7 +1130,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1133,7 +1133,7 @@ public class ServerLevel extends Level implements WorldGenLevel { for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) { if (tileentity instanceof net.minecraft.world.Container) { for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((net.minecraft.world.Container) tileentity).getViewers())) { @@ -19,7 +19,7 @@ index 11b0f1ef4aa02cf719e4d937c98d41b82ffca23a..9f3b3c34e625e27c9c56ccbfd244dd05 } } } -@@ -2063,7 +2063,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2070,7 +2070,7 @@ public class ServerLevel extends Level implements WorldGenLevel { // Spigot Start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) { @@ -29,10 +29,10 @@ index 11b0f1ef4aa02cf719e4d937c98d41b82ffca23a..9f3b3c34e625e27c9c56ccbfd244dd05 } // Spigot End diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 90bff0dd400a67bcb84f8576bd8326793420919a..fd1937f49312204d38510996a5be43b731f38bde 100644 +index 7f2d96722d3f835980ee841a285a585938acfe1a..005856931c27d4e2dbffec65ae59191782508e06 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -601,7 +601,7 @@ public class ServerPlayer extends Player { +@@ -599,7 +599,7 @@ public class ServerPlayer extends Player { } // Paper end if (!this.level.isClientSide && !this.containerMenu.stillValid(this)) { @@ -41,7 +41,7 @@ index 90bff0dd400a67bcb84f8576bd8326793420919a..fd1937f49312204d38510996a5be43b7 this.containerMenu = this.inventoryMenu; } -@@ -789,7 +789,7 @@ public class ServerPlayer extends Player { +@@ -787,7 +787,7 @@ public class ServerPlayer extends Player { // SPIGOT-943 - only call if they have an inventory open if (this.containerMenu != this.inventoryMenu) { @@ -50,7 +50,7 @@ index 90bff0dd400a67bcb84f8576bd8326793420919a..fd1937f49312204d38510996a5be43b7 } net.kyori.adventure.text.Component deathMessage = event.deathMessage() != null ? event.deathMessage() : net.kyori.adventure.text.Component.empty(); // Paper - Adventure -@@ -1429,7 +1429,7 @@ public class ServerPlayer extends Player { +@@ -1427,7 +1427,7 @@ public class ServerPlayer extends Player { } // CraftBukkit end if (this.containerMenu != this.inventoryMenu) { @@ -59,7 +59,7 @@ index 90bff0dd400a67bcb84f8576bd8326793420919a..fd1937f49312204d38510996a5be43b7 } // this.nextContainerCounter(); // CraftBukkit - moved up -@@ -1457,7 +1457,13 @@ public class ServerPlayer extends Player { +@@ -1455,7 +1455,13 @@ public class ServerPlayer extends Player { @Override public void closeContainer() { @@ -75,10 +75,10 @@ index 90bff0dd400a67bcb84f8576bd8326793420919a..fd1937f49312204d38510996a5be43b7 this.doCloseContainer(); } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ed477b6a229ed9e53067a8bb50f76b96945cab71..011b0a6c4fbcf9b5ffa7435c4fb325ce6b3fb262 100644 +index 9854706d1645a5c04e7ba636cf6f139b1ac4c453..1be8c731ab7019a2f93d0b32facbe05fb23371d2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -187,6 +187,7 @@ import org.bukkit.event.inventory.ClickType; +@@ -188,6 +188,7 @@ import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.CraftItemEvent; import org.bukkit.event.inventory.InventoryAction; import org.bukkit.event.inventory.InventoryClickEvent; @@ -86,7 +86,7 @@ index ed477b6a229ed9e53067a8bb50f76b96945cab71..011b0a6c4fbcf9b5ffa7435c4fb325ce import org.bukkit.event.inventory.InventoryCreativeEvent; import org.bukkit.event.inventory.InventoryType.SlotType; import org.bukkit.event.inventory.SmithItemEvent; -@@ -2334,10 +2335,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2349,10 +2350,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handleContainerClose(ServerboundContainerClosePacket packet) { @@ -105,7 +105,7 @@ index ed477b6a229ed9e53067a8bb50f76b96945cab71..011b0a6c4fbcf9b5ffa7435c4fb325ce this.player.doCloseContainer(); } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index be65d315af3089f49d2f5c9fe59c9ec0e8d3e2f9..f2efbb954ca56040ed39937750c4a01a4b6334fc 100644 +index a1ca0c0c08f6793ce3440733f802a40f99890d85..b2034239e158ce0388c9b09a52d457271a487d8f 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -502,7 +502,7 @@ public abstract class PlayerList { @@ -118,10 +118,10 @@ index be65d315af3089f49d2f5c9fe59c9ec0e8d3e2f9..f2efbb954ca56040ed39937750c4a01a PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index e72657009686461a28d27883573ecff09a77ccee..fcd66b668008a0c3be8d20f7f169b213fabe91a5 100644 +index c522ecc74d2b204986716bccfa555cb54e8bd062..2dcbeaed2e84675e95cde9e831b9d552b2e0b32f 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -262,7 +262,7 @@ public abstract class Player extends LivingEntity { +@@ -263,7 +263,7 @@ public abstract class Player extends LivingEntity { this.updateIsUnderwater(); super.tick(); if (!this.level.isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) { @@ -130,7 +130,7 @@ index e72657009686461a28d27883573ecff09a77ccee..fcd66b668008a0c3be8d20f7f169b213 this.containerMenu = this.inventoryMenu; } -@@ -485,6 +485,13 @@ public abstract class Player extends LivingEntity { +@@ -486,6 +486,13 @@ public abstract class Player extends LivingEntity { } diff --git a/patches/server/0221-Refresh-player-inventory-when-cancelling-PlayerInter.patch b/patches/server/0221-Refresh-player-inventory-when-cancelling-PlayerInter.patch index 1c6889936..cc6541e4c 100644 --- a/patches/server/0221-Refresh-player-inventory-when-cancelling-PlayerInter.patch +++ b/patches/server/0221-Refresh-player-inventory-when-cancelling-PlayerInter.patch @@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is cancelled to avoid this problem. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 011b0a6c4fbcf9b5ffa7435c4fb325ce6b3fb262..cca7ce86c619527c5ec920e68e308af46878fd8e 100644 +index 1be8c731ab7019a2f93d0b32facbe05fb23371d2..27526c1c1b21369fe8ca0f1541a15562555922b5 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2219,6 +2219,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2234,6 +2234,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } if (event.isCancelled()) { diff --git a/patches/server/0224-add-more-information-to-Entity.toString.patch b/patches/server/0224-add-more-information-to-Entity.toString.patch index d44d17446..4da95a5c3 100644 --- a/patches/server/0224-add-more-information-to-Entity.toString.patch +++ b/patches/server/0224-add-more-information-to-Entity.toString.patch @@ -6,10 +6,10 @@ Subject: [PATCH] add more information to Entity.toString() UUID, ticks lived, valid, dead diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c2b24ad7ca280972f287cbb876dcc7011fb49db9..612478675192471ffcf937842d522bd179c43c51 100644 +index 4473197fdcad7e6026797c6f494c4e2a90c2fb36..9041feeeb0e2d43abebaa136dc739b3525f48e16 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2827,7 +2827,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2844,7 +2844,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public String toString() { String s = this.level == null ? "~NULL~" : this.level.toString(); diff --git a/patches/server/0230-Option-to-prevent-armor-stands-from-doing-entity-loo.patch b/patches/server/0230-Option-to-prevent-armor-stands-from-doing-entity-loo.patch index bb7b8b094..03f12b975 100644 --- a/patches/server/0230-Option-to-prevent-armor-stands-from-doing-entity-loo.patch +++ b/patches/server/0230-Option-to-prevent-armor-stands-from-doing-entity-loo.patch @@ -31,10 +31,10 @@ index 138422903dcb3056cd011a72e0625a1a225b4280..b92c2d5f9ad3936f619b51c79379983e for (int i = 0; i < list.size(); ++i) { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index cd4c3be34647e772753dc68fbe50060365d8cd29..d61e598478d297857f5e76d7c42a9e5c157514d5 100644 +index 46168d119d10231b8b946015245a476e0b56d567..e80a9a5df0e4722a12c65c57592879621571a13f 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -775,6 +775,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -774,6 +774,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Paper end } } diff --git a/patches/server/0231-Vanished-players-don-t-have-rights.patch b/patches/server/0231-Vanished-players-don-t-have-rights.patch index 9f99ea6f0..2b61bed88 100644 --- a/patches/server/0231-Vanished-players-don-t-have-rights.patch +++ b/patches/server/0231-Vanished-players-don-t-have-rights.patch @@ -38,7 +38,7 @@ index c3fb7d41688855010c643b91c8d9496486dae089..8175bb6331727440da2232998bdad068 BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(context.getLevel(), context.getClickedPos()), player, CraftBlockData.fromData(state), defaultReturn); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index d61e598478d297857f5e76d7c42a9e5c157514d5..fe666bb392ca16a9a6210dcb08bd0ddae22ead85 100644 +index e80a9a5df0e4722a12c65c57592879621571a13f..67566e5f95f7452d31bea485bdb91a4e1a32e5d5 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -72,6 +72,10 @@ import net.minecraft.world.level.saveddata.maps.MapItemSavedData; @@ -50,9 +50,9 @@ index d61e598478d297857f5e76d7c42a9e5c157514d5..fe666bb392ca16a9a6210dcb08bd0dda +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.scores.Scoreboard; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -251,6 +255,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + + // CraftBukkit start +@@ -250,6 +254,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } diff --git a/patches/server/0236-AnvilDamageEvent.patch b/patches/server/0236-AnvilDamageEvent.patch index c6a2d4749..f2443baef 100644 --- a/patches/server/0236-AnvilDamageEvent.patch +++ b/patches/server/0236-AnvilDamageEvent.patch @@ -5,11 +5,11 @@ Subject: [PATCH] AnvilDamageEvent diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java -index 57c2806543e8a183033170bfb7746cfa8f14b448..6b9c39b85e3a21fc0073fc15c8a76c92f75d2487 100644 +index 4348a2f7187b4751ceafe567381ebd9828983fef..21215d27e59d7e6ab4b9511340e642c710fb74da 100644 --- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java -@@ -89,6 +89,16 @@ public class AnvilMenu extends ItemCombinerMenu { - if (!player.getAbilities().instabuild && iblockdata.is((Tag) BlockTags.ANVIL) && player.getRandom().nextFloat() < 0.12F) { +@@ -88,6 +88,16 @@ public class AnvilMenu extends ItemCombinerMenu { + if (!player.getAbilities().instabuild && iblockdata.is(BlockTags.ANVIL) && player.getRandom().nextFloat() < 0.12F) { BlockState iblockdata1 = AnvilBlock.damage(iblockdata); + // Paper start diff --git a/patches/server/0237-Add-hand-to-bucket-events.patch b/patches/server/0237-Add-hand-to-bucket-events.patch index 523d45c4e..9720caf62 100644 --- a/patches/server/0237-Add-hand-to-bucket-events.patch +++ b/patches/server/0237-Add-hand-to-bucket-events.patch @@ -18,10 +18,10 @@ index 0f601ad4629bda75ec90612ad27fdec9ce62f83d..425c6da0de40983b0870c9fd1b53f16b if (event.isCancelled()) { return InteractionResult.PASS; diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -index dc1ef737267aa826d1d2fb10f923fe294a67be83..d3c4f93ee2aa1902eeca197c72eb17199fc41fb2 100644 +index 8017953b623454593fbddbbcf90806c6e07c0974..8618790938f182e4aa0e27ea79dea1d35a36ec6e 100644 --- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -@@ -182,7 +182,7 @@ public class Goat extends Animal { +@@ -177,7 +177,7 @@ public class Goat extends Animal { if (itemstack.is(Items.BUCKET) && !this.isBaby()) { // CraftBukkit start - Got milk? diff --git a/patches/server/0238-Add-TNTPrimeEvent.patch b/patches/server/0238-Add-TNTPrimeEvent.patch index 4c2f58822..63784ce3b 100644 --- a/patches/server/0238-Add-TNTPrimeEvent.patch +++ b/patches/server/0238-Add-TNTPrimeEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add TNTPrimeEvent diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -index 19e594757fca90c64c4dc59233ff956e7c316da9..e17a3afa41fd628d2c4a3637ae19418e258a99b8 100644 +index 139c98ab86589027873418601dbc7f4ed6358906..7eebecf836d21fc4ee901d23d7061db64486c0d5 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -536,6 +536,11 @@ public class EnderDragon extends Mob implements Enemy { +@@ -533,6 +533,11 @@ public class EnderDragon extends Mob implements Enemy { }); craftBlock.getNMS().spawnAfterBreak((ServerLevel) level, blockposition, ItemStack.EMPTY); } diff --git a/patches/server/0239-Break-up-and-make-tab-spam-limits-configurable.patch b/patches/server/0239-Break-up-and-make-tab-spam-limits-configurable.patch index c4907e088..3383fa2c3 100644 --- a/patches/server/0239-Break-up-and-make-tab-spam-limits-configurable.patch +++ b/patches/server/0239-Break-up-and-make-tab-spam-limits-configurable.patch @@ -45,10 +45,10 @@ index 915e2c5b0ffbd0d459a203e1bfb131be4c5476d4..00dd9dab2b19f3e49f3b41c20eb96a84 + } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index cca7ce86c619527c5ec920e68e308af46878fd8e..c0f558d3c6f3b4b01e56d453ab136cf2357f2463 100644 +index 27526c1c1b21369fe8ca0f1541a15562555922b5..62fda1dd8d560a8e16118e9d1b044ef59c0e5b02 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -226,6 +226,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -227,6 +227,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private long keepAliveChallenge; // CraftBukkit start - multithreaded fields private final AtomicInteger chatSpamTickCount = new AtomicInteger(); @@ -56,7 +56,7 @@ index cca7ce86c619527c5ec920e68e308af46878fd8e..c0f558d3c6f3b4b01e56d453ab136cf2 // CraftBukkit end private int dropSpamTickCount; private double firstGoodX; -@@ -357,6 +358,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -358,6 +359,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.server.getProfiler().pop(); // CraftBukkit start for (int spam; (spam = this.chatSpamTickCount.get()) > 0 && !this.chatSpamTickCount.compareAndSet(spam, spam - 1); ) ; @@ -64,7 +64,7 @@ index cca7ce86c619527c5ec920e68e308af46878fd8e..c0f558d3c6f3b4b01e56d453ab136cf2 /* Use thread-safe field access instead if (this.chatSpamTickCount > 0) { --this.chatSpamTickCount; -@@ -703,7 +705,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -710,7 +712,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) { // PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async // CraftBukkit start diff --git a/patches/server/0240-MC-135506-Experience-should-save-as-Integers.patch b/patches/server/0240-MC-135506-Experience-should-save-as-Integers.patch index 839858204..c0c7c171f 100644 --- a/patches/server/0240-MC-135506-Experience-should-save-as-Integers.patch +++ b/patches/server/0240-MC-135506-Experience-should-save-as-Integers.patch @@ -5,10 +5,10 @@ Subject: [PATCH] MC-135506: Experience should save as Integers diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index 8a3f2d2c9087b1a5f4dbde8e58af825e334f2432..8be7a3527018f9f6ecb91576c928c255b3089342 100644 +index 6bf6d6629dfb9338d3e34f433a5698904a2acdad..4848f26a006f4d4df620ded526134b3b39e90d29 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -@@ -283,7 +283,7 @@ public class ExperienceOrb extends Entity { +@@ -284,7 +284,7 @@ public class ExperienceOrb extends Entity { public void addAdditionalSaveData(CompoundTag nbt) { nbt.putShort("Health", (short) this.health); nbt.putShort("Age", (short) this.age); @@ -17,7 +17,7 @@ index 8a3f2d2c9087b1a5f4dbde8e58af825e334f2432..8be7a3527018f9f6ecb91576c928c255 nbt.putInt("Count", this.count); this.savePaperNBT(nbt); // Paper } -@@ -292,7 +292,7 @@ public class ExperienceOrb extends Entity { +@@ -293,7 +293,7 @@ public class ExperienceOrb extends Entity { public void readAdditionalSaveData(CompoundTag nbt) { this.health = nbt.getShort("Health"); this.age = nbt.getShort("Age"); diff --git a/patches/server/0242-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch b/patches/server/0242-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch index 3101f4013..e8dd47033 100644 --- a/patches/server/0242-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch +++ b/patches/server/0242-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch @@ -8,10 +8,10 @@ Add -Ddebug.entities=true to your JVM flags to gain more information 1.17: Needs to be reworked for new entity storage system diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 71e0206e31eafca2859fe972214bea0ad74f203e..8593f68b0d2c1043009d02ada5396333c8da4d50 100644 +index 610a1ce766d826f3fdca595dd4135f96ef9280d8..b64f42b9ca1da5b6d5c290c157e510797e524117 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1312,6 +1312,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1366,6 +1366,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } else { ChunkMap.TrackedEntity playerchunkmap_entitytracker = new ChunkMap.TrackedEntity(entity, i, j, entitytypes.trackDeltas()); @@ -19,7 +19,7 @@ index 71e0206e31eafca2859fe972214bea0ad74f203e..8593f68b0d2c1043009d02ada5396333 this.entityMap.put(entity.getId(), playerchunkmap_entitytracker); playerchunkmap_entitytracker.updatePlayers(this.level.players()); if (entity instanceof ServerPlayer) { -@@ -1354,7 +1355,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1408,7 +1409,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (playerchunkmap_entitytracker1 != null) { playerchunkmap_entitytracker1.broadcastRemoved(); } @@ -29,10 +29,10 @@ index 71e0206e31eafca2859fe972214bea0ad74f203e..8593f68b0d2c1043009d02ada5396333 protected void tick() { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 9f3b3c34e625e27c9c56ccbfd244dd053c2e703f..cd11361cd2dc12c7b94f3e8505937b484ec19dff 100644 +index b2a4fd52eeead4dd2e20cfab47acc9d3fcabab98..7e2e7ce7ba9b23c813e1a4197ac06d0fe703c22b 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -208,6 +208,9 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -209,6 +209,9 @@ public class ServerLevel extends Level implements WorldGenLevel { public final LevelStorageSource.LevelStorageAccess convertable; public final UUID uuid; public boolean hasPhysicsEvent = true; // Paper @@ -42,7 +42,7 @@ index 9f3b3c34e625e27c9c56ccbfd244dd053c2e703f..cd11361cd2dc12c7b94f3e8505937b48 @Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI return this.chunkSource.getChunk(x, z, false); -@@ -1093,7 +1096,28 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1096,7 +1099,28 @@ public class ServerLevel extends Level implements WorldGenLevel { // CraftBukkit start private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot @@ -72,10 +72,10 @@ index 9f3b3c34e625e27c9c56ccbfd244dd053c2e703f..cd11361cd2dc12c7b94f3e8505937b48 return false; } else { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6defa5579f3c7dba3dc9d82937a14edd1bb16cfe..37f337efb7ac164749c73974e4acfde93d649290 100644 +index 9041feeeb0e2d43abebaa136dc739b3525f48e16..c819bd3db7dfab1181288683f2a47bb71a52953d 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -170,6 +170,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -173,6 +173,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper private CraftEntity bukkitEntity; @@ -85,10 +85,10 @@ index 6defa5579f3c7dba3dc9d82937a14edd1bb16cfe..37f337efb7ac164749c73974e4acfde9 if (this.bukkitEntity == null) { this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index fe666bb392ca16a9a6210dcb08bd0ddae22ead85..5e3d1a36b0eb350536e29730540ee17b68fe315b 100644 +index 67566e5f95f7452d31bea485bdb91a4e1a32e5d5..dc2235824853a0d7ccbff51dd26a71e97fe90ba7 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -144,6 +144,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -142,6 +142,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public boolean pvpMode; public boolean keepSpawnInMemory = true; public org.bukkit.generator.ChunkGenerator generator; @@ -97,7 +97,7 @@ index fe666bb392ca16a9a6210dcb08bd0ddae22ead85..5e3d1a36b0eb350536e29730540ee17b public boolean preventPoiUpdated = false; // CraftBukkit - SPIGOT-5710 public boolean captureBlockStates = false; diff --git a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java -index c8cf7da4224dccd9b9e8a73bcfc3ff5babfb8f8c..1d04f35b6755b3a7ee77f93c1a30513a5af7d6cf 100644 +index 3864da01056970ae05cc3ca094f923178b4ffc97..ab6be988a8714d57ee73ce80b9101a1e9917fbbe 100644 --- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java +++ b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java @@ -20,7 +20,7 @@ public class EntityLookup { diff --git a/patches/server/0243-Add-Early-Warning-Feature-to-WatchDog.patch b/patches/server/0243-Add-Early-Warning-Feature-to-WatchDog.patch index 410e523f9..e980e9bfb 100644 --- a/patches/server/0243-Add-Early-Warning-Feature-to-WatchDog.patch +++ b/patches/server/0243-Add-Early-Warning-Feature-to-WatchDog.patch @@ -36,10 +36,10 @@ index 00dd9dab2b19f3e49f3b41c20eb96a84bfae1769..d9114c5fa141c37270398100db6bb2a8 public static int tabSpamLimit = 500; private static void tabSpamLimiters() { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e89f100e950c6fa85112a67daaa157de665b17cf..37ccbfc3b5ff47fac8cd878f9de5bccec84994e5 100644 +index d48232d6bef4728242d2cde6b37d95a7041677d8..86e789515922345ed3ce623b24f81a5a379a020c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1085,6 +1085,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> { - protected static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().create(); private final File file; - private final Map map = Maps.newHashMap(); diff --git a/patches/server/0245-Use-a-Queue-for-Queueing-Commands.patch b/patches/server/0245-Use-a-Queue-for-Queueing-Commands.patch index 79bac7892..742b00ee9 100644 --- a/patches/server/0245-Use-a-Queue-for-Queueing-Commands.patch +++ b/patches/server/0245-Use-a-Queue-for-Queueing-Commands.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Use a Queue for Queueing Commands Lists are bad as Queues mmmkay. diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index eed1d77a91f19722c2d2a3a43184565cd29732f7..9a2c040c3a513fe51c5fa9c5deaba13a01639f38 100644 +index 39a24292f215920bc3121f4ac903040dd73a9978..4357d5c7c66d9490a34f2d591ddc3d58d36cadd1 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -75,7 +75,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -78,7 +78,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface private static final int CONVERSION_RETRY_DELAY_MS = 5000; private static final int CONVERSION_RETRIES = 2; private static final Pattern SHA1 = Pattern.compile("^[a-fA-F0-9]{40}$"); @@ -18,7 +18,7 @@ index eed1d77a91f19722c2d2a3a43184565cd29732f7..9a2c040c3a513fe51c5fa9c5deaba13a @Nullable private QueryThreadGs4 queryThreadGs4; public final RconConsoleSource rconConsoleSource; -@@ -453,13 +453,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -456,13 +456,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface } public void handleConsoleInput(String command, CommandSourceStack commandSource) { diff --git a/patches/server/0246-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/patches/server/0246-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch index 28dbf7c0e..a583e1baf 100644 --- a/patches/server/0246-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch +++ b/patches/server/0246-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 6c47771e0168e958b22c987bcd8bc100f6208c10..a1fe076d76fe5f84eca39ea68e9820096f58f5a7 100644 +index 404bd3389aaa75ca23f04d23ecea9093443c3976..f3c67a815c570beb14136905cbf5aa4046ee8394 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -4,8 +4,10 @@ import com.google.common.base.Preconditions; @@ -19,7 +19,7 @@ index 6c47771e0168e958b22c987bcd8bc100f6208c10..a1fe076d76fe5f84eca39ea68e982009 import java.util.Objects; import java.util.concurrent.locks.LockSupport; import java.util.function.BooleanSupplier; -@@ -175,6 +177,13 @@ public class CraftChunk implements Chunk { +@@ -176,6 +178,13 @@ public class CraftChunk implements Chunk { @Override public BlockState[] getTileEntities() { @@ -33,7 +33,7 @@ index 6c47771e0168e958b22c987bcd8bc100f6208c10..a1fe076d76fe5f84eca39ea68e982009 if (!this.isLoaded()) { this.getWorld().getChunkAt(x, z); // Transient load for this tick } -@@ -189,7 +198,29 @@ public class CraftChunk implements Chunk { +@@ -190,7 +199,29 @@ public class CraftChunk implements Chunk { } BlockPos position = (BlockPos) obj; diff --git a/patches/server/0249-Slime-Pathfinder-Events.patch b/patches/server/0249-Slime-Pathfinder-Events.patch index 86987afbe..40c543b87 100644 --- a/patches/server/0249-Slime-Pathfinder-Events.patch +++ b/patches/server/0249-Slime-Pathfinder-Events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Slime Pathfinder Events diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java -index 11aefbf65b0e63777d6ed5bfdb18c7f7df30fc0e..6ec81054bcf25d99aec567d568c361eea84ed384 100644 +index 990f2e17aad4a1116482b3aa534686cf8dc3669a..8d03466e2f546aae705c1d4dd2d562d3db2f2671 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Slime.java +++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java -@@ -44,6 +44,12 @@ import net.minecraft.world.level.biome.Biomes; +@@ -42,6 +42,12 @@ import net.minecraft.world.level.biome.Biomes; import net.minecraft.world.level.levelgen.WorldgenRandom; import net.minecraft.world.level.storage.loot.BuiltInLootTables; import net.minecraft.world.phys.Vec3; @@ -21,7 +21,7 @@ index 11aefbf65b0e63777d6ed5bfdb18c7f7df30fc0e..6ec81054bcf25d99aec567d568c361ee // CraftBukkit start import java.util.ArrayList; import java.util.List; -@@ -108,6 +114,7 @@ public class Slime extends Mob implements Enemy { +@@ -106,6 +112,7 @@ public class Slime extends Mob implements Enemy { @Override public void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); @@ -29,7 +29,7 @@ index 11aefbf65b0e63777d6ed5bfdb18c7f7df30fc0e..6ec81054bcf25d99aec567d568c361ee nbt.putInt("Size", this.getSize() - 1); nbt.putBoolean("wasOnGround", this.wasOnGround); } -@@ -116,6 +123,11 @@ public class Slime extends Mob implements Enemy { +@@ -114,6 +121,11 @@ public class Slime extends Mob implements Enemy { public void readAdditionalSaveData(CompoundTag nbt) { this.setSize(nbt.getInt("Size") + 1, false); super.readAdditionalSaveData(nbt); @@ -41,7 +41,7 @@ index 11aefbf65b0e63777d6ed5bfdb18c7f7df30fc0e..6ec81054bcf25d99aec567d568c361ee this.wasOnGround = nbt.getBoolean("wasOnGround"); } -@@ -454,7 +466,7 @@ public class Slime extends Mob implements Enemy { +@@ -452,7 +464,7 @@ public class Slime extends Mob implements Enemy { @Override public boolean canUse() { @@ -50,7 +50,7 @@ index 11aefbf65b0e63777d6ed5bfdb18c7f7df30fc0e..6ec81054bcf25d99aec567d568c361ee } @Override -@@ -486,7 +498,15 @@ public class Slime extends Mob implements Enemy { +@@ -484,7 +496,15 @@ public class Slime extends Mob implements Enemy { public boolean canUse() { LivingEntity entityliving = this.slime.getTarget(); @@ -67,7 +67,7 @@ index 11aefbf65b0e63777d6ed5bfdb18c7f7df30fc0e..6ec81054bcf25d99aec567d568c361ee } @Override -@@ -499,7 +519,15 @@ public class Slime extends Mob implements Enemy { +@@ -497,7 +517,15 @@ public class Slime extends Mob implements Enemy { public boolean canContinueToUse() { LivingEntity entityliving = this.slime.getTarget(); @@ -84,7 +84,7 @@ index 11aefbf65b0e63777d6ed5bfdb18c7f7df30fc0e..6ec81054bcf25d99aec567d568c361ee } @Override -@@ -517,6 +545,13 @@ public class Slime extends Mob implements Enemy { +@@ -515,6 +543,13 @@ public class Slime extends Mob implements Enemy { ((Slime.SlimeMoveControl) this.slime.getMoveControl()).setDirection(this.slime.getYRot(), this.slime.isDealsDamage()); } @@ -98,7 +98,7 @@ index 11aefbf65b0e63777d6ed5bfdb18c7f7df30fc0e..6ec81054bcf25d99aec567d568c361ee } private static class SlimeRandomDirectionGoal extends Goal { -@@ -532,7 +567,7 @@ public class Slime extends Mob implements Enemy { +@@ -530,7 +565,7 @@ public class Slime extends Mob implements Enemy { @Override public boolean canUse() { @@ -107,7 +107,7 @@ index 11aefbf65b0e63777d6ed5bfdb18c7f7df30fc0e..6ec81054bcf25d99aec567d568c361ee } @Override -@@ -540,6 +575,11 @@ public class Slime extends Mob implements Enemy { +@@ -538,6 +573,11 @@ public class Slime extends Mob implements Enemy { if (--this.nextRandomizeTime <= 0) { this.nextRandomizeTime = this.adjustedTickDelay(40 + this.slime.getRandom().nextInt(60)); this.chosenDegrees = (float) this.slime.getRandom().nextInt(360); @@ -119,7 +119,7 @@ index 11aefbf65b0e63777d6ed5bfdb18c7f7df30fc0e..6ec81054bcf25d99aec567d568c361ee } ((Slime.SlimeMoveControl) this.slime.getMoveControl()).setDirection(this.chosenDegrees, false); -@@ -557,7 +597,7 @@ public class Slime extends Mob implements Enemy { +@@ -555,7 +595,7 @@ public class Slime extends Mob implements Enemy { @Override public boolean canUse() { @@ -128,7 +128,7 @@ index 11aefbf65b0e63777d6ed5bfdb18c7f7df30fc0e..6ec81054bcf25d99aec567d568c361ee } @Override -@@ -565,4 +605,15 @@ public class Slime extends Mob implements Enemy { +@@ -563,4 +603,15 @@ public class Slime extends Mob implements Enemy { ((Slime.SlimeMoveControl) this.slime.getMoveControl()).setWantedMovement(1.0D); } } diff --git a/patches/server/0250-Configurable-speed-for-water-flowing-over-lava.patch b/patches/server/0250-Configurable-speed-for-water-flowing-over-lava.patch index f8d88afb9..d9b466d62 100644 --- a/patches/server/0250-Configurable-speed-for-water-flowing-over-lava.patch +++ b/patches/server/0250-Configurable-speed-for-water-flowing-over-lava.patch @@ -20,10 +20,10 @@ index 831e874f01d8edcff12a094dbf918d2533939c60..e57ab8a3e6efd78e12385042b7d91dcd + } } diff --git a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java -index c3d3c06e06a85ce926a2be69ec9d9b8a3eb9b8e2..11ebadaa2438281a54cffe025a49ee5046a71ba5 100644 +index c3afe362f76eed689c33d05e28b1b2b9107c90c7..8497adcba2570da8875c322e751fca2fdad057e5 100644 --- a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java -@@ -24,6 +24,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; +@@ -23,6 +23,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.material.FlowingFluid; import net.minecraft.world.level.material.FluidState; @@ -31,7 +31,7 @@ index c3d3c06e06a85ce926a2be69ec9d9b8a3eb9b8e2..11ebadaa2438281a54cffe025a49ee50 import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.phys.shapes.CollisionContext; -@@ -107,11 +108,27 @@ public class LiquidBlock extends Block implements BucketPickup { +@@ -106,11 +107,27 @@ public class LiquidBlock extends Block implements BucketPickup { @Override public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { if (this.shouldSpreadLiquid(world, pos, state)) { @@ -60,7 +60,7 @@ index c3d3c06e06a85ce926a2be69ec9d9b8a3eb9b8e2..11ebadaa2438281a54cffe025a49ee50 @Override public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { if (state.getFluidState().isSource() || neighborState.getFluidState().isSource()) { -@@ -124,7 +141,7 @@ public class LiquidBlock extends Block implements BucketPickup { +@@ -123,7 +140,7 @@ public class LiquidBlock extends Block implements BucketPickup { @Override public void neighborChanged(BlockState state, Level world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { if (this.shouldSpreadLiquid(world, pos, state)) { diff --git a/patches/server/0251-Optimize-CraftBlockData-Creation.patch b/patches/server/0251-Optimize-CraftBlockData-Creation.patch index a7acf9bde..998ef1e21 100644 --- a/patches/server/0251-Optimize-CraftBlockData-Creation.patch +++ b/patches/server/0251-Optimize-CraftBlockData-Creation.patch @@ -7,10 +7,10 @@ Avoids a hashmap lookup by cacheing a reference to the CraftBlockData and cloning it when one is needed. diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index a3f44e3a44b2ec21ef41f6d598b428448c847c5f..3c6b1b92fedf9986ebb835170c070ebd461f5d25 100644 +index 2b88ea323b7e179015751e87d1a4303bffed7f51..a5b7fbd940bf180b76017442ee7224761741fe52 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -678,6 +678,14 @@ public abstract class BlockBehaviour { +@@ -680,6 +680,14 @@ public abstract class BlockBehaviour { this.hasPostProcess = blockbase_info.hasPostProcess; this.emissiveRendering = blockbase_info.emissiveRendering; } @@ -26,7 +26,7 @@ index a3f44e3a44b2ec21ef41f6d598b428448c847c5f..3c6b1b92fedf9986ebb835170c070ebd // Paper start protected boolean shapeExceedsCube = true; diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index c6a9ce2a67591205cbeb436b5043e737331c3527..3594f432a25b580173e8577bf324be954f5eddd1 100644 +index 41702f632ca89158da3d72a6135240ccb2283ad6..275401f9bf7a78e69766e0547c94c3a115a8896c 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java @@ -527,7 +527,17 @@ public class CraftBlockData implements BlockData { diff --git a/patches/server/0252-Optimize-MappedRegistry.patch b/patches/server/0252-Optimize-MappedRegistry.patch index ad28f0dfd..bb17dbc54 100644 --- a/patches/server/0252-Optimize-MappedRegistry.patch +++ b/patches/server/0252-Optimize-MappedRegistry.patch @@ -8,33 +8,33 @@ Use larger initial sizes to increase bucket capacity on the BiMap BiMap.get was seen to be using a good bit of CPU time. diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java -index 25a6d195c5d6ee456258d2167f8acc5eb717e187..76b0b8b03c1d1c548ff67cfd6e6b127764f951d9 100644 +index d74665f6c3aa05b9e27a712092005e3de81f18a1..a015a097b807d49f60323dacda970db260543561 100644 --- a/src/main/java/net/minecraft/core/MappedRegistry.java +++ b/src/main/java/net/minecraft/core/MappedRegistry.java -@@ -36,13 +36,11 @@ import org.apache.logging.log4j.Logger; - +@@ -37,13 +37,11 @@ import org.slf4j.Logger; public class MappedRegistry extends WritableRegistry { - protected static final Logger LOGGER = LogManager.getLogger(); -- private final ObjectList byId = new ObjectArrayList<>(256); + private static final Logger LOGGER = LogUtils.getLogger(); + private final ObjectList> byId = new ObjectArrayList<>(256); - private final Object2IntMap toId = Util.make(new Object2IntOpenCustomHashMap<>(Util.identityStrategy()), (object2IntOpenCustomHashMap) -> { - object2IntOpenCustomHashMap.defaultReturnValue(-1); - }); -- private final BiMap storage = HashBiMap.create(); -- private final BiMap, T> keyStorage = HashBiMap.create(); -- private final Map lifecycles = Maps.newIdentityHashMap(); -+ private final ObjectList byId = new ObjectArrayList(256); +- private final Map> byLocation = new HashMap<>(); +- private final Map, Holder.Reference> byKey = new HashMap<>(); +- private final Map> byValue = new IdentityHashMap<>(); +- private final Map lifecycles = new IdentityHashMap<>(); + private final it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap toId = new it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap(2048);// Paper - use bigger expected size to reduce collisions and direct intent for FastUtil to be identity map -+ private final BiMap storage = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions -+ private final BiMap, T> keyStorage = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions -+ private final Map lifecycles = new java.util.IdentityHashMap<>(2048); // Paper - use bigger expected size to reduce collisions ++ private final Map> byLocation = new HashMap<>(2048); // Paper - use bigger expected size to reduce collisions ++ private final Map, Holder.Reference> byKey = new HashMap<>(2048); // Paper - use bigger expected size to reduce collisions ++ private final Map> byValue = new IdentityHashMap<>(2048); // Paper - use bigger expected size to reduce collisions ++ private final Map lifecycles = new IdentityHashMap<>(2048); // Paper - use bigger expected size to reduce collisions private Lifecycle elementsLifecycle; - @Nullable - protected Object[] randomCache; -@@ -51,6 +49,7 @@ public class MappedRegistry extends WritableRegistry { - public MappedRegistry(ResourceKey> key, Lifecycle lifecycle) { - super(key, lifecycle); - this.elementsLifecycle = lifecycle; + private volatile Map, HolderSet.Named> tags = new IdentityHashMap<>(); + private boolean frozen; +@@ -63,6 +61,7 @@ public class MappedRegistry extends WritableRegistry { + this.intrusiveHolderCache = new IdentityHashMap<>(); + } + + this.toId.defaultReturnValue(-1); // Paper } - public static MapCodec> withNameAndId(ResourceKey> key, MapCodec entryCodec) { + private List> holdersInOrder() { diff --git a/patches/server/0256-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch b/patches/server/0256-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch index 4e338bbe9..7abfc4852 100644 --- a/patches/server/0256-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch +++ b/patches/server/0256-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Make CraftWorld#loadChunk(int, int, false) load unconverted diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 7b98b8639b48504096f8ab1a2cadf98d492b6789..20d0e19851a4e8b62a8f781eb7f5795b2d156eb8 100644 +index 15455d7be314d32cbda7adede326b33d3306c349..65b7a4dc767a3fd5c4d0c00f4a4aaa8e04d13f13 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -378,7 +378,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -381,7 +381,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean loadChunk(int x, int z, boolean generate) { org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot diff --git a/patches/server/0257-Asynchronous-chunk-IO-and-loading.patch b/patches/server/0257-Asynchronous-chunk-IO-and-loading.patch index e2304c2ed..736fc64b7 100644 --- a/patches/server/0257-Asynchronous-chunk-IO-and-loading.patch +++ b/patches/server/0257-Asynchronous-chunk-IO-and-loading.patch @@ -2306,22 +2306,22 @@ index a5e438a834826161c52ca9db57d234d9ff80a591..b8bc1b9b8e8a33df90a963f9f9769292 @Override diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index e98492adfb83c24e1baa6cab24cca55f3ec151bf..afc7606e0df5dc87767444b42bb4e4b1b2f96b2d 100644 +index 8f5784ed4df46f3c7d4c6b4ff76ad839d436be1f..6a006f22d33491be4413fb64649ba9f6f51acac8 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -227,6 +227,7 @@ public class Main { +@@ -250,6 +250,7 @@ public class Main { - convertable_conversionsession.saveDataTag(iregistrycustom_dimension, (SaveData) object); + convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata); */ + Class.forName(net.minecraft.world.entity.npc.VillagerTrades.class.getName());// Paper - load this sync so it won't fail later async final DedicatedServer dedicatedserver = (DedicatedServer) MinecraftServer.spin((thread) -> { - DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataFixers.getDataFixer(), minecraftsessionservice, gameprofilerepository, usercache, LoggerChunkProgressListener::new); + DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, config.get(), ops.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), minecraftsessionservice, gameprofilerepository, usercache, LoggerChunkProgressListener::new); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 37ccbfc3b5ff47fac8cd878f9de5bccec84994e5..d8023ef3237fd415a0dd04e01a78c84298a330d1 100644 +index 86e789515922345ed3ce623b24f81a5a379a020c..ca48908148b6d9f4ae03fd55bcaf37e5fdb01cab 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -985,7 +985,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { return true; }); @@ -2365,7 +2365,7 @@ index 8593f68b0d2c1043009d02ada5396333c8da4d50..244f6a2934e807fa4f67c617dcd08a9a } else { this.visibleChunkMap.values().forEach(this::saveChunkIfNeeded); } -@@ -512,17 +514,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -548,11 +550,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider protected void tick(BooleanSupplier shouldKeepTicking) { ProfilerFiller gameprofilerfiller = this.level.getProfiler(); @@ -2381,6 +2381,8 @@ index 8593f68b0d2c1043009d02ada5396333c8da4d50..244f6a2934e807fa4f67c617dcd08a9a } gameprofilerfiller.pop(); +@@ -562,7 +568,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + return this.lightEngine.hasLightWork() || !this.pendingUnloads.isEmpty() || !this.updatingChunkMap.isEmpty() || this.poiManager.hasWork() || !this.toDrop.isEmpty() || !this.unloadQueue.isEmpty() || this.queueSorter.hasWork() || this.distanceManager.hasTickets(); } - private static final double UNLOAD_QUEUE_RESIZE_FACTOR = 0.96; // Spigot @@ -2388,7 +2390,7 @@ index 8593f68b0d2c1043009d02ada5396333c8da4d50..244f6a2934e807fa4f67c617dcd08a9a private void processUnloads(BooleanSupplier shouldKeepTicking) { LongIterator longiterator = this.toDrop.iterator(); -@@ -539,12 +545,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -579,12 +585,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (playerchunk != null) { this.pendingUnloads.put(j, playerchunk); this.modified = true; @@ -2403,7 +2405,7 @@ index 8593f68b0d2c1043009d02ada5396333c8da4d50..244f6a2934e807fa4f67c617dcd08a9a } } activityAccountant.endActivity(); // Spigot -@@ -588,7 +595,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -628,7 +635,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ((LevelChunk) ichunkaccess).setLoaded(false); } @@ -2414,14 +2416,14 @@ index 8593f68b0d2c1043009d02ada5396333c8da4d50..244f6a2934e807fa4f67c617dcd08a9a + } catch (ThreadDeath ex) { + throw ex; // bye + } catch (Throwable ex) { -+ LOGGER.fatal("Failed to prepare async save, attempting synchronous save", ex); ++ LOGGER.error("Failed to prepare async save, attempting synchronous save", ex); + this.save(ichunkaccess); + } + // Paper end - async chunk saving if (this.entitiesInLevel.remove(pos) && ichunkaccess instanceof LevelChunk) { LevelChunk chunk = (LevelChunk) ichunkaccess; -@@ -653,20 +669,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -694,20 +710,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } private CompletableFuture> scheduleChunkLoad(ChunkPos pos) { @@ -2454,7 +2456,7 @@ index 8593f68b0d2c1043009d02ada5396333c8da4d50..244f6a2934e807fa4f67c617dcd08a9a this.markPosition(pos, protochunk.getStatus().getChunkType()); return Either.left(protochunk); } -@@ -688,7 +705,32 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -729,7 +746,32 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.markPositionReplaceable(pos); return Either.left(new ProtoChunk(pos, UpgradeData.EMPTY, this.level, this.level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), (BlendingData) null)); @@ -2488,7 +2490,7 @@ index 8593f68b0d2c1043009d02ada5396333c8da4d50..244f6a2934e807fa4f67c617dcd08a9a } private void markPositionReplaceable(ChunkPos pos) { -@@ -890,7 +932,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -944,7 +986,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } @@ -2537,7 +2539,7 @@ index 8593f68b0d2c1043009d02ada5396333c8da4d50..244f6a2934e807fa4f67c617dcd08a9a this.poiManager.flush(chunk.getPos()); if (!chunk.isUnsaved()) { return false; -@@ -902,7 +985,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -956,7 +1039,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ChunkStatus chunkstatus = chunk.getStatus(); if (chunkstatus.getChunkType() != ChunkStatus.ChunkType.LEVELCHUNK) { @@ -2546,7 +2548,7 @@ index 8593f68b0d2c1043009d02ada5396333c8da4d50..244f6a2934e807fa4f67c617dcd08a9a return false; } -@@ -912,9 +995,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -966,9 +1049,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } this.level.getProfiler().incrementCounter("chunkSave"); @@ -2564,7 +2566,7 @@ index 8593f68b0d2c1043009d02ada5396333c8da4d50..244f6a2934e807fa4f67c617dcd08a9a this.markPosition(chunkcoordintpair, chunkstatus.getChunkType()); return true; } catch (Exception exception) { -@@ -923,6 +1012,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -977,6 +1066,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return false; } } @@ -2572,7 +2574,7 @@ index 8593f68b0d2c1043009d02ada5396333c8da4d50..244f6a2934e807fa4f67c617dcd08a9a } private boolean isExistingChunkFull(ChunkPos pos) { -@@ -1056,6 +1146,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1110,6 +1200,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } @@ -2609,10 +2611,10 @@ index 8593f68b0d2c1043009d02ada5396333c8da4d50..244f6a2934e807fa4f67c617dcd08a9a public CompoundTag readChunk(ChunkPos pos) throws IOException { CompoundTag nbttagcompound = this.read(pos); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index dc618a0dde6c15cb2ee812ed21c10b343f75f280..343d54addd67998175db152d38702adda37b7d21 100644 +index efb735f2cf0d232db83ade7332250e455c276bea..b6737c0b74e821c948919ca4184dfe0281a19894 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -502,10 +502,111 @@ public class ServerChunkCache extends ChunkSource { +@@ -498,10 +498,111 @@ public class ServerChunkCache extends ChunkSource { return ret; } // Paper end @@ -2724,7 +2726,7 @@ index dc618a0dde6c15cb2ee812ed21c10b343f75f280..343d54addd67998175db152d38702add if (Thread.currentThread() != this.mainThread) { return (ChunkAccess) CompletableFuture.supplyAsync(() -> { return this.getChunk(x, z, leastStatus, create); -@@ -528,13 +629,18 @@ public class ServerChunkCache extends ChunkSource { +@@ -524,13 +625,18 @@ public class ServerChunkCache extends ChunkSource { } gameprofilerfiller.incrementCounter("getChunkCacheMiss"); @@ -2744,7 +2746,7 @@ index dc618a0dde6c15cb2ee812ed21c10b343f75f280..343d54addd67998175db152d38702add this.level.timings.syncChunkLoad.stopTiming(); // Paper } // Paper ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { -@@ -621,6 +727,11 @@ public class ServerChunkCache extends ChunkSource { +@@ -617,6 +723,11 @@ public class ServerChunkCache extends ChunkSource { } private CompletableFuture> getChunkFutureMainThread(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) { @@ -2756,7 +2758,7 @@ index dc618a0dde6c15cb2ee812ed21c10b343f75f280..343d54addd67998175db152d38702add ChunkPos chunkcoordintpair = new ChunkPos(chunkX, chunkZ); long k = chunkcoordintpair.toLong(); int l = 33 + ChunkStatus.getDistance(leastStatus); -@@ -1035,11 +1146,12 @@ public class ServerChunkCache extends ChunkSource { +@@ -1036,11 +1147,12 @@ public class ServerChunkCache extends ChunkSource { // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task public boolean pollTask() { try { @@ -2771,10 +2773,10 @@ index dc618a0dde6c15cb2ee812ed21c10b343f75f280..343d54addd67998175db152d38702add } finally { chunkMap.callbackExecutor.run(); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 2e791dc863e6f41b1d9d4f99e5054caa93f6ca52..fb0d99ca76896a710a16d70aaf7ee714a428430d 100644 +index 7e2e7ce7ba9b23c813e1a4197ac06d0fe703c22b..83fac40b413e8f1ae4bda1e1c87b07c51af832ef 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -309,6 +309,78 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -310,6 +310,78 @@ public class ServerLevel extends Level implements WorldGenLevel { } } } @@ -2853,7 +2855,7 @@ index 2e791dc863e6f41b1d9d4f99e5054caa93f6ca52..fb0d99ca76896a710a16d70aaf7ee714 // Paper end // Add env and gen to constructor, WorldData -> WorldDataServer -@@ -376,6 +448,8 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -379,6 +451,8 @@ public class ServerLevel extends Level implements WorldGenLevel { this.sleepStatus = new SleepStatus(); this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit @@ -2875,10 +2877,10 @@ index 0d536d72ac918fbd403397ff369d10143ee9c204..be677d437d17b74c6188ce1bd5fc6fdc private final String name; private final Comparator comparator; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c0f558d3c6f3b4b01e56d453ab136cf2357f2463..607be2544cc163065dcbb7fedd5709cca2453ea2 100644 +index 62fda1dd8d560a8e16118e9d1b044ef59c0e5b02..d0adb066fcea5636c88be838fb5eff79306c5f4a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -709,6 +709,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -716,6 +716,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper return; } @@ -2965,10 +2967,10 @@ index 2b60fc107c309958ec3f20539b243d32765f3518..4a972b26242cf4c9d7e8f655cb1264cd HAS_SPACE(PoiRecord::hasSpace), IS_OCCUPIED(PoiRecord::isOccupied), diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 1729af83b979e35a585c8d049b14dc23ddf23803..89de1589833dcce8028fd402aea8a3e57dc29e86 100644 +index 4e5cfc508e356691a9a249013553f97e77c213b0..37a60420b993525852492fd6665fb75afee9796f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -75,7 +75,31 @@ public class ChunkSerializer { +@@ -77,7 +77,31 @@ public class ChunkSerializer { public ChunkSerializer() {} @@ -3000,7 +3002,7 @@ index 1729af83b979e35a585c8d049b14dc23ddf23803..89de1589833dcce8028fd402aea8a3e5 ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); if (!Objects.equals(chunkPos, chunkcoordintpair1)) { -@@ -92,7 +116,9 @@ public class ChunkSerializer { +@@ -94,7 +118,9 @@ public class ChunkSerializer { LevelLightEngine lightengine = chunkproviderserver.getLightEngine(); if (flag) { @@ -3010,7 +3012,7 @@ index 1729af83b979e35a585c8d049b14dc23ddf23803..89de1589833dcce8028fd402aea8a3e5 } Registry iregistry = world.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); -@@ -136,16 +162,28 @@ public class ChunkSerializer { +@@ -138,16 +164,28 @@ public class ChunkSerializer { LevelChunkSection chunksection = new LevelChunkSection(b0, datapaletteblock, datapaletteblock1); achunksection[k] = chunksection; @@ -3041,7 +3043,7 @@ index 1729af83b979e35a585c8d049b14dc23ddf23803..89de1589833dcce8028fd402aea8a3e5 } } } -@@ -265,7 +303,7 @@ public class ChunkSerializer { +@@ -267,7 +305,7 @@ public class ChunkSerializer { } if (chunkstatus_type == ChunkStatus.ChunkType.LEVELCHUNK) { @@ -3050,7 +3052,7 @@ index 1729af83b979e35a585c8d049b14dc23ddf23803..89de1589833dcce8028fd402aea8a3e5 } else { ProtoChunk protochunk1 = (ProtoChunk) object; -@@ -304,9 +342,67 @@ public class ChunkSerializer { +@@ -306,9 +344,67 @@ public class ChunkSerializer { protochunk1.setCarvingMask(worldgenstage_features, new CarvingMask(nbttagcompound4.getLongArray(s1), ((ChunkAccess) object).getMinBuildHeight())); } @@ -3119,7 +3121,7 @@ index 1729af83b979e35a585c8d049b14dc23ddf23803..89de1589833dcce8028fd402aea8a3e5 private static void logErrors(ChunkPos chunkPos, int y, String message) { ChunkSerializer.LOGGER.error("Recoverable errors when loading section [" + chunkPos.x + ", " + y + ", " + chunkPos.z + "]: " + message); -@@ -317,6 +413,11 @@ public class ChunkSerializer { +@@ -319,6 +415,11 @@ public class ChunkSerializer { } public static CompoundTag write(ServerLevel world, ChunkAccess chunk) { @@ -3131,7 +3133,7 @@ index 1729af83b979e35a585c8d049b14dc23ddf23803..89de1589833dcce8028fd402aea8a3e5 ChunkPos chunkcoordintpair = chunk.getPos(); CompoundTag nbttagcompound = new CompoundTag(); -@@ -324,7 +425,7 @@ public class ChunkSerializer { +@@ -326,7 +427,7 @@ public class ChunkSerializer { nbttagcompound.putInt("xPos", chunkcoordintpair.x); nbttagcompound.putInt("yPos", chunk.getMinSection()); nbttagcompound.putInt("zPos", chunkcoordintpair.z); @@ -3140,7 +3142,7 @@ index 1729af83b979e35a585c8d049b14dc23ddf23803..89de1589833dcce8028fd402aea8a3e5 nbttagcompound.putLong("InhabitedTime", chunk.getInhabitedTime()); nbttagcompound.putString("Status", chunk.getStatus().getName()); BlendingData blendingdata = chunk.getBlendingData(); -@@ -367,8 +468,17 @@ public class ChunkSerializer { +@@ -369,8 +470,17 @@ public class ChunkSerializer { for (int i = lightenginethreaded.getMinLightSection(); i < lightenginethreaded.getMaxLightSection(); ++i) { int j = chunk.getSectionIndexFromSectionY(i); boolean flag1 = j >= 0 && j < achunksection.length; @@ -3160,7 +3162,7 @@ index 1729af83b979e35a585c8d049b14dc23ddf23803..89de1589833dcce8028fd402aea8a3e5 if (flag1 || nibblearray != null || nibblearray1 != null) { CompoundTag nbttagcompound1 = new CompoundTag(); -@@ -406,8 +516,17 @@ public class ChunkSerializer { +@@ -408,8 +518,17 @@ public class ChunkSerializer { nbttagcompound.putBoolean("isLightOn", true); } @@ -3180,7 +3182,7 @@ index 1729af83b979e35a585c8d049b14dc23ddf23803..89de1589833dcce8028fd402aea8a3e5 CompoundTag nbttagcompound2; -@@ -444,7 +563,14 @@ public class ChunkSerializer { +@@ -446,7 +565,14 @@ public class ChunkSerializer { nbttagcompound.put("CarvingMasks", nbttagcompound2); } @@ -3313,7 +3315,7 @@ index 2d1c8d5cf8ea6739d5e9df91cc16cde72917feff..ba677f282f2c8a05d1bad88226655549 } } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index 87ea11505849cc9d4455d42eaae9af310ad63ae4..04e45b4de2f4e26853a4fed6271cf79ef8607154 100644 +index 2d74ab966a1291895b6248a67a31fe4802b3773f..038e2177182c94baa4af24f9111cf155ec342dfe 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -44,6 +44,7 @@ public class RegionFile implements AutoCloseable { @@ -3465,16 +3467,16 @@ index deb852aa0fb2ad55a94d3c7ee542a0cc8013be42..40830a2b231df9bbf676d8325e76c825 while (objectiterator.hasNext()) { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -index 415ec2cb81e956526e7f4965b899c9aa04f62f2e..ff6cadec530dedf9efc5d6226e48a096a1073ad6 100644 +index 4160a35ecfa1c28b88d6ebbfd14a0be1933e3b6d..3e08ff74979c78b27537403bbcaf13459e9e06b1 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -@@ -30,10 +30,10 @@ import net.minecraft.world.level.LevelHeightAccessor; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -30,10 +30,10 @@ import net.minecraft.world.level.ChunkPos; + import net.minecraft.world.level.LevelHeightAccessor; + import org.slf4j.Logger; -public class SectionStorage implements AutoCloseable { +public class SectionStorage extends RegionFileStorage implements AutoCloseable { // Paper - nuke IOWorker - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private static final String SECTIONS_TAG = "Sections"; - private final IOWorker worker; + // Paper - remove mojang I/O thread @@ -3496,7 +3498,7 @@ index 415ec2cb81e956526e7f4965b899c9aa04f62f2e..ff6cadec530dedf9efc5d6226e48a096 } protected void tick(BooleanSupplier shouldKeepTicking) { -@@ -106,13 +107,18 @@ public class SectionStorage implements AutoCloseable { +@@ -110,13 +111,18 @@ public class SectionStorage implements AutoCloseable { } private void readColumn(ChunkPos chunkPos) { @@ -3517,7 +3519,7 @@ index 415ec2cb81e956526e7f4965b899c9aa04f62f2e..ff6cadec530dedf9efc5d6226e48a096 } catch (IOException var3) { LOGGER.error("Error reading chunk {} data from disk", pos, var3); return null; -@@ -156,13 +162,26 @@ public class SectionStorage implements AutoCloseable { +@@ -160,13 +166,26 @@ public class SectionStorage implements AutoCloseable { Dynamic dynamic = this.writeColumn(chunkPos, NbtOps.INSTANCE); Tag tag = dynamic.getValue(); if (tag instanceof CompoundTag) { @@ -3545,7 +3547,7 @@ index 415ec2cb81e956526e7f4965b899c9aa04f62f2e..ff6cadec530dedf9efc5d6226e48a096 private Dynamic writeColumn(ChunkPos chunkPos, DynamicOps dynamicOps) { Map map = Maps.newHashMap(); -@@ -219,6 +238,23 @@ public class SectionStorage implements AutoCloseable { +@@ -223,6 +242,23 @@ public class SectionStorage implements AutoCloseable { @Override public void close() throws IOException { @@ -3571,10 +3573,10 @@ index 415ec2cb81e956526e7f4965b899c9aa04f62f2e..ff6cadec530dedf9efc5d6226e48a096 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 20d0e19851a4e8b62a8f781eb7f5795b2d156eb8..e76a98b8144ab0de92263fb00bf521b2683a6b7d 100644 +index 65b7a4dc767a3fd5c4d0c00f4a4aaa8e04d13f13..5dea397fc7f11db39385c1711364a31144979f5c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1872,6 +1872,34 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1875,6 +1875,34 @@ public class CraftWorld extends CraftRegionAccessor implements World { public DragonBattle getEnderDragonBattle() { return (this.getHandle().dragonFight() == null) ? null : new CraftDragonBattle(this.getHandle().dragonFight()); } diff --git a/patches/server/0258-Add-ray-tracing-methods-to-LivingEntity.patch b/patches/server/0258-Add-ray-tracing-methods-to-LivingEntity.patch index ce3f0f507..a639c0f64 100644 --- a/patches/server/0258-Add-ray-tracing-methods-to-LivingEntity.patch +++ b/patches/server/0258-Add-ray-tracing-methods-to-LivingEntity.patch @@ -28,10 +28,10 @@ index 0cf818fceddd76e7704fdc6625456787856b2815..ccdee183f02ab55723e16f41efce55dc switch (enumDirection) { case DOWN: diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 9b6fcaaafa84853804f6183d02bd90b4f988d418..c5d6e5c5c35fa3ab444f271c929ee88c30832dc9 100644 +index 7436cf1b9cce14494bd514cb7f4ed03536170c87..f62dd338c5f0618b6235d398bd56cb6737577a0b 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3689,6 +3689,23 @@ public abstract class LivingEntity extends Entity { +@@ -3679,6 +3679,23 @@ public abstract class LivingEntity extends Entity { } // Paper start diff --git a/patches/server/0260-Improve-death-events.patch b/patches/server/0260-Improve-death-events.patch index 3cb07d39b..14d818a75 100644 --- a/patches/server/0260-Improve-death-events.patch +++ b/patches/server/0260-Improve-death-events.patch @@ -19,10 +19,10 @@ maybe more (please check patch overrides for drops for more): - players, armor stands, foxes, chested donkeys/llamas diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index fd1937f49312204d38510996a5be43b731f38bde..a2e2b6ea166bf64fe5b49672a6c6f86af3776638 100644 +index 005856931c27d4e2dbffec65ae59191782508e06..36517924b6e1d32bc969b9bc7314a88d531accb2 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -222,6 +222,10 @@ public class ServerPlayer extends Player { +@@ -220,6 +220,10 @@ public class ServerPlayer extends Player { public int latency; public boolean wonGame; private int containerUpdateDelay; // Paper @@ -33,7 +33,7 @@ index fd1937f49312204d38510996a5be43b731f38bde..a2e2b6ea166bf64fe5b49672a6c6f86a // CraftBukkit start public String displayName; -@@ -786,6 +790,15 @@ public class ServerPlayer extends Player { +@@ -784,6 +788,15 @@ public class ServerPlayer extends Player { String deathmessage = defaultMessage.getString(); this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, PaperAdventure.asAdventure(defaultMessage), defaultMessage.getString(), keepInventory); // Paper - Adventure @@ -49,7 +49,7 @@ index fd1937f49312204d38510996a5be43b731f38bde..a2e2b6ea166bf64fe5b49672a6c6f86a // SPIGOT-943 - only call if they have an inventory open if (this.containerMenu != this.inventoryMenu) { -@@ -933,8 +946,17 @@ public class ServerPlayer extends Player { +@@ -931,8 +944,17 @@ public class ServerPlayer extends Player { } } } @@ -70,10 +70,10 @@ index fd1937f49312204d38510996a5be43b731f38bde..a2e2b6ea166bf64fe5b49672a6c6f86a } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index c5d6e5c5c35fa3ab444f271c929ee88c30832dc9..cd3f18a7484817c5bc7c53585f6deb8889744c0b 100644 +index f62dd338c5f0618b6235d398bd56cb6737577a0b..bd4230a4e5fc9c1264b390b59ddefbd0aa8e73c8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -257,6 +257,7 @@ public abstract class LivingEntity extends Entity { +@@ -260,6 +260,7 @@ public abstract class LivingEntity extends Entity { public Set collidableExemptions = new HashSet<>(); public boolean bukkitPickUpLoot; public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper @@ -81,7 +81,7 @@ index c5d6e5c5c35fa3ab444f271c929ee88c30832dc9..cd3f18a7484817c5bc7c53585f6deb88 @Override public float getBukkitYaw() { -@@ -1439,13 +1440,12 @@ public abstract class LivingEntity extends Entity { +@@ -1442,13 +1443,12 @@ public abstract class LivingEntity extends Entity { if (knockbackCancelled) this.level.broadcastEntityEvent(this, (byte) 2); // Paper - Disable explosion knockback if (this.isDeadOrDying()) { if (!this.checkTotemDeathProtection(source)) { @@ -99,7 +99,7 @@ index c5d6e5c5c35fa3ab444f271c929ee88c30832dc9..cd3f18a7484817c5bc7c53585f6deb88 } } else if (flag1) { this.playHurtSound(source); -@@ -1594,7 +1594,7 @@ public abstract class LivingEntity extends Entity { +@@ -1597,7 +1597,7 @@ public abstract class LivingEntity extends Entity { if (!this.isRemoved() && !this.dead) { Entity entity = source.getEntity(); LivingEntity entityliving = this.getKillCredit(); @@ -108,7 +108,7 @@ index c5d6e5c5c35fa3ab444f271c929ee88c30832dc9..cd3f18a7484817c5bc7c53585f6deb88 if (this.deathScore >= 0 && entityliving != null) { entityliving.awardKillScore(this, this.deathScore, source); } -@@ -1606,20 +1606,54 @@ public abstract class LivingEntity extends Entity { +@@ -1609,20 +1609,54 @@ public abstract class LivingEntity extends Entity { if (!this.level.isClientSide && this.hasCustomName()) { if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot } @@ -166,7 +166,7 @@ index c5d6e5c5c35fa3ab444f271c929ee88c30832dc9..cd3f18a7484817c5bc7c53585f6deb88 } } -@@ -1627,7 +1661,7 @@ public abstract class LivingEntity extends Entity { +@@ -1630,7 +1664,7 @@ public abstract class LivingEntity extends Entity { if (!this.level.isClientSide) { boolean flag = false; @@ -175,7 +175,7 @@ index c5d6e5c5c35fa3ab444f271c929ee88c30832dc9..cd3f18a7484817c5bc7c53585f6deb88 if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { BlockPos blockposition = this.blockPosition(); BlockState iblockdata = Blocks.WITHER_ROSE.defaultBlockState(); -@@ -1656,7 +1690,11 @@ public abstract class LivingEntity extends Entity { +@@ -1659,7 +1693,11 @@ public abstract class LivingEntity extends Entity { } } @@ -188,7 +188,7 @@ index c5d6e5c5c35fa3ab444f271c929ee88c30832dc9..cd3f18a7484817c5bc7c53585f6deb88 Entity entity = source.getEntity(); int i; -@@ -1671,18 +1709,27 @@ public abstract class LivingEntity extends Entity { +@@ -1674,18 +1712,27 @@ public abstract class LivingEntity extends Entity { this.dropEquipment(); // CraftBukkit - from below if (this.shouldDropLoot() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { this.dropFromLootTable(source, flag); @@ -218,7 +218,7 @@ index c5d6e5c5c35fa3ab444f271c929ee88c30832dc9..cd3f18a7484817c5bc7c53585f6deb88 // CraftBukkit start public int getExpReward() { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index b13e6bfa449599aafeb97d99c9dc1e0c3885c4be..ecd484a35f9401ffe8f0893749d8d05399166ac2 100644 +index 0dd63184ffc9a4f25261344600336679c902e2ec..bcf7c431f90a917d56933370e9f479f25f009dcb 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -1002,7 +1002,13 @@ public abstract class Mob extends LivingEntity { @@ -236,10 +236,10 @@ index b13e6bfa449599aafeb97d99c9dc1e0c3885c4be..ecd484a35f9401ffe8f0893749d8d053 } diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java -index 2caf3aa6ca876d59deb98ee917e8228df140b414..63f0ed4c80b7afa091c4a835eefd6d709428f984 100644 +index 6ffd1aec3563e92f5d5975d3fb4d3d89feec1416..e36c01533dc85541c91f7a55690fae46f770b516 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Fox.java +++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java -@@ -696,15 +696,25 @@ public class Fox extends Animal { +@@ -698,15 +698,25 @@ public class Fox extends Animal { } @Override diff --git a/patches/server/0261-Allow-chests-to-be-placed-with-NBT-data.patch b/patches/server/0261-Allow-chests-to-be-placed-with-NBT-data.patch index 1bcd55b62..d8349a70c 100644 --- a/patches/server/0261-Allow-chests-to-be-placed-with-NBT-data.patch +++ b/patches/server/0261-Allow-chests-to-be-placed-with-NBT-data.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow chests to be placed with NBT data diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index ce082016d841e3e7ba46b722b85edae9acc3f290..589a9bd9d3bf3cbf88a6efad5f58970a0a4a56c0 100644 +index 65189af7acc3e60fc7f2bfe82128ada981bf1271..f1289d7251783c5203828c2b76785dd22c7e2992 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -338,6 +338,7 @@ public final class ItemStack { +@@ -348,6 +348,7 @@ public final class ItemStack { enuminteractionresult = InteractionResult.FAIL; // cancel placement // PAIL: Remove this when MC-99075 fixed placeEvent.getPlayer().updateInventory(); diff --git a/patches/server/0264-Prevent-chunk-loading-from-Fluid-Flowing.patch b/patches/server/0264-Prevent-chunk-loading-from-Fluid-Flowing.patch index 6a32dc068..8e59eff59 100644 --- a/patches/server/0264-Prevent-chunk-loading-from-Fluid-Flowing.patch +++ b/patches/server/0264-Prevent-chunk-loading-from-Fluid-Flowing.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent chunk loading from Fluid Flowing diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java -index 4be8fbe06ee97d5fe8f99d5d8137ac7302ffec91..49b8e9a764a868975ec832ea354bb0df99f9721a 100644 +index 89296667d2ad76a706a3f5b817f3ad8c207cac2d..02be7c3d104fe3b3a2772201f5ebdfb6d16e9b49 100644 --- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java -@@ -175,7 +175,8 @@ public abstract class FlowingFluid extends Fluid { +@@ -174,7 +174,8 @@ public abstract class FlowingFluid extends Fluid { Direction enumdirection = (Direction) entry.getKey(); FluidState fluid1 = (FluidState) entry.getValue(); BlockPos blockposition1 = pos.relative(enumdirection); @@ -18,7 +18,7 @@ index 4be8fbe06ee97d5fe8f99d5d8137ac7302ffec91..49b8e9a764a868975ec832ea354bb0df if (this.canSpreadTo(world, pos, blockState, enumdirection, blockposition1, iblockdata1, world.getFluidState(blockposition1), fluid1.getType())) { // CraftBukkit start -@@ -202,7 +203,9 @@ public abstract class FlowingFluid extends Fluid { +@@ -201,7 +202,9 @@ public abstract class FlowingFluid extends Fluid { while (iterator.hasNext()) { Direction enumdirection = (Direction) iterator.next(); BlockPos blockposition1 = pos.relative(enumdirection); @@ -29,7 +29,7 @@ index 4be8fbe06ee97d5fe8f99d5d8137ac7302ffec91..49b8e9a764a868975ec832ea354bb0df FluidState fluid = iblockdata1.getFluidState(); if (fluid.getType().isSame(this) && this.canPassThroughWall(enumdirection, world, pos, state, blockposition1, iblockdata1)) { -@@ -319,11 +322,18 @@ public abstract class FlowingFluid extends Fluid { +@@ -318,11 +321,18 @@ public abstract class FlowingFluid extends Fluid { if (enumdirection1 != enumdirection) { BlockPos blockposition2 = blockposition.relative(enumdirection1); short short0 = FlowingFluid.getCacheKey(blockposition1, blockposition2); @@ -52,7 +52,7 @@ index 4be8fbe06ee97d5fe8f99d5d8137ac7302ffec91..49b8e9a764a868975ec832ea354bb0df BlockState iblockdata1 = (BlockState) pair.getFirst(); FluidState fluid = (FluidState) pair.getSecond(); -@@ -395,11 +405,16 @@ public abstract class FlowingFluid extends Fluid { +@@ -394,11 +404,16 @@ public abstract class FlowingFluid extends Fluid { Direction enumdirection = (Direction) iterator.next(); BlockPos blockposition1 = pos.relative(enumdirection); short short0 = FlowingFluid.getCacheKey(pos, blockposition1); diff --git a/patches/server/0267-Implement-furnace-cook-speed-multiplier-API.patch b/patches/server/0267-Implement-furnace-cook-speed-multiplier-API.patch index f27ec0740..d75b53a87 100644 --- a/patches/server/0267-Implement-furnace-cook-speed-multiplier-API.patch +++ b/patches/server/0267-Implement-furnace-cook-speed-multiplier-API.patch @@ -11,10 +11,10 @@ to the nearest Integer when updating its current cook time. Modified by: Eric Su diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index d39546b3f8d0c97fefdcc90f638eee60a5db409e..8c69b817eeb5d5555e8eb2093ff2c5377c884946 100644 +index c3c53a34f645a834256c31951e465ae33aa1a9ff..635d47d4bea679e96736ef891c40f57488cbc6a1 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -73,6 +73,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -75,6 +75,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit protected NonNullList items; public int litTime; int litDuration; @@ -22,7 +22,7 @@ index d39546b3f8d0c97fefdcc90f638eee60a5db409e..8c69b817eeb5d5555e8eb2093ff2c537 public int cookingProgress; public int cookingTotalTime; protected final ContainerData dataAccess; -@@ -279,6 +280,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -281,6 +282,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit this.recipesUsed.put(new ResourceLocation(s), nbttagcompound1.getInt(s)); } @@ -34,7 +34,7 @@ index d39546b3f8d0c97fefdcc90f638eee60a5db409e..8c69b817eeb5d5555e8eb2093ff2c537 } @Override -@@ -287,6 +293,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -289,6 +295,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit nbt.putShort("BurnTime", (short) this.litTime); nbt.putShort("CookTime", (short) this.cookingProgress); nbt.putShort("CookTimeTotal", (short) this.cookingTotalTime); @@ -42,7 +42,7 @@ index d39546b3f8d0c97fefdcc90f638eee60a5db409e..8c69b817eeb5d5555e8eb2093ff2c537 ContainerHelper.saveAllItems(nbt, this.items); CompoundTag nbttagcompound1 = new CompoundTag(); -@@ -349,7 +356,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -351,7 +358,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit CraftItemStack source = CraftItemStack.asCraftMirror(blockEntity.items.get(0)); CookingRecipe recipe = (CookingRecipe) irecipe.toBukkitRecipe(); @@ -51,7 +51,7 @@ index d39546b3f8d0c97fefdcc90f638eee60a5db409e..8c69b817eeb5d5555e8eb2093ff2c537 world.getCraftServer().getPluginManager().callEvent(event); blockEntity.cookingTotalTime = event.getTotalCookTime(); -@@ -357,9 +364,9 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -359,9 +366,9 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit // CraftBukkit end ++blockEntity.cookingProgress; @@ -63,7 +63,7 @@ index d39546b3f8d0c97fefdcc90f638eee60a5db409e..8c69b817eeb5d5555e8eb2093ff2c537 if (AbstractFurnaceBlockEntity.burn(blockEntity.level, blockEntity.worldPosition, irecipe, blockEntity.items, i)) { // CraftBukkit blockEntity.setRecipeUsed(irecipe); } -@@ -459,9 +466,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -461,9 +468,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit } } @@ -79,7 +79,7 @@ index d39546b3f8d0c97fefdcc90f638eee60a5db409e..8c69b817eeb5d5555e8eb2093ff2c537 public static boolean isFuel(ItemStack stack) { return AbstractFurnaceBlockEntity.getFuel().containsKey(stack.getItem()); -@@ -530,7 +541,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -532,7 +543,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit } if (slot == 0 && !flag) { diff --git a/patches/server/0268-Catch-JsonParseException-in-Entity-and-TE-names.patch b/patches/server/0268-Catch-JsonParseException-in-Entity-and-TE-names.patch index 12e1a6bab..740e52781 100644 --- a/patches/server/0268-Catch-JsonParseException-in-Entity-and-TE-names.patch +++ b/patches/server/0268-Catch-JsonParseException-in-Entity-and-TE-names.patch @@ -61,7 +61,7 @@ index 04a3627667498b841fbff547d1874d99cc708af4..5b125aa77e769983a0aee7c5f6eb6a8a if (nbt.contains("TrackOutput", 1)) { diff --git a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java -index 8854901b439cdeddc528e02fa5f8539869556a3c..aec30b264e2e24ea101f8b3296a93293b4c9eef4 100644 +index 0de9d86d5e2f0a9043640e3154c11612408e24d8..d58f3beabbdb48cbb36bd4802d12cda41628731f 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java @@ -97,7 +97,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable { @@ -87,10 +87,10 @@ index cfd1e2fbc029d928daa2d9f12df393c8cf30e850..72c4c367b3531b21f1f28601735a5250 } diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -index 76a401bcfdacded2137142ed38d739ed65d9fae6..7c8809e679670ba0e0ea7a1e193913e45b34a97a 100644 +index dca94c75f4531eab3ab788e722363d2065bf4170..4b7da0df927f669845c7d4c9b4a0acfab8efe657 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -@@ -360,7 +360,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { +@@ -359,7 +359,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { this.levels = nbt.getInt("Levels"); // SPIGOT-5053, use where available // CraftBukkit end if (nbt.contains("CustomName", 8)) { @@ -100,7 +100,7 @@ index 76a401bcfdacded2137142ed38d739ed65d9fae6..7c8809e679670ba0e0ea7a1e193913e4 this.lockKey = LockCode.fromTag(nbt); diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java -index b03621ebd0a94ab2dceb9006aee43fd5320094e3..424ad38b5522d9b76aa1bf726a9fe2c1e934598d 100644 +index d399d9ea7656d1c96f3b7547049d2e133ef5e847..1eccf9424bd8a4bcbeed4ebb1795fd113fe5af18 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java @@ -43,7 +43,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable diff --git a/patches/server/0269-Honor-EntityAgeable.ageLock.patch b/patches/server/0269-Honor-EntityAgeable.ageLock.patch index 2a996fbe5..8a44dcb05 100644 --- a/patches/server/0269-Honor-EntityAgeable.ageLock.patch +++ b/patches/server/0269-Honor-EntityAgeable.ageLock.patch @@ -17,10 +17,10 @@ index 123b125a3576903767983c93135086ca7a8ea813..d165117d62fe8a55d624966e8c4b626c int k = j; diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java -index 93f17997ac3f36d0a72e5d4e85c7e748d615801f..0dca7b0f40af9337bdda75ba40cb064f39723bf8 100644 +index afe4991fb69fa303279a4e46d730f482e8a58f01..e4e879cdfe7d257161bf8e98305c0f2e9b9539f9 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java -@@ -295,6 +295,7 @@ public class BeehiveBlockEntity extends BlockEntity { +@@ -296,6 +296,7 @@ public class BeehiveBlockEntity extends BlockEntity { } private static void setBeeReleaseData(int ticks, Bee bee) { @@ -28,7 +28,7 @@ index 93f17997ac3f36d0a72e5d4e85c7e748d615801f..0dca7b0f40af9337bdda75ba40cb064f int j = bee.getAge(); if (j < 0) { -@@ -302,6 +303,7 @@ public class BeehiveBlockEntity extends BlockEntity { +@@ -303,6 +304,7 @@ public class BeehiveBlockEntity extends BlockEntity { } else if (j > 0) { bee.setAge(Math.max(0, j - ticks)); } diff --git a/patches/server/0273-Add-LivingEntity-getTargetEntity.patch b/patches/server/0273-Add-LivingEntity-getTargetEntity.patch index d1c80027f..886dba3bb 100644 --- a/patches/server/0273-Add-LivingEntity-getTargetEntity.patch +++ b/patches/server/0273-Add-LivingEntity-getTargetEntity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index cd3f18a7484817c5bc7c53585f6deb8889744c0b..dc723e1a4d73e06c4b9f275c7b912de1a1cef070 100644 +index bd4230a4e5fc9c1264b390b59ddefbd0aa8e73c8..e5c5bdc83804f335d7163cfefba79b57df97310b 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -113,6 +113,7 @@ import net.minecraft.world.level.storage.loot.LootTable; +@@ -115,6 +115,7 @@ import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.AABB; @@ -16,7 +16,7 @@ index cd3f18a7484817c5bc7c53585f6deb8889744c0b..dc723e1a4d73e06c4b9f275c7b912de1 import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; import net.minecraft.world.scores.PlayerTeam; -@@ -3753,6 +3754,38 @@ public abstract class LivingEntity extends Entity { +@@ -3743,6 +3744,38 @@ public abstract class LivingEntity extends Entity { return level.clip(raytrace); } diff --git a/patches/server/0274-Add-sun-related-API.patch b/patches/server/0274-Add-sun-related-API.patch index af139849c..b20576cea 100644 --- a/patches/server/0274-Add-sun-related-API.patch +++ b/patches/server/0274-Add-sun-related-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add sun related API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index e76a98b8144ab0de92263fb00bf521b2683a6b7d..fd034c619b0615f480d1686d76e0f155cd9f9949 100644 +index 5dea397fc7f11db39385c1711364a31144979f5c..6b54afecfe45fd078a709fc87ab101a4aee4f7f7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -673,6 +673,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -676,6 +676,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { } } diff --git a/patches/server/0275-Turtle-API.patch b/patches/server/0275-Turtle-API.patch index 75d7b88e5..619fa7ebf 100644 --- a/patches/server/0275-Turtle-API.patch +++ b/patches/server/0275-Turtle-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Turtle API diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java -index dabdce6332c267c3b82698010e284b34dcc0c083..8d8cce87acc5a93afb4b8925a5a5dbf71d371fcd 100644 +index e3983370c09e3e3445c4557fcca50dd25f29cba0..6efba52c2e5d7811ee329ed22c1c76f75d7ddbe1 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java @@ -14,7 +14,7 @@ public abstract class MoveToBlockGoal extends Goal { @@ -18,10 +18,10 @@ index dabdce6332c267c3b82698010e284b34dcc0c083..8d8cce87acc5a93afb4b8925a5a5dbf7 private final int searchRange; private final int verticalSearchRange; diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java -index 44679e3b44b03dc20b3763af84df655d81680c06..60e1111f3c2c43398f21c541248f38524f41f4fb 100644 +index ea1bb6924043dfd05452b793afd7651c867de5dc..1b0be28ebfd7ec2f978b5d87f6d26e4d5913fb06 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java +++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java -@@ -484,14 +484,17 @@ public class Turtle extends Animal { +@@ -482,14 +482,17 @@ public class Turtle extends Animal { if (!this.turtle.isInWater() && this.isReachedTarget()) { if (this.turtle.layEggCounter < 1) { @@ -42,12 +42,12 @@ index 44679e3b44b03dc20b3763af84df655d81680c06..60e1111f3c2c43398f21c541248f3852 } // CraftBukkit end this.turtle.setHasEgg(false); -@@ -559,7 +562,7 @@ public class Turtle extends Animal { +@@ -557,7 +560,7 @@ public class Turtle extends Animal { @Override public boolean canUse() { -- return this.turtle.isBaby() ? false : (this.turtle.hasEgg() ? true : (this.turtle.getRandom().nextInt(reducedTickDelay(700)) != 0 ? false : !this.turtle.getHomePos().closerThan((Position) this.turtle.position(), 64.0D))); -+ return this.turtle.isBaby() ? false : (this.turtle.hasEgg() ? true : (this.turtle.getRandom().nextInt(reducedTickDelay(700)) != 0 ? false : !this.turtle.getHomePos().closerThan((Position) this.turtle.position(), 64.0D))) && new com.destroystokyo.paper.event.entity.TurtleGoHomeEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity()).callEvent(); // Paper +- return this.turtle.isBaby() ? false : (this.turtle.hasEgg() ? true : (this.turtle.getRandom().nextInt(reducedTickDelay(700)) != 0 ? false : !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 64.0D))); ++ return this.turtle.isBaby() ? false : (this.turtle.hasEgg() ? true : (this.turtle.getRandom().nextInt(reducedTickDelay(700)) != 0 ? false : !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 64.0D))) && new com.destroystokyo.paper.event.entity.TurtleGoHomeEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity()).callEvent(); // Paper } @Override diff --git a/patches/server/0276-Call-player-spectator-target-events-and-improve-impl.patch b/patches/server/0276-Call-player-spectator-target-events-and-improve-impl.patch index e4a7c69c8..18797e4cc 100644 --- a/patches/server/0276-Call-player-spectator-target-events-and-improve-impl.patch +++ b/patches/server/0276-Call-player-spectator-target-events-and-improve-impl.patch @@ -19,10 +19,10 @@ spectate the target entity. Co-authored-by: Spottedleaf diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index a2e2b6ea166bf64fe5b49672a6c6f86af3776638..4a8afc06f58bb608055a0fabc587bf06a7110232 100644 +index 36517924b6e1d32bc969b9bc7314a88d531accb2..c2a4d209b4d736c0c0a8a0f1bf703dd822a84790 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1850,14 +1850,58 @@ public class ServerPlayer extends Player { +@@ -1848,14 +1848,58 @@ public class ServerPlayer extends Player { } public void setCamera(@Nullable Entity entity) { diff --git a/patches/server/0278-Add-Velocity-IP-Forwarding-Support.patch b/patches/server/0278-Add-Velocity-IP-Forwarding-Support.patch index b0f090daa..513b5f8a7 100644 --- a/patches/server/0278-Add-Velocity-IP-Forwarding-Support.patch +++ b/patches/server/0278-Add-Velocity-IP-Forwarding-Support.patch @@ -128,10 +128,10 @@ index 0000000000000000000000000000000000000000..41d73aa91fb401612e087aa1b7278ba6 + } +} diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 67b300574655854249c1f7440f56a6e8f0fad351..bb767f5b626225e70a8af273384bb74dbd21430d 100644 +index 5ebc450432805d52457b9f8ff1e2b1981bdd78e6..4c06e62e967f28eb844d74237948834e61daeab0 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -18,6 +18,7 @@ import javax.crypto.Cipher; +@@ -17,6 +17,7 @@ import javax.crypto.Cipher; import javax.crypto.SecretKey; import net.minecraft.DefaultUncaughtExceptionHandler; import net.minecraft.network.Connection; @@ -139,7 +139,7 @@ index 67b300574655854249c1f7440f56a6e8f0fad351..bb767f5b626225e70a8af273384bb74d import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TranslatableComponent; -@@ -44,6 +45,7 @@ import org.bukkit.craftbukkit.util.Waitable; +@@ -40,6 +41,7 @@ import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerPreLoginEvent; // CraftBukkit end @@ -147,7 +147,7 @@ index 67b300574655854249c1f7440f56a6e8f0fad351..bb767f5b626225e70a8af273384bb74d public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener { -@@ -62,6 +64,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -58,6 +60,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @Nullable private ServerPlayer delayedAcceptPlayer; public String hostname = ""; // CraftBukkit - add field @@ -155,7 +155,7 @@ index 67b300574655854249c1f7440f56a6e8f0fad351..bb767f5b626225e70a8af273384bb74d public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection) { this.state = ServerLoginPacketListenerImpl.State.HELLO; -@@ -234,6 +237,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -231,6 +234,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener this.state = ServerLoginPacketListenerImpl.State.KEY; this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.nonce)); } else { @@ -170,7 +170,7 @@ index 67b300574655854249c1f7440f56a6e8f0fad351..bb767f5b626225e70a8af273384bb74d // Spigot start // Paper start - Cache authenticator threads authenticatorPool.execute(new Runnable() { -@@ -335,6 +346,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -338,6 +349,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener public class LoginHandler { public void fireEvents() throws Exception { @@ -183,7 +183,7 @@ index 67b300574655854249c1f7440f56a6e8f0fad351..bb767f5b626225e70a8af273384bb74d String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName(); java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(); java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId(); -@@ -382,6 +399,40 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -385,6 +402,40 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener // Spigot end public void handleCustomQueryPacket(ServerboundCustomQueryPacket packet) { @@ -225,10 +225,10 @@ index 67b300574655854249c1f7440f56a6e8f0fad351..bb767f5b626225e70a8af273384bb74d } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9fc876f3de20b0ad043a9dc6772d4bc6639c943d..8ef4679af2e7ad090f6cbdca9d69a5d88b3c6e93 100644 +index 53650ba59f05d8c7549a71d89c3734e02c6a7fea..532185882420c04c1a996a7d269af554ee106ed1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -763,7 +763,7 @@ public final class CraftServer implements Server { +@@ -759,7 +759,7 @@ public final class CraftServer implements Server { @Override public long getConnectionThrottle() { // Spigot Start - Automatically set connection throttle for bungee configurations diff --git a/patches/server/0280-Check-Drowned-for-Villager-Aggression-Config.patch b/patches/server/0280-Check-Drowned-for-Villager-Aggression-Config.patch index 157a9d1e6..0e8194266 100644 --- a/patches/server/0280-Check-Drowned-for-Villager-Aggression-Config.patch +++ b/patches/server/0280-Check-Drowned-for-Villager-Aggression-Config.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Check Drowned for Villager Aggression Config diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java -index 0a458a88c21c8eece3b08cf7f5d7533efcd879f1..ccaa50d1ba9151bd94333b6b8fc0e77bc4324990 100644 +index b0778270bc9fa5df57974e6f37dc7bfb4b809e3e..030ddefe45563bdd0a7091ae60d365f9aa58b6fc 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java +++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java -@@ -79,7 +79,7 @@ public class Drowned extends Zombie implements RangedAttackMob { +@@ -77,7 +77,7 @@ public class Drowned extends Zombie implements RangedAttackMob { this.goalSelector.addGoal(7, new RandomStrollGoal(this, 1.0D)); this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, Drowned.class)).setAlertOthers(ZombifiedPiglin.class)); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::okTarget)); diff --git a/patches/server/0281-Add-option-to-prevent-players-from-moving-into-unloa.patch b/patches/server/0281-Add-option-to-prevent-players-from-moving-into-unloa.patch index ad2e41bfb..f0c000f5f 100644 --- a/patches/server/0281-Add-option-to-prevent-players-from-moving-into-unloa.patch +++ b/patches/server/0281-Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -20,10 +20,10 @@ index e57ab8a3e6efd78e12385042b7d91dcd27fef11d..eb44aef0aecf65f5c1b19f42bf85a3a2 + } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 607be2544cc163065dcbb7fedd5709cca2453ea2..99f8c661908d6540b8f0bb08a9fd0f5511c885d1 100644 +index d0adb066fcea5636c88be838fb5eff79306c5f4a..b7923ee97eea5c2e285080afba0bd1e93ace41b5 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -529,6 +529,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -534,6 +534,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } speed *= 2f; // TODO: Get the speed of the vehicle instead of the player @@ -36,8 +36,8 @@ index 607be2544cc163065dcbb7fedd5709cca2453ea2..99f8c661908d6540b8f0bb08a9fd0f55 + if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { // CraftBukkit end - ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName().getString(), this.player.getName().getString(), d6, d7, d8); -@@ -1159,9 +1166,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8}); +@@ -1166,9 +1173,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser float prevYaw = this.player.getYRot(); float prevPitch = this.player.getXRot(); // CraftBukkit end @@ -49,7 +49,7 @@ index 607be2544cc163065dcbb7fedd5709cca2453ea2..99f8c661908d6540b8f0bb08a9fd0f55 double d6 = this.player.getY(); double d7 = d0 - this.firstGoodX; double d8 = d1 - this.firstGoodY; -@@ -1199,6 +1206,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1206,6 +1213,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } else { speed = this.player.getAbilities().walkingSpeed * 10f; } diff --git a/patches/server/0282-Reset-players-airTicks-on-respawn.patch b/patches/server/0282-Reset-players-airTicks-on-respawn.patch index 6ff1a31d1..6ff23153d 100644 --- a/patches/server/0282-Reset-players-airTicks-on-respawn.patch +++ b/patches/server/0282-Reset-players-airTicks-on-respawn.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reset players airTicks on respawn diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 4a8afc06f58bb608055a0fabc587bf06a7110232..db7f2715534ed71a2b285de095238586fe6a35b0 100644 +index c2a4d209b4d736c0c0a8a0f1bf703dd822a84790..28a5255626b1a4ed893ac66850ed42adbf573a1c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -2252,6 +2252,7 @@ public class ServerPlayer extends Player { +@@ -2250,6 +2250,7 @@ public class ServerPlayer extends Player { this.setHealth(this.getMaxHealth()); this.stopUsingItem(); // CraftBukkit - SPIGOT-6682: Clear active item on reset diff --git a/patches/server/0284-Improve-Server-Thread-Pool-and-Thread-Priorities.patch b/patches/server/0284-Improve-Server-Thread-Pool-and-Thread-Priorities.patch index 8c8f9eb9f..aeda232b2 100644 --- a/patches/server/0284-Improve-Server-Thread-Pool-and-Thread-Priorities.patch +++ b/patches/server/0284-Improve-Server-Thread-Pool-and-Thread-Priorities.patch @@ -12,10 +12,10 @@ server threads Allow usage of a single thread executor by not using ForkJoin so single core CPU's. diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 5c57a6607f1a95ac4d8770d0429d6848351f5452..cc565d1f766d5a6e0fe674ee9e453dbcb890116e 100644 +index 90d22b75fd33d8355e59b6bab79757c5b436c9d7..a8772417eb54e1a52c490b75b470a502a480f925 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -74,8 +74,8 @@ public class Util { +@@ -69,8 +69,8 @@ public class Util { private static final int DEFAULT_MAX_THREADS = 255; private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads"; private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1); @@ -25,8 +25,8 @@ index 5c57a6607f1a95ac4d8770d0429d6848351f5452..cc565d1f766d5a6e0fe674ee9e453dbc + private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority private static final ExecutorService IO_POOL = makeIoExecutor(); public static LongSupplier timeSource = System::nanoTime; - public static final UUID NIL_UUID = new UUID(0L, 0L); -@@ -114,14 +114,18 @@ public class Util { + public static final Ticker TICKER = new Ticker() { +@@ -112,14 +112,18 @@ public class Util { return Instant.now().toEpochMilli(); } @@ -49,7 +49,7 @@ index 5c57a6607f1a95ac4d8770d0429d6848351f5452..cc565d1f766d5a6e0fe674ee9e453dbc @Override protected void onTermination(Throwable throwable) { if (throwable != null) { -@@ -137,6 +141,7 @@ public class Util { +@@ -135,6 +139,7 @@ public class Util { return forkJoinWorkerThread; }, Util::onThreadException, true); } @@ -58,7 +58,7 @@ index 5c57a6607f1a95ac4d8770d0429d6848351f5452..cc565d1f766d5a6e0fe674ee9e453dbc return executorService; } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 534c02bc7f4fe925d2e12257e88001801a63444c..dd03544da48a2d8276e3dd16eb1985a251a9cfba 100644 +index ca48908148b6d9f4ae03fd55bcaf37e5fdb01cab..2cc2e496991db1ca4154816ecd6121b82fca07c6 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -320,6 +320,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 36.0D) { + if (true) return; // Paper - Don't notify if unreasonably far away - this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, false, "too far")); - } else if (pos.getY() >= worldHeight) { - this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, false, "too high")); -@@ -294,10 +301,12 @@ public class ServerPlayerGameMode { + BlockState iblockdata; + + if (this.player.level.getServer() != null && this.player.chunkPosition().getChessboardDistance(new ChunkPos(pos)) < this.player.level.getServer().getPlayerList().getViewDistance()) { +@@ -304,10 +311,12 @@ public class ServerPlayerGameMode { this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, true, "stopped destroying")); } else if (action == ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK) { this.isDestroyingBlock = false; @@ -59,10 +59,10 @@ index 3ef782b69b9f21d12b1ef214e77bc8af8a94970b..abc7b15976131dc840f40258ed5cc4ef this.level.destroyBlockProgress(this.player.getId(), pos, -1); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 99f8c661908d6540b8f0bb08a9fd0f5511c885d1..c5800f0e502815bf0e71a389e30e9b604ac6b107 100644 +index b7923ee97eea5c2e285080afba0bd1e93ace41b5..bfdf4072d27b022377beafae877f2d553acae9d3 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1555,7 +1555,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1563,7 +1563,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser case START_DESTROY_BLOCK: case ABORT_DESTROY_BLOCK: case STOP_DESTROY_BLOCK: diff --git a/patches/server/0290-Make-the-default-permission-message-configurable.patch b/patches/server/0290-Make-the-default-permission-message-configurable.patch index d1b154203..e28db7fdb 100644 --- a/patches/server/0290-Make-the-default-permission-message-configurable.patch +++ b/patches/server/0290-Make-the-default-permission-message-configurable.patch @@ -42,10 +42,10 @@ index edf0a82ba7e16b86100aa1920fa41508be2ab1e8..c48b175d5511b733bcff9a93a874f5ff Object val = config.get("settings.save-player-data"); if (val instanceof Boolean) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 8ef4679af2e7ad090f6cbdca9d69a5d88b3c6e93..23d450f150d2f2acbb6add825add5f9c777d30b3 100644 +index 532185882420c04c1a996a7d269af554ee106ed1..1373f00a5a93fbb34cc7cb47683a1eef48e88c8c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2585,6 +2585,11 @@ public final class CraftServer implements Server { +@@ -2577,6 +2577,11 @@ public final class CraftServer implements Server { return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions; } diff --git a/patches/server/0292-Handle-Large-Packets-disconnecting-client.patch b/patches/server/0292-Handle-Large-Packets-disconnecting-client.patch index dab7c75b9..048207097 100644 --- a/patches/server/0292-Handle-Large-Packets-disconnecting-client.patch +++ b/patches/server/0292-Handle-Large-Packets-disconnecting-client.patch @@ -7,10 +7,10 @@ If a players inventory is too big to send in a single packet, split the inventory set into multiple packets instead. diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 0aacf2e0155a9a7c9dfe9b368a251aee25ed24fc..0b3f1585618e29685ffcba704f03ff5e581f0851 100644 +index 7e7d33a843566440f815d779ef2f3db9efc3b92d..97b9c53f695d55f8e7d1cb5b300740028c535b7c 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -120,6 +120,15 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -130,6 +130,15 @@ public class Connection extends SimpleChannelInboundHandler> { } public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) { @@ -27,10 +27,10 @@ index 0aacf2e0155a9a7c9dfe9b368a251aee25ed24fc..0b3f1585618e29685ffcba704f03ff5e Connection.LOGGER.debug("Skipping packet due to errors", throwable.getCause()); } else { diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index dfeff0da932b0d66b70f3a5dd281c926c048f2f0..9cdcd4d92f73d1b9866cdef33d2463e843462516 100644 +index 00d432bd395e7f7fb6ee24e371818d13892b2f0c..5fce1177e7198d791d4ab1c64b394c5b1c145782 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java -@@ -57,7 +57,31 @@ public class PacketEncoder extends MessageToByteEncoder> { +@@ -54,7 +54,31 @@ public class PacketEncoder extends MessageToByteEncoder> { throw var10; } } diff --git a/patches/server/0293-force-entity-dismount-during-teleportation.patch b/patches/server/0293-force-entity-dismount-during-teleportation.patch index 053ab671c..9c5889a6a 100644 --- a/patches/server/0293-force-entity-dismount-during-teleportation.patch +++ b/patches/server/0293-force-entity-dismount-during-teleportation.patch @@ -20,10 +20,10 @@ this is going to be the best soultion all around. Improvements/suggestions welcome! diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index db7f2715534ed71a2b285de095238586fe6a35b0..f51c416e7938b7905f7efb154ab14cad643962e9 100644 +index 28a5255626b1a4ed893ac66850ed42adbf573a1c..119a32c11aff63a764eadeca59d5f50fab89cb72 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1323,11 +1323,13 @@ public class ServerPlayer extends Player { +@@ -1321,11 +1321,13 @@ public class ServerPlayer extends Player { } } @@ -41,10 +41,10 @@ index db7f2715534ed71a2b285de095238586fe6a35b0..f51c416e7938b7905f7efb154ab14cad if (entity1 != entity && this.connection != null) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 37f337efb7ac164749c73974e4acfde93d649290..3a013ffe5feec6dab478684964f581c354f2a7ae 100644 +index c819bd3db7dfab1181288683f2a47bb71a52953d..1f1442e62c089ef9a922bbee91fc841771e7777f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2252,11 +2252,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2256,11 +2256,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public void removeVehicle() { @@ -62,7 +62,7 @@ index 37f337efb7ac164749c73974e4acfde93d649290..3a013ffe5feec6dab478684964f581c3 } } -@@ -2319,7 +2324,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2323,7 +2328,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i return true; // CraftBukkit } @@ -74,7 +74,7 @@ index 37f337efb7ac164749c73974e4acfde93d649290..3a013ffe5feec6dab478684964f581c3 if (entity.getVehicle() == this) { throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); } else { -@@ -2329,7 +2337,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2333,7 +2341,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { VehicleExitEvent event = new VehicleExitEvent( (Vehicle) this.getBukkitEntity(), @@ -83,7 +83,7 @@ index 37f337efb7ac164749c73974e4acfde93d649290..3a013ffe5feec6dab478684964f581c3 ); // Suppress during worldgen if (this.valid) { -@@ -2343,7 +2351,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2347,7 +2355,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } // CraftBukkit end // Spigot start @@ -93,10 +93,10 @@ index 37f337efb7ac164749c73974e4acfde93d649290..3a013ffe5feec6dab478684964f581c3 if (this.valid) { Bukkit.getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index dc723e1a4d73e06c4b9f275c7b912de1a1cef070..8587ac23b5c98ef2ee90445432da9db130d93464 100644 +index e5c5bdc83804f335d7163cfefba79b57df97310b..853ce6536557b64de134a098d7ed3dde2782ffde 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3352,9 +3352,15 @@ public abstract class LivingEntity extends Entity { +@@ -3347,9 +3347,15 @@ public abstract class LivingEntity extends Entity { @Override public void stopRiding() { @@ -114,10 +114,10 @@ index dc723e1a4d73e06c4b9f275c7b912de1a1cef070..8587ac23b5c98ef2ee90445432da9db1 this.dismountVehicle(entity); } diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index fcd66b668008a0c3be8d20f7f169b213fabe91a5..7bc6518dd4da041d9f59affc5447a23312790917 100644 +index 2dcbeaed2e84675e95cde9e831b9d552b2e0b32f..a55ee0868fbf85456749ecede30cea7e0c481bb3 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -1093,7 +1093,13 @@ public abstract class Player extends LivingEntity { +@@ -1106,7 +1106,13 @@ public abstract class Player extends LivingEntity { @Override public void removeVehicle() { diff --git a/patches/server/0295-Book-Size-Limits.patch b/patches/server/0295-Book-Size-Limits.patch index 894f68fa4..bfc0c1610 100644 --- a/patches/server/0295-Book-Size-Limits.patch +++ b/patches/server/0295-Book-Size-Limits.patch @@ -24,10 +24,10 @@ index c48b175d5511b733bcff9a93a874f5ffc0174691..e683e5bf47abe7bd3d2f7e9811a37754 private static void asyncChunks() { ConfigurationSection section; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c5800f0e502815bf0e71a389e30e9b604ac6b107..b1ea73320b7927b23d48ee6e80b63b37d1806c97 100644 +index bfdf4072d27b022377beafae877f2d553acae9d3..52de402481607a0f35e43028003593499821ffb7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1005,6 +1005,45 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1012,6 +1012,45 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handleEditBook(ServerboundEditBookPacket packet) { diff --git a/patches/server/0296-Add-PlayerConnectionCloseEvent.patch b/patches/server/0296-Add-PlayerConnectionCloseEvent.patch index 015b6d566..5a881a7a4 100644 --- a/patches/server/0296-Add-PlayerConnectionCloseEvent.patch +++ b/patches/server/0296-Add-PlayerConnectionCloseEvent.patch @@ -34,10 +34,10 @@ how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent is undefined. diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 0b3f1585618e29685ffcba704f03ff5e581f0851..821f22b8fde2d76bfcb417138f9bd83af766dcd7 100644 +index 97b9c53f695d55f8e7d1cb5b300740028c535b7c..3559f6c54e7674d3eaf023d2ceaee13edfcae5b2 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -418,6 +418,26 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -430,6 +430,26 @@ public class Connection extends SimpleChannelInboundHandler> { this.getPacketListener().onDisconnect(new TranslatableComponent("multiplayer.disconnect.generic")); } this.queue.clear(); // Free up packet queue. diff --git a/patches/server/0297-Prevent-Enderman-from-loading-chunks.patch b/patches/server/0297-Prevent-Enderman-from-loading-chunks.patch index 5c0a545a6..60ad30486 100644 --- a/patches/server/0297-Prevent-Enderman-from-loading-chunks.patch +++ b/patches/server/0297-Prevent-Enderman-from-loading-chunks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent Enderman from loading chunks diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -index c7714824d8e85087397047cf9bcb0528968b1f93..d47002d45dabd66f38d25d398d8943f4b911cdc5 100644 +index 102cab5a2104d32440ad489847bb7a443beead51..4920f5465298b4da33b53f80b8af6220cb0e8ccc 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -@@ -490,7 +490,8 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -489,7 +489,8 @@ public class EnderMan extends Monster implements NeutralMob { int j = Mth.floor(this.enderman.getY() + random.nextDouble() * 2.0D); int k = Mth.floor(this.enderman.getZ() - 1.0D + random.nextDouble() * 2.0D); BlockPos blockposition = new BlockPos(i, j, k); @@ -18,7 +18,7 @@ index c7714824d8e85087397047cf9bcb0528968b1f93..d47002d45dabd66f38d25d398d8943f4 BlockPos blockposition1 = blockposition.below(); BlockState iblockdata1 = world.getBlockState(blockposition1); BlockState iblockdata2 = this.enderman.getCarriedBlock(); -@@ -536,7 +537,8 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -535,7 +536,8 @@ public class EnderMan extends Monster implements NeutralMob { int j = Mth.floor(this.enderman.getY() + random.nextDouble() * 3.0D); int k = Mth.floor(this.enderman.getZ() - 2.0D + random.nextDouble() * 4.0D); BlockPos blockposition = new BlockPos(i, j, k); diff --git a/patches/server/0298-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch b/patches/server/0298-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch index 232a30462..cb5aa60f4 100644 --- a/patches/server/0298-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch +++ b/patches/server/0298-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch @@ -16,10 +16,10 @@ intent to remove) and replace it with two new methods, clearly named and documented as to their purpose. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index f51c416e7938b7905f7efb154ab14cad643962e9..71cd61112fa36d1de2f5fc0dd75993fafc3d76ab 100644 +index 119a32c11aff63a764eadeca59d5f50fab89cb72..4e51975dbab2f4904246a2bcff12d923cd629909 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -222,6 +222,7 @@ public class ServerPlayer extends Player { +@@ -220,6 +220,7 @@ public class ServerPlayer extends Player { public int latency; public boolean wonGame; private int containerUpdateDelay; // Paper @@ -28,7 +28,7 @@ index f51c416e7938b7905f7efb154ab14cad643962e9..71cd61112fa36d1de2f5fc0dd75993fa public boolean queueHealthUpdatePacket = false; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index e1603b674823067a55faa12e716b695171b31d32..73dd4776fee3429c42b279ab92050a4b872f64b5 100644 +index 8e8fee668b6a351ef14904e6e065e59014868adb..e889c7f626316ea68e9231d903bd97095f07e9e9 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -173,6 +173,7 @@ public abstract class PlayerList { diff --git a/patches/server/0299-Workaround-for-vehicle-tracking-issue-on-disconnect.patch b/patches/server/0299-Workaround-for-vehicle-tracking-issue-on-disconnect.patch index fdfe69929..6ad108b93 100644 --- a/patches/server/0299-Workaround-for-vehicle-tracking-issue-on-disconnect.patch +++ b/patches/server/0299-Workaround-for-vehicle-tracking-issue-on-disconnect.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Workaround for vehicle tracking issue on disconnect diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 71cd61112fa36d1de2f5fc0dd75993fafc3d76ab..e8ef3adad0bfddf17271e095ec928c8acb9413f2 100644 +index 4e51975dbab2f4904246a2bcff12d923cd629909..889881c6835a68b1ada3b613fa7e9ed9cdf82c2a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1565,6 +1565,13 @@ public class ServerPlayer extends Player { +@@ -1563,6 +1563,13 @@ public class ServerPlayer extends Player { public void disconnect() { this.disconnected = true; this.ejectPassengers(); diff --git a/patches/server/0301-BlockDestroyEvent.patch b/patches/server/0301-BlockDestroyEvent.patch index 448b9603c..667142632 100644 --- a/patches/server/0301-BlockDestroyEvent.patch +++ b/patches/server/0301-BlockDestroyEvent.patch @@ -11,10 +11,10 @@ floating in the air. This can replace many uses of BlockPhysicsEvent diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 5e3d1a36b0eb350536e29730540ee17b68fe315b..9d963766cce68f5cb837988c73c8b271404c8376 100644 +index dc2235824853a0d7ccbff51dd26a71e97fe90ba7..a00b4c84cc27678c07d0195a90f38dc458a11862 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -28,6 +28,7 @@ import net.minecraft.nbt.CompoundTag; +@@ -29,6 +29,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -22,7 +22,7 @@ index 5e3d1a36b0eb350536e29730540ee17b68fe315b..9d963766cce68f5cb837988c73c8b271 import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ServerLevel; -@@ -564,8 +565,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -563,8 +564,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return false; } else { FluidState fluid = this.getFluidState(pos); diff --git a/patches/server/0302-Async-command-map-building.patch b/patches/server/0302-Async-command-map-building.patch index 7581f7fb8..22cd32cfc 100644 --- a/patches/server/0302-Async-command-map-building.patch +++ b/patches/server/0302-Async-command-map-building.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Async command map building diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index cc2337ee8a00fab8919a61324899113370bc5018..ee31455158afbed8f3bbac57d2f41a59d01a0670 100644 +index 7d6b416f0889221d63233f8650c530467ea8fbd7..f3bbe012541a71ab75c1863990d0c056c62d8c6e 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -30,6 +30,7 @@ import net.minecraft.network.chat.MutableComponent; +@@ -31,6 +31,7 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.protocol.game.ClientboundCommandsPacket; @@ -16,7 +16,7 @@ index cc2337ee8a00fab8919a61324899113370bc5018..ee31455158afbed8f3bbac57d2f41a59 import net.minecraft.server.commands.AdvancementCommands; import net.minecraft.server.commands.AttributeCommand; import net.minecraft.server.commands.BanIpCommands; -@@ -344,6 +345,12 @@ public class Commands { +@@ -346,6 +347,12 @@ public class Commands { if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot // CraftBukkit start // Register Vanilla commands into builtRoot as before @@ -29,7 +29,7 @@ index cc2337ee8a00fab8919a61324899113370bc5018..ee31455158afbed8f3bbac57d2f41a59 Map, CommandNode> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues RootCommandNode vanillaRoot = new RootCommandNode(); -@@ -361,7 +368,14 @@ public class Commands { +@@ -363,7 +370,14 @@ public class Commands { for (CommandNode node : rootcommandnode.getChildren()) { bukkit.add(node.getName()); } diff --git a/patches/server/0303-Implement-Brigadier-Mojang-API.patch b/patches/server/0303-Implement-Brigadier-Mojang-API.patch index bc55828b4..e675f1517 100644 --- a/patches/server/0303-Implement-Brigadier-Mojang-API.patch +++ b/patches/server/0303-Implement-Brigadier-Mojang-API.patch @@ -10,7 +10,7 @@ Adds CommandRegisteredEvent - Allows manipulating the CommandNode to add more children/metadata for the client diff --git a/build.gradle.kts b/build.gradle.kts -index 125630037713c4790636ffd11b14b2c1d83a085a..898e2efb764e5bd97ab4e757e6c4c27fc4efdbef 100644 +index 0c560f91986d5352f1ec42ccb48853366a981fbe..e8badd402381eaae1eafbd751bd2dfecc0427922 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,6 +12,7 @@ repositories { @@ -22,7 +22,7 @@ index 125630037713c4790636ffd11b14b2c1d83a085a..898e2efb764e5bd97ab4e757e6c4c27f implementation("org.jline:jline-terminal-jansi:3.21.0") implementation("net.minecrell:terminalconsoleappender:1.3.0") diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java -index 9f79c949d18c1ff3bdb49780fcecfc75366a8ff6..530a09fa3c9155459c6a4519e3412408ae658145 100644 +index 5ebf717535eab892898a62ce6aaaf936fe064626..31aaad639b6c285226ca7aca1bd2285cfe0d9117 100644 --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java @@ -38,7 +38,7 @@ import net.minecraft.world.phys.Vec2; @@ -61,10 +61,10 @@ index 9f79c949d18c1ff3bdb49780fcecfc75366a8ff6..530a09fa3c9155459c6a4519e3412408 public boolean hasPermission(int level) { // CraftBukkit start diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index ee31455158afbed8f3bbac57d2f41a59d01a0670..4049576478efed97092b7e1b3d40afda6b114d68 100644 +index f3bbe012541a71ab75c1863990d0c056c62d8c6e..4bc28b66788d06d1446284f5adef6a44be736f92 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -369,6 +369,7 @@ public class Commands { +@@ -371,6 +371,7 @@ public class Commands { bukkit.add(node.getName()); } // Paper start - Async command map building @@ -72,7 +72,7 @@ index ee31455158afbed8f3bbac57d2f41a59d01a0670..4049576478efed97092b7e1b3d40afda MinecraftServer.getServer().execute(() -> { runSync(player, bukkit, rootcommandnode); }); -@@ -376,6 +377,7 @@ public class Commands { +@@ -378,6 +379,7 @@ public class Commands { private void runSync(ServerPlayer player, Collection bukkit, RootCommandNode rootcommandnode) { // Paper end - Async command map building @@ -81,10 +81,10 @@ index ee31455158afbed8f3bbac57d2f41a59d01a0670..4049576478efed97092b7e1b3d40afda event.getPlayer().getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b1ea73320b7927b23d48ee6e80b63b37d1806c97..e2044745f490f99deb993e42385d71fa8d927ab1 100644 +index 52de402481607a0f35e43028003593499821ffb7..fdf45cb0132bc588b9bb3ac8d9f89c0d1082b0e7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -746,8 +746,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -753,8 +753,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser ParseResults parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { @@ -99,7 +99,7 @@ index b1ea73320b7927b23d48ee6e80b63b37d1806c97..e2044745f490f99deb993e42385d71fa }); }); } -@@ -756,7 +760,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -763,7 +767,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser builder = builder.createOffset(builder.getInput().lastIndexOf(' ') + 1); completions.forEach(builder::suggest); diff --git a/patches/server/0305-Limit-Client-Sign-length-more.patch b/patches/server/0305-Limit-Client-Sign-length-more.patch index f556e47a8..6f7d06e2d 100644 --- a/patches/server/0305-Limit-Client-Sign-length-more.patch +++ b/patches/server/0305-Limit-Client-Sign-length-more.patch @@ -22,10 +22,10 @@ it only impacts data sent from the client. Set -DPaper.maxSignLength=XX to change limit or -1 to disable diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e2044745f490f99deb993e42385d71fa8d927ab1..7b639081b1bd5ac0cca7c6be1692c179bc9692fb 100644 +index fdf45cb0132bc588b9bb3ac8d9f89c0d1082b0e7..3ec98749f23e56d52e246d2c94006c5ed4ddf303 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -253,6 +253,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -254,6 +254,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private int aboveGroundVehicleTickCount; private int receivedMovePacketCount; private int knownMovePacketCount; @@ -33,7 +33,7 @@ index e2044745f490f99deb993e42385d71fa8d927ab1..7b639081b1bd5ac0cca7c6be1692c179 private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { -@@ -2865,6 +2866,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2889,6 +2890,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser for (int i = 0; i < signText.size(); ++i) { TextFilter.FilteredText currentLine = signText.get(i); diff --git a/patches/server/0307-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/0307-Optimize-Network-Manager-and-add-advanced-packet-sup.patch index 8ae2ad20e..bdd97d425 100644 --- a/patches/server/0307-Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/patches/server/0307-Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -28,10 +28,10 @@ and then catch exceptions and close if they fire. Part of this commit was authored by: Spottedleaf diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 821f22b8fde2d76bfcb417138f9bd83af766dcd7..f13e24eede7f09ecc8f375df5e27e385f589005d 100644 +index 3559f6c54e7674d3eaf023d2ceaee13edfcae5b2..a0d3d9e344f530b713167d0663634c40eefce5b5 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -87,6 +87,10 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -97,6 +97,10 @@ public class Connection extends SimpleChannelInboundHandler> { public int protocolVersion; public java.net.InetSocketAddress virtualHost; private static boolean enableExplicitFlush = Boolean.getBoolean("paper.explicit-flush"); @@ -42,7 +42,7 @@ index 821f22b8fde2d76bfcb417138f9bd83af766dcd7..f13e24eede7f09ecc8f375df5e27e385 // Paper end public Connection(PacketFlow side) { -@@ -110,6 +114,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -120,6 +124,7 @@ public class Connection extends SimpleChannelInboundHandler> { } public void setProtocol(ConnectionProtocol state) { @@ -50,7 +50,7 @@ index 821f22b8fde2d76bfcb417138f9bd83af766dcd7..f13e24eede7f09ecc8f375df5e27e385 this.channel.attr(Connection.ATTRIBUTE_PROTOCOL).set(state); this.channel.config().setAutoRead(true); Connection.LOGGER.debug("Enabled auto read"); -@@ -186,19 +191,87 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -198,19 +203,87 @@ public class Connection extends SimpleChannelInboundHandler> { Validate.notNull(listener, "packetListener", new Object[0]); this.packetListener = listener; } @@ -142,7 +142,7 @@ index 821f22b8fde2d76bfcb417138f9bd83af766dcd7..f13e24eede7f09ecc8f375df5e27e385 } private void sendPacket(Packet packet, @Nullable GenericFutureListener> callback) { -@@ -226,33 +299,79 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -238,33 +311,79 @@ public class Connection extends SimpleChannelInboundHandler> { this.setProtocol(packetState); } @@ -231,7 +231,7 @@ index 821f22b8fde2d76bfcb417138f9bd83af766dcd7..f13e24eede7f09ecc8f375df5e27e385 public void tick() { this.flushQueue(); -@@ -289,9 +408,22 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -301,9 +420,22 @@ public class Connection extends SimpleChannelInboundHandler> { return this.address; } @@ -254,7 +254,7 @@ index 821f22b8fde2d76bfcb417138f9bd83af766dcd7..f13e24eede7f09ecc8f375df5e27e385 // Spigot End if (this.channel.isOpen()) { this.channel.close(); // We can't wait as this may be called from an event loop. -@@ -409,7 +541,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -421,7 +553,7 @@ public class Connection extends SimpleChannelInboundHandler> { public void handleDisconnection() { if (this.channel != null && !this.channel.isOpen()) { if (this.disconnectionHandled) { @@ -263,7 +263,7 @@ index 821f22b8fde2d76bfcb417138f9bd83af766dcd7..f13e24eede7f09ecc8f375df5e27e385 } else { this.disconnectionHandled = true; if (this.getDisconnectedReason() != null) { -@@ -417,7 +549,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -429,7 +561,7 @@ public class Connection extends SimpleChannelInboundHandler> { } else if (this.getPacketListener() != null) { this.getPacketListener().onDisconnect(new TranslatableComponent("multiplayer.disconnect.generic")); } @@ -297,7 +297,7 @@ index 74bfe0d3942259c45702b099efdc4e101a4e3022..e8fcd56906d26f6dc87959e32c4c7c78 return false; } diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index 526e07d8ea21af42c271bee4da5bccd766227006..6bf39699700075e295a693b56d237391de4e4f58 100644 +index e174d9803e557470068f7893260d55a042888517..7c820a8f9ae85eb6941dce0e6296775fb331d720 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -63,10 +63,12 @@ public class ServerConnectionListener { diff --git a/patches/server/0312-Entity-getEntitySpawnReason.patch b/patches/server/0312-Entity-getEntitySpawnReason.patch index 8c45099f0..2cebcd9b4 100644 --- a/patches/server/0312-Entity-getEntitySpawnReason.patch +++ b/patches/server/0312-Entity-getEntitySpawnReason.patch @@ -10,10 +10,10 @@ persistenting Living Entity, SPAWNER for spawners, or DEFAULT since data was not stored. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 8da73bd016b7da297e64383e2e6dc65a1dd3be87..d01f3207d4a7516d2eba9df44c44a7c41c354c84 100644 +index 83fac40b413e8f1ae4bda1e1c87b07c51af832ef..49d6941b95dd5d7030f38915e31144d03e807909 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1185,6 +1185,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1188,6 +1188,7 @@ public class ServerLevel extends Level implements WorldGenLevel { return true; } // Paper end @@ -22,7 +22,7 @@ index 8da73bd016b7da297e64383e2e6dc65a1dd3be87..d01f3207d4a7516d2eba9df44c44a7c4 // Paper start if (DEBUG_ENTITIES) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 25da9e3252154415303db662286e89e3aa7cfcd8..eea7a625fb00af13944b21e1af4bf1804c5ce6d9 100644 +index b494d7fc864a2fa734c73c2c4d433e288bccfb26..840bfcea9347b50b422eb7a325a1be438da45015 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -342,7 +342,7 @@ public abstract class PlayerList { @@ -35,10 +35,10 @@ index 25da9e3252154415303db662286e89e3aa7cfcd8..eea7a625fb00af13944b21e1af4bf180 }); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3a013ffe5feec6dab478684964f581c354f2a7ae..e42da944f70520b7b8f0a67928614b85f7385f9f 100644 +index 1f1442e62c089ef9a922bbee91fc841771e7777f..a896b0b671d0c57de49c8f5e937e6218cbdc7a1e 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -67,6 +67,8 @@ import net.minecraft.world.InteractionHand; +@@ -70,6 +70,8 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.Nameable; import net.minecraft.world.damagesource.DamageSource; @@ -47,7 +47,7 @@ index 3a013ffe5feec6dab478684964f581c354f2a7ae..e42da944f70520b7b8f0a67928614b85 import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.Boat; -@@ -165,6 +167,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -168,6 +170,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } } }; @@ -55,7 +55,7 @@ index 3a013ffe5feec6dab478684964f581c354f2a7ae..e42da944f70520b7b8f0a67928614b85 // Paper end public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper -@@ -1869,6 +1872,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1874,6 +1877,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } @@ -65,7 +65,7 @@ index 3a013ffe5feec6dab478684964f581c354f2a7ae..e42da944f70520b7b8f0a67928614b85 // Save entity's from mob spawner status if (spawnedViaMobSpawner) { nbt.putBoolean("Paper.FromMobSpawner", true); -@@ -2018,6 +2024,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2023,6 +2029,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -93,7 +93,7 @@ index 3a013ffe5feec6dab478684964f581c354f2a7ae..e42da944f70520b7b8f0a67928614b85 } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index f08c5ae9d41ec9efb627665f5de4dd6165fd0092..30930a24c197c45f2ed86eaf7a150252005e7a37 100644 +index 1c76a59eb25148bf2523e9d68cc165b6cd3e1d23..fafbc8601ba3378b86c660f947e23ec293dd7e7e 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -179,6 +179,7 @@ public abstract class BaseSpawner { diff --git a/patches/server/0313-Update-entity-Metadata-for-all-tracked-players.patch b/patches/server/0313-Update-entity-Metadata-for-all-tracked-players.patch index bd49d6359..d7b4690b1 100644 --- a/patches/server/0313-Update-entity-Metadata-for-all-tracked-players.patch +++ b/patches/server/0313-Update-entity-Metadata-for-all-tracked-players.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Update entity Metadata for all tracked players diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 3d27cbf5e9105def2f38525a85da5acf8ebf8fe9..ceba19ea3bb9664899b83f82f28af06476b7ff56 100644 +index 861f3790179e18f6192ac8b2fb5d2ecbc54484ad..5e3f489964489e0facc93a823a1cb84b4c8abce7 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -391,6 +391,12 @@ public class ServerEntity { @@ -22,10 +22,10 @@ index 3d27cbf5e9105def2f38525a85da5acf8ebf8fe9..ceba19ea3bb9664899b83f82f28af064 this.broadcast.accept(packet); if (this.entity instanceof ServerPlayer) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 7b639081b1bd5ac0cca7c6be1692c179bc9692fb..d61a841653c26c210ba583141517ff421319ee1a 100644 +index 3ec98749f23e56d52e246d2c94006c5ed4ddf303..30807f1ca5fe70c874420f63adea4cc37e4e3e67 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2290,7 +2290,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2305,7 +2305,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser if (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem) { // Refresh the current entity metadata diff --git a/patches/server/0317-Server-Tick-Events.patch b/patches/server/0317-Server-Tick-Events.patch index 0bfdc4234..c2b4a226a 100644 --- a/patches/server/0317-Server-Tick-Events.patch +++ b/patches/server/0317-Server-Tick-Events.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Server Tick Events Fires event at start and end of a server tick diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0c899c5f2d896d32aed7d165773ff2cd4a78f112..bc9937642a46ecd766a45ccb037de993dafa3608 100644 +index fcc8062487e41802988337796a52e8a7fcb59aad..5c976fd8aa5f79d1ef4174063acb0db7a5ce835c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1319,6 +1319,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop pendingFullStateConfirmation; @@ -17,10 +17,10 @@ index 5b8b9dabc6673b6f0a335a42d2ec71a583c410fb..74d674b2684b0db4aa6c183edc6091d5 public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) { diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index 19d3802becd353e130b785f8286e595e08dc5c5f..f0dac1f596911eb2109192ef16a619f8ae71d1f7 100644 +index 2012831c4e9573118209672c8a0170573566b491..a028de3cec90a097d6f10c49be2c6a7cb0b19318 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -51,7 +51,16 @@ public abstract class DistanceManager { +@@ -52,7 +52,16 @@ public abstract class DistanceManager { private final DistanceManager.FixedPlayerDistanceChunkTracker naturalSpawnChunkCounter = new DistanceManager.FixedPlayerDistanceChunkTracker(8); private final TickingTracker tickingTicketsTracker = new TickingTracker(); private final DistanceManager.PlayerTicketTracker playerTicketManager = new DistanceManager.PlayerTicketTracker(33); @@ -38,7 +38,7 @@ index 19d3802becd353e130b785f8286e595e08dc5c5f..f0dac1f596911eb2109192ef16a619f8 final ChunkTaskPriorityQueueSorter ticketThrottler; final ProcessorHandle> ticketThrottlerInput; final ProcessorHandle ticketThrottlerReleaser; -@@ -126,26 +135,14 @@ public abstract class DistanceManager { +@@ -127,26 +136,14 @@ public abstract class DistanceManager { ; } @@ -73,7 +73,7 @@ index 19d3802becd353e130b785f8286e595e08dc5c5f..f0dac1f596911eb2109192ef16a619f8 return true; } else { if (!this.ticketsToRelease.isEmpty()) { -@@ -434,7 +431,7 @@ public abstract class DistanceManager { +@@ -471,7 +468,7 @@ public abstract class DistanceManager { if (k != level) { playerchunk = DistanceManager.this.updateChunkScheduling(id, level, playerchunk, k); if (playerchunk != null) { diff --git a/patches/server/0330-Allow-Saving-of-Oversized-Chunks.patch b/patches/server/0330-Allow-Saving-of-Oversized-Chunks.patch index 059276373..7a71ae6af 100644 --- a/patches/server/0330-Allow-Saving-of-Oversized-Chunks.patch +++ b/patches/server/0330-Allow-Saving-of-Oversized-Chunks.patch @@ -33,10 +33,10 @@ this fix, as the data will remain in the oversized file. Once the server returns to a jar with this fix, the data will be restored. diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index 04e45b4de2f4e26853a4fed6271cf79ef8607154..44de464b5f2190944c7a7316a76e13f9c3b954ab 100644 +index 038e2177182c94baa4af24f9111cf155ec342dfe..330fb8e6565a5c0490af0c5ca0e7355d81a82e58 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -@@ -17,8 +17,12 @@ import java.nio.file.LinkOption; +@@ -18,8 +18,12 @@ import java.nio.file.LinkOption; import java.nio.file.Path; import java.nio.file.StandardCopyOption; import java.nio.file.StandardOpenOption; @@ -47,8 +47,8 @@ index 04e45b4de2f4e26853a4fed6271cf79ef8607154..44de464b5f2190944c7a7316a76e13f9 +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtIo; import net.minecraft.world.level.ChunkPos; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; + import org.slf4j.Logger; + @@ -45,6 +49,7 @@ public class RegionFile implements AutoCloseable { @VisibleForTesting protected final RegionBitmap usedSectors; diff --git a/patches/server/0331-Expose-the-internal-current-tick.patch b/patches/server/0331-Expose-the-internal-current-tick.patch index a517a14b0..ad6e545a9 100644 --- a/patches/server/0331-Expose-the-internal-current-tick.patch +++ b/patches/server/0331-Expose-the-internal-current-tick.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose the internal current tick diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 4d0ff2866580a7ce7e83e8ed223ebb16d328ecbf..3573856d032605236c5b73196a7287a1e4ed41ac 100644 +index 699d0c6361465bc799a6a135dcf75e2ba3a4a0f1..2cd64494b43a591c6471221bba649c7d74cfb64b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2608,5 +2608,10 @@ public final class CraftServer implements Server { +@@ -2600,5 +2600,10 @@ public final class CraftServer implements Server { } return new com.destroystokyo.paper.profile.CraftPlayerProfile(uuid, name); } diff --git a/patches/server/0332-Fix-World-isChunkGenerated-calls.patch b/patches/server/0332-Fix-World-isChunkGenerated-calls.patch index 60fb4cc25..71bc0e1f6 100644 --- a/patches/server/0332-Fix-World-isChunkGenerated-calls.patch +++ b/patches/server/0332-Fix-World-isChunkGenerated-calls.patch @@ -8,10 +8,10 @@ This patch also adds a chunk status cache on region files (note that its only purpose is to cache the status on DISK) diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 244f6a2934e807fa4f67c617dcd08a9ae2065bbf..e47dc348a98de67146d45d5f57cc72dbc2c0f975 100644 +index 6a7e6cbc188619b0239e97237069c895a50e8083..5ccf921bb0ed5f1d4330fec3b3fdfc654d8c5160 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -87,6 +87,7 @@ import net.minecraft.world.level.chunk.ProtoChunk; +@@ -90,6 +90,7 @@ import net.minecraft.world.level.chunk.ProtoChunk; import net.minecraft.world.level.chunk.UpgradeData; import net.minecraft.world.level.chunk.storage.ChunkSerializer; import net.minecraft.world.level.chunk.storage.ChunkStorage; @@ -19,7 +19,7 @@ index 244f6a2934e807fa4f67c617dcd08a9ae2065bbf..e47dc348a98de67146d45d5f57cc72db import net.minecraft.world.level.entity.ChunkStatusUpdateListener; import net.minecraft.world.level.levelgen.blending.BlendingData; import net.minecraft.world.level.levelgen.structure.StructureStart; -@@ -1178,10 +1179,59 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1232,10 +1233,59 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @Nullable public CompoundTag readChunk(ChunkPos pos) throws IOException { CompoundTag nbttagcompound = this.read(pos); @@ -81,7 +81,7 @@ index 244f6a2934e807fa4f67c617dcd08a9ae2065bbf..e47dc348a98de67146d45d5f57cc72db // Spigot start return this.anyPlayerCloseEnoughForSpawning(pos, false); diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java -index 328f482a0bae8d2f8013ae9a90f0500ef889ffb5..6c72854aa975800bd6160d104936a5ba978f4d67 100644 +index a7f173c385f7a96010652b92fe14bffa5f1ffc68..954e141e5617d6d52e2f3008c25fe9e2fe2f0f9a 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java @@ -290,6 +290,17 @@ public class ChunkStatus { @@ -103,10 +103,10 @@ index 328f482a0bae8d2f8013ae9a90f0500ef889ffb5..6c72854aa975800bd6160d104936a5ba return (ChunkStatus) Registry.CHUNK_STATUS.get(ResourceLocation.tryParse(id)); } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 89de1589833dcce8028fd402aea8a3e57dc29e86..3e631d55d30831a4063e23f9dbc7a315d11a7b68 100644 +index 37a60420b993525852492fd6665fb75afee9796f..9a4fe42da43037a65738b978c0c6c9969de59e76 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -604,6 +604,17 @@ public class ChunkSerializer { +@@ -606,6 +606,17 @@ public class ChunkSerializer { })); } @@ -125,28 +125,20 @@ index 89de1589833dcce8028fd402aea8a3e57dc29e86..3e631d55d30831a4063e23f9dbc7a315 return nbt != null ? ChunkStatus.byName(nbt.getString("Status")).getChunkType() : ChunkStatus.ChunkType.PROTOCHUNK; } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index 44de464b5f2190944c7a7316a76e13f9c3b954ab..293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3 100644 +index 330fb8e6565a5c0490af0c5ca0e7355d81a82e58..861a25a15f1aab20e3245b6d5cdad5d23bdfd6d0 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -@@ -24,6 +24,7 @@ import net.minecraft.Util; - import net.minecraft.nbt.CompoundTag; - import net.minecraft.nbt.NbtIo; - import net.minecraft.world.level.ChunkPos; -+import net.minecraft.world.level.chunk.ChunkStatus; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -@@ -51,6 +52,30 @@ public class RegionFile implements AutoCloseable { +@@ -51,6 +51,30 @@ public class RegionFile implements AutoCloseable { public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper public final Path regionFile; // Paper + // Paper start - Cache chunk status -+ private final ChunkStatus[] statuses = new ChunkStatus[32 * 32]; ++ private final net.minecraft.world.level.chunk.ChunkStatus[] statuses = new net.minecraft.world.level.chunk.ChunkStatus[32 * 32]; + + private boolean closed; + + // invoked on write/read -+ public void setStatus(int x, int z, ChunkStatus status) { ++ public void setStatus(int x, int z, net.minecraft.world.level.chunk.ChunkStatus status) { + if (this.closed) { + // We've used an invalid region file. + throw new IllegalStateException("RegionFile is closed"); @@ -154,7 +146,7 @@ index 44de464b5f2190944c7a7316a76e13f9c3b954ab..293cce2c80fbdc18480977f5f6b24d6b + this.statuses[getChunkLocation(x, z)] = status; + } + -+ public ChunkStatus getStatusIfCached(int x, int z) { ++ public net.minecraft.world.level.chunk.ChunkStatus getStatusIfCached(int x, int z) { + if (this.closed) { + // We've used an invalid region file. + throw new IllegalStateException("RegionFile is closed"); @@ -167,7 +159,7 @@ index 44de464b5f2190944c7a7316a76e13f9c3b954ab..293cce2c80fbdc18480977f5f6b24d6b public RegionFile(Path file, Path directory, boolean dsync) throws IOException { this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync); } -@@ -398,6 +423,7 @@ public class RegionFile implements AutoCloseable { +@@ -398,6 +422,7 @@ public class RegionFile implements AutoCloseable { return this.getOffset(pos) != 0; } @@ -175,7 +167,7 @@ index 44de464b5f2190944c7a7316a76e13f9c3b954ab..293cce2c80fbdc18480977f5f6b24d6b private static int getOffsetIndex(ChunkPos pos) { return pos.getRegionLocalX() + pos.getRegionLocalZ() * 32; } -@@ -408,6 +434,7 @@ public class RegionFile implements AutoCloseable { +@@ -408,6 +433,7 @@ public class RegionFile implements AutoCloseable { synchronized (this) { try { // Paper end @@ -196,7 +188,7 @@ index a1bfcdd713c47d8613eb4af7625a64d51161690b..4bc33c31d497aa7d69226ab870fd7890 } catch (Throwable throwable) { if (dataoutputstream != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index a8f759c6a122411a78ea93c075c2b5eb3f9b06d2..62fb9636364e2f45465a4bd5fc62d47d81e1fd2f 100644 +index 3ffefd881c2ec03debd2e69e8e82badfdfe66778..a4b9e20b2656647afacefc2c4b7962f78d882114 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -20,6 +20,7 @@ import java.util.Objects; @@ -207,7 +199,7 @@ index a8f759c6a122411a78ea93c075c2b5eb3f9b06d2..62fb9636364e2f45465a4bd5fc62d47d import java.util.function.Predicate; import java.util.stream.Collectors; import net.minecraft.core.BlockPos; -@@ -288,8 +289,22 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -291,8 +292,22 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean isChunkGenerated(int x, int z) { @@ -231,7 +223,7 @@ index a8f759c6a122411a78ea93c075c2b5eb3f9b06d2..62fb9636364e2f45465a4bd5fc62d47d } catch (IOException ex) { throw new RuntimeException(ex); } -@@ -401,20 +416,48 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -404,20 +419,48 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean loadChunk(int x, int z, boolean generate) { org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot diff --git a/patches/server/0338-Prevent-consuming-the-wrong-itemstack.patch b/patches/server/0338-Prevent-consuming-the-wrong-itemstack.patch index 4c929200c..cb72cd0d5 100644 --- a/patches/server/0338-Prevent-consuming-the-wrong-itemstack.patch +++ b/patches/server/0338-Prevent-consuming-the-wrong-itemstack.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent consuming the wrong itemstack diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8587ac23b5c98ef2ee90445432da9db130d93464..d3bb82817e595a946a8294a059982924226ebfa7 100644 +index 853ce6536557b64de134a098d7ed3dde2782ffde..6086c566ac90e6d048202fee0882b72741aa31ce 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3574,9 +3574,14 @@ public abstract class LivingEntity extends Entity { +@@ -3564,9 +3564,14 @@ public abstract class LivingEntity extends Entity { } public void startUsingItem(InteractionHand hand) { @@ -24,7 +24,7 @@ index 8587ac23b5c98ef2ee90445432da9db130d93464..d3bb82817e595a946a8294a059982924 this.useItem = itemstack; this.useItemRemaining = itemstack.getUseDuration(); if (!this.level.isClientSide) { -@@ -3655,6 +3660,7 @@ public abstract class LivingEntity extends Entity { +@@ -3645,6 +3650,7 @@ public abstract class LivingEntity extends Entity { this.releaseUsingItem(); } else { if (!this.useItem.isEmpty() && this.isUsingItem()) { @@ -32,7 +32,7 @@ index 8587ac23b5c98ef2ee90445432da9db130d93464..d3bb82817e595a946a8294a059982924 this.triggerItemUseEffects(this.useItem, 16); // CraftBukkit start - fire PlayerItemConsumeEvent ItemStack itemstack; -@@ -3689,8 +3695,8 @@ public abstract class LivingEntity extends Entity { +@@ -3679,8 +3685,8 @@ public abstract class LivingEntity extends Entity { } this.stopUsingItem(); diff --git a/patches/server/0339-Dont-send-unnecessary-sign-update.patch b/patches/server/0339-Dont-send-unnecessary-sign-update.patch index 4e968818f..ae5cd2aef 100644 --- a/patches/server/0339-Dont-send-unnecessary-sign-update.patch +++ b/patches/server/0339-Dont-send-unnecessary-sign-update.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Dont send unnecessary sign update diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8e6bf6f5026e2d19ed5983eaee81f2aae4b8cca2..10a392b381e681eead9c55a6e261ae1849cacc47 100644 +index c49dfd213d3b1a2862707f2866179f34334b9eaa..319a2c29a960f24e82da9131e128d3d1d36a37db 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2860,6 +2860,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2884,6 +2884,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) { ServerGamePacketListenerImpl.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString()); diff --git a/patches/server/0340-Add-option-to-disable-pillager-patrols.patch b/patches/server/0340-Add-option-to-disable-pillager-patrols.patch index 83d2a56ec..27849c5ae 100644 --- a/patches/server/0340-Add-option-to-disable-pillager-patrols.patch +++ b/patches/server/0340-Add-option-to-disable-pillager-patrols.patch @@ -20,10 +20,10 @@ index 4cbb5e77dad6b096a7de818300c6fc112d983ceb..3510509a02b5c0de695b55792c035943 } diff --git a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java -index 96da518295362665270bcd5ff3031f1d9a152b1f..4fc90f8a1fa199a1af6c125ccadcb78c970671ec 100644 +index 38bdce99b6be6e0dfc3dcd975af3faa8dbe42f7e..d5a701b2d684bbe18f985adb6bd62e9218d3a0a6 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java +++ b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java -@@ -23,6 +23,7 @@ public class PatrolSpawner implements CustomSpawner { +@@ -24,6 +24,7 @@ public class PatrolSpawner implements CustomSpawner { @Override public int tick(ServerLevel world, boolean spawnMonsters, boolean spawnAnimals) { diff --git a/patches/server/0341-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch b/patches/server/0341-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch index a1ddf42c6..406550da8 100644 --- a/patches/server/0341-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch +++ b/patches/server/0341-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch @@ -7,10 +7,10 @@ Fixes an AssertionError when setting the player's item in hand to null or a new Fixes GH-2718 diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 10a392b381e681eead9c55a6e261ae1849cacc47..d51637e88119b17d6c1727405853d923fe15b2fa 100644 +index 319a2c29a960f24e82da9131e128d3d1d36a37db..c6328204024ffffd2cd0fe1a4ee921d846143987 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1738,6 +1738,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1753,6 +1753,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524 return; } diff --git a/patches/server/0342-Flat-bedrock-generator-settings.patch b/patches/server/0342-Flat-bedrock-generator-settings.patch index 19a21cba1..294fff62b 100644 --- a/patches/server/0342-Flat-bedrock-generator-settings.patch +++ b/patches/server/0342-Flat-bedrock-generator-settings.patch @@ -21,10 +21,10 @@ index 3510509a02b5c0de695b55792c035943ceaef222..03fbe3ff215cc482108a8926960bb601 } diff --git a/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java b/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java -index 514493f20bcd0a697d6787e11ec7042e601e1de2..66379a83e7fe7b9d1262e1ef4a7fa986adeb82ba 100644 +index a8d422352fa21b607a77746f847f3c54ed3d5a60..226a422023be7060a7b8abf1e42c93b77ffe4213 100644 --- a/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java +++ b/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java -@@ -54,6 +54,50 @@ public class SurfaceRuleData { +@@ -53,6 +53,50 @@ public class SurfaceRuleData { return overworldLike(true, false, true); } @@ -76,7 +76,7 @@ index 514493f20bcd0a697d6787e11ec7042e601e1de2..66379a83e7fe7b9d1262e1ef4a7fa986 SurfaceRules.ConditionSource conditionSource = SurfaceRules.yBlockCheck(VerticalAnchor.absolute(97), 2); SurfaceRules.ConditionSource conditionSource2 = SurfaceRules.yBlockCheck(VerticalAnchor.absolute(256), 0); @@ -82,11 +126,11 @@ public class SurfaceRuleData { - SurfaceRules.RuleSource ruleSource9 = SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.WOODED_BADLANDS), SurfaceRules.ifTrue(conditionSource, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource14, COARSE_DIRT), SurfaceRules.ifTrue(conditionSource15, COARSE_DIRT), SurfaceRules.ifTrue(conditionSource16, COARSE_DIRT), ruleSource))), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.SWAMP), SurfaceRules.ifTrue(conditionSource5, SurfaceRules.ifTrue(SurfaceRules.not(conditionSource6), SurfaceRules.ifTrue(SurfaceRules.noiseCondition(Noises.SWAMP, 0.0D), WATER)))))), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.BADLANDS, Biomes.ERODED_BADLANDS, Biomes.WOODED_BADLANDS), SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource2, ORANGE_TERRACOTTA), SurfaceRules.ifTrue(conditionSource4, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource14, TERRACOTTA), SurfaceRules.ifTrue(conditionSource15, TERRACOTTA), SurfaceRules.ifTrue(conditionSource16, TERRACOTTA), SurfaceRules.bandlands())), SurfaceRules.ifTrue(conditionSource7, SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.ON_CEILING, RED_SANDSTONE), RED_SAND)), SurfaceRules.ifTrue(SurfaceRules.not(conditionSource10), ORANGE_TERRACOTTA), SurfaceRules.ifTrue(conditionSource9, WHITE_TERRACOTTA), ruleSource3)), SurfaceRules.ifTrue(conditionSource3, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource6, SurfaceRules.ifTrue(SurfaceRules.not(conditionSource4), ORANGE_TERRACOTTA)), SurfaceRules.bandlands())), SurfaceRules.ifTrue(SurfaceRules.UNDER_FLOOR, SurfaceRules.ifTrue(conditionSource9, WHITE_TERRACOTTA)))), SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.ifTrue(conditionSource7, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource11, SurfaceRules.ifTrue(conditionSource10, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource8, AIR), SurfaceRules.ifTrue(SurfaceRules.temperature(), ICE), WATER))), ruleSource8))), SurfaceRules.ifTrue(conditionSource9, SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.ifTrue(conditionSource11, SurfaceRules.ifTrue(conditionSource10, WATER))), SurfaceRules.ifTrue(SurfaceRules.UNDER_FLOOR, ruleSource7), SurfaceRules.ifTrue(conditionSource13, SurfaceRules.ifTrue(SurfaceRules.stoneDepthCheck(0, true, true, CaveSurface.FLOOR), SANDSTONE)))), SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.FROZEN_PEAKS, Biomes.JAGGED_PEAKS), STONE), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.WARM_OCEAN, Biomes.LUKEWARM_OCEAN, Biomes.DEEP_LUKEWARM_OCEAN), ruleSource2), ruleSource3))); + SurfaceRules.RuleSource ruleSource9 = SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.WOODED_BADLANDS), SurfaceRules.ifTrue(conditionSource, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource15, COARSE_DIRT), SurfaceRules.ifTrue(conditionSource16, COARSE_DIRT), SurfaceRules.ifTrue(conditionSource17, COARSE_DIRT), ruleSource))), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.SWAMP), SurfaceRules.ifTrue(conditionSource5, SurfaceRules.ifTrue(SurfaceRules.not(conditionSource6), SurfaceRules.ifTrue(SurfaceRules.noiseCondition(Noises.SWAMP, 0.0D), WATER)))))), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.BADLANDS, Biomes.ERODED_BADLANDS, Biomes.WOODED_BADLANDS), SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource2, ORANGE_TERRACOTTA), SurfaceRules.ifTrue(conditionSource4, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource15, TERRACOTTA), SurfaceRules.ifTrue(conditionSource16, TERRACOTTA), SurfaceRules.ifTrue(conditionSource17, TERRACOTTA), SurfaceRules.bandlands())), SurfaceRules.ifTrue(conditionSource7, SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.ON_CEILING, RED_SANDSTONE), RED_SAND)), SurfaceRules.ifTrue(SurfaceRules.not(conditionSource10), ORANGE_TERRACOTTA), SurfaceRules.ifTrue(conditionSource9, WHITE_TERRACOTTA), ruleSource3)), SurfaceRules.ifTrue(conditionSource3, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource6, SurfaceRules.ifTrue(SurfaceRules.not(conditionSource4), ORANGE_TERRACOTTA)), SurfaceRules.bandlands())), SurfaceRules.ifTrue(SurfaceRules.UNDER_FLOOR, SurfaceRules.ifTrue(conditionSource9, WHITE_TERRACOTTA)))), SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.ifTrue(conditionSource7, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource11, SurfaceRules.ifTrue(conditionSource10, SurfaceRules.sequence(SurfaceRules.ifTrue(conditionSource8, AIR), SurfaceRules.ifTrue(SurfaceRules.temperature(), ICE), WATER))), ruleSource8))), SurfaceRules.ifTrue(conditionSource9, SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.ifTrue(conditionSource11, SurfaceRules.ifTrue(conditionSource10, WATER))), SurfaceRules.ifTrue(SurfaceRules.UNDER_FLOOR, ruleSource7), SurfaceRules.ifTrue(conditionSource13, SurfaceRules.ifTrue(SurfaceRules.DEEP_UNDER_FLOOR, SANDSTONE)), SurfaceRules.ifTrue(conditionSource14, SurfaceRules.ifTrue(SurfaceRules.VERY_DEEP_UNDER_FLOOR, SANDSTONE)))), SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, SurfaceRules.sequence(SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.FROZEN_PEAKS, Biomes.JAGGED_PEAKS), STONE), SurfaceRules.ifTrue(SurfaceRules.isBiome(Biomes.WARM_OCEAN, Biomes.LUKEWARM_OCEAN, Biomes.DEEP_LUKEWARM_OCEAN), ruleSource2), ruleSource3))); Builder builder = ImmutableList.builder(); if (bedrockRoof) { - builder.add(SurfaceRules.ifTrue(SurfaceRules.not(SurfaceRules.verticalGradient("bedrock_roof", VerticalAnchor.belowTop(5), VerticalAnchor.top())), BEDROCK)); @@ -99,24 +99,24 @@ index 514493f20bcd0a697d6787e11ec7042e601e1de2..66379a83e7fe7b9d1262e1ef4a7fa986 public static SurfaceRules.RuleSource end() { diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -index 74ab13e89ee4a8f8c367706d86382f08e62520b3..09d814317443a86210245ab3a7902f2078f08131 100644 +index bc7eda79df872d26c5f55e489ba99e7396370e31..829403a35ec91627f38857e66fd5451eb4c1e83a 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -@@ -231,7 +231,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { +@@ -233,7 +233,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { @Override public void buildSurface(WorldGenRegion region, StructureFeatureManager structures, ChunkAccess chunk) { if (!SharedConstants.debugVoidTerrain(chunk.getPos())) { - WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region); -+ WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region, structures.getWorld()); // Paper - NoiseGeneratorSettings generatorsettingbase = (NoiseGeneratorSettings) this.settings.get(); - NoiseChunk noisechunk = chunk.getOrCreateNoiseChunk(this.sampler, () -> { ++ WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region, region.getLevel()); // Paper + NoiseGeneratorSettings generatorsettingbase = (NoiseGeneratorSettings) this.settings.value(); + NoiseChunk noisechunk = chunk.getOrCreateNoiseChunk(this.router, () -> { return new Beardifier(structures, chunk); -@@ -253,7 +253,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { +@@ -255,7 +255,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { return new Beardifier(structureAccessor, chunk); - }, (NoiseGeneratorSettings) this.settings.get(), this.globalFluidPicker, Blender.of(chunkRegion)); + }, (NoiseGeneratorSettings) this.settings.value(), this.globalFluidPicker, Blender.of(chunkRegion)); Aquifer aquifer = noisechunk.aquifer(); - CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk); -+ CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk, structureAccessor.getWorld()); // Paper ++ CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk, chunkRegion.getLevel()); // Paper CarvingMask carvingmask = ((ProtoChunk) chunk).getOrCreateCarvingMask(generationStep); for (int j = -8; j <= 8; ++j) { @@ -154,10 +154,10 @@ index b99283c31193e2110f6e3f39c23dbfc2442bab2b..eed55a3f95d30bcd4184b8dfd597af7d + // Paper end } diff --git a/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java b/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java -index 0709cdae1be12a64b7105b50b7593b186797ca5b..bacc7a8de19f5938daf79f1829780efb6c2fcce4 100644 +index b4b194751beed05a49ba7ece1dcbaad91ca932c1..32ed5f5485e697de018e48331d9f8d1ee78e00f7 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java +++ b/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java -@@ -17,8 +17,8 @@ public class CarvingContext extends WorldGenerationContext { +@@ -18,8 +18,8 @@ public class CarvingContext extends WorldGenerationContext { private final RegistryAccess registryAccess; private final NoiseChunk noiseChunk; diff --git a/patches/server/0343-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch b/patches/server/0343-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch index e04a1de2e..ea3c47b7b 100644 --- a/patches/server/0343-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch +++ b/patches/server/0343-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent sync chunk loads when villagers try to find beds diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java b/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java -index 455774a211c679367c6e7845a11159ad84ca07e2..ff78092c40197b826863f19cb2e912d96bd68b7e 100644 +index d7c6064710a04a8ecb5b429567467bd497f826a3..4da7f9af12c9bbc3403cdfd4245bd13f011ed89c 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java @@ -41,7 +41,8 @@ public class SleepInBed extends Behavior { @@ -15,6 +15,6 @@ index 455774a211c679367c6e7845a11159ad84ca07e2..ff78092c40197b826863f19cb2e912d9 - BlockState blockState = world.getBlockState(globalPos.pos()); + BlockState blockState = world.getBlockStateIfLoaded(globalPos.pos()); // Paper + if (blockState == null) { return false; } // Paper - return globalPos.pos().closerThan(entity.position(), 2.0D) && blockState.is(BlockTags.BEDS) && !blockState.getValue(BedBlock.OCCUPIED); + return globalPos.pos().closerToCenterThan(entity.position(), 2.0D) && blockState.is(BlockTags.BEDS) && !blockState.getValue(BedBlock.OCCUPIED); } } diff --git a/patches/server/0345-Duplicate-UUID-Resolve-Option.patch b/patches/server/0345-Duplicate-UUID-Resolve-Option.patch index 9f29e293a..049835490 100644 --- a/patches/server/0345-Duplicate-UUID-Resolve-Option.patch +++ b/patches/server/0345-Duplicate-UUID-Resolve-Option.patch @@ -83,7 +83,7 @@ index e4820ece5279a0324f1e7ebf0027dcb054b7ecc3..3e3a48a636c225ec113c1c64f6ffc8a3 private void countAllMobsForSpawning() { countAllMobsForSpawning = getBoolean("count-all-mobs-for-spawning", false); diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 9dd2f5d7ea6a1d6744916c403bdd852bb66e45b8..848952c9bd3d91488d964c72bdc77925f904c3fa 100644 +index 5ccf921bb0ed5f1d4330fec3b3fdfc654d8c5160..e3c9b1f33e146918dcdf4f3cd76fdf324acedda1 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1,6 +1,7 @@ @@ -94,7 +94,7 @@ index 9dd2f5d7ea6a1d6744916c403bdd852bb66e45b8..848952c9bd3d91488d964c72bdc77925 import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList.Builder; import com.google.common.collect.Iterables; -@@ -29,13 +30,17 @@ import java.io.Writer; +@@ -32,13 +33,17 @@ import java.io.Writer; import java.nio.file.Path; import java.util.ArrayList; import java.util.BitSet; @@ -112,7 +112,7 @@ index 9dd2f5d7ea6a1d6744916c403bdd852bb66e45b8..848952c9bd3d91488d964c72bdc77925 import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import java.util.concurrent.CompletionStage; -@@ -818,6 +823,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -859,6 +864,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.discard(); needsRemoval = true; } @@ -120,7 +120,7 @@ index 9dd2f5d7ea6a1d6744916c403bdd852bb66e45b8..848952c9bd3d91488d964c72bdc77925 return !needsRemoval; })); // CraftBukkit end -@@ -868,6 +874,43 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -909,6 +915,43 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }); } @@ -165,7 +165,7 @@ index 9dd2f5d7ea6a1d6744916c403bdd852bb66e45b8..848952c9bd3d91488d964c72bdc77925 ChunkPos chunkcoordintpair = holder.getPos(); CompletableFuture, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkRangeFuture(chunkcoordintpair, 1, (i) -> { diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -index 0177a0323af651adace928b22f9461326ec07bc0..e19f5b2c8f485d596a64d5d96e75fa1f4a8255b5 100644 +index aadadee393332d84fad20644c349107e3ec3a92d..1407f30d467fa78bc207a91da0e6395c0a9ba83d 100644 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java @@ -78,7 +78,22 @@ public class PersistentEntitySectionManager implements A diff --git a/patches/server/0346-Optimize-Hoppers.patch b/patches/server/0346-Optimize-Hoppers.patch index deb72afaa..c992ed11b 100644 --- a/patches/server/0346-Optimize-Hoppers.patch +++ b/patches/server/0346-Optimize-Hoppers.patch @@ -35,10 +35,10 @@ index 3e3a48a636c225ec113c1c64f6ffc8a37ad9169e..98adf2fd1c2e9fe75456266ea1d7604f } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 7576047ea9695434ca06ca8fefde0dce68980be8..f71a1401d229b32557f0444ce45cfa47ffa2fde4 100644 +index e60e4f3693314adb7763c440036f0c80d15f349a..20bbe968b03b32a6124dbf9df1fbf9da71cd668f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1421,6 +1421,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper @@ -47,10 +47,10 @@ index 7576047ea9695434ca06ca8fefde0dce68980be8..f71a1401d229b32557f0444ce45cfa47 this.profiler.push(() -> { return worldserver + " " + worldserver.dimension().location(); diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 589a9bd9d3bf3cbf88a6efad5f58970a0a4a56c0..83d872044c3db54352847e08bb333ff7e0aee0b0 100644 +index f1289d7251783c5203828c2b76785dd22c7e2992..b78769cf6a70fb7513ea8d3302cb2dd4bf242752 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -603,11 +603,12 @@ public final class ItemStack { +@@ -613,11 +613,12 @@ public final class ItemStack { return this.getItem().interactLivingEntity(this, user, entity, hand); } @@ -67,7 +67,7 @@ index 589a9bd9d3bf3cbf88a6efad5f58970a0a4a56c0..83d872044c3db54352847e08bb333ff7 itemstack.setPopTime(this.getPopTime()); if (this.tag != null) { diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -index 6f61fd8224fb4094f38a851300ab55f94523c252..0e37da7227eaba0d089e5bd136eca088ab2b5eb3 100644 +index a69bbc11b9e003aed1630a6f5cdbca521deb6ff5..e838abb6d258a1ab47e95572cf4c30c6ca6144b4 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java @@ -70,6 +70,7 @@ public abstract class BlockEntity implements io.papermc.paper.util.KeyedObject { @@ -100,7 +100,7 @@ index a05acf709735b40ca86f978508c63a86065fd405..6a1405a8630e90db3b5a3c9152259ba6 double getLevelY(); diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index f3bc3133b68cabda359e99b74323b94f82bc42e9..31c128eab2a2cb7436e5c1777e9b19affa448ba3 100644 +index 43b0e6a4c2bcd1d2026add39f64b5993eb614d40..ae680111d01470881e5dc4914cc7e8e82a463aaa 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java @@ -3,7 +3,6 @@ package net.minecraft.world.level.block.entity; diff --git a/patches/server/0347-PlayerDeathEvent-shouldDropExperience.patch b/patches/server/0347-PlayerDeathEvent-shouldDropExperience.patch index c4f047485..c929696bd 100644 --- a/patches/server/0347-PlayerDeathEvent-shouldDropExperience.patch +++ b/patches/server/0347-PlayerDeathEvent-shouldDropExperience.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index ea73914ec8fb877de3f34cf7d5a0d60d547733fe..b193f8dfbe7b61c919ad5eb452d29885982e25e4 100644 +index 16c29e372aa71e25d24cde9485520fdb368a6f8c..1d0dc77947d1b7fc89d41e5edb660aea86282562 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -884,7 +884,7 @@ public class ServerPlayer extends Player { +@@ -882,7 +882,7 @@ public class ServerPlayer extends Player { this.tellNeutralMobsThatIDied(); } // SPIGOT-5478 must be called manually now diff --git a/patches/server/0348-Prevent-bees-loading-chunks-checking-hive-position.patch b/patches/server/0348-Prevent-bees-loading-chunks-checking-hive-position.patch index 1a6db3ffe..2c8a65022 100644 --- a/patches/server/0348-Prevent-bees-loading-chunks-checking-hive-position.patch +++ b/patches/server/0348-Prevent-bees-loading-chunks-checking-hive-position.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent bees loading chunks checking hive position diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index 4d335a725506cbf54604ea3e76ca39ef0f3ca013..d5d61129d72f061ef1e45d39778072ee1e51fc2d 100644 +index c7ecdb37d18ea5c342b09ede6b347e414056d288..420df05634abc0e976be4f725ac9099112608b2b 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java -@@ -497,6 +497,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +@@ -495,6 +495,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { if (!this.hasHive()) { return false; } else { diff --git a/patches/server/0350-Guard-against-serializing-mismatching-chunk-coordina.patch b/patches/server/0350-Guard-against-serializing-mismatching-chunk-coordina.patch index a7467b9f9..64048f55c 100644 --- a/patches/server/0350-Guard-against-serializing-mismatching-chunk-coordina.patch +++ b/patches/server/0350-Guard-against-serializing-mismatching-chunk-coordina.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Guard against serializing mismatching chunk coordinate Should help if something dumb happens diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 3e631d55d30831a4063e23f9dbc7a315d11a7b68..cf86755050632b158576849b786079787db11763 100644 +index 9a4fe42da43037a65738b978c0c6c9969de59e76..73d26c9eb902f19b0c3ffdd911898845277655b0 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -75,6 +75,18 @@ public class ChunkSerializer { +@@ -77,6 +77,18 @@ public class ChunkSerializer { public ChunkSerializer() {} @@ -28,7 +28,7 @@ index 3e631d55d30831a4063e23f9dbc7a315d11a7b68..cf86755050632b158576849b78607978 // Paper start public static final class InProgressChunkHolder { -@@ -100,7 +112,7 @@ public class ChunkSerializer { +@@ -102,7 +114,7 @@ public class ChunkSerializer { public static InProgressChunkHolder loadChunk(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt, boolean distinguish) { java.util.ArrayDeque tasksToExecuteOnMain = new java.util.ArrayDeque<>(); // Paper end @@ -36,7 +36,7 @@ index 3e631d55d30831a4063e23f9dbc7a315d11a7b68..cf86755050632b158576849b78607978 + ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate if (!Objects.equals(chunkPos, chunkcoordintpair1)) { - ChunkSerializer.LOGGER.error("Chunk file at {} is in the wrong location; relocating. (Expected {}, got {})", chunkPos, chunkPos, chunkcoordintpair1); + ChunkSerializer.LOGGER.error("Chunk file at {} is in the wrong location; relocating. (Expected {}, got {})", new Object[]{chunkPos, chunkPos, chunkcoordintpair1}); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java index ba677f282f2c8a05d1bad88226655549a81679bb..392fd2f5919d6a8f37c9f2b0421831d6ce381e0c 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java diff --git a/patches/server/0351-Optimise-IEntityAccess-getPlayerByUUID.patch b/patches/server/0351-Optimise-IEntityAccess-getPlayerByUUID.patch index b877d9624..b229ce21e 100644 --- a/patches/server/0351-Optimise-IEntityAccess-getPlayerByUUID.patch +++ b/patches/server/0351-Optimise-IEntityAccess-getPlayerByUUID.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimise IEntityAccess#getPlayerByUUID Use the world entity map instead of iterating over all players diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index fef3846a978dcba95c5dbe5c528ac20cb4f56178..c04402666b9219d508bfd32b4f2e3faea0c9b648 100644 +index 9722603f06bd386a114052652afddfe40e7ef757..9d5fec4f5786557718d2759f2116af46b99d9a36 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -384,6 +384,14 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -385,6 +385,14 @@ public class ServerLevel extends Level implements WorldGenLevel { public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; // Paper end @@ -22,5 +22,5 @@ index fef3846a978dcba95c5dbe5c528ac20cb4f56178..c04402666b9219d508bfd32b4f2e3fae + // Paper end + // Add env and gen to constructor, WorldData -> WorldDataServer - public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { + public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey resourcekey, Holder holder, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error diff --git a/patches/server/0353-Lag-compensate-eating.patch b/patches/server/0353-Lag-compensate-eating.patch index fc63ccbe1..26fdd71e3 100644 --- a/patches/server/0353-Lag-compensate-eating.patch +++ b/patches/server/0353-Lag-compensate-eating.patch @@ -7,10 +7,10 @@ When the server is lagging, players will wait longer when eating. Change to also use a time check instead if it passes. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d3bb82817e595a946a8294a059982924226ebfa7..77f79aa787aae0b146f84030d07df9d71e1637c5 100644 +index 6086c566ac90e6d048202fee0882b72741aa31ce..d2450dd5e9aa0958f5db187a82212ae54ac1d864 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3517,6 +3517,11 @@ public abstract class LivingEntity extends Entity { +@@ -3507,6 +3507,11 @@ public abstract class LivingEntity extends Entity { return ((Byte) this.entityData.get(LivingEntity.DATA_LIVING_ENTITY_FLAGS) & 2) > 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND; } @@ -22,7 +22,7 @@ index d3bb82817e595a946a8294a059982924226ebfa7..77f79aa787aae0b146f84030d07df9d7 private void updatingUsingItem() { if (this.isUsingItem()) { if (ItemStack.isSameIgnoreDurability(this.getItemInHand(this.getUsedItemHand()), this.useItem)) { -@@ -3534,8 +3539,12 @@ public abstract class LivingEntity extends Entity { +@@ -3524,8 +3529,12 @@ public abstract class LivingEntity extends Entity { if (this.shouldTriggerItemUseEffects()) { this.triggerItemUseEffects(stack, 5); } @@ -37,7 +37,7 @@ index d3bb82817e595a946a8294a059982924226ebfa7..77f79aa787aae0b146f84030d07df9d7 this.completeUsingItem(); } -@@ -3583,7 +3592,10 @@ public abstract class LivingEntity extends Entity { +@@ -3573,7 +3582,10 @@ public abstract class LivingEntity extends Entity { if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag this.useItem = itemstack; @@ -49,7 +49,7 @@ index d3bb82817e595a946a8294a059982924226ebfa7..77f79aa787aae0b146f84030d07df9d7 if (!this.level.isClientSide) { this.setLivingEntityFlag(1, true); this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND); -@@ -3607,7 +3619,10 @@ public abstract class LivingEntity extends Entity { +@@ -3597,7 +3609,10 @@ public abstract class LivingEntity extends Entity { } } else if (!this.isUsingItem() && !this.useItem.isEmpty()) { this.useItem = ItemStack.EMPTY; @@ -61,7 +61,7 @@ index d3bb82817e595a946a8294a059982924226ebfa7..77f79aa787aae0b146f84030d07df9d7 } } -@@ -3735,7 +3750,10 @@ public abstract class LivingEntity extends Entity { +@@ -3725,7 +3740,10 @@ public abstract class LivingEntity extends Entity { } this.useItem = ItemStack.EMPTY; diff --git a/patches/server/0355-Fix-last-firework-in-stack-not-having-effects-when-d.patch b/patches/server/0355-Fix-last-firework-in-stack-not-having-effects-when-d.patch index 602eb2b81..1b7f46694 100644 --- a/patches/server/0355-Fix-last-firework-in-stack-not-having-effects-when-d.patch +++ b/patches/server/0355-Fix-last-firework-in-stack-not-having-effects-when-d.patch @@ -9,10 +9,10 @@ dispensed. The resulting item would have size == 0 and therefore be convertered to air, hence why the effects disappeared. diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -index ba28fdc1a7ed2bc9d55489a8aeb3f786d31c732e..89921ffeae7cc715aa18cbf8687e7c8e612e5612 100644 +index 4830da3279c1f5b18307dfe148f42b05e5b6b9d3..047dd5600e3aae8b19bfc33566ee60541131e60a 100644 --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -510,7 +510,7 @@ public interface DispenseItemBehavior { +@@ -509,7 +509,7 @@ public interface DispenseItemBehavior { } itemstack1 = CraftItemStack.asNMSCopy(event.getItem()); diff --git a/patches/server/0356-Add-effect-to-block-break-naturally.patch b/patches/server/0356-Add-effect-to-block-break-naturally.patch index c31a5e03d..f05e2e493 100644 --- a/patches/server/0356-Add-effect-to-block-break-naturally.patch +++ b/patches/server/0356-Add-effect-to-block-break-naturally.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add effect to block break naturally diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index a9f962819c602e801de2d1a1bd069994283e785c..a918813a0faf451977686bdd6ee3aff71853f41f 100644 +index 7f1d4015ba795db7404669d931bd44060116bcc9..7eb8f37f493a83058a6e96f2e134a204b3304015 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -462,6 +462,18 @@ public class CraftBlock implements Block { +@@ -468,6 +468,18 @@ public class CraftBlock implements Block { @Override public boolean breakNaturally(ItemStack item) { @@ -27,7 +27,7 @@ index a9f962819c602e801de2d1a1bd069994283e785c..a918813a0faf451977686bdd6ee3aff7 // Order matters here, need to drop before setting to air so skulls can get their data net.minecraft.world.level.block.state.BlockState iblockdata = this.getNMS(); net.minecraft.world.level.block.Block block = iblockdata.getBlock(); -@@ -471,6 +483,7 @@ public class CraftBlock implements Block { +@@ -477,6 +489,7 @@ public class CraftBlock implements Block { // Modelled off EntityHuman#hasBlock if (block != Blocks.AIR && (item == null || !iblockdata.requiresCorrectToolForDrops() || nmsItem.isCorrectToolForDrops(iblockdata))) { net.minecraft.world.level.block.Block.dropResources(iblockdata, this.world.getMinecraftWorld(), position, this.world.getBlockEntity(position), null, nmsItem); diff --git a/patches/server/0357-Entity-Activation-Range-2.0.patch b/patches/server/0357-Entity-Activation-Range-2.0.patch index f9e8a8ce6..25395c03c 100644 --- a/patches/server/0357-Entity-Activation-Range-2.0.patch +++ b/patches/server/0357-Entity-Activation-Range-2.0.patch @@ -14,7 +14,7 @@ Adds flying monsters to control ghast and phantoms Adds villagers as separate config diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 367e074dd5f85f824b7c4f5506d0ccac60580c1b..83c5b111b98e52f52b7e4cf607aac07be7043709 100644 +index 9d5fec4f5786557718d2759f2116af46b99d9a36..a8d4a104d8f431c1e2b2f98bfac8217211d9e4a9 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2,7 +2,6 @@ package net.minecraft.server.level; @@ -24,8 +24,8 @@ index 367e074dd5f85f824b7c4f5506d0ccac60580c1b..83c5b111b98e52f52b7e4cf607aac07b -import co.aikar.timings.Timings; // Paper import com.google.common.collect.Lists; import com.mojang.datafixers.DataFixer; - import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -@@ -966,17 +965,17 @@ public class ServerLevel extends Level implements WorldGenLevel { + import com.mojang.datafixers.util.Pair; +@@ -969,17 +968,17 @@ public class ServerLevel extends Level implements WorldGenLevel { ++TimingHistory.entityTicks; // Paper - timings // Spigot start co.aikar.timings.Timing timer; // Paper @@ -47,7 +47,7 @@ index 367e074dd5f85f824b7c4f5506d0ccac60580c1b..83c5b111b98e52f52b7e4cf607aac07b try { // Paper end - timings entity.setOldPosAndRot(); -@@ -987,9 +986,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -990,9 +989,13 @@ public class ServerLevel extends Level implements WorldGenLevel { return Registry.ENTITY_TYPE.getKey(entity.getType()).toString(); }); gameprofilerfiller.incrementCounter("tickNonPassenger"); @@ -61,7 +61,7 @@ index 367e074dd5f85f824b7c4f5506d0ccac60580c1b..83c5b111b98e52f52b7e4cf607aac07b Iterator iterator = entity.getPassengers().iterator(); while (iterator.hasNext()) { -@@ -997,13 +1000,18 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1000,13 +1003,18 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(entity, entity1); } @@ -81,7 +81,7 @@ index 367e074dd5f85f824b7c4f5506d0ccac60580c1b..83c5b111b98e52f52b7e4cf607aac07b passenger.setOldPosAndRot(); ++passenger.tickCount; ProfilerFiller gameprofilerfiller = this.getProfiler(); -@@ -1012,8 +1020,17 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1015,8 +1023,17 @@ public class ServerLevel extends Level implements WorldGenLevel { return Registry.ENTITY_TYPE.getKey(passenger.getType()).toString(); }); gameprofilerfiller.incrementCounter("tickPassenger"); @@ -99,7 +99,7 @@ index 367e074dd5f85f824b7c4f5506d0ccac60580c1b..83c5b111b98e52f52b7e4cf607aac07b gameprofilerfiller.pop(); Iterator iterator = passenger.getPassengers().iterator(); -@@ -1023,6 +1040,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1026,6 +1043,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(passenger, entity2); } @@ -108,10 +108,10 @@ index 367e074dd5f85f824b7c4f5506d0ccac60580c1b..83c5b111b98e52f52b7e4cf607aac07b } else { passenger.stopRiding(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index e42da944f70520b7b8f0a67928614b85f7385f9f..344719bfe08bffe7012609fce64d73c467934d09 100644 +index a896b0b671d0c57de49c8f5e937e6218cbdc7a1e..3ad6488119a5fa5928219960fb37272f1bf7f73a 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -319,6 +319,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -322,6 +322,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public void inactiveTick() { } // Spigot end // Paper start @@ -120,7 +120,7 @@ index e42da944f70520b7b8f0a67928614b85f7385f9f..344719bfe08bffe7012609fce64d73c4 protected int numCollisions = 0; // Paper public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one @javax.annotation.Nullable -@@ -790,6 +792,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -794,6 +796,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } else { this.wasOnFire = this.isOnFire(); if (movementType == MoverType.PISTON) { @@ -129,7 +129,7 @@ index e42da944f70520b7b8f0a67928614b85f7385f9f..344719bfe08bffe7012609fce64d73c4 movement = this.limitPistonMovement(movement); if (movement.equals(Vec3.ZERO)) { return; -@@ -802,6 +806,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -806,6 +810,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i this.stuckSpeedMultiplier = Vec3.ZERO; this.setDeltaMovement(Vec3.ZERO); } @@ -144,7 +144,7 @@ index e42da944f70520b7b8f0a67928614b85f7385f9f..344719bfe08bffe7012609fce64d73c4 movement = this.maybeBackOffFromEdge(movement, movementType); Vec3 vec3d1 = this.collide(movement); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 426b3afc7ba5229339f820062f17c1a0775a0df6..e803af4d27f3f005a56696175d7ae8a51d7005a6 100644 +index b234473dcac22dcb121a3b3d9f75053b42f357c4..2df50b4fc01dec77e41f96711c493aedceaae863 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -206,6 +206,19 @@ public abstract class Mob extends LivingEntity { @@ -180,7 +180,7 @@ index ff458abb221daaddaa734811eaaa35ea43883343..d1ab31d03ae421e628448fe2492ff138 public float getWalkTargetValue(BlockPos pos) { return this.getWalkTargetValue(pos, this.level); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -index 30bf98ad7fad6c6fdc8bc48e9f4caa0443cdb31c..2bb32378b19a21c94ff3ec8ed32fc9d6f0ad0fdb 100644 +index d1a68808af3c9c35767e4be72ce1ed0f77f7a3c9..ef8fe11bcda9fb8365d2c7efb2e088727dd849d9 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java @@ -33,6 +33,7 @@ public class GoalSelector { @@ -213,7 +213,7 @@ index 30bf98ad7fad6c6fdc8bc48e9f4caa0443cdb31c..2bb32378b19a21c94ff3ec8ed32fc9d6 this.availableGoals.stream().filter((wrappedGoal) -> { return wrappedGoal.getGoal() == goal; diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java -index 8d8cce87acc5a93afb4b8925a5a5dbf71d371fcd..7fc40bb5fb6265b283c7c611f63aae76302c0eaf 100644 +index 6efba52c2e5d7811ee329ed22c1c76f75d7ddbe1..26bf383caea68834c654b25653ced9017f1b1b22 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java @@ -14,7 +14,7 @@ public abstract class MoveToBlockGoal extends Goal { @@ -248,10 +248,10 @@ index 8d8cce87acc5a93afb4b8925a5a5dbf71d371fcd..7fc40bb5fb6265b283c7c611f63aae76 } } diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 6600272bfd5e5ae1699485b143a49a2471c561d9..8bcb6df10e99e47dee35f441261847aa8e62e165 100644 +index ecd7083b40ce6230d49ea4487766a6f06b4e96d0..f7b8804394ad55e3f6c7c8c3a8f0fe7894385c90 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -223,17 +223,29 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -225,17 +225,29 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @Override public void inactiveTick() { // SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :( @@ -285,7 +285,7 @@ index 6600272bfd5e5ae1699485b143a49a2471c561d9..8bcb6df10e99e47dee35f441261847aa this.level.getProfiler().pop(); if (this.assignProfessionWhenSpawned) { this.assignProfessionWhenSpawned = false; -@@ -257,7 +269,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -259,7 +271,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler this.lastTradedPlayer = null; } @@ -294,7 +294,7 @@ index 6600272bfd5e5ae1699485b143a49a2471c561d9..8bcb6df10e99e47dee35f441261847aa Raid raid = ((ServerLevel) this.level).getRaidAt(this.blockPosition()); if (raid != null && raid.isActive() && !raid.isOver()) { -@@ -268,6 +280,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -270,6 +282,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.isTrading()) { this.stopTrading(); } @@ -303,10 +303,10 @@ index 6600272bfd5e5ae1699485b143a49a2471c561d9..8bcb6df10e99e47dee35f441261847aa super.customServerAiStep(); } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 46c340685327173e6719c040e46886f0f49a19b6..f28ae6eb853f9abbae295ab2753b4f0c91aa5fe4 100644 +index dab1b7491fff4da9f606d041536adb649bfccd9a..27bd21ec70a446537d24952cb7ea04b0c2f4ef86 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -154,6 +154,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -152,6 +152,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public Map capturedTileEntities = new HashMap<>(); public List captureDrops; public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>(); @@ -687,7 +687,7 @@ index 7bae24598218dcf0012dd21e619e6f5f984bd6f0..88c3022abc5edde312573de4fe499f1f isActive = false; } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 7acf96f2fbf807d4621ad3cfc9d9312adb255287..bc7eaf32867f743edf1644859f7cad063e646120 100644 +index c55321ec37b500199eda375cabca21e666612b9c..d4f035aca1d63596fd52b21e34c69e8d08e24e7a 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -199,14 +199,60 @@ public class SpigotWorldConfig diff --git a/patches/server/0359-Fix-Light-Command.patch b/patches/server/0359-Fix-Light-Command.patch index f6384f589..9829d9fb7 100644 --- a/patches/server/0359-Fix-Light-Command.patch +++ b/patches/server/0359-Fix-Light-Command.patch @@ -134,10 +134,10 @@ index 005361c38b02713fb823d0be40954400d59f0c4d..3091c100eaf5a86ba270ef0d96de1852 + } } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 848952c9bd3d91488d964c72bdc77925f904c3fa..cb050e658c5c99feb4586c1fba9a57ee3c0d6052 100644 +index e3c9b1f33e146918dcdf4f3cd76fdf324acedda1..655a2f2fd64cc3ce1c972f3b05df8136f31a603a 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -134,6 +134,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -137,6 +137,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private final ChunkTaskPriorityQueueSorter queueSorter; private final ProcessorHandle> worldgenMailbox; public final ProcessorHandle> mainThreadMailbox; @@ -150,7 +150,7 @@ index 848952c9bd3d91488d964c72bdc77925f904c3fa..cb050e658c5c99feb4586c1fba9a57ee public final ChunkProgressListener progressListener; private final ChunkStatusUpdateListener chunkStatusListener; public final ChunkMap.ChunkDistanceManager distanceManager; -@@ -242,11 +248,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -247,11 +253,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.progressListener = worldGenerationProgressListener; this.chunkStatusListener = chunkStatusChangeListener; diff --git a/patches/server/0360-Anti-Xray.patch b/patches/server/0360-Anti-Xray.patch index a2f46b2f1..f0e2d5d78 100644 --- a/patches/server/0360-Anti-Xray.patch +++ b/patches/server/0360-Anti-Xray.patch @@ -1126,10 +1126,10 @@ index 7825d6f0fdcfda6212cff8033ec55fb7db236154..2072aa8710f6e285f7c8f76c63b7bcf8 public ClientboundLevelChunkWithLightPacket(FriendlyByteBuf buf) { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 00d9bad699494c8dcbce66832c7231c5e4f3e384..e0f2eff645de3855cb36a2f2184f3d4502c83c81 100644 +index 655a2f2fd64cc3ce1c972f3b05df8136f31a603a..ab976352bb0b7a7aa9ffaf1f8bffeadb31abcc1d 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -938,7 +938,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -980,7 +980,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider completablefuture1.thenAcceptAsync((either) -> { either.ifLeft((chunk) -> { this.tickingGenerated.getAndIncrement(); @@ -1138,7 +1138,7 @@ index 00d9bad699494c8dcbce66832c7231c5e4f3e384..e0f2eff645de3855cb36a2f2184f3d45 this.getPlayers(chunkcoordintpair, false).forEach((entityplayer) -> { this.playerLoadedChunk(entityplayer, mutableobject, chunk); -@@ -1105,7 +1105,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1159,7 +1159,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider while (objectiterator.hasNext()) { ChunkHolder playerchunk = (ChunkHolder) objectiterator.next(); ChunkPos chunkcoordintpair = playerchunk.getPos(); @@ -1147,7 +1147,7 @@ index 00d9bad699494c8dcbce66832c7231c5e4f3e384..e0f2eff645de3855cb36a2f2184f3d45 this.getPlayers(chunkcoordintpair, false).forEach((entityplayer) -> { SectionPos sectionposition = entityplayer.getLastSectionPos(); -@@ -1119,7 +1119,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1173,7 +1173,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } @@ -1156,7 +1156,7 @@ index 00d9bad699494c8dcbce66832c7231c5e4f3e384..e0f2eff645de3855cb36a2f2184f3d45 if (player.level == this.level) { if (newWithinViewDistance && !oldWithinViewDistance) { ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos.toLong()); -@@ -1639,12 +1639,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1693,12 +1693,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } @@ -1179,32 +1179,32 @@ index 00d9bad699494c8dcbce66832c7231c5e4f3e384..e0f2eff645de3855cb36a2f2184f3d45 List list = Lists.newArrayList(); List list1 = Lists.newArrayList(); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 83c5b111b98e52f52b7e4cf607aac07be7043709..be75691d91b3559788365da2b813ea3c010b6637 100644 +index a8d4a104d8f431c1e2b2f98bfac8217211d9e4a9..01d7948d195afcee9dc2542993f3379858ee0210 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -394,7 +394,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -395,7 +395,7 @@ public class ServerLevel extends Level implements WorldGenLevel { // Add env and gen to constructor, WorldData -> WorldDataServer - public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { + public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey resourcekey, Holder holder, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error -- super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i, gen, biomeProvider, env); -+ super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i, gen, biomeProvider, env, executor); // Paper - Async-Anti-Xray - Pass executor +- super(iworlddataserver, resourcekey, holder, minecraftserver::getProfiler, false, flag, i, gen, biomeProvider, env); ++ super(iworlddataserver, resourcekey, holder, minecraftserver::getProfiler, false, flag, i, gen, biomeProvider, env, executor); // Paper - Async-Anti-Xray - Pass executor this.pvpMode = minecraftserver.isPvpAllowed(); this.convertable = convertable_conversionsession; this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelPath.toFile()); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index abc7b15976131dc840f40258ed5cc4ef88c27815..391e20c284b24f6c5fe446fd6a2c677214ed15c5 100644 +index eb58536e37af9da5e3ae7e43f874a1ef09c20944..d4f57fde2f02071dfde08cb2a5c8359984056aef 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -48,7 +48,7 @@ import org.bukkit.event.player.PlayerInteractEvent; +@@ -50,7 +50,7 @@ import org.bukkit.event.player.PlayerInteractEvent; public class ServerPlayerGameMode { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); - protected ServerLevel level; + public ServerLevel level; // Paper - Anti-Xray - protected -> public protected final ServerPlayer player; private GameType gameModeForPlayer; @Nullable -@@ -316,6 +316,8 @@ public class ServerPlayerGameMode { +@@ -326,6 +326,8 @@ public class ServerPlayerGameMode { } } @@ -1214,10 +1214,10 @@ index abc7b15976131dc840f40258ed5cc4ef88c27815..391e20c284b24f6c5fe446fd6a2c6772 public void destroyAndAck(BlockPos pos, ServerboundPlayerActionPacket.Action action, String reason) { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index f28ae6eb853f9abbae295ab2753b4f0c91aa5fe4..95d4785222d732488971e640567668353d6cf96d 100644 +index 27bd21ec70a446537d24952cb7ea04b0c2f4ef86..bfbd1922d77602628e57326b3251459f45b1aed9 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -164,6 +164,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -162,6 +162,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper @@ -1225,16 +1225,16 @@ index f28ae6eb853f9abbae295ab2753b4f0c91aa5fe4..95d4785222d732488971e64056766835 public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPos lastPhysicsProblem; // Spigot -@@ -183,7 +184,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -181,7 +182,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public abstract ResourceKey getTypeKey(); -- protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, final DimensionType dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) { -+ protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, final DimensionType dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor +- protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) { ++ protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper this.generator = gen; -@@ -261,6 +262,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -260,6 +261,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); @@ -1242,7 +1242,7 @@ index f28ae6eb853f9abbae295ab2753b4f0c91aa5fe4..95d4785222d732488971e64056766835 } // Paper start -@@ -441,6 +443,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -440,6 +442,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // CraftBukkit end BlockState iblockdata1 = chunk.setBlockState(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag @@ -1251,10 +1251,10 @@ index f28ae6eb853f9abbae295ab2753b4f0c91aa5fe4..95d4785222d732488971e64056766835 if (iblockdata1 == null) { // CraftBukkit start - remove blockstate if failed (or the same) diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index b3b3fa7ece66e1ab467c8ed550d150db541fd02a..a657b41263739b454617db5d7cb9e5cdd94f44ec 100644 +index eea6816c52e6c0329f3bea0e7789cda9dd4a5a08..8038b37bdfdd41eadb4f3cb4dd7ef245051ed3a4 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -109,7 +109,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -112,7 +112,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom private static void replaceMissingSections(LevelHeightAccessor world, Registry biome, LevelChunkSection[] sectionArray) { for (int i = 0; i < sectionArray.length; ++i) { if (sectionArray[i] == null) { @@ -1264,7 +1264,7 @@ index b3b3fa7ece66e1ab467c8ed550d150db541fd02a..a657b41263739b454617db5d7cb9e5cd } 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 ddd97d7b89d33f1d03de0b00681808e48cedd499..4e2405f416102d744f76384bbfdf051c29f87286 100644 +index e9436ab14bac2b5267239bcb27ad450d93c680e4..b2050ea7e9c2ad544c45d37b01dd152b28cd3dc9 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -93,7 +93,7 @@ public class LevelChunk extends ChunkAccess { @@ -1277,10 +1277,10 @@ index ddd97d7b89d33f1d03de0b00681808e48cedd499..4e2405f416102d744f76384bbfdf051c this.clientLightReady = false; this.level = (ServerLevel) world; // CraftBukkit - type diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -index 50b6ecfea7a342be0d21e37ae87777a4b4860026..512f53b24de14ea48eab85a0e725556d92def6e9 100644 +index c696358102086257033b55adbef84b1a259cb46e..67b06640358e04752bf149e9380f5f83d5d1d0f6 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -@@ -33,10 +33,13 @@ public class LevelChunkSection { +@@ -34,10 +34,13 @@ public class LevelChunkSection { this.recalcBlockCounts(); } @@ -1291,13 +1291,13 @@ index 50b6ecfea7a342be0d21e37ae87777a4b4860026..512f53b24de14ea48eab85a0e725556d + // Paper end this.bottomBlockY = LevelChunkSection.getBottomBlockY(chunkPos); - this.states = new PalettedContainer<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES); -- this.biomes = new PalettedContainer<>(biomeRegistry, (Biome) biomeRegistry.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); +- this.biomes = new PalettedContainer<>(biomeRegistry.asHolderIdMap(), biomeRegistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); + this.states = new PalettedContainer<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES, level == null || level.chunkPacketBlockController == null ? null : level.chunkPacketBlockController.getPresetBlockStates(level, pos, this.bottomBlockY())); // Paper - Anti-Xray - Add preset block states -+ this.biomes = new PalettedContainer<>(biomeRegistry, (Biome) biomeRegistry.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper - Anti-Xray - Add preset biomes ++ this.biomes = new PalettedContainer<>(biomeRegistry.asHolderIdMap(), biomeRegistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper - Anti-Xray - Add preset biomes } public static int getBottomBlockY(int chunkPos) { -@@ -158,10 +161,13 @@ public class LevelChunkSection { +@@ -172,10 +175,13 @@ public class LevelChunkSection { this.biomes.read(buf); } @@ -1315,7 +1315,7 @@ index 50b6ecfea7a342be0d21e37ae87777a4b4860026..512f53b24de14ea48eab85a0e725556d public int getSerializedSize() { diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index 911bf2b7bbe627f98d21681b0c6d5b8a5170c8a8..cdd357a8dd82cfd2a8abd45c1b7937b409af4b05 100644 +index 911bf2b7bbe627f98d21681b0c6d5b8a5170c8a8..5bae276dd55d080cbf8fca53c99c9c3636d8f33f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java @@ -29,6 +29,7 @@ public class PalettedContainer implements PaletteResize { @@ -1333,7 +1333,7 @@ index 911bf2b7bbe627f98d21681b0c6d5b8a5170c8a8..cdd357a8dd82cfd2a8abd45c1b7937b4 - public static Codec> codec(IdMap idList, Codec entryCodec, PalettedContainer.Strategy provider, T object) { + // Paper start - Anti-Xray - Add preset values + @Deprecated public static Codec> codec(IdMap idList, Codec entryCodec, PalettedContainer.Strategy provider, T object) { return PalettedContainer.codec(idList, entryCodec, provider, object, null); } // Notice for updates: Please make sure this function isn't used anywhere -+ public static Codec> codec(IdMap idList, Codec entryCodec, PalettedContainer.Strategy provider, T object, T[] presetValues) { ++ public static Codec> codec(IdMap idList, Codec entryCodec, PalettedContainer.Strategy provider, T object, T @org.jetbrains.annotations.Nullable [] presetValues) { return RecordCodecBuilder.create((instance) -> { return instance.group(entryCodec.mapResult(ExtraCodecs.orElsePartial(object)).listOf().fieldOf("palette").forGetter(PalettedContainer.DiscData::paletteEntries), Codec.LONG_STREAM.optionalFieldOf("data").forGetter(PalettedContainer.DiscData::storage)).apply(instance, PalettedContainer.DiscData::new); }).comapFlatMap((serialized) -> { @@ -1391,7 +1391,7 @@ index 911bf2b7bbe627f98d21681b0c6d5b8a5170c8a8..cdd357a8dd82cfd2a8abd45c1b7937b4 - public PalettedContainer(IdMap idList, T object, PalettedContainer.Strategy paletteProvider) { + // Paper start - Anti-Xray - Add preset values + @Deprecated public PalettedContainer(IdMap idList, T object, PalettedContainer.Strategy paletteProvider) { this(idList, object, paletteProvider, null); } // Notice for updates: Please make sure this constructor isn't used anywhere -+ public PalettedContainer(IdMap idList, T object, PalettedContainer.Strategy paletteProvider, T[] presetValues) { ++ public PalettedContainer(IdMap idList, T object, PalettedContainer.Strategy paletteProvider, T @org.jetbrains.annotations.Nullable [] presetValues) { + this.presetValues = presetValues; + // Paper end this.strategy = paletteProvider; @@ -1511,19 +1511,19 @@ index 911bf2b7bbe627f98d21681b0c6d5b8a5170c8a8..cdd357a8dd82cfd2a8abd45c1b7937b4 } } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index cf86755050632b158576849b786079787db11763..1267e93d1e315d55086a87670fd098db552c3afd 100644 +index 73d26c9eb902f19b0c3ffdd911898845277655b0..78058b505742541a484cadc790c445bdfb9c1136 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -67,7 +67,7 @@ import org.apache.logging.log4j.Logger; +@@ -69,7 +69,7 @@ import org.slf4j.Logger; public class ChunkSerializer { - public static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState()); + public static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), null); // Paper - Anti-Xray - Add preset block states - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private static final String TAG_UPGRADE_DATA = "UpgradeData"; private static final String BLOCK_TICKS_TAG = "block_ticks"; -@@ -146,16 +146,20 @@ public class ChunkSerializer { +@@ -148,16 +148,20 @@ public class ChunkSerializer { if (k >= 0 && k < achunksection.length) { Logger logger; PalettedContainer datapaletteblock; @@ -1538,7 +1538,7 @@ index cf86755050632b158576849b786079787db11763..1267e93d1e315d55086a87670fd098db }); logger = ChunkSerializer.LOGGER; Objects.requireNonNull(logger); - datapaletteblock = (PalettedContainer) dataresult.getOrThrow(false, logger::error); + datapaletteblock = (PalettedContainer) ((DataResult>) dataresult).getOrThrow(false, logger::error); // CraftBukkit - decompile error } else { - datapaletteblock = new PalettedContainer<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES); + datapaletteblock = new PalettedContainer<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES, presetBlockStates); @@ -1546,29 +1546,29 @@ index cf86755050632b158576849b786079787db11763..1267e93d1e315d55086a87670fd098db } PalettedContainer datapaletteblock1; -@@ -168,7 +172,7 @@ public class ChunkSerializer { +@@ -170,7 +174,7 @@ public class ChunkSerializer { Objects.requireNonNull(logger); - datapaletteblock1 = (PalettedContainer) dataresult.getOrThrow(false, logger::error); + datapaletteblock1 = (PalettedContainer) ((DataResult>>) dataresult).getOrThrow(false, logger::error); // CraftBukkit - decompile error } else { -- datapaletteblock1 = new PalettedContainer<>(iregistry, (Biome) iregistry.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); -+ datapaletteblock1 = new PalettedContainer<>(iregistry, (Biome) iregistry.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper - Anti-Xray - Add preset biomes +- datapaletteblock1 = new PalettedContainer<>(iregistry.asHolderIdMap(), iregistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); ++ datapaletteblock1 = new PalettedContainer<>(iregistry.asHolderIdMap(), iregistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper - Anti-Xray - Add preset biomes); } LevelChunkSection chunksection = new LevelChunkSection(b0, datapaletteblock, datapaletteblock1); -@@ -421,7 +425,7 @@ public class ChunkSerializer { +@@ -423,7 +427,7 @@ public class ChunkSerializer { } - private static Codec> makeBiomeCodec(Registry biomeRegistry) { -- return PalettedContainer.codec(biomeRegistry, biomeRegistry.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, (Biome) biomeRegistry.getOrThrow(Biomes.PLAINS)); -+ return PalettedContainer.codec(biomeRegistry, biomeRegistry.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, (Biome) biomeRegistry.getOrThrow(Biomes.PLAINS), null); // Paper - Anti-Xray - Add preset biomes + private static Codec>> makeBiomeCodec(Registry biomeRegistry) { +- return PalettedContainer.codec(biomeRegistry.asHolderIdMap(), biomeRegistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomeRegistry.getHolderOrThrow(Biomes.PLAINS)); ++ return PalettedContainer.codec(biomeRegistry.asHolderIdMap(), biomeRegistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomeRegistry.getHolderOrThrow(Biomes.PLAINS), null); // Paper - Anti-Xray - Add preset biomes } public static CompoundTag write(ServerLevel world, ChunkAccess chunk) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index a1fe076d76fe5f84eca39ea68e9820096f58f5a7..155933ef7c324ea17c2349a1f73ede29169ec4f2 100644 +index f3c67a815c570beb14136905cbf5aa4046ee8394..ecab8b4d6850cf182c28869ecbdbc92d45fbe637 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -@@ -52,7 +52,7 @@ public class CraftChunk implements Chunk { +@@ -53,7 +53,7 @@ public class CraftChunk implements Chunk { private final ServerLevel worldServer; private final int x; private final int z; @@ -1577,29 +1577,36 @@ index a1fe076d76fe5f84eca39ea68e9820096f58f5a7..155933ef7c324ea17c2349a1f73ede29 private static final byte[] emptyLight = new byte[2048]; public CraftChunk(net.minecraft.world.level.chunk.LevelChunk chunk) { -@@ -325,7 +325,7 @@ public class CraftChunk implements Chunk { - PalettedContainer[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null; +@@ -326,7 +326,11 @@ public class CraftChunk implements Chunk { + PalettedContainer>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null; Registry iregistry = this.worldServer.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); -- Codec> biomeCodec = PalettedContainer.codec(iregistry, iregistry.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getOrThrow(Biomes.PLAINS)); ++<<<<<<< HEAD + Codec>> biomeCodec = PalettedContainer.codec(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS)); ++======= + Codec> biomeCodec = PalettedContainer.codec(iregistry, iregistry.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getOrThrow(Biomes.PLAINS), null); // Paper - Anti-Xray - Add preset biomes ++>>>>>>> Anti-Xray for (int i = 0; i < cs.length; i++) { CompoundTag data = new CompoundTag(); -@@ -390,7 +390,7 @@ public class CraftChunk implements Chunk { +@@ -391,7 +395,12 @@ public class CraftChunk implements Chunk { + empty[i] = true; if (biome != null) { - Registry iregistry = world.getHandle().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); -- biome[i] = new PalettedContainer<>(iregistry, iregistry.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); ++<<<<<<< HEAD + biome[i] = new PalettedContainer<>(iregistry.asHolderIdMap(), iregistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); ++======= ++ Registry iregistry = world.getHandle().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); + biome[i] = new PalettedContainer<>(iregistry, iregistry.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper - Anti-Xray - Add preset biomes ++>>>>>>> Anti-Xray } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3573856d032605236c5b73196a7287a1e4ed41ac..2b79cc8538b583c991bda78656cfb0fca888d406 100644 +index 2cd64494b43a591c6471221bba649c7d74cfb64b..969a0fb7dba180b44cd5fe155b118ec28e0f61be 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2224,7 +2224,7 @@ public final class CraftServer implements Server { +@@ -2216,7 +2216,7 @@ public final class CraftServer implements Server { public ChunkGenerator.ChunkData createChunkData(World world) { Validate.notNull(world, "World cannot be null"); ServerLevel handle = ((CraftWorld) world).getHandle(); diff --git a/patches/server/0361-Implement-alternative-item-despawn-rate.patch b/patches/server/0361-Implement-alternative-item-despawn-rate.patch index df1f5816f..2915ea05e 100644 --- a/patches/server/0361-Implement-alternative-item-despawn-rate.patch +++ b/patches/server/0361-Implement-alternative-item-despawn-rate.patch @@ -63,7 +63,7 @@ index a17bf0ebe4d60effc72ea71ba4a7eba001875e19..68ae6664541d1dbc611520e7e8612b4f + } +} 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 b73198444747e6f8865ad9694c0b11ee95746dae..995172d8f271520ffa09e919f2a4890a4a1ccd89 100644 +index 87c92e73d23a1ebb0646ba0293e1c0d51bb0e059..7b2ac6920d5f0a8dc7cbb552a0e45e2fe471190e 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -174,7 +174,7 @@ public class ItemEntity extends Entity { @@ -84,7 +84,7 @@ index b73198444747e6f8865ad9694c0b11ee95746dae..995172d8f271520ffa09e919f2a4890a // CraftBukkit start - fire ItemDespawnEvent if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { this.age = 0; -@@ -558,9 +558,16 @@ public class ItemEntity extends Entity { +@@ -560,9 +560,16 @@ public class ItemEntity extends Entity { public void makeFakeItem() { this.setNeverPickUp(); diff --git a/patches/server/0362-Tracking-Range-Improvements.patch b/patches/server/0362-Tracking-Range-Improvements.patch index 1f22b79e8..8d05c0e50 100644 --- a/patches/server/0362-Tracking-Range-Improvements.patch +++ b/patches/server/0362-Tracking-Range-Improvements.patch @@ -8,10 +8,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code Also ignores Enderdragon, defaulting it to Mojang's setting diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 1112ffdaa13c6f0ca41b32127c3fed69f828d6fe..0c82b270c7095c7e4666a8078ecc7142503795c4 100644 +index ab976352bb0b7a7aa9ffaf1f8bffeadb31abcc1d..6dae228c0d0460d74ed49aee5a38dfd7b145d891 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1827,6 +1827,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1881,6 +1881,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); int j = entity.getType().clientTrackingRange() * 16; diff --git a/patches/server/0363-Fix-items-vanishing-through-end-portal.patch b/patches/server/0363-Fix-items-vanishing-through-end-portal.patch index 291ffc737..d7a5200b1 100644 --- a/patches/server/0363-Fix-items-vanishing-through-end-portal.patch +++ b/patches/server/0363-Fix-items-vanishing-through-end-portal.patch @@ -13,10 +13,10 @@ Quickly loading the exact world spawn chunk before searching the heightmap resolves the issue without having to load all spawn chunks. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 344719bfe08bffe7012609fce64d73c467934d09..82f5f9f6f97551ac7182c68f00f5471cf7d2269f 100644 +index 3ad6488119a5fa5928219960fb37272f1bf7f73a..fb442956b525bc7a65fb89f2d2ec99bf8a29de5c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3034,6 +3034,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3051,6 +3051,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i if (flag1) { blockposition1 = ServerLevel.END_SPAWN_POINT; } else { diff --git a/patches/server/0364-implement-optional-per-player-mob-spawns.patch b/patches/server/0364-implement-optional-per-player-mob-spawns.patch index 077291995..686a36f2a 100644 --- a/patches/server/0364-implement-optional-per-player-mob-spawns.patch +++ b/patches/server/0364-implement-optional-per-player-mob-spawns.patch @@ -269,18 +269,18 @@ index 0000000000000000000000000000000000000000..11de56afaf059b00fa5bec293516bcdc + } +} diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index d2755c00a28fa584d506259f33f8da44c2cf4842..6a8d929721f61b5235614496f60473b89a227ee5 100644 +index 6dae228c0d0460d74ed49aee5a38dfd7b145d891..c7114fc8045feab770dde30669d2711313bff189 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -151,6 +151,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - private final Long2ByteMap chunkTypeCache; +@@ -155,6 +155,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + private final Long2LongMap chunkSaveCooldowns; private final Queue unloadQueue; int viewDistance; + public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobDistanceMap; // Paper // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() public final CallbackExecutor callbackExecutor = new CallbackExecutor(); -@@ -180,16 +181,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -184,16 +185,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider int chunkX = MCUtil.getChunkCoordinate(player.getX()); int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); // Note: players need to be explicitly added to distance maps before they can be updated @@ -312,7 +312,7 @@ index d2755c00a28fa584d506259f33f8da44c2cf4842..6a8d929721f61b5235614496f60473b8 } // Paper end // Paper start -@@ -263,6 +279,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -268,6 +284,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new); this.regionManagers.add(this.dataRegionManager); // Paper end @@ -320,7 +320,7 @@ index d2755c00a28fa584d506259f33f8da44c2cf4842..6a8d929721f61b5235614496f60473b8 } protected ChunkGenerator generator() { -@@ -280,6 +297,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -285,6 +302,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }); } @@ -353,10 +353,10 @@ index d2755c00a28fa584d506259f33f8da44c2cf4842..6a8d929721f61b5235614496f60473b8 double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8); double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8); diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index f0dac1f596911eb2109192ef16a619f8ae71d1f7..07b616d9d7cde77c001f5c627daef0731d883e61 100644 +index a028de3cec90a097d6f10c49be2c6a7cb0b19318..92bd7382f0e1e19c245587ff32dff3dd87a401a3 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -323,6 +323,12 @@ public abstract class DistanceManager { +@@ -326,6 +326,12 @@ public abstract class DistanceManager { } @@ -370,10 +370,10 @@ index f0dac1f596911eb2109192ef16a619f8ae71d1f7..07b616d9d7cde77c001f5c627daef073 this.naturalSpawnChunkCounter.runAllUpdates(); return this.naturalSpawnChunkCounter.chunks.size(); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 343d54addd67998175db152d38702adda37b7d21..6830d1d9929b472e530b6676c7d0f8b316aea899 100644 +index b6737c0b74e821c948919ca4184dfe0281a19894..cbb8adea5e867a92e1dc4c94a0e7e116b7ac2274 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -916,7 +916,18 @@ public class ServerChunkCache extends ChunkSource { +@@ -915,7 +915,18 @@ public class ServerChunkCache extends ChunkSource { gameprofilerfiller.push("naturalSpawnCount"); this.level.timings.countNaturalMobs.startTiming(); // Paper - timings int l = this.distanceManager.getNaturalSpawnChunkCount(); @@ -394,10 +394,10 @@ index 343d54addd67998175db152d38702adda37b7d21..6830d1d9929b472e530b6676c7d0f8b3 this.lastSpawnState = spawnercreature_d; diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index b193f8dfbe7b61c919ad5eb452d29885982e25e4..01b9edc8aaf472650f171f1b88229807bcfdc145 100644 +index 1d0dc77947d1b7fc89d41e5edb660aea86282562..49f272d37fb59fd4c13466217389e626b6ca1e2d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -227,6 +227,11 @@ public class ServerPlayer extends Player { +@@ -225,6 +225,11 @@ public class ServerPlayer extends Player { public boolean queueHealthUpdatePacket = false; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; // Paper end @@ -409,7 +409,7 @@ index b193f8dfbe7b61c919ad5eb452d29885982e25e4..01b9edc8aaf472650f171f1b88229807 // CraftBukkit start public String displayName; -@@ -316,6 +321,7 @@ public class ServerPlayer extends Player { +@@ -314,6 +319,7 @@ public class ServerPlayer extends Player { this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getScoreboardName()); // Paper this.bukkitPickUpLoot = true; this.maxHealthCache = this.getMaxHealth(); @@ -418,7 +418,7 @@ index b193f8dfbe7b61c919ad5eb452d29885982e25e4..01b9edc8aaf472650f171f1b88229807 // Yes, this doesn't match Vanilla, but it's the best we can do for now. diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index be1068c305ef0c968caa2ee9412ed7ad1b1946f1..8e63d93a574f2c37094770099ea8e1f45cde3db5 100644 +index 474dc6302d2b0f8c629b2e1f6de9d4ba6faf398b..1622450b53e0f0f48c3ca107e4d705b4ad29dadf 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -67,7 +67,13 @@ public final class NaturalSpawner { @@ -579,7 +579,7 @@ index be1068c305ef0c968caa2ee9412ed7ad1b1946f1..8e63d93a574f2c37094770099ea8e1f4 } private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel world, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double squaredDistance) { -@@ -545,7 +598,7 @@ public final class NaturalSpawner { +@@ -551,7 +604,7 @@ public final class NaturalSpawner { MobCategory enumcreaturetype = entitytypes.getCategory(); this.mobCategoryCounts.addTo(enumcreaturetype, 1); @@ -588,7 +588,7 @@ index be1068c305ef0c968caa2ee9412ed7ad1b1946f1..8e63d93a574f2c37094770099ea8e1f4 } public int getSpawnableChunkCount() { -@@ -561,6 +614,7 @@ public final class NaturalSpawner { +@@ -567,6 +620,7 @@ public final class NaturalSpawner { int i = limit * this.spawnableChunkCount / NaturalSpawner.MAGIC_NUMBER; // CraftBukkit end diff --git a/patches/server/0365-Avoid-hopper-searches-if-there-are-no-items.patch b/patches/server/0365-Avoid-hopper-searches-if-there-are-no-items.patch index f0f10b624..19a1fa015 100644 --- a/patches/server/0365-Avoid-hopper-searches-if-there-are-no-items.patch +++ b/patches/server/0365-Avoid-hopper-searches-if-there-are-no-items.patch @@ -14,10 +14,10 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear Combined, this adds up a lot. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 95d4785222d732488971e640567668353d6cf96d..bb990265990769eacc99a0ce8b1384888976ec31 100644 +index bfbd1922d77602628e57326b3251459f45b1aed9..334fd625829c8e5e9c434b184f6d0084b2d6ccc8 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -987,7 +987,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -986,7 +986,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } } @@ -27,11 +27,11 @@ index 95d4785222d732488971e640567668353d6cf96d..bb990265990769eacc99a0ce8b138488 } diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySection.java b/src/main/java/net/minecraft/world/level/entity/EntitySection.java -index e3027cae3674502bdc34fdbd7002980515ffc837..07691d38960add169d24bc830ac7b951bd5afaef 100644 +index e6b1663d4ccdd3842f711ad7547df8ccf973e4b1..28f5c01497e0cbad50016f72585f8384496de0fa 100644 --- a/src/main/java/net/minecraft/world/level/entity/EntitySection.java +++ b/src/main/java/net/minecraft/world/level/entity/EntitySection.java @@ -13,6 +13,10 @@ public class EntitySection { - protected static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final ClassInstanceMultiMap storage; private Visibility chunkStatus; + // Paper start - track number of items and minecarts diff --git a/patches/server/0366-Bees-get-gravity-in-void.-Fixes-MC-167279.patch b/patches/server/0366-Bees-get-gravity-in-void.-Fixes-MC-167279.patch index e9d7e6444..9e66f6e30 100644 --- a/patches/server/0366-Bees-get-gravity-in-void.-Fixes-MC-167279.patch +++ b/patches/server/0366-Bees-get-gravity-in-void.-Fixes-MC-167279.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Bees get gravity in void. Fixes MC-167279 diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index d5d61129d72f061ef1e45d39778072ee1e51fc2d..678912a37167a12695388682bef634d3715def68 100644 +index 420df05634abc0e976be4f725ac9099112608b2b..c08d0377820dd242b15d9b0b40d6ea622e07f26e 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java -@@ -144,7 +144,22 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +@@ -142,7 +142,22 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { public Bee(EntityType type, Level world) { super(type, world); this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(this.random, 20, 60); diff --git a/patches/server/0367-Optimise-getChunkAt-calls-for-loaded-chunks.patch b/patches/server/0367-Optimise-getChunkAt-calls-for-loaded-chunks.patch index 0d1a96433..d84613d8f 100644 --- a/patches/server/0367-Optimise-getChunkAt-calls-for-loaded-chunks.patch +++ b/patches/server/0367-Optimise-getChunkAt-calls-for-loaded-chunks.patch @@ -7,10 +7,10 @@ bypass the need to get a player chunk, then get the either, then unwrap it... diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 17a36ee61aacfc41e2d926335c460350cd25ab42..f08490a9829d3558008b44a8eb12ce7041510b7a 100644 +index cbb8adea5e867a92e1dc4c94a0e7e116b7ac2274..e05f3c197c072860a3242ccfb41ba68609be748d 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -612,6 +612,12 @@ public class ServerChunkCache extends ChunkSource { +@@ -608,6 +608,12 @@ public class ServerChunkCache extends ChunkSource { return this.getChunk(x, z, leastStatus, create); }, this.mainThreadProcessor).join(); } else { @@ -23,7 +23,7 @@ index 17a36ee61aacfc41e2d926335c460350cd25ab42..f08490a9829d3558008b44a8eb12ce70 ProfilerFiller gameprofilerfiller = this.level.getProfiler(); gameprofilerfiller.incrementCounter("getChunk"); -@@ -663,39 +669,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -659,39 +665,7 @@ public class ServerChunkCache extends ChunkSource { if (Thread.currentThread() != this.mainThread) { return null; } else { diff --git a/patches/server/0368-Add-debug-for-sync-chunk-loads.patch b/patches/server/0368-Add-debug-for-sync-chunk-loads.patch index f1a4b1be8..55c22e669 100644 --- a/patches/server/0368-Add-debug-for-sync-chunk-loads.patch +++ b/patches/server/0368-Add-debug-for-sync-chunk-loads.patch @@ -305,10 +305,10 @@ index 0000000000000000000000000000000000000000..0bb4aaa546939b67a5d22865190f3047 + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index f08490a9829d3558008b44a8eb12ce7041510b7a..5b6381858418ceca4fe40ef329e050538e980cdb 100644 +index e05f3c197c072860a3242ccfb41ba68609be748d..cf56b2ed508352205ef6ec71519b0626aa698987 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -644,6 +644,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -640,6 +640,7 @@ public class ServerChunkCache extends ChunkSource { this.level.asyncChunkTaskManager.raisePriority(x1, z1, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY); com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.level, x1, z1); // Paper end @@ -317,10 +317,10 @@ index f08490a9829d3558008b44a8eb12ce7041510b7a..5b6381858418ceca4fe40ef329e05053 chunkproviderserver_b.managedBlock(completablefuture::isDone); com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 6a0eb9313ae62549f2e9220ca00a7ef27d3b2fca..c5109445e392cc9d91b2f6c4bab4bb5aea708be2 100644 +index 01d7948d195afcee9dc2542993f3379858ee0210..8932b7fb1a1c9f24f917711af69c6f8cbfca93a4 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -382,6 +382,12 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -383,6 +383,12 @@ public class ServerLevel extends Level implements WorldGenLevel { }; public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; // Paper end diff --git a/patches/server/0371-Entity-Jump-API.patch b/patches/server/0371-Entity-Jump-API.patch index 2e5524e44..f99b63d8e 100644 --- a/patches/server/0371-Entity-Jump-API.patch +++ b/patches/server/0371-Entity-Jump-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity Jump API diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 77f79aa787aae0b146f84030d07df9d71e1637c5..a30f71d4558040e42f061d056a2ae26db3b9ce57 100644 +index d2450dd5e9aa0958f5db187a82212ae54ac1d864..2e931bf17309b3b679b7ad9c98e1107d9a971e1d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3180,8 +3180,10 @@ public abstract class LivingEntity extends Entity { +@@ -3183,8 +3183,10 @@ public abstract class LivingEntity extends Entity { } else if (this.isInLava() && (!this.onGround || d7 > d8)) { this.jumpInLiquid(FluidTags.LAVA); } else if ((this.onGround || flag && d7 <= d8) && this.noJumpDelay == 0) { @@ -20,7 +20,7 @@ index 77f79aa787aae0b146f84030d07df9d71e1637c5..a30f71d4558040e42f061d056a2ae26d } else { this.noJumpDelay = 0; diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java -index 943a8d7c137feffcb1b06d7ddb4cb26378094675..a0cf2f28400bce6246c02e2fbe0d69bc6f7d46e2 100644 +index f584f5a6fc503cdf08a3a2c3720f086031c11798..306aa8c36be92d66ebcc6b7e0dbb9dee6ec41a9b 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Panda.java +++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java @@ -515,7 +515,9 @@ public class Panda extends Animal { diff --git a/patches/server/0372-Add-option-to-nerf-pigmen-from-nether-portals.patch b/patches/server/0372-Add-option-to-nerf-pigmen-from-nether-portals.patch index 5942a9a8a..d6ab8551d 100644 --- a/patches/server/0372-Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/patches/server/0372-Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -21,10 +21,10 @@ index 6b0391743cd9e249c66796e7fe7a4da8c6b81b2e..5ba23152d2c7e45a824d49246706aa98 private void lightQueueSize() { lightQueueSize = getInt("light-queue-size", lightQueueSize); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a9705e54b88339e2746348aee9ab1acdae5182b2..aedb75bd1ca841ede6f71ba7bd3c69d393c4e07f 100644 +index fb442956b525bc7a65fb89f2d2ec99bf8a29de5c..b254affe962442c9363e41787454697c509c1cab 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -321,6 +321,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -324,6 +324,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i // Paper start public long activatedImmunityTick = Integer.MIN_VALUE; // Paper public boolean isTemporarilyActive = false; // Paper @@ -32,7 +32,7 @@ index a9705e54b88339e2746348aee9ab1acdae5182b2..aedb75bd1ca841ede6f71ba7bd3c69d3 protected int numCollisions = 0; // Paper public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one @javax.annotation.Nullable -@@ -1890,6 +1891,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1895,6 +1896,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i if (spawnedViaMobSpawner) { nbt.putBoolean("Paper.FromMobSpawner", true); } @@ -42,7 +42,7 @@ index a9705e54b88339e2746348aee9ab1acdae5182b2..aedb75bd1ca841ede6f71ba7bd3c69d3 // Paper end return nbt; } catch (Throwable throwable) { -@@ -2035,6 +2039,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2040,6 +2044,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status diff --git a/patches/server/0375-Prevent-teleporting-dead-entities.patch b/patches/server/0375-Prevent-teleporting-dead-entities.patch index 8269e71ae..bacbb52c7 100644 --- a/patches/server/0375-Prevent-teleporting-dead-entities.patch +++ b/patches/server/0375-Prevent-teleporting-dead-entities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent teleporting dead entities diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d51637e88119b17d6c1727405853d923fe15b2fa..78804497375740189d01c594c26786254288ef19 100644 +index c6328204024ffffd2cd0fe1a4ee921d846143987..e9fbbe197b991276111cad87fadde8d1077a7062 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1499,6 +1499,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1507,6 +1507,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } private void internalTeleport(double d0, double d1, double d2, float f, float f1, Set set, boolean flag) { diff --git a/patches/server/0379-Optimise-Chunk-getFluid.patch b/patches/server/0379-Optimise-Chunk-getFluid.patch index 10bb6a295..a4e3dba9e 100644 --- a/patches/server/0379-Optimise-Chunk-getFluid.patch +++ b/patches/server/0379-Optimise-Chunk-getFluid.patch @@ -8,7 +8,7 @@ faster on its own, however removing the try catch makes it easier to inline due to code size 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 4e2405f416102d744f76384bbfdf051c29f87286..8cfe47012b78eb582afff23ffcf758ca2e9dec95 100644 +index b2050ea7e9c2ad544c45d37b01dd152b28cd3dc9..a909fea6e1cedd1282bf975be200031dde41f99a 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -373,18 +373,20 @@ public class LevelChunk extends ChunkAccess { @@ -47,10 +47,10 @@ index 4e2405f416102d744f76384bbfdf051c29f87286..8cfe47012b78eb582afff23ffcf758ca // CraftBukkit start diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -index 512f53b24de14ea48eab85a0e725556d92def6e9..836f036550cf76f40d6e0eb8b229238d311c1e35 100644 +index 67b06640358e04752bf149e9380f5f83d5d1d0f6..cdd17e501c678a4f4bebbaaccdaec1682351e2f2 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -@@ -51,7 +51,7 @@ public class LevelChunkSection { +@@ -52,7 +52,7 @@ public class LevelChunkSection { } public FluidState getFluidState(int x, int y, int z) { diff --git a/patches/server/0381-Add-tick-times-API-and-mspt-command.patch b/patches/server/0381-Add-tick-times-API-and-mspt-command.patch index aed1d11b7..888465d84 100644 --- a/patches/server/0381-Add-tick-times-API-and-mspt-command.patch +++ b/patches/server/0381-Add-tick-times-API-and-mspt-command.patch @@ -87,7 +87,7 @@ index a3c3656ba4e8bb85bfb3186d6284f02f09975b13..6cfaef1886b517c56ed9a96347be6e51 version = getInt("config-version", 25); set("config-version", 25); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 76da16590f27702883c07200a02db823d9720c61..3c2af39f7bd62448a3075d327132ebc19af6bd77 100644 +index 49f86ccc3e0d5ba7d42e353a963ab0d4a18e251f..68e7372c4a01006dd8549aa8dde5e06de2d3f9d9 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -245,6 +245,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop entitytypes = entity.getType(); int i = entitytypes.clientTrackingRange() * 16; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index c5109445e392cc9d91b2f6c4bab4bb5aea708be2..fda854c603629e3b9facc8ea3577cd8b23d973d9 100644 +index 8932b7fb1a1c9f24f917711af69c6f8cbfca93a4..9f1b38c40da90f4224810356b8ee78418b58cb5d 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2193,7 +2193,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2200,7 +2200,7 @@ public class ServerLevel extends Level implements WorldGenLevel { public void onTrackingStart(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot @@ -38,7 +38,7 @@ index c5109445e392cc9d91b2f6c4bab4bb5aea708be2..fda854c603629e3b9facc8ea3577cd8b if (entity instanceof ServerPlayer) { ServerPlayer entityplayer = (ServerPlayer) entity; -@@ -2226,6 +2226,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2233,6 +2233,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } entity.valid = true; // CraftBukkit diff --git a/patches/server/0388-Don-t-tick-dead-players.patch b/patches/server/0388-Don-t-tick-dead-players.patch index 2bfc8b407..915abcb53 100644 --- a/patches/server/0388-Don-t-tick-dead-players.patch +++ b/patches/server/0388-Don-t-tick-dead-players.patch @@ -7,10 +7,10 @@ Causes sync chunk loads and who knows what all else. This is safe because Spectators are skipped in unloaded chunks too in vanilla. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 06d13cca9179156a14571785e8ed3c4d8f956ccd..fd609c7b757b570206c17444867f786c1767aa69 100644 +index f0c9610fe9e2475c13f897cb2d77978a0caa53a2..249f49a551ea94705a4f5dfc687fcefe3e789a07 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -643,7 +643,7 @@ public class ServerPlayer extends Player { +@@ -641,7 +641,7 @@ public class ServerPlayer extends Player { public void doTick() { try { diff --git a/patches/server/0389-Dead-Player-s-shouldn-t-be-able-to-move.patch b/patches/server/0389-Dead-Player-s-shouldn-t-be-able-to-move.patch index fdca15b67..f2b52414b 100644 --- a/patches/server/0389-Dead-Player-s-shouldn-t-be-able-to-move.patch +++ b/patches/server/0389-Dead-Player-s-shouldn-t-be-able-to-move.patch @@ -7,10 +7,10 @@ This fixes a lot of game state issues where packets were delayed for processing due to 1.15's new queue but processed while dead. diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 7bc6518dd4da041d9f59affc5447a23312790917..c0731e186ba23cd3d443a2d7fef65980b8d5e3a1 100644 +index a55ee0868fbf85456749ecede30cea7e0c481bb3..4e604e902145ea91811e8e7769952024fcbd1a3d 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -1105,7 +1105,7 @@ public abstract class Player extends LivingEntity { +@@ -1118,7 +1118,7 @@ public abstract class Player extends LivingEntity { @Override protected boolean isImmobile() { diff --git a/patches/server/0390-Optimize-Collision-to-not-load-chunks.patch b/patches/server/0390-Optimize-Collision-to-not-load-chunks.patch index 5572ad19a..8cebcd055 100644 --- a/patches/server/0390-Optimize-Collision-to-not-load-chunks.patch +++ b/patches/server/0390-Optimize-Collision-to-not-load-chunks.patch @@ -14,7 +14,7 @@ movement will load only the chunk the player enters anyways and avoids loading massive amounts of surrounding chunks due to large AABB lookups. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 81aee8c195307fd3cd4a89c29ebb7ebc25436c83..2458619f7f377398322459e00a49f7f49437f9a2 100644 +index 3c176d48e6b1a8e165b5860cd443b36c65397ce9..c909163f664875bded56656ad3c0ca6c39265abb 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -791,6 +791,7 @@ public abstract class PlayerList { @@ -22,14 +22,14 @@ index 81aee8c195307fd3cd4a89c29ebb7ebc25436c83..2458619f7f377398322459e00a49f7f4 // CraftBukkit end + worldserver1.getChunkSource().addRegionTicket(net.minecraft.server.level.TicketType.POST_TELEPORT, new net.minecraft.world.level.ChunkPos(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper - while (avoidSuffocation && !worldserver1.noCollision(entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) { + while (avoidSuffocation && !worldserver1.noCollision((Entity) entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) { entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6fbbd591873d28dde1ff59ab0ae46f9ce4d6ae31..a3a80ad047dfa9ba1c058eaaf95b76cd3e0ec490 100644 +index b254affe962442c9363e41787454697c509c1cab..61fe669b567a3af5bfb6bc1c80f53b6abfde68ce 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -171,6 +171,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -174,6 +174,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i // Paper end public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper diff --git a/patches/server/0391-Don-t-move-existing-players-to-world-spawn.patch b/patches/server/0391-Don-t-move-existing-players-to-world-spawn.patch index 7f4816617..894ba6bee 100644 --- a/patches/server/0391-Don-t-move-existing-players-to-world-spawn.patch +++ b/patches/server/0391-Don-t-move-existing-players-to-world-spawn.patch @@ -10,10 +10,10 @@ larger than the keep loaded range. By skipping this, we avoid potential for a large spike on server start. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index fd609c7b757b570206c17444867f786c1767aa69..d507adcb538933fcf36e9a4bfb561106d509c26f 100644 +index 249f49a551ea94705a4f5dfc687fcefe3e789a07..3ddbfbf537351bcd97801e4018c85c14f7ab463c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -313,7 +313,7 @@ public class ServerPlayer extends Player { +@@ -311,7 +311,7 @@ public class ServerPlayer extends Player { this.stats = server.getPlayerList().getPlayerStats(this); this.advancements = server.getPlayerList().getPlayerAdvancements(this); this.maxUpStep = 1.0F; @@ -22,7 +22,7 @@ index fd609c7b757b570206c17444867f786c1767aa69..d507adcb538933fcf36e9a4bfb561106 this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper -@@ -531,7 +531,7 @@ public class ServerPlayer extends Player { +@@ -529,7 +529,7 @@ public class ServerPlayer extends Player { position = Vec3.atCenterOf(((ServerLevel) world).getSharedSpawnPos()); } this.level = world; @@ -32,7 +32,7 @@ index fd609c7b757b570206c17444867f786c1767aa69..d507adcb538933fcf36e9a4bfb561106 this.gameMode.setLevel((ServerLevel) world); } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 2458619f7f377398322459e00a49f7f49437f9a2..362fe0c88021c4530110d1128819016c8ae9c0d5 100644 +index c909163f664875bded56656ad3c0ca6c39265abb..e2991476289f04fce5aac307a95b4c6df9ede85f 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -210,6 +210,8 @@ public abstract class PlayerList { diff --git a/patches/server/0393-Improved-Watchdog-Support.patch b/patches/server/0393-Improved-Watchdog-Support.patch index f03a5123d..da3a43603 100644 --- a/patches/server/0393-Improved-Watchdog-Support.patch +++ b/patches/server/0393-Improved-Watchdog-Support.patch @@ -59,7 +59,7 @@ index e3b74dbdf8e14219a56fab939f3174e0c2f66de6..218f5bafeed8551b55b91c7fccaf6935 // Many servers tend to restart at a fixed time at xx:00 which causes an uneven distribution of requests on the // bStats backend. To circumvent this problem, we introduce some randomness into the initial and second delay. diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java -index c54530d1c66845b190a9cb6d06f985943bb4dbe1..35c9b3e6c5a2d11b4dbd491b16647df105960d1a 100644 +index 8cc4cb2163a93b9491550fe6d0f5d980fb216920..4dd14d73a37b32288a64fbd67ee22c435b6e6d57 100644 --- a/src/main/java/net/minecraft/CrashReport.java +++ b/src/main/java/net/minecraft/CrashReport.java @@ -228,6 +228,7 @@ public class CrashReport { @@ -71,7 +71,7 @@ index c54530d1c66845b190a9cb6d06f985943bb4dbe1..35c9b3e6c5a2d11b4dbd491b16647df1 cause = cause.getCause(); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3c2af39f7bd62448a3075d327132ebc19af6bd77..af7bc83f4a232489874f69dc2814b2c063bbb7eb 100644 +index 68e7372c4a01006dd8549aa8dde5e06de2d3f9d9..b15ce2bc3abdcdf97d65edcd09a020241aeb0ffa 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -298,7 +298,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { CompletableFuture completablefuture; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 362fe0c88021c4530110d1128819016c8ae9c0d5..11698ed04d77c974f18aa6981e7f1efa60c5c7b7 100644 +index e2991476289f04fce5aac307a95b4c6df9ede85f..903a816ec6f4d1a9c82b7e32bd2b4fc9b78f3a5c 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -512,7 +512,7 @@ public abstract class PlayerList { @@ -287,22 +287,22 @@ index 362fe0c88021c4530110d1128819016c8ae9c0d5..11698ed04d77c974f18aa6981e7f1efa // Paper start - Remove from collideRule team if needed diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -index 7bf4bf5cb2c1b54a7e2733091f48f3a824336d36..dcce05d2f4ab16424db4ab103a12188e207a457b 100644 +index 6fefa619299d3202158490630d62c16aef71e831..7a4ade1a4190bf4fbb048919ae2be230f7b80fff 100644 --- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java +++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -@@ -148,6 +148,7 @@ public abstract class BlockableEventLoop implements Profiler +@@ -152,6 +152,7 @@ public abstract class BlockableEventLoop implements Profiler try { task.run(); } catch (Exception var3) { + if (var3.getCause() instanceof ThreadDeath) throw var3; // Paper - LOGGER.fatal("Error executing task on {}", this.name(), var3); + LOGGER.error(LogUtils.FATAL_MARKER, "Error executing task on {}", this.name(), var3); } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index bb990265990769eacc99a0ce8b1384888976ec31..33cc7cb32f2d8ac780ca4b4058db6da87b28e1e5 100644 +index 334fd625829c8e5e9c434b184f6d0084b2d6ccc8..e4c2bd0131a54495fbd1930ad046225118e33186 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -833,6 +833,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -832,6 +832,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { try { tickConsumer.accept(entity); } catch (Throwable throwable) { @@ -311,10 +311,10 @@ index bb990265990769eacc99a0ce8b1384888976ec31..33cc7cb32f2d8ac780ca4b4058db6da8 final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level.getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); MinecraftServer.LOGGER.error(msg, throwable); 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 8cfe47012b78eb582afff23ffcf758ca2e9dec95..d70bdf21dd7bdf01b34d0fd38e79f9b386ec1fcc 100644 +index a909fea6e1cedd1282bf975be200031dde41f99a..76a15f9a3419c430a288b52b824aa723a91f87fb 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -1070,6 +1070,7 @@ public class LevelChunk extends ChunkAccess { +@@ -1068,6 +1068,7 @@ public class LevelChunk extends ChunkAccess { gameprofilerfiller.pop(); } catch (Throwable throwable) { @@ -323,10 +323,10 @@ index 8cfe47012b78eb582afff23ffcf758ca2e9dec95..d70bdf21dd7bdf01b34d0fd38e79f9b3 final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 42b615b4acb109f29d90430013db00b011c169ad..f3acca2144011e57fe49acf1ba09d7041b7aaba4 100644 +index b65a28d96f9d5a4e6272890ce0ac04b68925d502..41da8bba32211fedc6142b8e2a43e609571eab08 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2069,7 +2069,7 @@ public final class CraftServer implements Server { +@@ -2061,7 +2061,7 @@ public final class CraftServer implements Server { @Override public boolean isPrimaryThread() { @@ -336,7 +336,7 @@ index 42b615b4acb109f29d90430013db00b011c169ad..f3acca2144011e57fe49acf1ba09d704 // Paper start diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index fce5539a8eaa98f433ad65e26ef6027a15e82fb4..cbd58b1a34a8151403033322971c09c2703fe845 100644 +index b07323de3587464b54c25fd9e079b3b50ed323da..c579f586c9a2dcb6356b49f68591f61e0fa61b62 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -12,6 +12,8 @@ import java.util.logging.Level; diff --git a/patches/server/0397-Prevent-opening-inventories-when-frozen.patch b/patches/server/0397-Prevent-opening-inventories-when-frozen.patch index e6cb075af..4581d52f2 100644 --- a/patches/server/0397-Prevent-opening-inventories-when-frozen.patch +++ b/patches/server/0397-Prevent-opening-inventories-when-frozen.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent opening inventories when frozen diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index d507adcb538933fcf36e9a4bfb561106d509c26f..9cbca14b0a111e57a1d01bcbcf2164ab8b53b1a5 100644 +index 3ddbfbf537351bcd97801e4018c85c14f7ab463c..9b3f8b6ff7a2522e74bdbc914e35d566ab9c7697 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -612,7 +612,7 @@ public class ServerPlayer extends Player { +@@ -610,7 +610,7 @@ public class ServerPlayer extends Player { containerUpdateDelay = level.paperConfig.containerUpdateTickRate; } // Paper end @@ -17,7 +17,7 @@ index d507adcb538933fcf36e9a4bfb561106d509c26f..9cbca14b0a111e57a1d01bcbcf2164ab this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper this.containerMenu = this.inventoryMenu; } -@@ -1479,7 +1479,7 @@ public class ServerPlayer extends Player { +@@ -1477,7 +1477,7 @@ public class ServerPlayer extends Player { } else { // CraftBukkit start this.containerMenu = container; @@ -27,7 +27,7 @@ index d507adcb538933fcf36e9a4bfb561106d509c26f..9cbca14b0a111e57a1d01bcbcf2164ab this.initMenu(container); return OptionalInt.of(this.containerCounter); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index c787bb69baa1b30fc513965fe4a9578c1be551d8..5d14403e1826ab2be43c0436b1fc2f1877072e6f 100644 +index adfbc156b4c4a8591609f385adaa6b04f984a64f..709bab9ac4eb453caeb0f565b6a0d6d097e2d1e0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -322,7 +322,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { diff --git a/patches/server/0398-Optimise-ArraySetSorted-removeIf.patch b/patches/server/0398-Optimise-ArraySetSorted-removeIf.patch index cc09beb28..00d76711f 100644 --- a/patches/server/0398-Optimise-ArraySetSorted-removeIf.patch +++ b/patches/server/0398-Optimise-ArraySetSorted-removeIf.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimise ArraySetSorted#removeIf Remove iterator allocation and ensure the call is always O(n) diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index 07b616d9d7cde77c001f5c627daef0731d883e61..e8b4de332cc655a55621e40360fa46d893d903f4 100644 +index 92bd7382f0e1e19c245587ff32dff3dd87a401a3..ea66ea9c9b64e95b52d9db41c0eafe52094eeb1e 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -85,13 +85,27 @@ public abstract class DistanceManager { +@@ -86,13 +86,27 @@ public abstract class DistanceManager { protected void purgeStaleTickets() { ++this.ticketTickCounter; ObjectIterator objectiterator = this.tickets.long2ObjectEntrySet().fastIterator(); diff --git a/patches/server/0399-Don-t-run-entity-collision-code-if-not-needed.patch b/patches/server/0399-Don-t-run-entity-collision-code-if-not-needed.patch index 23677741c..f276bc6cb 100644 --- a/patches/server/0399-Don-t-run-entity-collision-code-if-not-needed.patch +++ b/patches/server/0399-Don-t-run-entity-collision-code-if-not-needed.patch @@ -7,10 +7,10 @@ Will not run if max entity craming is disabled and the max collisions per entity is less than or equal to 0 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index a30f71d4558040e42f061d056a2ae26db3b9ce57..16d9d4ff14d032e1793a482c57338839a5ab62fb 100644 +index 2e931bf17309b3b679b7ad9c98e1107d9a971e1d..73be677946a5e7b1f522b69bef395b0725996e5c 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3277,10 +3277,16 @@ public abstract class LivingEntity extends Entity { +@@ -3280,10 +3280,16 @@ public abstract class LivingEntity extends Entity { protected void serverAiStep() {} protected void pushEntities() { diff --git a/patches/server/0400-Implement-Player-Client-Options-API.patch b/patches/server/0400-Implement-Player-Client-Options-API.patch index cd544b820..dd2a6d2bd 100644 --- a/patches/server/0400-Implement-Player-Client-Options-API.patch +++ b/patches/server/0400-Implement-Player-Client-Options-API.patch @@ -85,10 +85,10 @@ index 0000000000000000000000000000000000000000..b6f4400df3d8ec7e06a996de54f8cabb + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 9cbca14b0a111e57a1d01bcbcf2164ab8b53b1a5..cdb0eb8e21299ca70ed7ed5c1195d07f44e47838 100644 +index 9b3f8b6ff7a2522e74bdbc914e35d566ab9c7697..e800229c294a04581c863349119f67270da1a6ca 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1830,6 +1830,7 @@ public class ServerPlayer extends Player { +@@ -1828,6 +1828,7 @@ public class ServerPlayer extends Player { public String locale = null; // CraftBukkit - add, lowercase // Paper - default to null public java.util.Locale adventure$locale = java.util.Locale.US; // Paper public void updateOptions(ServerboundClientInformationPacket packet) { diff --git a/patches/server/0401-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch b/patches/server/0401-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch index 2b327db27..7724250eb 100644 --- a/patches/server/0401-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch +++ b/patches/server/0401-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Don't crash if player is attempted to be removed from I suspect it deals with teleporting as it uses players current x/y/z diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index e8b4de332cc655a55621e40360fa46d893d903f4..75f11490737018096e7645ce0b991fd210c8f596 100644 +index ea66ea9c9b64e95b52d9db41c0eafe52094eeb1e..cca9efd1b7aabc4b8010cf4b8b942c66adb7eee1 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -297,8 +297,8 @@ public abstract class DistanceManager { +@@ -300,8 +300,8 @@ public abstract class DistanceManager { ObjectSet objectset = (ObjectSet) this.playersPerChunk.get(i); if (objectset == null) return; // CraftBukkit - SPIGOT-6208 diff --git a/patches/server/0403-Fix-Chunk-Post-Processing-deadlock-risk.patch b/patches/server/0403-Fix-Chunk-Post-Processing-deadlock-risk.patch index df2020bea..bcb188622 100644 --- a/patches/server/0403-Fix-Chunk-Post-Processing-deadlock-risk.patch +++ b/patches/server/0403-Fix-Chunk-Post-Processing-deadlock-risk.patch @@ -25,10 +25,10 @@ This successfully fixed a reoccurring and highly reproduceable crash for heightmaps. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 4cb7e63b433b8d4a02c2d193a2596e51ddab2779..9396d1164355aa3f10a8e5adad4813be808c0ffb 100644 +index 7e3f7b69fc7a608dd82b471d832cc401a77f0738..a603e74d6bc936db997f9230fff1100946fa8075 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -174,6 +174,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -178,6 +178,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }; // CraftBukkit end @@ -36,20 +36,20 @@ index 4cb7e63b433b8d4a02c2d193a2596e51ddab2779..9396d1164355aa3f10a8e5adad4813be // Paper start - distance maps private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); -@@ -975,7 +976,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - return Either.left(chunk); +@@ -1043,7 +1044,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + return chunk; }); }, (runnable) -> { - this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable)); + this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, () -> ChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request. }); + } - completablefuture1.thenAcceptAsync((either) -> { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 19c44eae78802c9fe0479cdc32f21156dc9b9d45..02516d4a6ee08908765f5bc84b14560754a67680 100644 +index cf56b2ed508352205ef6ec71519b0626aa698987..1b6fb81079d3ad5d3c33be67a1c05111f9dd5f2d 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -1140,6 +1140,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -1141,6 +1141,7 @@ public class ServerChunkCache extends ChunkSource { return super.pollTask() || execChunkTask; // Paper } } finally { diff --git a/patches/server/0404-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/patches/server/0404-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch index 187b38989..0a5181696 100644 --- a/patches/server/0404-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch +++ b/patches/server/0404-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch @@ -28,10 +28,10 @@ receives a deterministic result, and should no longer require 1 tick delays anymore. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 9396d1164355aa3f10a8e5adad4813be808c0ffb..5f576e6b749e36a4729439930f48e2b1cdddef16 100644 +index a603e74d6bc936db997f9230fff1100946fa8075..79403282d297c2cfd20df964f65df62ec35bb45f 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1569,6 +1569,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1623,6 +1623,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider .printStackTrace(); return; } @@ -40,10 +40,10 @@ index 9396d1164355aa3f10a8e5adad4813be808c0ffb..5f576e6b749e36a4729439930f48e2b1 if (!(entity instanceof EnderDragonPart)) { EntityType entitytypes = entity.getType(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index cdb0eb8e21299ca70ed7ed5c1195d07f44e47838..6d59a813aa752b4233dbe1894cfc8273473c24e9 100644 +index e800229c294a04581c863349119f67270da1a6ca..fae4880a645c9ea83fc1fa55cbc483543369b12e 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -246,6 +246,7 @@ public class ServerPlayer extends Player { +@@ -244,6 +244,7 @@ public class ServerPlayer extends Player { public double maxHealthCache; public boolean joining = true; public boolean sentListPacket = false; @@ -52,7 +52,7 @@ index cdb0eb8e21299ca70ed7ed5c1195d07f44e47838..6d59a813aa752b4233dbe1894cfc8273 // CraftBukkit end public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index f32fad01c9f1b0642615be896bbf79f73f4656db..f096fbe48d8cc70e3749f48bc9972def42b0068d 100644 +index bb7260a179de2652accb79b5bd0f0e6624163ab4..e7904870da5134b397f93c4de29d804775830947 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -276,6 +276,12 @@ public abstract class PlayerList { diff --git a/patches/server/0405-Load-Chunks-for-Login-Asynchronously.patch b/patches/server/0405-Load-Chunks-for-Login-Asynchronously.patch index 7485f31b9..84904bbaf 100644 --- a/patches/server/0405-Load-Chunks-for-Login-Asynchronously.patch +++ b/patches/server/0405-Load-Chunks-for-Login-Asynchronously.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Load Chunks for Login Asynchronously diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 6d59a813aa752b4233dbe1894cfc8273473c24e9..beebb7a0e6b8b1fa4e7d2f9fdf1962357cc2ebc3 100644 +index fae4880a645c9ea83fc1fa55cbc483543369b12e..89156bd30cc41dd80de47c7e6e45db034904dbf3 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -174,6 +174,7 @@ public class ServerPlayer extends Player { +@@ -172,6 +172,7 @@ public class ServerPlayer extends Player { private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32; private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; public ServerGamePacketListenerImpl connection; @@ -16,7 +16,7 @@ index 6d59a813aa752b4233dbe1894cfc8273473c24e9..beebb7a0e6b8b1fa4e7d2f9fdf196235 public final MinecraftServer server; public final ServerPlayerGameMode gameMode; private final PlayerAdvancements advancements; -@@ -247,6 +248,7 @@ public class ServerPlayer extends Player { +@@ -245,6 +246,7 @@ public class ServerPlayer extends Player { public boolean joining = true; public boolean sentListPacket = false; public boolean supressTrackerForLogin = false; // Paper @@ -37,10 +37,10 @@ index be677d437d17b74c6188ce1bd5fc6fdc228fd92f..78fbb4c3e52e900956ae0811aaf934c8 public static final TicketType UNKNOWN = TicketType.create("unknown", Comparator.comparingLong(ChunkPos::toLong), 1); public static final TicketType PLUGIN = TicketType.create("plugin", (a, b) -> 0); // CraftBukkit diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 78804497375740189d01c594c26786254288ef19..f0630bf6502d0b7be1c63e9c610ca2c8e1edc9d5 100644 +index e9fbbe197b991276111cad87fadde8d1077a7062..2859db2809a3d789b8246dd76f313e304d979e0f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -219,6 +219,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -220,6 +220,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private static final int LATENCY_CHECK_INTERVAL = 15000; public final Connection connection; private final MinecraftServer server; @@ -48,7 +48,7 @@ index 78804497375740189d01c594c26786254288ef19..f0630bf6502d0b7be1c63e9c610ca2c8 public ServerPlayer player; private int tickCount; private long keepAliveTime = Util.getMillis(); -@@ -292,6 +293,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -293,6 +294,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // CraftBukkit end public void tick() { @@ -64,7 +64,7 @@ index 78804497375740189d01c594c26786254288ef19..f0630bf6502d0b7be1c63e9c610ca2c8 this.resetPosition(); this.player.xo = this.player.getX(); this.player.yo = this.player.getY(); -@@ -333,7 +343,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -334,7 +344,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.lastVehicle = null; this.clientVehicleIsFloating = false; this.aboveGroundVehicleTickCount = 0; @@ -74,10 +74,10 @@ index 78804497375740189d01c594c26786254288ef19..f0630bf6502d0b7be1c63e9c610ca2c8 this.server.getProfiler().push("keepAlive"); // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index bb767f5b626225e70a8af273384bb74dbd21430d..301042e7a0d372a914f27ec0988dd938cf2a8262 100644 +index 4c06e62e967f28eb844d74237948834e61daeab0..0af65f1698e4ee9d94724f19b0abd61c437f18f2 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -88,7 +88,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -84,7 +84,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } // Paper end } else if (this.state == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) { @@ -86,7 +86,7 @@ index bb767f5b626225e70a8af273384bb74dbd21430d..301042e7a0d372a914f27ec0988dd938 if (entityplayer == null) { this.state = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT; -@@ -194,7 +194,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -190,7 +190,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } this.connection.send(new ClientboundGameProfilePacket(this.gameProfile)); @@ -96,10 +96,10 @@ index bb767f5b626225e70a8af273384bb74dbd21430d..301042e7a0d372a914f27ec0988dd938 try { ServerPlayer entityplayer1 = this.server.getPlayerList().getPlayerForLogin(this.gameProfile, s); // CraftBukkit - add player reference diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index f096fbe48d8cc70e3749f48bc9972def42b0068d..b84124abaca401406fbffc8bc6bd21245c303156 100644 +index e7904870da5134b397f93c4de29d804775830947..a36d582b8fdd99eba423fbeb8f46f0dd226d3523 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -39,6 +39,7 @@ import net.minecraft.network.protocol.Packet; +@@ -40,6 +40,7 @@ import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientboundChangeDifficultyPacket; import net.minecraft.network.protocol.game.ClientboundChatPacket; import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket; diff --git a/patches/server/0406-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/patches/server/0406-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index 3da11d3d4..7bca0279f 100644 --- a/patches/server/0406-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/patches/server/0406-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -7,10 +7,10 @@ The code following this has better support for null worlds to move them back to the world spawn. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a7872994c3e48a2e27c31fab58a89593f8548d81..c8fb6387fb3ac2849a399b2ab1f30158aa734827 100644 +index 61fe669b567a3af5bfb6bc1c80f53b6abfde68ce..31a571ec0f4cd60b9ef192d1deb2c529e7a354ff 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2012,9 +2012,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2017,9 +2017,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i bworld = server.getWorld(worldName); } diff --git a/patches/server/0407-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/server/0407-Add-PlayerAttackEntityCooldownResetEvent.patch index f2962f86d..f55e537dd 100644 --- a/patches/server/0407-Add-PlayerAttackEntityCooldownResetEvent.patch +++ b/patches/server/0407-Add-PlayerAttackEntityCooldownResetEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 16d9d4ff14d032e1793a482c57338839a5ab62fb..843097979f45b8f99efbfdcf268eea4879c0239a 100644 +index 73be677946a5e7b1f522b69bef395b0725996e5c..a34566fbdb2e2ffb80f239c0d1d5c94ecf7f91ff 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -2055,7 +2055,16 @@ public abstract class LivingEntity extends Entity { +@@ -2058,7 +2058,16 @@ public abstract class LivingEntity extends Entity { EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption); if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player) { diff --git a/patches/server/0410-Fix-numerous-item-duplication-issues-and-teleport-is.patch b/patches/server/0410-Fix-numerous-item-duplication-issues-and-teleport-is.patch index 68eb1f006..8d65b504d 100644 --- a/patches/server/0410-Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/patches/server/0410-Fix-numerous-item-duplication-issues-and-teleport-is.patch @@ -16,10 +16,10 @@ So even if something NEW comes up, it would be impossible to drop the same item twice because the source was destroyed. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6fa35e0acd966a9cfd3d5b3765c7d0130ea2de18..7bf62752b6604abe0bda6f5d0024f0e93efb3a9a 100644 +index 31a571ec0f4cd60b9ef192d1deb2c529e7a354ff..0dc85e33e9748a87e2dfbbbfb1861bdf636dab33 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2162,11 +2162,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2167,11 +2167,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } else { // CraftBukkit start - Capture drops for death event if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) { @@ -34,7 +34,7 @@ index 6fa35e0acd966a9cfd3d5b3765c7d0130ea2de18..7bf62752b6604abe0bda6f5d0024f0e9 entityitem.setDefaultPickUpDelay(); // CraftBukkit start -@@ -2919,6 +2920,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2936,6 +2937,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i @Nullable public Entity teleportTo(ServerLevel worldserver, BlockPos location) { // CraftBukkit end @@ -47,7 +47,7 @@ index 6fa35e0acd966a9cfd3d5b3765c7d0130ea2de18..7bf62752b6604abe0bda6f5d0024f0e9 if (this.level instanceof ServerLevel && !this.isRemoved()) { this.level.getProfiler().push("changeDimension"); // CraftBukkit start -@@ -2945,6 +2952,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2962,6 +2969,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i // CraftBukkit end this.level.getProfiler().popPush("reloading"); @@ -59,7 +59,7 @@ index 6fa35e0acd966a9cfd3d5b3765c7d0130ea2de18..7bf62752b6604abe0bda6f5d0024f0e9 Entity entity = this.getType().create(worldserver); if (entity != null) { -@@ -2958,10 +2970,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2975,10 +2987,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i // CraftBukkit start - Forward the CraftEntity to the new entity this.getBukkitEntity().setHandle(entity); entity.bukkitEntity = this.getBukkitEntity(); @@ -70,7 +70,7 @@ index 6fa35e0acd966a9cfd3d5b3765c7d0130ea2de18..7bf62752b6604abe0bda6f5d0024f0e9 // CraftBukkit end } -@@ -3083,7 +3091,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3100,7 +3108,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public boolean canChangeDimensions() { @@ -80,10 +80,10 @@ index 6fa35e0acd966a9cfd3d5b3765c7d0130ea2de18..7bf62752b6604abe0bda6f5d0024f0e9 public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 843097979f45b8f99efbfdcf268eea4879c0239a..9d8912ff91932e5e3c9a708b4c850e8abaa1a605 100644 +index a34566fbdb2e2ffb80f239c0d1d5c94ecf7f91ff..479a10b24d5c8d825d3c11d1800c89d769e0f441 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1619,9 +1619,9 @@ public abstract class LivingEntity extends Entity { +@@ -1622,9 +1622,9 @@ public abstract class LivingEntity extends Entity { // Paper start org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(source); if (deathEvent == null || !deathEvent.isCancelled()) { @@ -96,7 +96,7 @@ index 843097979f45b8f99efbfdcf268eea4879c0239a..9d8912ff91932e5e3c9a708b4c850e8a // Paper start - clear equipment if event is not cancelled if (this instanceof Mob) { for (EquipmentSlot slot : this.clearedEquipmentSlots) { -@@ -1718,8 +1718,13 @@ public abstract class LivingEntity extends Entity { +@@ -1721,8 +1721,13 @@ public abstract class LivingEntity extends Entity { this.dropCustomDeathLoot(source, i, flag); this.clearEquipmentSlots = prev; // Paper } diff --git a/patches/server/0412-Validate-PickItem-Packet-and-kick-for-invalid.patch b/patches/server/0412-Validate-PickItem-Packet-and-kick-for-invalid.patch index e67ae7df6..f0294e9c7 100644 --- a/patches/server/0412-Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/patches/server/0412-Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f0630bf6502d0b7be1c63e9c610ca2c8e1edc9d5..f7542d053be38298229719bd63e950fc6d167fb9 100644 +index 2859db2809a3d789b8246dd76f313e304d979e0f..81a1af417ea394a63d4d86b19fadbafce8963aac 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -874,7 +874,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -881,7 +881,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handlePickItem(ServerboundPickItemPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); diff --git a/patches/server/0413-Expose-game-version.patch b/patches/server/0413-Expose-game-version.patch index 001c40d9d..2d6166aa5 100644 --- a/patches/server/0413-Expose-game-version.patch +++ b/patches/server/0413-Expose-game-version.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose game version diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f3acca2144011e57fe49acf1ba09d7041b7aaba4..a200cdfcab72980ed5df3810a0c7b3e9f30f4e04 100644 +index 41da8bba32211fedc6142b8e2a43e609571eab08..b38432ca44cca2fe459d15ef021c7243871fa899 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -576,6 +576,13 @@ public final class CraftServer implements Server { +@@ -572,6 +572,13 @@ public final class CraftServer implements Server { return this.bukkitVersion; } diff --git a/patches/server/0416-misc-debugging-dumps.patch b/patches/server/0416-misc-debugging-dumps.patch index bd0c3ca99..0920af410 100644 --- a/patches/server/0416-misc-debugging-dumps.patch +++ b/patches/server/0416-misc-debugging-dumps.patch @@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..2d5494d2813b773e60ddba6790b750a9 + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index af7bc83f4a232489874f69dc2814b2c063bbb7eb..3092a50be8243a576d95e7f5ce546941f0b105fa 100644 +index b15ce2bc3abdcdf97d65edcd09a020241aeb0ffa..df2a564794fa5ee907cbde7a09239a314ea03a57 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -919,6 +919,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> { - public static final Marker PACKET_MARKER = MarkerManager.getMarker("NETWORK_PACKETS", Connection.ROOT_MARKER); +@@ -66,13 +66,13 @@ public class Connection extends SimpleChannelInboundHandler> { + }); public static final AttributeKey ATTRIBUTE_PROTOCOL = AttributeKey.valueOf("protocol"); public static final LazyLoadedValue NETWORK_WORKER_GROUP = new LazyLoadedValue<>(() -> { - return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Client IO #%d").setDaemon(true).build()); @@ -564,10 +564,10 @@ index 5165170e3289fe3939497c56a71eae9fdaa4bcfa..8a0ced3f9b9099913ade4b71181aff6c if ( !this.message.startsWith("/") ) { diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 0716aaf29f9d76240a0de4ca02daba442b36ec7d..2b7ba5d8dda0297c8b35a0cea68c3ae10188e3f2 100644 +index d0d058287fc1e87e944e99d4fc2cbd38eafb82b3..cec0082718c2a729044d6f19d74b8e4425816725 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -212,6 +212,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -215,6 +215,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface } com.destroystokyo.paper.PaperConfig.registerCommands(); com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now @@ -576,12 +576,12 @@ index 0716aaf29f9d76240a0de4ca02daba442b36ec7d..2b7ba5d8dda0297c8b35a0cea68c3ae1 this.setPvpAllowed(dedicatedserverproperties.pvp); diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index 6bf39699700075e295a693b56d237391de4e4f58..7fe08a998b4067f9f67c7e7a2244c1de0b194093 100644 +index 7c820a8f9ae85eb6941dce0e6296775fb331d720..888e863b6d605bf587d0c071795a43d2157afa4d 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -52,10 +52,10 @@ public class ServerConnectionListener { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); public static final LazyLoadedValue SERVER_EVENT_GROUP = new LazyLoadedValue<>(() -> { - return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).build()); + return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(LOGGER)).build()); // Paper diff --git a/patches/server/0418-Implement-Mob-Goal-API.patch b/patches/server/0418-Implement-Mob-Goal-API.patch index 2bd232d60..f4c7f1f6f 100644 --- a/patches/server/0418-Implement-Mob-Goal-API.patch +++ b/patches/server/0418-Implement-Mob-Goal-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement Mob Goal API diff --git a/build.gradle.kts b/build.gradle.kts -index 055abcdfd779ce37d657845b3c6322f01fac989d..0ed1fa068da85543b161fe86869ad8c90e701b73 100644 +index 962c4eca17efca49f7c738287c90093e340779b4..cc75f70b5ab381c0c7012c2d6e5c40d7e4a06c7b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -45,6 +45,7 @@ dependencies { @@ -785,10 +785,10 @@ index 4379b9948f1eecfe6fd7dea98e298ad5f761019a..3f081183521603824430709886a9cc31 LOOK, JUMP, diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 2a2f4e4d05ebeef44153171a09bf9ef79bd9c65e..ed5418dac2fc781437f840792581b61e73e46bc4 100644 +index 6ae8627d0c80b7b32fe7d26b54fba99b17daf7ef..6826b89ebabe6fd54d1d7c751defa2413c72844d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2636,5 +2636,11 @@ public final class CraftServer implements Server { +@@ -2628,5 +2628,11 @@ public final class CraftServer implements Server { public boolean isStopping() { return net.minecraft.server.MinecraftServer.getServer().hasStopped(); } diff --git a/patches/server/0419-Add-villager-reputation-API.patch b/patches/server/0419-Add-villager-reputation-API.patch index 11bc8d930..e68e780e0 100644 --- a/patches/server/0419-Add-villager-reputation-API.patch +++ b/patches/server/0419-Add-villager-reputation-API.patch @@ -20,10 +20,10 @@ index 0000000000000000000000000000000000000000..0f10c333d88f2e1c56a6c7f22d421084 + } +} diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java -index 284608f404d1bd588dd9f4c0cd86a21d46394627..971ef3d98057ede1316e07cc1e9dcb2742a42187 100644 +index 22aa000ad7d44a86231fd8ad93083c972f14caa6..125d08fc4536f15604ef13636056c94f77b5df57 100644 --- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java +++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java -@@ -29,7 +29,7 @@ import net.minecraft.util.VisibleForDebug; +@@ -28,7 +28,7 @@ import net.minecraft.util.VisibleForDebug; public class GossipContainer { public static final int DISCARD_THRESHOLD = 2; @@ -32,7 +32,7 @@ index 284608f404d1bd588dd9f4c0cd86a21d46394627..971ef3d98057ede1316e07cc1e9dcb27 @VisibleForDebug public Map> getGossipEntries() { -@@ -228,6 +228,28 @@ public class GossipContainer { +@@ -227,6 +227,28 @@ public class GossipContainer { public void remove(GossipType gossipType) { this.entries.removeInt(gossipType); } diff --git a/patches/server/0425-Wait-for-Async-Tasks-during-shutdown.patch b/patches/server/0425-Wait-for-Async-Tasks-during-shutdown.patch index f9e126219..1369b8579 100644 --- a/patches/server/0425-Wait-for-Async-Tasks-during-shutdown.patch +++ b/patches/server/0425-Wait-for-Async-Tasks-during-shutdown.patch @@ -10,7 +10,7 @@ Adds a 5 second grace period for any async tasks to finish and warns if any are still running after that delay just as reload does. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3092a50be8243a576d95e7f5ce546941f0b105fa..9d8dd7ac4e471d658ba942e29c5028df410fa2c3 100644 +index df2a564794fa5ee907cbde7a09239a314ea03a57..b00b17681233283b314fc1b4daf88379c3b5dea0 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -954,6 +954,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop stateDefinition; private BlockState defaultBlockState; // Paper start @@ -93,10 +93,10 @@ index b77eda6af8b430311e502465a2590d83555ff6cf..a37213bce34f45898f56a22196b0d5ef public co.aikar.timings.Timing getTiming() { if (timing == null) { diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -index aa4c582172221f7d48c9a64e91bdfb95a2453a6c..ebd8a234acf42f8d6ae0790bb6a60a214d22429f 100644 +index 8f4b3bf0eba548a35b59232491c68d635e21123f..edb599da2431fa32f6e656dd3de8f4a6f5e2ed4f 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -@@ -199,6 +199,12 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -198,6 +198,12 @@ public class PistonBaseBlock extends DirectionalBlock { @Override public boolean triggerEvent(BlockState state, Level world, BlockPos pos, int type, int data) { Direction enumdirection = (Direction) state.getValue(PistonBaseBlock.FACING); @@ -109,7 +109,7 @@ index aa4c582172221f7d48c9a64e91bdfb95a2453a6c..ebd8a234acf42f8d6ae0790bb6a60a21 if (!world.isClientSide) { boolean flag = this.getNeighborSignal(world, pos, enumdirection); -@@ -231,7 +237,7 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -230,7 +236,7 @@ public class PistonBaseBlock extends DirectionalBlock { BlockState iblockdata1 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT); world.setBlock(pos, iblockdata1, 20); @@ -118,7 +118,7 @@ index aa4c582172221f7d48c9a64e91bdfb95a2453a6c..ebd8a234acf42f8d6ae0790bb6a60a21 world.blockUpdated(pos, iblockdata1.getBlock()); iblockdata1.updateNeighbourShapes(world, pos, 2); if (this.isSticky) { -@@ -260,7 +266,14 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -259,7 +265,14 @@ public class PistonBaseBlock extends DirectionalBlock { } } } else { @@ -135,10 +135,10 @@ index aa4c582172221f7d48c9a64e91bdfb95a2453a6c..ebd8a234acf42f8d6ae0790bb6a60a21 world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F); diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 3c6b1b92fedf9986ebb835170c070ebd461f5d25..9055a82e9c91ecb8fc2ef5ac58db043ffb759168 100644 +index a5b7fbd940bf180b76017442ee7224761741fe52..fdb9a60ce9e1f8e3caabe1733e32e34146d4ddf3 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -223,7 +223,7 @@ public abstract class BlockBehaviour { +@@ -225,7 +225,7 @@ public abstract class BlockBehaviour { /** @deprecated */ @Deprecated public boolean canBeReplaced(BlockState state, BlockPlaceContext context) { @@ -147,7 +147,7 @@ index 3c6b1b92fedf9986ebb835170c070ebd461f5d25..9055a82e9c91ecb8fc2ef5ac58db043f } /** @deprecated */ -@@ -705,7 +705,11 @@ public abstract class BlockBehaviour { +@@ -707,7 +707,11 @@ public abstract class BlockBehaviour { public Block getBlock() { return (Block) this.owner; } @@ -160,7 +160,7 @@ index 3c6b1b92fedf9986ebb835170c070ebd461f5d25..9055a82e9c91ecb8fc2ef5ac58db043f public Material getMaterial() { return this.material; } -@@ -803,7 +807,7 @@ public abstract class BlockBehaviour { +@@ -805,7 +809,7 @@ public abstract class BlockBehaviour { } public PushReaction getPistonPushReaction() { diff --git a/patches/server/0429-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/server/0429-Reduce-allocation-of-Vec3D-by-entity-tracker.patch index a6be09ca2..df965d6a0 100644 --- a/patches/server/0429-Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/patches/server/0429-Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reduce allocation of Vec3D by entity tracker diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 5f576e6b749e36a4729439930f48e2b1cdddef16..20818ae001a0a1bcf570041468bea33b88fda4ac 100644 +index 79403282d297c2cfd20df964f65df62ec35bb45f..662954f44da3829e7d828f2290a4934188985a84 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1847,9 +1847,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1901,9 +1901,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public void updatePlayer(ServerPlayer player) { org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot if (player != this.entity) { @@ -25,7 +25,7 @@ index 5f576e6b749e36a4729439930f48e2b1cdddef16..20818ae001a0a1bcf570041468bea33b boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player); diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index ceba19ea3bb9664899b83f82f28af06476b7ff56..f6b6ac1ab31c364646151866c54c9e46dee12516 100644 +index 5e3f489964489e0facc93a823a1cb84b4c8abce7..1a4350b40d15edba998e3dee5f16cde4e9f50759 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -143,8 +143,12 @@ public class ServerEntity { diff --git a/patches/server/0430-Ensure-safe-gateway-teleport.patch b/patches/server/0430-Ensure-safe-gateway-teleport.patch index c81dcd407..527175e57 100644 --- a/patches/server/0430-Ensure-safe-gateway-teleport.patch +++ b/patches/server/0430-Ensure-safe-gateway-teleport.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ensure safe gateway teleport diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -index 1d8af8475d0aac71a4ed8a2fed9861dd89d8319b..bc028de0ac71e69e8d714db5f65286f306544bf1 100644 +index 4e47b641a2aae8e82890cda1bdb209803472b1d4..4e435a16a16c703a2978f4dc82606b8710742670 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -@@ -104,7 +104,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { +@@ -105,7 +105,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { List list = world.getEntitiesOfClass(Entity.class, new AABB(pos), TheEndGatewayBlockEntity::canEntityTeleport); if (!list.isEmpty()) { diff --git a/patches/server/0432-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch b/patches/server/0432-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch index 8bfa55436..8c52a596d 100644 --- a/patches/server/0432-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch +++ b/patches/server/0432-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize anyPlayerCloseEnoughForSpawning to use distance maps Use a distance map to find the players in range quickly diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 74d674b2684b0db4aa6c183edc6091d53e9ee882..560cc04ee7a8fd0c3c7217e08d53d1da682054e2 100644 +index 674a6492e2eb10cfd29989643eedcea08b2d5218..dff475b327d6edaa4dcb9bc09029237f8f659846 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -73,6 +73,23 @@ public class ChunkHolder { +@@ -76,6 +76,23 @@ public class ChunkHolder { boolean isUpdateQueued = false; // Paper private final ChunkMap chunkMap; // Paper @@ -33,19 +33,19 @@ index 74d674b2684b0db4aa6c183edc6091d53e9ee882..560cc04ee7a8fd0c3c7217e08d53d1da public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) { this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size()); this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; -@@ -94,6 +111,7 @@ public class ChunkHolder { +@@ -97,6 +114,7 @@ public class ChunkHolder { this.setTicketLevel(level); this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()]; this.chunkMap = (ChunkMap)playersWatchingChunkProvider; // Paper + this.onChunkAdd(); // Paper - optimise anyPlayerCloseEnoughForSpawning } - // CraftBukkit start + // Paper start diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 00eeaa04c98a658bac63f72da6b6d157131e9120..cd58121bfa059366919e098005299dde0c55f46f 100644 +index 662954f44da3829e7d828f2290a4934188985a84..980afbd2b9bc232becd6001e6b1da0aae0abedec 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -177,11 +177,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -181,11 +181,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final CallbackExecutor chunkLoadConversionCallbackExecutor = new CallbackExecutor(); // Paper // Paper start - distance maps private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); @@ -69,7 +69,7 @@ index 00eeaa04c98a658bac63f72da6b6d157131e9120..cd58121bfa059366919e098005299dde // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.add(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance()); -@@ -191,6 +203,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -195,6 +207,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider void removePlayerFromDistanceMaps(ServerPlayer player) { @@ -80,7 +80,7 @@ index 00eeaa04c98a658bac63f72da6b6d157131e9120..cd58121bfa059366919e098005299dde // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.remove(player); -@@ -202,6 +218,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -206,6 +222,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider int chunkX = MCUtil.getChunkCoordinate(player.getX()); int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); // Note: players need to be explicitly added to distance maps before they can be updated @@ -88,7 +88,7 @@ index 00eeaa04c98a658bac63f72da6b6d157131e9120..cd58121bfa059366919e098005299dde // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.update(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance()); -@@ -281,6 +298,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -286,6 +303,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.regionManagers.add(this.dataRegionManager); // Paper end this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper @@ -127,7 +127,7 @@ index 00eeaa04c98a658bac63f72da6b6d157131e9120..cd58121bfa059366919e098005299dde } protected ChunkGenerator generator() { -@@ -501,6 +550,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -537,6 +586,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider holder = (ChunkHolder) this.pendingUnloads.remove(pos); if (holder != null) { holder.setTicketLevel(level); @@ -135,7 +135,7 @@ index 00eeaa04c98a658bac63f72da6b6d157131e9120..cd58121bfa059366919e098005299dde } else { holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this); // Paper start -@@ -600,6 +650,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -640,6 +690,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ChunkHolder playerchunk = (ChunkHolder) this.updatingChunkMap.remove(j); if (playerchunk != null) { @@ -143,7 +143,7 @@ index 00eeaa04c98a658bac63f72da6b6d157131e9120..cd58121bfa059366919e098005299dde this.pendingUnloads.put(j, playerchunk); this.modified = true; this.scheduleUnload(j, playerchunk); // Paper - Move up - don't leak chunks -@@ -1331,43 +1382,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1385,43 +1436,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return this.anyPlayerCloseEnoughForSpawning(pos, false); } @@ -224,10 +224,10 @@ index 00eeaa04c98a658bac63f72da6b6d157131e9120..cd58121bfa059366919e098005299dde public List getPlayersCloseForSpawning(ChunkPos pos) { diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index 75f11490737018096e7645ce0b991fd210c8f596..14774d51dd35a98471d29230a64fadee74651d19 100644 +index cca9efd1b7aabc4b8010cf4b8b942c66adb7eee1..a3bdace1ce3252e8c09b642ee8963bfb4b39222c 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -48,7 +48,7 @@ public abstract class DistanceManager { +@@ -49,7 +49,7 @@ public abstract class DistanceManager { final Long2ObjectMap> playersPerChunk = new Long2ObjectOpenHashMap(); public final Long2ObjectOpenHashMap>> tickets = new Long2ObjectOpenHashMap(); private final DistanceManager.ChunkTicketTracker ticketTracker = new DistanceManager.ChunkTicketTracker(); @@ -236,7 +236,7 @@ index 75f11490737018096e7645ce0b991fd210c8f596..14774d51dd35a98471d29230a64fadee private final TickingTracker tickingTicketsTracker = new TickingTracker(); private final DistanceManager.PlayerTicketTracker playerTicketManager = new DistanceManager.PlayerTicketTracker(33); // Paper start use a queue, but still keep unique requirement -@@ -139,7 +139,7 @@ public abstract class DistanceManager { +@@ -140,7 +140,7 @@ public abstract class DistanceManager { protected abstract ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k); public boolean runAllUpdates(ChunkMap chunkStorage) { @@ -245,7 +245,7 @@ index 75f11490737018096e7645ce0b991fd210c8f596..14774d51dd35a98471d29230a64fadee this.tickingTicketsTracker.runAllUpdates(); this.playerTicketManager.runAllUpdates(); int i = Integer.MAX_VALUE - this.ticketTracker.runDistanceUpdates(Integer.MAX_VALUE); -@@ -286,7 +286,7 @@ public abstract class DistanceManager { +@@ -289,7 +289,7 @@ public abstract class DistanceManager { ((ObjectSet) this.playersPerChunk.computeIfAbsent(i, (j) -> { return new ObjectOpenHashSet(); })).add(player); @@ -254,7 +254,7 @@ index 75f11490737018096e7645ce0b991fd210c8f596..14774d51dd35a98471d29230a64fadee this.playerTicketManager.update(i, 0, true); this.tickingTicketsTracker.addTicket(TicketType.PLAYER, chunkcoordintpair, this.getPlayerTicketLevel(), chunkcoordintpair); } -@@ -300,7 +300,7 @@ public abstract class DistanceManager { +@@ -303,7 +303,7 @@ public abstract class DistanceManager { if (objectset != null) objectset.remove(player); // Paper - some state corruption happens here, don't crash, clean up gracefully. if (objectset == null || objectset.isEmpty()) { // Paper this.playersPerChunk.remove(i); @@ -263,7 +263,7 @@ index 75f11490737018096e7645ce0b991fd210c8f596..14774d51dd35a98471d29230a64fadee this.playerTicketManager.update(i, Integer.MAX_VALUE, false); this.tickingTicketsTracker.removeTicket(TicketType.PLAYER, chunkcoordintpair, this.getPlayerTicketLevel(), chunkcoordintpair); } -@@ -344,13 +344,17 @@ public abstract class DistanceManager { +@@ -347,13 +347,17 @@ public abstract class DistanceManager { // Paper end public int getNaturalSpawnChunkCount() { @@ -286,10 +286,10 @@ index 75f11490737018096e7645ce0b991fd210c8f596..14774d51dd35a98471d29230a64fadee public String getDebugStatus() { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 8cfd38617b49ea6be318abc819f2ed5b7dabd2e1..59cd2b8ecdd2c962a027526fe45032559aa2ee8c 100644 +index 1b6fb81079d3ad5d3c33be67a1c05111f9dd5f2d..1d5587bb9cf785de4b6d59234eb700c2e1a8a7dd 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -881,6 +881,37 @@ public class ServerChunkCache extends ChunkSource { +@@ -880,6 +880,37 @@ public class ServerChunkCache extends ChunkSource { if (flag) { this.chunkMap.tick(); } else { @@ -327,7 +327,7 @@ index 8cfd38617b49ea6be318abc819f2ed5b7dabd2e1..59cd2b8ecdd2c962a027526fe4503255 LevelData worlddata = this.level.getLevelData(); ProfilerFiller gameprofilerfiller = this.level.getProfiler(); -@@ -924,15 +955,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -923,15 +954,7 @@ public class ServerChunkCache extends ChunkSource { boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit Collections.shuffle(list); @@ -344,12 +344,12 @@ index 8cfd38617b49ea6be318abc819f2ed5b7dabd2e1..59cd2b8ecdd2c962a027526fe4503255 Iterator iterator1 = list.iterator(); while (iterator1.hasNext()) { -@@ -940,9 +963,9 @@ public class ServerChunkCache extends ChunkSource { +@@ -939,9 +962,9 @@ public class ServerChunkCache extends ChunkSource { LevelChunk chunk1 = chunkproviderserver_a.chunk; ChunkPos chunkcoordintpair = chunk1.getPos(); -- if (this.level.isPositionEntityTicking(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair)) { -+ if (this.level.isPositionEntityTicking(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkproviderserver_a.holder, chunkcoordintpair, false)) { // Paper - optimise anyPlayerCloseEnoughForSpawning +- if (this.level.isNaturalSpawningAllowed(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair)) { ++ if (this.level.isNaturalSpawningAllowed(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkproviderserver_a.holder, chunkcoordintpair, false)) { // Paper - optimise anyPlayerCloseEnoughForSpawning chunk1.incrementInhabitedTime(j); - if (flag2 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair, true)) { // Spigot + if (flag2 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkproviderserver_a.holder, chunkcoordintpair, true)) { // Spigot // Paper - optimise anyPlayerCloseEnoughForSpawning @@ -357,10 +357,10 @@ index 8cfd38617b49ea6be318abc819f2ed5b7dabd2e1..59cd2b8ecdd2c962a027526fe4503255 } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index beebb7a0e6b8b1fa4e7d2f9fdf1962357cc2ebc3..2f13055a39c26fe12d2c1094103186635e536166 100644 +index 89156bd30cc41dd80de47c7e6e45db034904dbf3..a7a3c17cf97486f9f1af0cdc00686c22b37449b6 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -253,6 +253,7 @@ public class ServerPlayer extends Player { +@@ -251,6 +251,7 @@ public class ServerPlayer extends Player { // CraftBukkit end public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper diff --git a/patches/server/0433-Use-distance-map-to-optimise-entity-tracker.patch b/patches/server/0433-Use-distance-map-to-optimise-entity-tracker.patch index bb03397ee..024652b79 100644 --- a/patches/server/0433-Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/server/0433-Use-distance-map-to-optimise-entity-tracker.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Use distance map to optimise entity tracker Use the distance map to find candidate players for tracking. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index cd58121bfa059366919e098005299dde0c55f46f..25c71ca93c54976cc319abb0d932beb6f95deb79 100644 +index 980afbd2b9bc232becd6001e6b1da0aae0abedec..b2072b4eb3369f73bd68d3836447ecda802d7007 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -67,6 +67,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; +@@ -70,6 +70,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket; import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.server.MCUtil; @@ -17,7 +17,7 @@ index cd58121bfa059366919e098005299dde0c55f46f..25c71ca93c54976cc319abb0d932beb6 import net.minecraft.server.level.progress.ChunkProgressListener; import net.minecraft.server.network.ServerPlayerConnection; import net.minecraft.util.CsvOutput; -@@ -188,10 +189,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -192,10 +193,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap; // this map is absent from updateMaps since it's controlled at the start of the chunkproviderserver tick public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerChunkTickRangeMap; // Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning @@ -53,7 +53,7 @@ index cd58121bfa059366919e098005299dde0c55f46f..25c71ca93c54976cc319abb0d932beb6 // Note: players need to be explicitly added to distance maps before they can be updated this.playerChunkTickRangeMap.add(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning // Paper start - per player mob spawning -@@ -203,6 +229,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -207,6 +233,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider void removePlayerFromDistanceMaps(ServerPlayer player) { @@ -65,7 +65,7 @@ index cd58121bfa059366919e098005299dde0c55f46f..25c71ca93c54976cc319abb0d932beb6 // Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning this.playerMobSpawnMap.remove(player); this.playerChunkTickRangeMap.remove(player); -@@ -218,6 +249,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -222,6 +253,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider int chunkX = MCUtil.getChunkCoordinate(player.getX()); int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); // Note: players need to be explicitly added to distance maps before they can be updated @@ -80,7 +80,7 @@ index cd58121bfa059366919e098005299dde0c55f46f..25c71ca93c54976cc319abb0d932beb6 this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { -@@ -298,6 +337,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -303,6 +342,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.regionManagers.add(this.dataRegionManager); // Paper end this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper @@ -126,7 +126,7 @@ index cd58121bfa059366919e098005299dde0c55f46f..25c71ca93c54976cc319abb0d932beb6 // Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning this.playerChunkTickRangeMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, (ServerPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ, -@@ -1505,17 +1583,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1559,17 +1637,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public void move(ServerPlayer player) { @@ -145,7 +145,7 @@ index cd58121bfa059366919e098005299dde0c55f46f..25c71ca93c54976cc319abb0d932beb6 int i = SectionPos.blockToSectionCoord(player.getBlockX()); int j = SectionPos.blockToSectionCoord(player.getBlockZ()); -@@ -1642,7 +1710,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1696,7 +1764,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker this.entityMap.put(entity.getId(), playerchunkmap_entitytracker); @@ -154,7 +154,7 @@ index cd58121bfa059366919e098005299dde0c55f46f..25c71ca93c54976cc319abb0d932beb6 if (entity instanceof ServerPlayer) { ServerPlayer entityplayer = (ServerPlayer) entity; -@@ -1686,7 +1754,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1740,7 +1808,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.tracker = null; // Paper - We're no longer tracked } @@ -192,7 +192,7 @@ index cd58121bfa059366919e098005299dde0c55f46f..25c71ca93c54976cc319abb0d932beb6 List list = Lists.newArrayList(); List list1 = this.level.players(); ObjectIterator objectiterator = this.entityMap.values().iterator(); -@@ -1762,23 +1860,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1816,23 +1914,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos()); List list = Lists.newArrayList(); List list1 = Lists.newArrayList(); @@ -236,7 +236,7 @@ index cd58121bfa059366919e098005299dde0c55f46f..25c71ca93c54976cc319abb0d932beb6 Iterator iterator; Entity entity1; -@@ -1854,6 +1960,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1908,6 +2014,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lastSectionPos = SectionPos.of(entity); } @@ -280,10 +280,10 @@ index cd58121bfa059366919e098005299dde0c55f46f..25c71ca93c54976cc319abb0d932beb6 return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false; } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7bf62752b6604abe0bda6f5d0024f0e93efb3a9a..9a4454746452f64d7a8caa52eef2dca86e9edd94 100644 +index 0dc85e33e9748a87e2dfbbbfb1861bdf636dab33..7ac9ca00521a9a265d4d188c3bef5c89736d8852 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -51,6 +51,7 @@ import net.minecraft.network.syncher.EntityDataSerializers; +@@ -54,6 +54,7 @@ import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -291,7 +291,7 @@ index 7bf62752b6604abe0bda6f5d0024f0e93efb3a9a..9a4454746452f64d7a8caa52eef2dca8 import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; -@@ -359,6 +360,39 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -362,6 +363,39 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } // Paper end diff --git a/patches/server/0434-Optimize-ServerLevels-chunk-level-checking-methods.patch b/patches/server/0434-Optimize-ServerLevels-chunk-level-checking-methods.patch index 21abb956a..bbbf4318c 100644 --- a/patches/server/0434-Optimize-ServerLevels-chunk-level-checking-methods.patch +++ b/patches/server/0434-Optimize-ServerLevels-chunk-level-checking-methods.patch @@ -8,10 +8,10 @@ so inline where possible, and avoid the abstraction of the Either class. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index fda854c603629e3b9facc8ea3577cd8b23d973d9..083772c2f71851b5521f0ec5c1ecb872e357e8f7 100644 +index 9f1b38c40da90f4224810356b8ee78418b58cb5d..ddf4f4081374910df6c8ad7b92c479066434276f 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2162,15 +2162,18 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2165,19 +2165,22 @@ public class ServerLevel extends Level implements WorldGenLevel { } private boolean isPositionTickingWithEntitiesLoaded(long chunkPos) { @@ -23,13 +23,18 @@ index fda854c603629e3b9facc8ea3577cd8b23d973d9..083772c2f71851b5521f0ec5c1ecb872 } public boolean isPositionEntityTicking(BlockPos pos) { -- return this.entityManager.isPositionTicking(pos); -+ return this.entityManager.isPositionTicking(ChunkPos.asLong(pos)); // Paper +- return this.entityManager.canPositionTick(pos) && this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(ChunkPos.asLong(pos)); ++ return this.entityManager.canPositionTick(ChunkPos.asLong(pos)) && this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(ChunkPos.asLong(pos)); // Paper } - public boolean isPositionEntityTicking(ChunkPos pos) { -- return this.entityManager.isPositionTicking(pos); -+ return this.entityManager.isPositionTicking(pos.toLong()); // Paper + public boolean isNaturalSpawningAllowed(BlockPos pos) { +- return this.entityManager.canPositionTick(pos); ++ return this.entityManager.canPositionTick(ChunkPos.asLong(pos)); // Paper + } + + public boolean isNaturalSpawningAllowed(ChunkPos pos) { +- return this.entityManager.canPositionTick(pos); ++ return this.entityManager.canPositionTick(pos.toLong()); // Paper } private final class EntityCallbacks implements LevelCallback { @@ -47,7 +52,7 @@ index 4c5f8a103b550a681178926096d5f758654c61a7..d2952a1a84ae7326e2d4a1f19497db8f public static int getX(long pos) { diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -index e19f5b2c8f485d596a64d5d96e75fa1f4a8255b5..ccafd28e3dc9a03f310eb5bdde85fcb277ef5116 100644 +index 1407f30d467fa78bc207a91da0e6395c0a9ba83d..2110cb437807f99994838b57653caefe2f01a9c5 100644 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java @@ -383,6 +383,11 @@ public class PersistentEntitySectionManager implements A @@ -55,10 +60,10 @@ index e19f5b2c8f485d596a64d5d96e75fa1f4a8255b5..ccafd28e3dc9a03f310eb5bdde85fcb2 return this.entityGetter; } + // Paper start -+ public final boolean isPositionTicking(long position) { ++ public final boolean canPositionTick(long position) { + return this.chunkVisibility.get(position).isTicking(); + } + // Paper end - public boolean isPositionTicking(BlockPos pos) { + public boolean canPositionTick(BlockPos pos) { return ((Visibility) this.chunkVisibility.get(ChunkPos.asLong(pos))).isTicking(); diff --git a/patches/server/0435-Delay-Chunk-Unloads-based-on-Player-Movement.patch b/patches/server/0435-Delay-Chunk-Unloads-based-on-Player-Movement.patch index d626ac1f6..fe8bf40a1 100644 --- a/patches/server/0435-Delay-Chunk-Unloads-based-on-Player-Movement.patch +++ b/patches/server/0435-Delay-Chunk-Unloads-based-on-Player-Movement.patch @@ -35,10 +35,10 @@ index bc880a78381b9c30e4ec92bdf17c9eca1ded41f2..eae27a641ee69f3383f1200f8c8ab8dd + } } diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index 14774d51dd35a98471d29230a64fadee74651d19..93a642cd6cf21a268074a73bff22249d32992ad3 100644 +index a3bdace1ce3252e8c09b642ee8963bfb4b39222c..d6bb8610de3c2e468c964f131564e54b392534f1 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -211,6 +211,27 @@ public abstract class DistanceManager { +@@ -212,6 +212,27 @@ public abstract class DistanceManager { boolean removed = false; // CraftBukkit if (arraysetsorted.remove(ticket)) { removed = true; // CraftBukkit diff --git a/patches/server/0437-Maps-shouldn-t-load-chunks.patch b/patches/server/0437-Maps-shouldn-t-load-chunks.patch index c1f48bd1b..d3c9edb4f 100644 --- a/patches/server/0437-Maps-shouldn-t-load-chunks.patch +++ b/patches/server/0437-Maps-shouldn-t-load-chunks.patch @@ -15,10 +15,10 @@ Previously maps would load all chunks in a certain radius depending on five ticks that movement occur in anyways. diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java -index 65fbc22b3b03d1e95cf76da37babd052d8ae4445..27862f85307e2de5f3fe2195b62a1a9bd3f496de 100644 +index f3c0d48f1f6bc6a1a20d4b25d943b01c8736bb36..d15d87208d21173912cf489b55b1c5d226ea998b 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java -@@ -131,9 +131,9 @@ public class MapItem extends ComplexItem { +@@ -130,9 +130,9 @@ public class MapItem extends ComplexItem { int k2 = (j / i + k1 - 64) * i; int l2 = (k / i + l1 - 64) * i; Multiset multiset = LinkedHashMultiset.create(); diff --git a/patches/server/0438-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch b/patches/server/0438-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch index 7361ae68f..3c0b925e5 100644 --- a/patches/server/0438-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch +++ b/patches/server/0438-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch @@ -6,15 +6,22 @@ Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java -index 27862f85307e2de5f3fe2195b62a1a9bd3f496de..602e6bc05c053baf821c11c30b24538320b9ac61 100644 +index d15d87208d21173912cf489b55b1c5d226ea998b..6f86f00d33cd50a2b67409c2f0f5400c869b802a 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java -@@ -256,7 +256,7 @@ public class MapItem extends ComplexItem { +@@ -251,14 +251,13 @@ public class MapItem extends ComplexItem { + boolean[] aboolean = new boolean[16384]; + int l = j / i - 64; + int i1 = k / i - 64; +- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(); - for (l = 0; l < 128 * i; ++l) { - for (i1 = 0; i1 < 128 * i; ++i1) { -- Biome.BiomeCategory biomebase_geography = world.getBiome(new BlockPos((j / i - 64) * i + i1, 0, (k / i - 64) * i + l)).getBiomeCategory(); -+ Biome.BiomeCategory biomebase_geography = world.getUncachedNoiseBiome((j / i - 64) * i + i1, 0, (k / i - 64) * i + l).getBiomeCategory(); // Paper + int j1; + int k1; - aboolean[l * 128 * i + i1] = biomebase_geography == Biome.BiomeCategory.OCEAN || biomebase_geography == Biome.BiomeCategory.RIVER || biomebase_geography == Biome.BiomeCategory.SWAMP; + for (j1 = 0; j1 < 128; ++j1) { + for (k1 = 0; k1 < 128; ++k1) { +- Biome.BiomeCategory biomebase_geography = Biome.getBiomeCategory(world.getBiome(blockposition_mutableblockposition.set((l + k1) * i, 0, (i1 + j1) * i))); ++ Biome.BiomeCategory biomebase_geography = Biome.getBiomeCategory(world.getUncachedNoiseBiome((l + k1) * i, 0, (i1 + j1) * i)); // Paper + + aboolean[j1 * 128 + k1] = biomebase_geography == Biome.BiomeCategory.OCEAN || biomebase_geography == Biome.BiomeCategory.RIVER || biomebase_geography == Biome.BiomeCategory.SWAMP; } diff --git a/patches/server/0439-Fix-missing-chunks-due-to-integer-overflow.patch b/patches/server/0439-Fix-missing-chunks-due-to-integer-overflow.patch index d2f7884b3..b1be3e839 100644 --- a/patches/server/0439-Fix-missing-chunks-due-to-integer-overflow.patch +++ b/patches/server/0439-Fix-missing-chunks-due-to-integer-overflow.patch @@ -13,10 +13,10 @@ The fix for the issue is quite simple, casting chunk coordinates to longs allows the distance calculation to avoid overflow and work as intended. diff --git a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java -index 9a704c45f1afa82ff8d9ee3fa1e2437c1d4ec875..d090bdc063480ee6e28b0d60447ebe4063e6d688 100644 +index bbb43461ad899aae2212c32a9e839c766b3b8e37..3f9127f93c9720c89b578d36a1bcdb89fc01222a 100644 --- a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java +++ b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java -@@ -85,7 +85,7 @@ public class TheEndBiomeSource extends BiomeSource { +@@ -84,7 +84,7 @@ public class TheEndBiomeSource extends BiomeSource { int l = j / 2; int m = i % 2; int n = j % 2; diff --git a/patches/server/0441-Fix-piston-physics-inconsistency-MC-188840.patch b/patches/server/0441-Fix-piston-physics-inconsistency-MC-188840.patch index 3ebfbf19c..b3550476a 100644 --- a/patches/server/0441-Fix-piston-physics-inconsistency-MC-188840.patch +++ b/patches/server/0441-Fix-piston-physics-inconsistency-MC-188840.patch @@ -49,10 +49,10 @@ index edfa4a27a18b5c9df75f3952c51acdde1faa6dde..a545a882335094daa787ec5c70059390 + } diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -index ebd8a234acf42f8d6ae0790bb6a60a214d22429f..2e95de4250f3b53591749ebbe7a5f2b607f6b7fa 100644 +index edb599da2431fa32f6e656dd3de8f4a6f5e2ed4f..f4f49cc4109d4ae72c0a50f7acbd181d05bf415a 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -@@ -410,14 +410,26 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -409,14 +409,26 @@ public class PistonBaseBlock extends DirectionalBlock { } for (k = list.size() - 1; k >= 0; --k) { diff --git a/patches/server/0442-Fix-sand-duping.patch b/patches/server/0442-Fix-sand-duping.patch index db38b4787..6d58f06d8 100644 --- a/patches/server/0442-Fix-sand-duping.patch +++ b/patches/server/0442-Fix-sand-duping.patch @@ -7,10 +7,10 @@ If the falling block dies during teleportation (entity#move), then we need to detect that by placing a check after the move. diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index a8a9cbcece45c3480120cb2fa0fa03523a87d317..e74a87336b47611fa29df4cd3d272fb08b91630b 100644 +index c1de9740d199dc862f8e85251a5de021499e0031..483127e9418489ad7ba1fbcb14a045d91c1c3c30 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -110,6 +110,11 @@ public class FallingBlockEntity extends Entity { +@@ -119,6 +119,11 @@ public class FallingBlockEntity extends Entity { @Override public void tick() { @@ -21,8 +21,8 @@ index a8a9cbcece45c3480120cb2fa0fa03523a87d317..e74a87336b47611fa29df4cd3d272fb0 + // Paper end - fix sand duping if (this.blockState.isAir()) { this.discard(); - } else if (this.level.isClientSide && this.removeAtMillis > 0L) { -@@ -137,6 +142,12 @@ public class FallingBlockEntity extends Entity { + } else { +@@ -131,6 +136,12 @@ public class FallingBlockEntity extends Entity { this.move(MoverType.SELF, this.getDeltaMovement()); diff --git a/patches/server/0443-Prevent-position-desync-in-playerconnection-causing-.patch b/patches/server/0443-Prevent-position-desync-in-playerconnection-causing-.patch index 164a8b0e3..9ced2d10a 100644 --- a/patches/server/0443-Prevent-position-desync-in-playerconnection-causing-.patch +++ b/patches/server/0443-Prevent-position-desync-in-playerconnection-causing-.patch @@ -14,10 +14,10 @@ behaviour, we need to move all of this dangerous logic outside of the move call and into an appropriate place in the tick method. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f7542d053be38298229719bd63e950fc6d167fb9..1030a835086591bcc166ef1e52db8b7a62da5292 100644 +index 81a1af417ea394a63d4d86b19fadbafce8963aac..901101fe571aa6723081d975ada15c54e543180e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1329,6 +1329,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1338,6 +1338,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9)); this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move diff --git a/patches/server/0446-Add-and-implement-PlayerRecipeBookClickEvent.patch b/patches/server/0446-Add-and-implement-PlayerRecipeBookClickEvent.patch index 9a833e7d6..5639a182f 100644 --- a/patches/server/0446-Add-and-implement-PlayerRecipeBookClickEvent.patch +++ b/patches/server/0446-Add-and-implement-PlayerRecipeBookClickEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 1030a835086591bcc166ef1e52db8b7a62da5292..25d392d89a461c6b5dea1d14134666927bee5d46 100644 +index 901101fe571aa6723081d975ada15c54e543180e..b6517796367e2424063d429fed6ceeb9078ea2e0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2780,9 +2780,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2801,9 +2801,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); this.player.resetLastActionTime(); if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu instanceof RecipeBookMenu) { diff --git a/patches/server/0447-Hide-sync-chunk-writes-behind-flag.patch b/patches/server/0447-Hide-sync-chunk-writes-behind-flag.patch index 9f93092cb..cb0833f0d 100644 --- a/patches/server/0447-Hide-sync-chunk-writes-behind-flag.patch +++ b/patches/server/0447-Hide-sync-chunk-writes-behind-flag.patch @@ -9,10 +9,10 @@ on harddrives. -DPaper.enable-sync-chunk-writes=true to enable diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -index 07fd3da4de300f80516961ae22700dbc741e81dc..f944e6beafc7876ed9c6923a22f58d82967b77cb 100644 +index a7938420f6840b9d3880fb895aaf709ebd844312..ebfaa8d5de5b905bd2dd7778728b8c9939d01252 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -@@ -107,7 +107,7 @@ public class DedicatedServerProperties extends Settings { return Mth.clamp(integer, (int) 1, 29999984); }, 29999984); diff --git a/patches/server/0448-Add-permission-for-command-blocks.patch b/patches/server/0448-Add-permission-for-command-blocks.patch index 5f9602f1f..97b909148 100644 --- a/patches/server/0448-Add-permission-for-command-blocks.patch +++ b/patches/server/0448-Add-permission-for-command-blocks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add permission for command blocks diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 391e20c284b24f6c5fe446fd6a2c677214ed15c5..954aa104912cfb65b663ca49f64fd2b59da99c55 100644 +index d4f57fde2f02071dfde08cb2a5c8359984056aef..176e5bbac94cf39805dcacfcae3a3daa98b793b7 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -393,7 +393,7 @@ public class ServerPlayerGameMode { +@@ -403,7 +403,7 @@ public class ServerPlayerGameMode { BlockEntity tileentity = this.level.getBlockEntity(pos); Block block = iblockdata.getBlock(); @@ -18,10 +18,10 @@ index 391e20c284b24f6c5fe446fd6a2c677214ed15c5..954aa104912cfb65b663ca49f64fd2b5 return false; } else if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 25d392d89a461c6b5dea1d14134666927bee5d46..ec784bb54f7e4b4cb90a64e636392a752302cf86 100644 +index b6517796367e2424063d429fed6ceeb9078ea2e0..e32011d5a0b9b2873adb99805fc3ab29e478679d 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -785,7 +785,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -792,7 +792,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (!this.server.isCommandBlockEnabled()) { this.player.sendMessage(new TranslatableComponent("advMode.notEnabled"), Util.NIL_UUID); @@ -30,7 +30,7 @@ index 25d392d89a461c6b5dea1d14134666927bee5d46..ec784bb54f7e4b4cb90a64e636392a75 this.player.sendMessage(new TranslatableComponent("advMode.notAllowed"), Util.NIL_UUID); } else { BaseCommandBlock commandblocklistenerabstract = null; -@@ -852,7 +852,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -859,7 +859,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (!this.server.isCommandBlockEnabled()) { this.player.sendMessage(new TranslatableComponent("advMode.notEnabled"), Util.NIL_UUID); @@ -53,7 +53,7 @@ index 5b125aa77e769983a0aee7c5f6eb6a8a146fead0..fca57e5d1e25db6367c53ad04e49508e } else { if (player.getCommandSenderWorld().isClientSide) { diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java -index 324d544355215804ed0b06bf931883d81e550ed8..135f37f79d1463896e47679e1d13e123b78f97c9 100644 +index 25a297968388f85108d7b9de96fdc7d368034e4d..1a48c5ea1f2f755abfa85469e26f37ea5f02d6da 100644 --- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java @@ -130,7 +130,7 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { diff --git a/patches/server/0449-Ensure-Entity-AABB-s-are-never-invalid.patch b/patches/server/0449-Ensure-Entity-AABB-s-are-never-invalid.patch index 448000a95..426a703d2 100644 --- a/patches/server/0449-Ensure-Entity-AABB-s-are-never-invalid.patch +++ b/patches/server/0449-Ensure-Entity-AABB-s-are-never-invalid.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ensure Entity AABB's are never invalid diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9a4454746452f64d7a8caa52eef2dca86e9edd94..362b509c6d2df8061ba7fac51373490554843c30 100644 +index 7ac9ca00521a9a265d4d188c3bef5c89736d8852..e2c3c733f6ee7c4f35ad7ee351d5ea1eb00fc251 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -595,8 +595,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -599,8 +599,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public void setPos(double x, double y, double z) { @@ -19,7 +19,7 @@ index 9a4454746452f64d7a8caa52eef2dca86e9edd94..362b509c6d2df8061ba7fac513734905 } protected AABB makeBoundingBox() { -@@ -3792,6 +3792,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3809,6 +3809,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public final void setPosRaw(double x, double y, double z) { @@ -31,7 +31,7 @@ index 9a4454746452f64d7a8caa52eef2dca86e9edd94..362b509c6d2df8061ba7fac513734905 if (this.position.x != x || this.position.y != y || this.position.z != z) { this.position = new Vec3(x, y, z); int i = Mth.floor(x); -@@ -3814,6 +3819,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3831,6 +3836,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } } diff --git a/patches/server/0450-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/0450-Fix-Per-World-Difficulty-Remembering-Difficulty.patch index 71b94ea2e..2769a06ce 100644 --- a/patches/server/0450-Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/patches/server/0450-Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -8,7 +8,7 @@ makes it so that the server keeps the last difficulty used instead of restoring the server.properties every single load. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9d8dd7ac4e471d658ba942e29c5028df410fa2c3..9a926114aa550ca5a6329e3ce993bf1f686cd10e 100644 +index b00b17681233283b314fc1b4daf88379c3b5dea0..aeceac6fb547b38e7691cb0435e55da556c69147 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -824,7 +824,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) either.left().orElse(null); diff --git a/patches/server/0456-incremental-chunk-and-player-saving.patch b/patches/server/0456-incremental-chunk-and-player-saving.patch index 6f948b6f9..d93c50da6 100644 --- a/patches/server/0456-incremental-chunk-and-player-saving.patch +++ b/patches/server/0456-incremental-chunk-and-player-saving.patch @@ -50,7 +50,7 @@ index eae27a641ee69f3383f1200f8c8ab8dd7a4105a4..12a6f12ffa8a45b054b01a7edc73ca8a config.addDefault("world-settings.default." + path, def); return config.getBoolean("world-settings." + worldName + "." + path, config.getBoolean("world-settings.default." + path)); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9a926114aa550ca5a6329e3ce993bf1f686cd10e..ab7ca991e5d7940a386a820e1953df1ac2428107 100644 +index aeceac6fb547b38e7691cb0435e55da556c69147..c37f0527367f1ee842cec150a141087d83851c23 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -902,7 +902,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> completablefuture = (CompletableFuture) this.futures.get(i); diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 25c71ca93c54976cc319abb0d932beb6f95deb79..e66e4d1656e5f6f042c5c63715e13a6b5e7d81c5 100644 +index b2072b4eb3369f73bd68d3836447ecda802d7007..36181d03c44f2ee4a129129b6fe253f25748af2d 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -101,6 +101,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana +@@ -104,6 +104,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.phys.Vec3; +import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; // Paper import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.commons.lang3.mutable.MutableObject; - import org.apache.logging.log4j.LogManager; -@@ -658,6 +659,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + import org.slf4j.Logger; +@@ -694,6 +695,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } @@ -241,7 +241,7 @@ index 25c71ca93c54976cc319abb0d932beb6f95deb79..e66e4d1656e5f6f042c5c63715e13a6b protected void saveAllChunks(boolean flush) { if (flush) { List list = (List) this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); -@@ -752,13 +811,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -792,13 +851,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } int l = 0; @@ -256,7 +256,7 @@ index 25c71ca93c54976cc319abb0d932beb6f95deb79..e66e4d1656e5f6f042c5c63715e13a6b } -@@ -796,6 +849,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -836,6 +889,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.level.unload(chunk); } @@ -264,7 +264,7 @@ index 25c71ca93c54976cc319abb0d932beb6f95deb79..e66e4d1656e5f6f042c5c63715e13a6b this.lightEngine.updateChunkStatus(ichunkaccess.getPos()); this.lightEngine.tryScheduleUpdate(); -@@ -1193,6 +1247,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1247,6 +1301,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider asyncSaveData, chunk); chunk.setUnsaved(false); @@ -272,7 +272,7 @@ index 25c71ca93c54976cc319abb0d932beb6f95deb79..e66e4d1656e5f6f042c5c63715e13a6b } // Paper end -@@ -1202,6 +1257,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1256,6 +1311,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (!chunk.isUnsaved()) { return false; } else { @@ -281,10 +281,10 @@ index 25c71ca93c54976cc319abb0d932beb6f95deb79..e66e4d1656e5f6f042c5c63715e13a6b ChunkPos chunkcoordintpair = chunk.getPos(); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 59cd2b8ecdd2c962a027526fe45032559aa2ee8c..fdc027bc5a7e9d691ac90c5fee0cdfebd959bc5f 100644 +index 1d5587bb9cf785de4b6d59234eb700c2e1a8a7dd..9fdd2a39e3590b3098fa31b9b0e0081160819630 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -825,6 +825,15 @@ public class ServerChunkCache extends ChunkSource { +@@ -821,6 +821,15 @@ public class ServerChunkCache extends ChunkSource { } // Paper - Timings } @@ -301,10 +301,10 @@ index 59cd2b8ecdd2c962a027526fe45032559aa2ee8c..fdc027bc5a7e9d691ac90c5fee0cdfeb public void close() throws IOException { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 04aae918f1951291459ce17b25986e5cac9d2378..3b99a6dda3638f3a7212d7c9fab5470409de4e6f 100644 +index ddf4f4081374910df6c8ad7b92c479066434276f..e4422ec63abf90e78a7ff6b12cb613234960e59a 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1058,6 +1058,37 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1061,6 +1061,37 @@ public class ServerLevel extends Level implements WorldGenLevel { return !this.server.isUnderSpawnProtection(this, pos, player) && this.getWorldBorder().isWithinBounds(pos); } @@ -343,19 +343,19 @@ index 04aae918f1951291459ce17b25986e5cac9d2378..3b99a6dda3638f3a7212d7c9fab54704 ServerChunkCache chunkproviderserver = this.getChunkSource(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 6b0cb662d9163c360035e19c5faad59fc72af3c1..d2280b9e9f107dca890bc76f0c58e7070ce4b38c 100644 +index 5a4eeb46543d9458e309e2d4cc56086b5cf528c6..d11b5c9e64b6695a44cc2db588bed2e8a870c607 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -171,6 +171,7 @@ public class ServerPlayer extends Player { - public final int getViewDistance() { return this.getLevel().getChunkSource().chunkMap.viewDistance - 1; } // Paper - placeholder +@@ -169,6 +169,7 @@ import org.bukkit.inventory.MainHand; + public class ServerPlayer extends Player { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); + public long lastSave = MinecraftServer.currentTick; // Paper private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32; private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; public ServerGamePacketListenerImpl connection; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index b84124abaca401406fbffc8bc6bd21245c303156..ae921bfe9634f0fe41ef18db8da7bf00d536b59a 100644 +index a36d582b8fdd99eba423fbeb8f46f0dd226d3523..d70680d5422434b4a0e962a30cc1324f323c272e 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -560,6 +560,7 @@ public abstract class PlayerList { @@ -391,10 +391,10 @@ index b84124abaca401406fbffc8bc6bd21245c303156..ae921bfe9634f0fe41ef18db8da7bf00 MinecraftTimings.savePlayers.stopTiming(); // Paper return null; }); // Paper - ensure main diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index a657b41263739b454617db5d7cb9e5cdd94f44ec..6d5f867989eb786683e81e2d270ed0b085c1f072 100644 +index 8038b37bdfdd41eadb4f3cb4dd7ef245051ed3a4..20b288fdef75c9994b174cb4d7d082c5e69eb26b 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -457,6 +457,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -458,6 +458,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom public LevelHeightAccessor getHeightAccessorForGeneration() { return this; } @@ -403,7 +403,7 @@ index a657b41263739b454617db5d7cb9e5cdd94f44ec..6d5f867989eb786683e81e2d270ed0b0 // CraftBukkit start - decompile error public static record TicksToSave(SerializableTickContainer blocks, SerializableTickContainer fluids) { 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 d70bdf21dd7bdf01b34d0fd38e79f9b386ec1fcc..6eaba33b7730d66bf631b6d5c6a7080f9f019f8b 100644 +index 76a15f9a3419c430a288b52b824aa723a91f87fb..bf4e03237225058efc63e23ac3ddb49c339b9f08 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -87,6 +87,12 @@ public class LevelChunk extends ChunkAccess { diff --git a/patches/server/0458-Support-old-UUID-format-for-NBT.patch b/patches/server/0458-Support-old-UUID-format-for-NBT.patch index 607a1ac12..174483efe 100644 --- a/patches/server/0458-Support-old-UUID-format-for-NBT.patch +++ b/patches/server/0458-Support-old-UUID-format-for-NBT.patch @@ -46,11 +46,11 @@ index be2bd47a509a03e78c380cf749cd476f332ab03d..210f81e380cb38c2d5d69849e593d2fd return tag != null && tag.getType() == IntArrayTag.TYPE && ((IntArrayTag)tag).getAsIntArray().length == 4; } diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java -index a61f480bc2e2169969e614bccd3e143f47c1a40e..b77b806b28dfada3e84e25d868aa8a8f8556f5af 100644 +index 32445370db8392c36065fa7a7680cfe9b90653c3..7b48db30a155006a74688809155d779b88e48092 100644 --- a/src/main/java/net/minecraft/nbt/NbtUtils.java +++ b/src/main/java/net/minecraft/nbt/NbtUtils.java -@@ -40,14 +40,14 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -40,14 +40,14 @@ import net.minecraft.world.level.material.FluidState; + import org.slf4j.Logger; public final class NbtUtils { - private static final Comparator YXZ_LISTTAG_INT_COMPARATOR = Comparator.comparingInt((nbt) -> { diff --git a/patches/server/0461-Remove-some-streams-from-structures.patch b/patches/server/0461-Remove-some-streams-from-structures.patch index 0f1c83377..3feaf02ae 100644 --- a/patches/server/0461-Remove-some-streams-from-structures.patch +++ b/patches/server/0461-Remove-some-streams-from-structures.patch @@ -6,32 +6,36 @@ Subject: [PATCH] Remove some streams from structures This showed up a lot in the spark profiler, should have a low-medium performance improvement. diff --git a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java -index 81b3f09e2da2363184f57bac08651185c8685b1a..6a2db2294d8692c070243d5e4f8773daa30bead6 100644 +index 353fd8290a48c722a5eb86794dd09ca81960c8f5..e7b02df8fd5c19537fc793f0c61ebb85c86b2100 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java +++ b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java -@@ -16,6 +16,7 @@ import net.minecraft.world.level.levelgen.feature.structures.StructureTemplatePo +@@ -13,6 +13,7 @@ import net.minecraft.world.level.levelgen.feature.NoiseEffect; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.PoolElementStructurePiece; import net.minecraft.world.level.levelgen.structure.StructurePiece; +import net.minecraft.world.level.levelgen.structure.StructureStart; + import net.minecraft.world.level.levelgen.structure.pools.JigsawJunction; + import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool; - public class Beardifier implements NoiseChunk.NoiseFiller { - public static final int BEARD_KERNEL_RADIUS = 12; -@@ -43,7 +44,7 @@ public class Beardifier implements NoiseChunk.NoiseFiller { +@@ -40,9 +41,10 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { + int j = chunkPos.getMinBlockZ(); + this.junctions = new ObjectArrayList<>(32); this.rigids = new ObjectArrayList<>(10); - - for(StructureFeature structureFeature : StructureFeature.NOISE_AFFECTING_FEATURES) { -- structureAccessor.startsForFeature(SectionPos.bottomOf(chunk), structureFeature).forEach((start) -> { -+ for (StructureStart start : structureAccessor.startsForFeature(SectionPos.bottomOf(chunk), structureFeature)) { // Paper - remove streams - for(StructurePiece structurePiece : start.getPieces()) { - if (structurePiece.isCloseToChunk(chunkPos, 12)) { - if (structurePiece instanceof PoolElementStructurePiece) { -@@ -66,7 +67,7 @@ public class Beardifier implements NoiseChunk.NoiseFiller { - } +- structureAccessor.startsForFeature(SectionPos.bottomOf(chunk), (configuredStructureFeature) -> { ++ // Paper start - replace for each ++ for (StructureStart start : structureAccessor.startsForFeature(SectionPos.bottomOf(chunk), (configuredStructureFeature) -> { + return configuredStructureFeature.adaptNoise; +- }).forEach((start) -> { ++ })) { // Paper end + for(StructurePiece structurePiece : start.getPieces()) { + if (structurePiece.isCloseToChunk(chunkPos, 12)) { + if (structurePiece instanceof PoolElementStructurePiece) { +@@ -65,7 +67,7 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { } + } -- }); -+ } // Paper - } - +- }); ++ } // Paper this.pieceIterator = this.rigids.iterator(); + this.junctionIterator = this.junctions.iterator(); + } diff --git a/patches/server/0462-Remove-streams-from-classes-related-villager-gossip.patch b/patches/server/0462-Remove-streams-from-classes-related-villager-gossip.patch index 23c4519a7..91540dce1 100644 --- a/patches/server/0462-Remove-streams-from-classes-related-villager-gossip.patch +++ b/patches/server/0462-Remove-streams-from-classes-related-villager-gossip.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove streams from classes related villager gossip diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java -index 971ef3d98057ede1316e07cc1e9dcb2742a42187..616e0b8e7a9846ad8ee0874c5dc3bce06de7156f 100644 +index 125d08fc4536f15604ef13636056c94f77b5df57..ea9c4bf7549f6a09bd5ac35f35686391a53838b2 100644 --- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java +++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java @@ -8,6 +8,7 @@ import com.mojang.serialization.Dynamic; @@ -16,7 +16,7 @@ index 971ef3d98057ede1316e07cc1e9dcb2742a42187..616e0b8e7a9846ad8ee0874c5dc3bce0 import it.unimi.dsi.fastutil.objects.ObjectIterator; import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; import java.util.Arrays; -@@ -60,8 +61,21 @@ public class GossipContainer { +@@ -59,8 +60,21 @@ public class GossipContainer { }); } @@ -39,7 +39,7 @@ index 971ef3d98057ede1316e07cc1e9dcb2742a42187..616e0b8e7a9846ad8ee0874c5dc3bce0 if (list.isEmpty()) { return Collections.emptyList(); } else { -@@ -154,9 +168,9 @@ public class GossipContainer { +@@ -153,9 +167,9 @@ public class GossipContainer { } @@ -52,7 +52,7 @@ index 971ef3d98057ede1316e07cc1e9dcb2742a42187..616e0b8e7a9846ad8ee0874c5dc3bce0 }).map(Dynamic::getValue))); } -@@ -181,11 +195,23 @@ public class GossipContainer { +@@ -180,11 +194,23 @@ public class GossipContainer { final Object2IntMap entries = new Object2IntOpenHashMap<>(); public int weightedValue(Predicate gossipTypeFilter) { diff --git a/patches/server/0465-Add-entity-liquid-API.patch b/patches/server/0465-Add-entity-liquid-API.patch index d5da8634f..d450f7b31 100644 --- a/patches/server/0465-Add-entity-liquid-API.patch +++ b/patches/server/0465-Add-entity-liquid-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add entity liquid API diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 362b509c6d2df8061ba7fac51373490554843c30..0b54c4e229aab803683101d7e2b1780ae41b42e0 100644 +index e2c3c733f6ee7c4f35ad7ee351d5ea1eb00fc251..a702a53f588ddd9f748f55973cd3782734aafc51 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1359,7 +1359,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1372,7 +1372,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i return this.isInWater() || this.isInRain(); } diff --git a/patches/server/0466-Update-itemstack-legacy-name-and-lore.patch b/patches/server/0466-Update-itemstack-legacy-name-and-lore.patch index d59dc7e54..159011097 100644 --- a/patches/server/0466-Update-itemstack-legacy-name-and-lore.patch +++ b/patches/server/0466-Update-itemstack-legacy-name-and-lore.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Update itemstack legacy name and lore diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 83d872044c3db54352847e08bb333ff7e0aee0b0..6dd68c17d5365fecfbd15cfaac837e0869cdce2e 100644 +index b78769cf6a70fb7513ea8d3302cb2dd4bf242752..1edd9d27a3af291e7ed9900009d0f6c30845e0b7 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -168,6 +168,44 @@ public final class ItemStack { +@@ -170,6 +170,44 @@ public final class ItemStack { list.sort((Comparator) enchantSorter); // Paper } catch (Exception ignored) {} } @@ -53,7 +53,7 @@ index 83d872044c3db54352847e08bb333ff7e0aee0b0..6dd68c17d5365fecfbd15cfaac837e08 // Paper end public ItemStack(ItemLike item) { -@@ -214,6 +252,7 @@ public final class ItemStack { +@@ -220,6 +258,7 @@ public final class ItemStack { this.tag = nbttagcompound.getCompound("tag").copy(); // CraftBukkit end this.processEnchantOrder(this.tag); // Paper diff --git a/patches/server/0467-Spawn-player-in-correct-world-on-login.patch b/patches/server/0467-Spawn-player-in-correct-world-on-login.patch index 389efb21a..e93a78eec 100644 --- a/patches/server/0467-Spawn-player-in-correct-world-on-login.patch +++ b/patches/server/0467-Spawn-player-in-correct-world-on-login.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Spawn player in correct world on login diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 8c0faa9ee28943c7750dc33947e3f096b45a2026..135337afa09f090847d26268fcb8e542b1535ef3 100644 +index d70680d5422434b4a0e962a30cc1324f323c272e..c154f5e7708dbb19cf1b1a546bb209d386ef52d4 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -196,7 +196,18 @@ public abstract class PlayerList { @@ -25,6 +25,6 @@ index 8c0faa9ee28943c7750dc33947e3f096b45a2026..135337afa09f090847d26268fcb8e542 + } else if (nbttagcompound != null) { + // Vanilla migration support + // Paper end - DataResult dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, nbttagcompound.get("Dimension"))); + DataResult> dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, nbttagcompound.get("Dimension"))); // CraftBukkit - decompile error Logger logger = PlayerList.LOGGER; diff --git a/patches/server/0468-Add-PrepareResultEvent.patch b/patches/server/0468-Add-PrepareResultEvent.patch index c651f04dc..f84d45cb4 100644 --- a/patches/server/0468-Add-PrepareResultEvent.patch +++ b/patches/server/0468-Add-PrepareResultEvent.patch @@ -8,10 +8,10 @@ Adds a new event for all crafting stations that generate a result slot item Anvil, Grindstone and Smithing now extend this event diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java -index b11e15d616e5584873895e076514e535289a24ed..0b60523861bbc1cd9f48207c9f5251b5659c6f24 100644 +index 21215d27e59d7e6ab4b9511340e642c710fb74da..aa8c101b29f7d9269f3766476ff7d552c2ab0c36 100644 --- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java -@@ -316,6 +316,7 @@ public class AnvilMenu extends ItemCombinerMenu { +@@ -315,6 +315,7 @@ public class AnvilMenu extends ItemCombinerMenu { } this.createResult(); diff --git a/patches/server/0469-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch b/patches/server/0469-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch index 5deab19e6..8adbe3815 100644 --- a/patches/server/0469-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch +++ b/patches/server/0469-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 9d8912ff91932e5e3c9a708b4c850e8abaa1a605..371ae3291afa84a41821edc37cdcabe7723a45d0 100644 +index 479a10b24d5c8d825d3c11d1800c89d769e0f441..aebf02fbd3823eb05a0823a843e35d94c05a8afe 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3383,7 +3383,7 @@ public abstract class LivingEntity extends Entity { +@@ -3378,7 +3378,7 @@ public abstract class LivingEntity extends Entity { Entity entity = this.getVehicle(); super.stopRiding(suppressCancellation); // Paper - suppress diff --git a/patches/server/0470-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch b/patches/server/0470-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch index d9c530e0a..45483ebb7 100644 --- a/patches/server/0470-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch +++ b/patches/server/0470-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch @@ -80,10 +80,10 @@ index 89e0181af99cba2368f875fc192342efc972f2ef..b3516862d796c2d9fcc1c67a60734454 chunkData.addProperty("queued-for-unload", chunkMap.toDrop.contains(playerChunk.pos.longKey)); chunkData.addProperty("status", status == null ? "unloaded" : status.toString()); diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 5479deb3f80a95c58cb6f0f532b2f56b71a68a3a..b62d7a85db012265dd4fae02cbed5363a41d536b 100644 +index 05d2790b80a6d2e1dc6b8d2375f783be4eff2343..6ba7e2713452c4c6f48a1a825ef27b500140aa16 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -57,7 +57,7 @@ public class ChunkHolder { +@@ -60,7 +60,7 @@ public class ChunkHolder { private final DebugBuffer chunkToSaveHistory; public int oldTicketLevel; private int ticketLevel; @@ -92,7 +92,7 @@ index 5479deb3f80a95c58cb6f0f532b2f56b71a68a3a..b62d7a85db012265dd4fae02cbed5363 public final ChunkPos pos; private boolean hasChangedSections; private final ShortSet[] changedBlocksPerSection; -@@ -70,6 +70,7 @@ public class ChunkHolder { +@@ -73,6 +73,7 @@ public class ChunkHolder { private boolean resendLight; private CompletableFuture pendingFullStateConfirmation; @@ -100,7 +100,7 @@ index 5479deb3f80a95c58cb6f0f532b2f56b71a68a3a..b62d7a85db012265dd4fae02cbed5363 boolean isUpdateQueued = false; // Paper private final ChunkMap chunkMap; // Paper -@@ -424,12 +425,18 @@ public class ChunkHolder { +@@ -437,12 +438,18 @@ public class ChunkHolder { }); } @@ -119,7 +119,7 @@ index 5479deb3f80a95c58cb6f0f532b2f56b71a68a3a..b62d7a85db012265dd4fae02cbed5363 ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel); ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel); boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE; -@@ -440,9 +447,22 @@ public class ChunkHolder { +@@ -453,9 +460,22 @@ public class ChunkHolder { // ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins. if (playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) { this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> { @@ -143,7 +143,7 @@ index 5479deb3f80a95c58cb6f0f532b2f56b71a68a3a..b62d7a85db012265dd4fae02cbed5363 // Minecraft will apply the chunks tick lists to the world once the chunk got loaded, and then store the tick // lists again inside the chunk once the chunk becomes inaccessible and set the chunk's needsSaving flag. // These actions may however happen deferred, so we manually set the needsSaving flag already here. -@@ -499,12 +519,14 @@ public class ChunkHolder { +@@ -512,12 +532,14 @@ public class ChunkHolder { this.scheduleFullChunkPromotion(chunkStorage, this.fullChunkFuture, executor, ChunkHolder.FullChunkStatus.BORDER); // Paper start - cache ticking ready status this.fullChunkFuture.thenAccept(either -> { @@ -158,7 +158,7 @@ index 5479deb3f80a95c58cb6f0f532b2f56b71a68a3a..b62d7a85db012265dd4fae02cbed5363 } }); this.updateChunkToSave(this.fullChunkFuture, "full"); -@@ -525,6 +547,7 @@ public class ChunkHolder { +@@ -538,6 +560,7 @@ public class ChunkHolder { this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, ChunkHolder.FullChunkStatus.TICKING); // Paper start - cache ticking ready status this.tickingChunkFuture.thenAccept(either -> { @@ -166,7 +166,7 @@ index 5479deb3f80a95c58cb6f0f532b2f56b71a68a3a..b62d7a85db012265dd4fae02cbed5363 either.ifLeft(chunk -> { // note: Here is a very good place to add callbacks to logic waiting on this. ChunkHolder.this.isTickingReady = true; -@@ -560,6 +583,7 @@ public class ChunkHolder { +@@ -573,6 +596,7 @@ public class ChunkHolder { this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, ChunkHolder.FullChunkStatus.ENTITY_TICKING); // Paper start - cache ticking ready status this.entityTickingChunkFuture.thenAccept(either -> { @@ -174,7 +174,7 @@ index 5479deb3f80a95c58cb6f0f532b2f56b71a68a3a..b62d7a85db012265dd4fae02cbed5363 either.ifLeft(chunk -> { ChunkHolder.this.isEntityTickingReady = true; // Paper start - entity ticking chunk set -@@ -586,16 +610,45 @@ public class ChunkHolder { +@@ -599,16 +623,45 @@ public class ChunkHolder { this.demoteFullChunk(chunkStorage, playerchunk_state1); } @@ -223,7 +223,7 @@ index 5479deb3f80a95c58cb6f0f532b2f56b71a68a3a..b62d7a85db012265dd4fae02cbed5363 }); } }).exceptionally((throwable) -> { -@@ -710,7 +763,134 @@ public class ChunkHolder { +@@ -733,7 +786,134 @@ public class ChunkHolder { }; } @@ -360,10 +360,10 @@ index 5479deb3f80a95c58cb6f0f532b2f56b71a68a3a..b62d7a85db012265dd4fae02cbed5363 return this.isEntityTickingReady; } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index e66e4d1656e5f6f042c5c63715e13a6b5e7d81c5..aef2974ecec878a014ada9619d814ae333f4923a 100644 +index 36181d03c44f2ee4a129129b6fe253f25748af2d..679306d4b4607954fe1d68c9bede6e37b408d399 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -128,6 +128,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -131,6 +131,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final ServerLevel level; private final ThreadedLevelLightEngine lightEngine; private final BlockableEventLoop mainThreadExecutor; @@ -371,7 +371,7 @@ index e66e4d1656e5f6f042c5c63715e13a6b5e7d81c5..aef2974ecec878a014ada9619d814ae3 public ChunkGenerator generator; public final Supplier overworldDataStorage; private final PoiManager poiManager; -@@ -315,6 +316,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -320,6 +321,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.level = world; this.generator = chunkGenerator; this.mainThreadExecutor = mainThreadExecutor; @@ -387,7 +387,7 @@ index e66e4d1656e5f6f042c5c63715e13a6b5e7d81c5..aef2974ecec878a014ada9619d814ae3 ProcessorMailbox threadedmailbox = ProcessorMailbox.create(executor, "worldgen"); Objects.requireNonNull(mainThreadExecutor); -@@ -426,6 +436,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -431,6 +441,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }); } @@ -425,7 +425,7 @@ index e66e4d1656e5f6f042c5c63715e13a6b5e7d81c5..aef2974ecec878a014ada9619d814ae3 // Paper start public void updatePlayerMobTypeMap(Entity entity) { if (!this.level.paperConfig.perPlayerMobSpawns) { -@@ -536,6 +577,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -541,6 +582,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider List list1 = new ArrayList(); int j = centerChunk.x; int k = centerChunk.z; @@ -433,7 +433,7 @@ index e66e4d1656e5f6f042c5c63715e13a6b5e7d81c5..aef2974ecec878a014ada9619d814ae3 for (int l = -margin; l <= margin; ++l) { for (int i1 = -margin; i1 <= margin; ++i1) { -@@ -554,6 +596,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -559,6 +601,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ChunkStatus chunkstatus = (ChunkStatus) distanceToStatus.apply(j1); CompletableFuture> completablefuture = playerchunk.getOrScheduleFuture(chunkstatus, this); @@ -448,7 +448,7 @@ index e66e4d1656e5f6f042c5c63715e13a6b5e7d81c5..aef2974ecec878a014ada9619d814ae3 list1.add(playerchunk); list.add(completablefuture); -@@ -889,11 +939,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -930,11 +980,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (requiredStatus == ChunkStatus.EMPTY) { return this.scheduleChunkLoad(chunkcoordintpair); } else { @@ -469,7 +469,7 @@ index e66e4d1656e5f6f042c5c63715e13a6b5e7d81c5..aef2974ecec878a014ada9619d814ae3 if (optional.isPresent() && ((ChunkAccess) optional.get()).getStatus().isOrAfter(requiredStatus)) { CompletableFuture> completablefuture = requiredStatus.load(this.level, this.structureManager, this.lightEngine, (ichunkaccess) -> { -@@ -905,6 +963,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -946,6 +1004,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } else { return this.scheduleChunkGeneration(holder, requiredStatus); } @@ -477,7 +477,7 @@ index e66e4d1656e5f6f042c5c63715e13a6b5e7d81c5..aef2974ecec878a014ada9619d814ae3 } } -@@ -961,14 +1020,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1002,14 +1061,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }; CompletableFuture chunkSaveFuture = this.level.asyncChunkTaskManager.getChunkSaveFuture(pos.x, pos.z); @@ -507,7 +507,7 @@ index e66e4d1656e5f6f042c5c63715e13a6b5e7d81c5..aef2974ecec878a014ada9619d814ae3 return ret; // Paper end } -@@ -1020,7 +1089,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1061,7 +1130,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.releaseLightTicket(chunkcoordintpair); return CompletableFuture.completedFuture(Either.right(playerchunk_failure)); }); @@ -519,7 +519,7 @@ index e66e4d1656e5f6f042c5c63715e13a6b5e7d81c5..aef2974ecec878a014ada9619d814ae3 } protected void releaseLightTicket(ChunkPos pos) { -@@ -1104,7 +1176,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1145,7 +1217,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider long i = chunkHolder.getPos().toLong(); Objects.requireNonNull(chunkHolder); @@ -529,10 +529,10 @@ index e66e4d1656e5f6f042c5c63715e13a6b5e7d81c5..aef2974ecec878a014ada9619d814ae3 } diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index 93a642cd6cf21a268074a73bff22249d32992ad3..7c66e4ed02c80521196b4ca797477dd9573752d8 100644 +index d6bb8610de3c2e468c964f131564e54b392534f1..005d75c93387a8c34a9ff7413ba09cb1ae788a74 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -127,6 +127,7 @@ public abstract class DistanceManager { +@@ -128,6 +128,7 @@ public abstract class DistanceManager { } private static int getTicketLevelAt(SortedArraySet> tickets) { @@ -540,7 +540,7 @@ index 93a642cd6cf21a268074a73bff22249d32992ad3..7c66e4ed02c80521196b4ca797477dd9 return !tickets.isEmpty() ? ((Ticket) tickets.first()).getTicketLevel() : ChunkMap.MAX_CHUNK_DISTANCE + 1; } -@@ -141,6 +142,7 @@ public abstract class DistanceManager { +@@ -142,6 +143,7 @@ public abstract class DistanceManager { public boolean runAllUpdates(ChunkMap chunkStorage) { //this.f.a(); // Paper - no longer used this.tickingTicketsTracker.runAllUpdates(); @@ -548,7 +548,7 @@ index 93a642cd6cf21a268074a73bff22249d32992ad3..7c66e4ed02c80521196b4ca797477dd9 this.playerTicketManager.runAllUpdates(); int i = Integer.MAX_VALUE - this.ticketTracker.runDistanceUpdates(Integer.MAX_VALUE); boolean flag = i != 0; -@@ -151,11 +153,13 @@ public abstract class DistanceManager { +@@ -152,11 +154,13 @@ public abstract class DistanceManager { // Paper start if (!this.pendingChunkUpdates.isEmpty()) { @@ -562,7 +562,7 @@ index 93a642cd6cf21a268074a73bff22249d32992ad3..7c66e4ed02c80521196b4ca797477dd9 // Paper end return true; } else { -@@ -191,8 +195,10 @@ public abstract class DistanceManager { +@@ -192,8 +196,10 @@ public abstract class DistanceManager { return flag; } } @@ -573,7 +573,7 @@ index 93a642cd6cf21a268074a73bff22249d32992ad3..7c66e4ed02c80521196b4ca797477dd9 SortedArraySet> arraysetsorted = this.getTickets(i); int j = DistanceManager.getTicketLevelAt(arraysetsorted); Ticket ticket1 = (Ticket) arraysetsorted.addOrGet(ticket); -@@ -206,7 +212,9 @@ public abstract class DistanceManager { +@@ -207,7 +213,9 @@ public abstract class DistanceManager { } boolean removeTicket(long i, Ticket ticket) { // CraftBukkit - void -> boolean @@ -583,7 +583,7 @@ index 93a642cd6cf21a268074a73bff22249d32992ad3..7c66e4ed02c80521196b4ca797477dd9 boolean removed = false; // CraftBukkit if (arraysetsorted.remove(ticket)) { -@@ -238,7 +246,12 @@ public abstract class DistanceManager { +@@ -239,7 +247,12 @@ public abstract class DistanceManager { this.tickets.remove(i); } @@ -597,7 +597,7 @@ index 93a642cd6cf21a268074a73bff22249d32992ad3..7c66e4ed02c80521196b4ca797477dd9 return removed; // CraftBukkit } -@@ -286,6 +299,112 @@ public abstract class DistanceManager { +@@ -289,6 +302,112 @@ public abstract class DistanceManager { }); } @@ -711,10 +711,10 @@ index 93a642cd6cf21a268074a73bff22249d32992ad3..7c66e4ed02c80521196b4ca797477dd9 Ticket ticket = new Ticket<>(TicketType.FORCED, 31, pos); long i = pos.toLong(); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index fdc027bc5a7e9d691ac90c5fee0cdfebd959bc5f..0eca545278568f5521bd721ff5bdcd7090c75e6e 100644 +index 9fdd2a39e3590b3098fa31b9b0e0081160819630..1b81ae617a43aa4723a879c150ce8e611c5369d9 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -601,6 +601,26 @@ public class ServerChunkCache extends ChunkSource { +@@ -597,6 +597,26 @@ public class ServerChunkCache extends ChunkSource { return CompletableFuture.completedFuture(either); }, this.mainThreadProcessor); } @@ -741,7 +741,7 @@ index fdc027bc5a7e9d691ac90c5fee0cdfebd959bc5f..0eca545278568f5521bd721ff5bdcd70 // Paper end - async chunk io @Nullable -@@ -641,6 +661,8 @@ public class ServerChunkCache extends ChunkSource { +@@ -637,6 +657,8 @@ public class ServerChunkCache extends ChunkSource { Objects.requireNonNull(completablefuture); if (!completablefuture.isDone()) { // Paper // Paper start - async chunk io/loading @@ -750,7 +750,7 @@ index fdc027bc5a7e9d691ac90c5fee0cdfebd959bc5f..0eca545278568f5521bd721ff5bdcd70 this.level.asyncChunkTaskManager.raisePriority(x1, z1, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY); com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.level, x1, z1); // Paper end -@@ -649,6 +671,8 @@ public class ServerChunkCache extends ChunkSource { +@@ -645,6 +667,8 @@ public class ServerChunkCache extends ChunkSource { chunkproviderserver_b.managedBlock(completablefuture::isDone); com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug this.level.timings.syncChunkLoad.stopTiming(); // Paper @@ -759,7 +759,7 @@ index fdc027bc5a7e9d691ac90c5fee0cdfebd959bc5f..0eca545278568f5521bd721ff5bdcd70 } // Paper ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { return ichunkaccess1; -@@ -722,10 +746,12 @@ public class ServerChunkCache extends ChunkSource { +@@ -718,10 +742,12 @@ public class ServerChunkCache extends ChunkSource { if (create && !currentlyUnloading) { // CraftBukkit end this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair); @@ -772,7 +772,7 @@ index fdc027bc5a7e9d691ac90c5fee0cdfebd959bc5f..0eca545278568f5521bd721ff5bdcd70 this.runDistanceManagerUpdates(); playerchunk = this.getVisibleChunkIfPresent(k); gameprofilerfiller.pop(); -@@ -735,7 +761,13 @@ public class ServerChunkCache extends ChunkSource { +@@ -731,7 +757,13 @@ public class ServerChunkCache extends ChunkSource { } } @@ -787,7 +787,7 @@ index fdc027bc5a7e9d691ac90c5fee0cdfebd959bc5f..0eca545278568f5521bd721ff5bdcd70 } private boolean chunkAbsent(@Nullable ChunkHolder holder, int maxLevel) { -@@ -787,6 +819,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -783,6 +815,7 @@ public class ServerChunkCache extends ChunkSource { } public boolean runDistanceManagerUpdates() { @@ -796,10 +796,10 @@ index fdc027bc5a7e9d691ac90c5fee0cdfebd959bc5f..0eca545278568f5521bd721ff5bdcd70 boolean flag1 = this.chunkMap.promoteChunkMap(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index d2280b9e9f107dca890bc76f0c58e7070ce4b38c..c68b95ef0d4c3e0d942e61bfccf23a00d0d8afd9 100644 +index d11b5c9e64b6695a44cc2db588bed2e8a870c607..1136a3e406b3683ba7498a7903ed32e7053ffd1d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -186,6 +186,7 @@ public class ServerPlayer extends Player { +@@ -184,6 +184,7 @@ public class ServerPlayer extends Player { private int lastRecordedArmor = Integer.MIN_VALUE; private int lastRecordedLevel = Integer.MIN_VALUE; private int lastRecordedExperience = Integer.MIN_VALUE; @@ -807,7 +807,7 @@ index d2280b9e9f107dca890bc76f0c58e7070ce4b38c..c68b95ef0d4c3e0d942e61bfccf23a00 private float lastSentHealth = -1.0E8F; private int lastSentFood = -99999999; private boolean lastFoodSaturationZero = true; -@@ -329,6 +330,21 @@ public class ServerPlayer extends Player { +@@ -327,6 +328,21 @@ public class ServerPlayer extends Player { this.maxHealthCache = this.getMaxHealth(); this.cachedSingleMobDistanceMap = new com.destroystokyo.paper.util.PooledHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper } @@ -830,28 +830,12 @@ index d2280b9e9f107dca890bc76f0c58e7070ce4b38c..c68b95ef0d4c3e0d942e61bfccf23a00 // Yes, this doesn't match Vanilla, but it's the best we can do for now. // If this is an issue, PRs are welcome diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java -index c0ef95f83f2d13025bedd4bcc7e177cee66b5470..fec2a2a9f958492eefbbffcaf8179a2fac5a4d99 100644 +index 43fcd179b43a2c64e6ea71da537263cc516485a0..bd475554a630fb68433dd6e6640586cf5240cfed 100644 --- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java +++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java -@@ -1,6 +1,7 @@ - package net.minecraft.server.level; - - import com.mojang.datafixers.util.Pair; -+import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; // Paper - import it.unimi.dsi.fastutil.objects.ObjectArrayList; - import it.unimi.dsi.fastutil.objects.ObjectList; - import it.unimi.dsi.fastutil.objects.ObjectListIterator; -@@ -16,6 +17,7 @@ import net.minecraft.util.thread.ProcessorMailbox; - import net.minecraft.world.level.ChunkPos; - import net.minecraft.world.level.LightLayer; - import net.minecraft.world.level.chunk.ChunkAccess; -+import net.minecraft.world.level.chunk.ChunkStatus; - import net.minecraft.world.level.chunk.DataLayer; - import net.minecraft.world.level.chunk.LevelChunkSection; - import net.minecraft.world.level.chunk.LightChunkGetter; -@@ -26,15 +28,140 @@ import org.apache.logging.log4j.Logger; +@@ -26,15 +26,140 @@ import org.slf4j.Logger; public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCloseable { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final ProcessorMailbox taskMailbox; - private final ObjectList> lightTasks = new ObjectArrayList<>(); - private final ChunkMap chunkMap; @@ -886,13 +870,13 @@ index c0ef95f83f2d13025bedd4bcc7e177cee66b5470..fec2a2a9f958492eefbbffcaf8179a2f + // Retain the chunks priority level for queued light tasks + class LightQueue { + private int size = 0; -+ private final Long2ObjectLinkedOpenHashMap[] buckets = new Long2ObjectLinkedOpenHashMap[MAX_PRIORITIES]; ++ private final it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap[] buckets = new it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap[MAX_PRIORITIES]; + private final java.util.concurrent.ConcurrentLinkedQueue pendingTasks = new java.util.concurrent.ConcurrentLinkedQueue<>(); + private final java.util.concurrent.ConcurrentLinkedQueue priorityChanges = new java.util.concurrent.ConcurrentLinkedQueue<>(); + + private LightQueue() { + for (int i = 0; i < buckets.length; i++) { -+ buckets[i] = new Long2ObjectLinkedOpenHashMap<>(); ++ buckets[i] = new it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<>(); + } + } + @@ -952,10 +936,10 @@ index c0ef95f83f2d13025bedd4bcc7e177cee66b5470..fec2a2a9f958492eefbbffcaf8179a2f + run.run(); + } + boolean hasWork = false; -+ Long2ObjectLinkedOpenHashMap[] buckets = this.buckets; ++ it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap[] buckets = this.buckets; + int priority = 0; + while (priority < MAX_PRIORITIES && !isEmpty()) { -+ Long2ObjectLinkedOpenHashMap bucket = buckets[priority]; ++ it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap bucket = buckets[priority]; + if (bucket.isEmpty()) { + priority++; + if (hasWork) { @@ -993,7 +977,7 @@ index c0ef95f83f2d13025bedd4bcc7e177cee66b5470..fec2a2a9f958492eefbbffcaf8179a2f this.sorterMailbox = executor; this.taskMailbox = processor; } -@@ -120,13 +247,9 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -120,13 +245,9 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } private void addTask(int x, int z, IntSupplier completedLevelSupplier, ThreadedLevelLightEngine.TaskType stage, Runnable task) { @@ -1010,7 +994,7 @@ index c0ef95f83f2d13025bedd4bcc7e177cee66b5470..fec2a2a9f958492eefbbffcaf8179a2f } @Override -@@ -142,8 +265,14 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -142,8 +263,14 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl public CompletableFuture lightChunk(ChunkAccess chunk, boolean excludeBlocks) { ChunkPos chunkPos = chunk.getPos(); @@ -1027,7 +1011,7 @@ index c0ef95f83f2d13025bedd4bcc7e177cee66b5470..fec2a2a9f958492eefbbffcaf8179a2f LevelChunkSection[] levelChunkSections = chunk.getSections(); for(int i = 0; i < chunk.getSectionsCount(); ++i) { -@@ -163,51 +292,45 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -163,51 +290,45 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl }, () -> { return "lightChunk " + chunkPos + " " + excludeBlocks; @@ -1128,7 +1112,7 @@ index 8770fe0db46b01e8b608637df4f1a669a3f4cdde..3c1698ba0d3bc412ab957777d9b5211d private final String name; private final Comparator comparator; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index d06e43bfaf8d22e0374bb6ed2e62c65e15699ef5..373f1c600ecdf75293dbe5ff6ef676a0e35e2e80 100644 +index c154f5e7708dbb19cf1b1a546bb209d386ef52d4..78270cdd1e8f371f951d317f6cf438069e81c958 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -175,6 +175,7 @@ public abstract class PlayerList { @@ -1151,10 +1135,10 @@ index d06e43bfaf8d22e0374bb6ed2e62c65e15699ef5..373f1c600ecdf75293dbe5ff6ef676a0 if (updatingChunk != null) { return updatingChunk.getEntityTickingChunkFuture(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 0b54c4e229aab803683101d7e2b1780ae41b42e0..cd1e850c1d55d203ecba40719a0578a69c33492c 100644 +index a702a53f588ddd9f748f55973cd3782734aafc51..e18b2855791002a20f5afaa87cbfb36023ba4b7f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -228,7 +228,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -231,7 +231,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i private BlockPos blockPosition; private ChunkPos chunkPosition; private Vec3 deltaMovement; @@ -1164,7 +1148,7 @@ index 0b54c4e229aab803683101d7e2b1780ae41b42e0..cd1e850c1d55d203ecba40719a0578a6 public float yRotO; public float xRotO; 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 6eaba33b7730d66bf631b6d5c6a7080f9f019f8b..8e03e63a00dd242791ba0d5a8a17922227b16165 100644 +index bf4e03237225058efc63e23ac3ddb49c339b9f08..937ff5dfb9d2950b80eff57dde27222551c352fe 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -141,7 +141,7 @@ public class LevelChunk extends ChunkAccess { @@ -1193,10 +1177,10 @@ index 6eaba33b7730d66bf631b6d5c6a7080f9f019f8b..8e03e63a00dd242791ba0d5a8a179222 org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isUnsaved()); server.getPluginManager().callEvent(unloadEvent); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d4df7a712738d53aa7b9876a2fea9a09b9e3caf1..bbba0658990cf6f10d09b78204788c8b5ad08787 100644 +index 7bb753f498b10be32726771250dca7e15338d8d1..3741dc458bf78be17144528ef041484863ef53ec 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1989,6 +1989,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1992,6 +1992,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { return future; } diff --git a/patches/server/0471-Optimize-NetworkManager-Exception-Handling.patch b/patches/server/0471-Optimize-NetworkManager-Exception-Handling.patch index 79d4327e4..013df0fbf 100644 --- a/patches/server/0471-Optimize-NetworkManager-Exception-Handling.patch +++ b/patches/server/0471-Optimize-NetworkManager-Exception-Handling.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize NetworkManager Exception Handling diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java -index ea69f11e3cd9775998679baaccdaf980ee8fd498..1e0e64568167f1525285abb043e93c8b4316d11c 100644 +index 5df72f16e6b954ecee23a6f8daa29de0d3d991fe..7789032797447d3518bf0af15e4e0dcf0826dce8 100644 --- a/src/main/java/net/minecraft/network/ConnectionProtocol.java +++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java -@@ -294,6 +294,7 @@ public enum ConnectionProtocol { +@@ -296,6 +296,7 @@ public enum ConnectionProtocol { @Nullable public Packet createPacket(int id, FriendlyByteBuf buf) { @@ -42,38 +42,28 @@ index 99b581052f937b0f2d6b5d73de699008c1d51774..ed54479b14dcfc736ac90749106557f0 for(int i = 0; i < bs.length; ++i) { diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -index 449f1b2f5dca350dc0912e14c8c2bf3eb4652b92..bcf53ec07b8eeec7a88fb67e6fb908362e6f51b0 100644 +index 049e64c355d5f064009b1107ad15d28c44f999dd..97b05b7145c6a3a379de31b8988c909da9b21139 100644 --- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java +++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -@@ -1,6 +1,9 @@ - package net.minecraft.network.protocol; - -+import net.minecraft.network.Connection; - import net.minecraft.network.PacketListener; -+import net.minecraft.network.chat.TextComponent; -+import net.minecraft.network.protocol.game.ClientboundDisconnectPacket; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - import co.aikar.timings.MinecraftTimings; // Paper -@@ -32,6 +35,21 @@ public class PacketUtils { - try (Timing ignored = timing.startTiming()) { // Paper - timings - packet.handle(listener); - } // Paper - timings -+ // Paper start -+ catch (Exception e) { -+ Connection networkmanager = listener.getConnection(); +@@ -30,11 +30,17 @@ public class PacketUtils { + try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings + packet.handle(listener); + } catch (Exception exception) { +- if (listener.shouldPropagateHandlingExceptions()) { +- throw exception; ++ net.minecraft.network.Connection networkmanager = listener.getConnection(); + if (networkmanager.getPlayer() != null) { -+ LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getScoreboardName(), networkmanager.getRemoteAddress(), e); ++ LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getScoreboardName(), networkmanager.getRemoteAddress(), exception); + } else { -+ LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getRemoteAddress(), e); -+ } -+ TextComponent error = new TextComponent("Packet processing error"); -+ networkmanager.send(new ClientboundDisconnectPacket(error), (future) -> { ++ LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getRemoteAddress(), exception); + } +- +- PacketUtils.LOGGER.error("Failed to handle packet {}, suppressing error", packet, exception); ++ net.minecraft.network.chat.TextComponent error = new net.minecraft.network.chat.TextComponent("Packet processing error"); ++ networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), (future) -> { + networkmanager.disconnect(error); + }); + networkmanager.setReadOnly(); -+ } -+ // Paper end + } } else { PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet); - } diff --git a/patches/server/0475-Move-range-check-for-block-placing-up.patch b/patches/server/0475-Move-range-check-for-block-placing-up.patch index d9c035c1c..f673fb2fe 100644 --- a/patches/server/0475-Move-range-check-for-block-placing-up.patch +++ b/patches/server/0475-Move-range-check-for-block-placing-up.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Move range check for block placing up diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 1486ac77bf4621a3a2a5da6d53461bada44c27c1..93f190cb2ccf59230a453356100e8e15fc174cc0 100644 +index c55d5c2f27babd8733a83fdd89b97d11c91de1cf..67ac85c5d9222f6ccbf5fed0f06c7b62e16c5e7b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1674,6 +1674,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1682,6 +1682,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } // Spigot end @@ -25,27 +25,19 @@ index 1486ac77bf4621a3a2a5da6d53461bada44c27c1..93f190cb2ccf59230a453356100e8e15 @Override public void handleUseItemOn(ServerboundUseItemOnPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); -@@ -1688,15 +1698,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1695,6 +1705,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + BlockPos blockposition = movingobjectpositionblock.getBlockPos(); + Vec3 vec3d1 = vec3d.subtract(Vec3.atCenterOf(blockposition)); - this.player.resetLastActionTime(); - int i = this.player.level.getMaxBuildHeight(); -- // CraftBukkit start -- double distanceSqr = this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D); -- if (distanceSqr > 100.0D) { -+ + // Paper start - improve distance check + final Vec3 clickedLocation = movingobjectpositionblock.getLocation(); + if (isOutsideOfReach(blockposition.getX() + 0.5D, blockposition.getY() + 0.5D, blockposition.getZ() + 0.5D) + || !Double.isFinite(clickedLocation.x) || !Double.isFinite(clickedLocation.y) || !Double.isFinite(clickedLocation.z) + || isOutsideOfReach(clickedLocation.x, clickedLocation.y, clickedLocation.z)) { - return; - } -- // CraftBukkit end ++ return; ++ } + // Paper end - - if (blockposition.getY() < i) { -- if (this.awaitingPositionFromClient == null && distanceSqr < 64.0D && worldserver.mayInteract(this.player, blockposition)) { // CraftBukkit - reuse value -+ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) { // CraftBukkit - reuse value // Paper - revert CB change - this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706 - InteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock); ++ + if (this.player.level.getServer() != null && this.player.chunkPosition().getChessboardDistance(new ChunkPos(blockposition)) < this.player.level.spigotConfig.viewDistance) { // Spigot + double d0 = 1.0000001D; diff --git a/patches/server/0476-Fix-SPIGOT-5989.patch b/patches/server/0476-Fix-SPIGOT-5989.patch index baeb76c54..98c7bbe05 100644 --- a/patches/server/0476-Fix-SPIGOT-5989.patch +++ b/patches/server/0476-Fix-SPIGOT-5989.patch @@ -10,10 +10,10 @@ This fixes that by checking if the modified spawn location is still at a respawn anchor. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 373f1c600ecdf75293dbe5ff6ef676a0e35e2e80..8ed4d4bc6d08c8339aba57b17f068c7bef22787c 100644 +index 78270cdd1e8f371f951d317f6cf438069e81c958..8c35ca1f6507092da1bd25ce4fe2e100f3233a1a 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -78,6 +78,7 @@ import net.minecraft.world.level.GameRules; +@@ -79,6 +79,7 @@ import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.BiomeManager; import net.minecraft.world.level.block.Blocks; diff --git a/patches/server/0477-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch b/patches/server/0477-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch index 566018e25..c434ad970 100644 --- a/patches/server/0477-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch +++ b/patches/server/0477-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5824 Bukkit world-container is not used diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index afc7606e0df5dc87767444b42bb4e4b1b2f96b2d..8fb463bf0e73ff81ee3270e249258910d3e7296e 100644 +index 6a006f22d33491be4413fb64649ba9f6f51acac8..e17bb884929d4f4b7dc5b2d71234ff81d840c994 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -134,11 +134,20 @@ public class Main { +@@ -137,11 +137,20 @@ public class Main { return; } diff --git a/patches/server/0478-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch b/patches/server/0478-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch index 49987a6fa..1525de48e 100644 --- a/patches/server/0478-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch +++ b/patches/server/0478-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5885 Unable to disable advancements diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 8fb463bf0e73ff81ee3270e249258910d3e7296e..d7975e6f0c855955ac04552cfbd4c9a8c86ae188 100644 +index e17bb884929d4f4b7dc5b2d71234ff81d840c994..11ed386c6358e55fe5c0e5e8496fa7f7c663a7e2 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -134,6 +134,7 @@ public class Main { +@@ -137,6 +137,7 @@ public class Main { return; } diff --git a/patches/server/0479-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch b/patches/server/0479-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch index 0cccf4b59..935dc6919 100644 --- a/patches/server/0479-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch +++ b/patches/server/0479-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch @@ -60,10 +60,10 @@ index 06fc39b19385d36fd0c5bb9a7042a238eb6e8a57..bb1f0e9dbcb792d015d1cb65664a96fd LootContext lootContext = EntityPredicate.createContext(player, player); List> list = null; diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java -index bd858a9da2f2442be85f36bb2de0dac46d0c68d7..3ff6995d34914720d353fdbe1aa981bfab9f6040 100644 +index f8f0be77126d2f3a1c53f7405ce4de4f0dca42be..8096f01fa7f1ed73e4812912fc9b21bafdd212c8 100644 --- a/src/main/java/net/minecraft/server/PlayerAdvancements.java +++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java -@@ -39,6 +39,7 @@ import net.minecraft.advancements.Criterion; +@@ -40,6 +40,7 @@ import net.minecraft.advancements.Criterion; import net.minecraft.advancements.CriterionProgress; import net.minecraft.advancements.CriterionTrigger; import net.minecraft.advancements.CriterionTriggerInstance; diff --git a/patches/server/0480-Add-missing-strikeLighting-call-to-World-spigot-stri.patch b/patches/server/0480-Add-missing-strikeLighting-call-to-World-spigot-stri.patch index 4512aa6fb..845f19b2f 100644 --- a/patches/server/0480-Add-missing-strikeLighting-call-to-World-spigot-stri.patch +++ b/patches/server/0480-Add-missing-strikeLighting-call-to-World-spigot-stri.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add missing strikeLighting call to diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index bbba0658990cf6f10d09b78204788c8b5ad08787..1f22f4d22959f210f7a374d0194d853d88f4dc1c 100644 +index 3741dc458bf78be17144528ef041484863ef53ec..6bd208485b8d7d4fb2eb80811304dfa626c95dfe 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2078,6 +2078,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2081,6 +2081,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { lightning.moveTo( loc.getX(), loc.getY(), loc.getZ() ); lightning.visualOnly = true; lightning.isSilent = isSilent; diff --git a/patches/server/0483-Do-not-let-the-server-load-chunks-from-newer-version.patch b/patches/server/0483-Do-not-let-the-server-load-chunks-from-newer-version.patch index 0ab51e6a0..a26acb8e1 100644 --- a/patches/server/0483-Do-not-let-the-server-load-chunks-from-newer-version.patch +++ b/patches/server/0483-Do-not-let-the-server-load-chunks-from-newer-version.patch @@ -9,10 +9,10 @@ the game, immediately stop the server to prevent data corruption. You can override this functionality at your own peril. diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 1267e93d1e315d55086a87670fd098db552c3afd..8866ded0567fee710aa301dbc89f4c45b7283447 100644 +index 78058b505742541a484cadc790c445bdfb9c1136..7de66cec1eeaf797d61c815a34267c3dc85f0719 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -109,9 +109,22 @@ public class ChunkSerializer { +@@ -111,9 +111,22 @@ public class ChunkSerializer { return holder.protoChunk; } diff --git a/patches/server/0484-Brand-support.patch b/patches/server/0484-Brand-support.patch index 63f74c0a2..9c1f018d0 100644 --- a/patches/server/0484-Brand-support.patch +++ b/patches/server/0484-Brand-support.patch @@ -5,18 +5,10 @@ Subject: [PATCH] Brand support diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 93f190cb2ccf59230a453356100e8e15fc174cc0..d43b3433879bcfad7ceca6bc67c5d101438c4dfb 100644 +index 67ac85c5d9222f6ccbf5fed0f06c7b62e16c5e7b..b0b715660d17751d4bc6c8d23dc288ca246608ec 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -4,6 +4,7 @@ import com.google.common.collect.Lists; - import com.google.common.primitives.Floats; - import com.mojang.brigadier.ParseResults; - import com.mojang.brigadier.StringReader; -+import io.netty.buffer.Unpooled; - import io.netty.util.concurrent.Future; - import io.netty.util.concurrent.GenericFutureListener; - import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry; -@@ -37,6 +38,7 @@ import net.minecraft.nbt.CompoundTag; +@@ -38,6 +38,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.StringTag; import net.minecraft.network.Connection; @@ -24,7 +16,7 @@ index 93f190cb2ccf59230a453356100e8e15fc174cc0..d43b3433879bcfad7ceca6bc67c5d101 import net.minecraft.network.chat.ChatType; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; -@@ -257,6 +259,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -258,6 +259,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit @@ -33,7 +25,7 @@ index 93f190cb2ccf59230a453356100e8e15fc174cc0..d43b3433879bcfad7ceca6bc67c5d101 public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { this.server = server; this.connection = connection; -@@ -3003,6 +3007,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3033,6 +3036,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register"); private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister"); @@ -42,14 +34,14 @@ index 93f190cb2ccf59230a453356100e8e15fc174cc0..d43b3433879bcfad7ceca6bc67c5d101 @Override public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); -@@ -3030,6 +3036,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3060,6 +3065,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser try { byte[] data = new byte[packet.data.readableBytes()]; packet.data.readBytes(data); + // Paper start - Brand support + if (packet.identifier.equals(MINECRAFT_BRAND)) { + try { -+ this.clientBrandName = new FriendlyByteBuf(Unpooled.copiedBuffer(data)).readUtf(256); ++ this.clientBrandName = new FriendlyByteBuf(io.netty.buffer.Unpooled.copiedBuffer(data)).readUtf(256); + } catch (StringIndexOutOfBoundsException ex) { + this.clientBrandName = "illegal"; + } @@ -58,7 +50,7 @@ index 93f190cb2ccf59230a453356100e8e15fc174cc0..d43b3433879bcfad7ceca6bc67c5d101 this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); -@@ -3039,6 +3054,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3069,6 +3083,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } diff --git a/patches/server/0485-Add-setMaxPlayers-API.patch b/patches/server/0485-Add-setMaxPlayers-API.patch index 1b9c59e4a..ba2b6710f 100644 --- a/patches/server/0485-Add-setMaxPlayers-API.patch +++ b/patches/server/0485-Add-setMaxPlayers-API.patch @@ -5,23 +5,23 @@ Subject: [PATCH] Add #setMaxPlayers API diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 8ed4d4bc6d08c8339aba57b17f068c7bef22787c..35cf9c8235534a5c59065718ff57873f9c00bfdc 100644 +index 8c35ca1f6507092da1bd25ce4fe2e100f3233a1a..1dcdc093e7e304ca2479b268bd4e8a07b8c5735a 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -144,7 +144,7 @@ public abstract class PlayerList { public final PlayerDataStorage playerIo; private boolean doWhiteList; - private final RegistryAccess.RegistryHolder registryHolder; + private final RegistryAccess.Frozen registryHolder; - protected final int maxPlayers; + protected int maxPlayers; public final void setMaxPlayers(int maxPlayers) { this.maxPlayers = maxPlayers; } // Paper - remove final and add setter private int viewDistance; private int simulationDistance; private boolean allowCheatsForAllPlayers; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index dd49caa38c2934eab581ad5c3393693bc03716d2..01fc3f252f6a05aa97df29b88acf0ff3ef8dfcb7 100644 +index 829f97c44a68acf7ed59c6790461bcb1c0cd4de8..18cd4950472d91d711c301a80f0946520dd87f84 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -671,6 +671,13 @@ public final class CraftServer implements Server { +@@ -667,6 +667,13 @@ public final class CraftServer implements Server { return this.playerList.getMaxPlayers(); } diff --git a/patches/server/0488-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/0488-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index 9642087ab..e7d888ee2 100644 --- a/patches/server/0488-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/patches/server/0488-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 3b99a6dda3638f3a7212d7c9fab5470409de4e6f..a57f9b332a9d3341e994a4c8d7dc80473c521493 100644 +index e4422ec63abf90e78a7ff6b12cb613234960e59a..116c9f57b91aad9928ef0834e9b46546553595b4 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1743,6 +1743,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1751,6 +1751,7 @@ public class ServerLevel extends Level implements WorldGenLevel { //ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c())); this.levelData.setSpawn(pos, angle); @@ -17,10 +17,10 @@ index 3b99a6dda3638f3a7212d7c9fab5470409de4e6f..a57f9b332a9d3341e994a4c8d7dc8047 // if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 1f22f4d22959f210f7a374d0194d853d88f4dc1c..c68f03e876e7d8d1ba694dccc3b208527d004240 100644 +index 6bd208485b8d7d4fb2eb80811304dfa626c95dfe..0f53de1e9fb15f4f63106f38aef6c398bdb87d78 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -253,11 +253,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -256,11 +256,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { public boolean setSpawnLocation(int x, int y, int z, float angle) { try { Location previousLocation = this.getSpawnLocation(); diff --git a/patches/server/0489-Add-moon-phase-API.patch b/patches/server/0489-Add-moon-phase-API.patch index b33b285c2..1fce89561 100644 --- a/patches/server/0489-Add-moon-phase-API.patch +++ b/patches/server/0489-Add-moon-phase-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add moon phase API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index c68f03e876e7d8d1ba694dccc3b208527d004240..5012fc9626e522b34e79f265f794365e8f359b96 100644 +index 0f53de1e9fb15f4f63106f38aef6c398bdb87d78..e8dd6a2de3a09e6144d42d16071de186a2b32817 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -191,6 +191,11 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -194,6 +194,11 @@ public class CraftWorld extends CraftRegionAccessor implements World { public int getPlayerCount() { return world.players().size(); } diff --git a/patches/server/0490-Improve-Chunk-Status-Transition-Speed.patch b/patches/server/0490-Improve-Chunk-Status-Transition-Speed.patch index d5c6e8226..14f78ac17 100644 --- a/patches/server/0490-Improve-Chunk-Status-Transition-Speed.patch +++ b/patches/server/0490-Improve-Chunk-Status-Transition-Speed.patch @@ -36,10 +36,10 @@ scenario / path: Previously would have hopped to SERVER around 12+ times there extra. diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index b62d7a85db012265dd4fae02cbed5363a41d536b..9810810467a9052f3362056e9372dd3d0f56b417 100644 +index 6ba7e2713452c4c6f48a1a825ef27b500140aa16..cd4328bd606d778ebb45f36af8cf23d88edef881 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -92,6 +92,13 @@ public class ChunkHolder { +@@ -95,6 +95,13 @@ public class ChunkHolder { // Paper end - optimise anyPlayerCloseEnoughForSpawning long lastAutoSaveTime; // Paper - incremental autosave long inactiveTimeStart; // Paper - incremental autosave @@ -54,10 +54,10 @@ index b62d7a85db012265dd4fae02cbed5363a41d536b..9810810467a9052f3362056e9372dd3d public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) { this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size()); diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index aef2974ecec878a014ada9619d814ae333f4923a..f4a10bd3bbd421999b5ab2d5896b1aec57eb6a82 100644 +index 679306d4b4607954fe1d68c9bede6e37b408d399..f79509a529d4e682b5e370ddd99539afd1934f73 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -655,7 +655,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -691,7 +691,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return either.mapLeft((list) -> { return (LevelChunk) list.get(list.size() / 2); }); @@ -66,7 +66,7 @@ index aef2974ecec878a014ada9619d814ae333f4923a..f4a10bd3bbd421999b5ab2d5896b1aec } @Nullable -@@ -1060,6 +1060,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1101,6 +1101,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return "chunkGenerate " + requiredStatus.getName(); }); Executor executor = (runnable) -> { diff --git a/patches/server/0494-Buffer-joins-to-world.patch b/patches/server/0494-Buffer-joins-to-world.patch index 5db79b54e..36aff9e06 100644 --- a/patches/server/0494-Buffer-joins-to-world.patch +++ b/patches/server/0494-Buffer-joins-to-world.patch @@ -24,10 +24,10 @@ index 1fd89294fabcd2a390ba7f1502acbfeb9a2343d6..8111e5e1752d93f94b773e35f7ff3857 for (Map.Entry entry : commands.entrySet()) { MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue()); diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index fc33e1dd5db461d380cfcbb3dacea095dd55b757..93a75f66935b19475aa878ebb00b44f35b3e29d6 100644 +index c469688c2b55b1c93435a2ac6e8e4494ab7e5229..1c63947958d202d00593e2b76d113c8b327706d7 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -37,6 +37,7 @@ import net.minecraft.network.protocol.Packet; +@@ -40,6 +40,7 @@ import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketFlow; import net.minecraft.network.protocol.game.ClientboundDisconnectPacket; import net.minecraft.network.protocol.login.ClientboundLoginDisconnectPacket; @@ -35,7 +35,7 @@ index fc33e1dd5db461d380cfcbb3dacea095dd55b757..93a75f66935b19475aa878ebb00b44f3 import net.minecraft.server.RunningOnDifferentThreadException; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.server.network.ServerLoginPacketListenerImpl; -@@ -373,10 +374,22 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -385,10 +386,22 @@ public class Connection extends SimpleChannelInboundHandler> { } // Paper end diff --git a/patches/server/0496-Fix-hex-colors-not-working-in-some-kick-messages.patch b/patches/server/0496-Fix-hex-colors-not-working-in-some-kick-messages.patch index bace25f98..21d66a60d 100644 --- a/patches/server/0496-Fix-hex-colors-not-working-in-some-kick-messages.patch +++ b/patches/server/0496-Fix-hex-colors-not-working-in-some-kick-messages.patch @@ -43,10 +43,10 @@ index 687308a414095f95b567a2993b679d8b62856578..54de844431cf9cc88d6e82014d5eb69b this.connection.disconnect(chatmessage); return; diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 1766a22e65af2e08611a9435c7384377120406de..8dc1e8bba37986c75966e321614ebb6366729c29 100644 +index d21f45d983bf3047811d2d73f4a38deb108ac402..ab21f25a3eb0575d08aeac717ba2b74160f54fa9 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -106,14 +106,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -102,14 +102,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener // CraftBukkit start @Deprecated public void disconnect(String s) { diff --git a/patches/server/0497-PortalCreateEvent-needs-to-know-its-entity.patch b/patches/server/0497-PortalCreateEvent-needs-to-know-its-entity.patch index 19b2867cf..dc90dbfec 100644 --- a/patches/server/0497-PortalCreateEvent-needs-to-know-its-entity.patch +++ b/patches/server/0497-PortalCreateEvent-needs-to-know-its-entity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PortalCreateEvent needs to know its entity diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 6dd68c17d5365fecfbd15cfaac837e0869cdce2e..9afecaa4cfa0466abb691977e55bcddb64b7feda 100644 +index 1edd9d27a3af291e7ed9900009d0f6c30845e0b7..dc192218aa2e325040dc2bf0f8586e1c1577e4c7 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -409,7 +409,7 @@ public final class ItemStack { +@@ -419,7 +419,7 @@ public final class ItemStack { net.minecraft.world.level.block.state.BlockState block = world.getBlockState(newblockposition); if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically @@ -79,10 +79,10 @@ index 08bc35b40720ca001d3f6c1185bdd11c61ec9ee1..d8e4fda2d501545e5f891bca317e2aa5 private static int getFireTickDelay(Random random) { diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 9055a82e9c91ecb8fc2ef5ac58db043ffb759168..aba21b3f30e56dc19aa914cc05c1abb364f3f348 100644 +index fdb9a60ce9e1f8e3caabe1733e32e34146d4ddf3..e5e8de790b1ab546d35ddf48583461c0b8d91acd 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -31,6 +31,7 @@ import net.minecraft.world.item.DyeColor; +@@ -33,6 +33,7 @@ import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; @@ -90,7 +90,7 @@ index 9055a82e9c91ecb8fc2ef5ac58db043ffb759168..aba21b3f30e56dc19aa914cc05c1abb3 import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.EmptyBlockGetter; import net.minecraft.world.level.Level; -@@ -132,6 +133,12 @@ public abstract class BlockBehaviour { +@@ -134,6 +135,12 @@ public abstract class BlockBehaviour { DebugPackets.sendNeighborsUpdatePacket(world, pos); } @@ -104,18 +104,18 @@ index 9055a82e9c91ecb8fc2ef5ac58db043ffb759168..aba21b3f30e56dc19aa914cc05c1abb3 @Deprecated public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java -index c327308dd0209b952e738a01cc9cefdaece393e4..5d76674d5e181f012c0686e9915556bc93087706 100644 +index 768c39b265437641721d669d6aa85b3db49e5422..3414f3190e1a760c602613e82e551e797c3aa575 100644 --- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java +++ b/src/main/java/net/minecraft/world/level/portal/PortalShape.java -@@ -11,6 +11,7 @@ import net.minecraft.tags.BlockTags; - import net.minecraft.tags.Tag; +@@ -10,6 +10,7 @@ import net.minecraft.server.level.ServerLevel; + import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.NetherPortalBlock; -@@ -185,7 +186,10 @@ public class PortalShape { +@@ -184,7 +185,10 @@ public class PortalShape { } // CraftBukkit start - return boolean @@ -127,7 +127,7 @@ index c327308dd0209b952e738a01cc9cefdaece393e4..5d76674d5e181f012c0686e9915556bc org.bukkit.World bworld = this.level.getMinecraftWorld().getWorld(); // Copy below for loop -@@ -195,7 +199,7 @@ public class PortalShape { +@@ -194,7 +198,7 @@ public class PortalShape { this.blocks.setBlock(blockposition, iblockdata, 18); }); diff --git a/patches/server/0500-Add-methods-to-get-translation-keys.patch b/patches/server/0500-Add-methods-to-get-translation-keys.patch index 76540bf87..e586f6509 100644 --- a/patches/server/0500-Add-methods-to-get-translation-keys.patch +++ b/patches/server/0500-Add-methods-to-get-translation-keys.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add methods to get translation keys Co-authored-by: MeFisto94 diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index a918813a0faf451977686bdd6ee3aff71853f41f..8b65d48606ea422c3e53a25c013540a0eb774648 100644 +index 7eb8f37f493a83058a6e96f2e134a204b3304015..5fbfa060fc476236face04af724356dc5a21b5b5 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -620,5 +620,15 @@ public class CraftBlock implements Block { +@@ -626,5 +626,15 @@ public class CraftBlock implements Block { public com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup() { return new com.destroystokyo.paper.block.CraftBlockSoundGroup(getNMS().getBlock().defaultBlockState().getSoundType()); } @@ -42,7 +42,7 @@ index eb99e0c2462a2d1ab4508a5c3f1580b6e31d7465..c536eceef3365a7b726cd970df345ba1 public net.minecraft.world.item.enchantment.Enchantment getHandle() { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 92cf689c0c2a6602a42319d0a665b3635ca88da5..698eac97ff9ca6c52e6e04332689794d8b65fa11 100644 +index 6c2d35ab30285ffdd0e2ceda8af1293cb140f4d0..b8169a643cd15200f3a46d5a5af3542b6464ec22 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -469,6 +469,30 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0502-Cache-block-data-strings.patch b/patches/server/0502-Cache-block-data-strings.patch index 45c6cb13a..69988c87c 100644 --- a/patches/server/0502-Cache-block-data-strings.patch +++ b/patches/server/0502-Cache-block-data-strings.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Cache block data strings diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 95842327aa08d4717f86e9dcc0519ab24c41ca14..135b3e44fb6054d360327a0ce46decc451974e30 100644 +index c37f0527367f1ee842cec150a141087d83851c23..9f27e35abf7ad6fd1a13a0aca660375354ef288f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1979,6 +1979,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop= level; } -@@ -1562,6 +1563,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1567,6 +1568,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public void moveTo(double x, double y, double z, float yaw, float pitch) { @@ -57,7 +57,7 @@ index cd1e850c1d55d203ecba40719a0578a69c33492c..f91b4081bb2d9e86cb6f1c3ab3eb654a this.setYRot(yaw); this.setXRot(pitch); diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index c0f33a6cb4812e13204552c125df06210adc7196..03726227fdd60e9cf77213d50184abff438e01ef 100644 +index 70e1f9bd9e4711aaf45ff8b7214726de646997ab..4bfebbb2e87464cd47a38a5da6275b2c662fa052 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -161,6 +161,7 @@ public abstract class BaseSpawner { diff --git a/patches/server/0506-Extend-block-drop-capture-to-capture-all-items-added.patch b/patches/server/0506-Extend-block-drop-capture-to-capture-all-items-added.patch index cf729624f..77ad94378 100644 --- a/patches/server/0506-Extend-block-drop-capture-to-capture-all-items-added.patch +++ b/patches/server/0506-Extend-block-drop-capture-to-capture-all-items-added.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Extend block drop capture to capture all items added to the diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 74044db6497071debf8ad02829876e410ee4090e..0312d888c89e8d7f85cf510a653e9e08a0d08d82 100644 +index 116c9f57b91aad9928ef0834e9b46546553595b4..7f20b6806a28a8ff064aa1b539e82977e1ab0395 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1260,6 +1260,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1263,6 +1263,13 @@ public class ServerLevel extends Level implements WorldGenLevel { // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit return false; } else { @@ -24,10 +24,10 @@ index 74044db6497071debf8ad02829876e410ee4090e..0312d888c89e8d7f85cf510a653e9e08 return false; } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 954aa104912cfb65b663ca49f64fd2b59da99c55..84cf2f3584858a8729b26de1605a7626abe73923 100644 +index 176e5bbac94cf39805dcacfcae3a3daa98b793b7..d006964cb6c4c3cd843064ab685700c67df8c238 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -425,10 +425,12 @@ public class ServerPlayerGameMode { +@@ -435,10 +435,12 @@ public class ServerPlayerGameMode { // return true; // CraftBukkit } // CraftBukkit start diff --git a/patches/server/0507-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch b/patches/server/0507-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch index d97a6bdd6..542c802f1 100644 --- a/patches/server/0507-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch +++ b/patches/server/0507-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't mark dirty in invalid locations (SPIGOT-6086) diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 9810810467a9052f3362056e9372dd3d0f56b417..c2a040f735db091b5fb6017aa28a95f91ebcd9d3 100644 +index cd4328bd606d778ebb45f36af8cf23d88edef881..7407fd045c2f2d5934fb67028633575041ed7930 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -234,6 +234,7 @@ public class ChunkHolder { +@@ -238,6 +238,7 @@ public class ChunkHolder { } public void blockChanged(BlockPos pos) { diff --git a/patches/server/0508-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/0508-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index 3d58b3136..80eeafad7 100644 --- a/patches/server/0508-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/patches/server/0508-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index f91b4081bb2d9e86cb6f1c3ab3eb654a83bf1dbe..046f68a7736a9897789ee1a08465ffdea24c8dc0 100644 +index b3d636566d818aa3113501bf1620af29c62602fd..dd22f619ace097c5d6ee63ef869d564df0569b5e 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3992,4 +3992,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -4013,4 +4013,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i void accept(Entity entity, double x, double y, double z); } @@ -21,7 +21,7 @@ index f91b4081bb2d9e86cb6f1c3ab3eb654a83bf1dbe..046f68a7736a9897789ee1a08465ffde + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 698eac97ff9ca6c52e6e04332689794d8b65fa11..eaeeff92c0ff0cee9f4efaba536b750020670293 100644 +index b8169a643cd15200f3a46d5a5af3542b6464ec22..d379b14dfe18650b8c7077a3018238565853d17e 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -493,6 +493,10 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0510-Entity-isTicking.patch b/patches/server/0510-Entity-isTicking.patch index ff33d9404..209855c20 100644 --- a/patches/server/0510-Entity-isTicking.patch +++ b/patches/server/0510-Entity-isTicking.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity#isTicking diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 046f68a7736a9897789ee1a08465ffdea24c8dc0..56c138d69423cd7fc99003ff4ddf124ede1c5b95 100644 +index dd22f619ace097c5d6ee63ef869d564df0569b5e..51711841c072e0ac59922a45271298d2930e3581 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -53,6 +53,7 @@ import net.minecraft.resources.ResourceKey; +@@ -56,6 +56,7 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MCUtil; import net.minecraft.server.MinecraftServer; @@ -16,7 +16,7 @@ index 046f68a7736a9897789ee1a08465ffdea24c8dc0..56c138d69423cd7fc99003ff4ddf124e import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.TicketType; -@@ -3997,5 +3998,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -4018,5 +4019,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public static int nextEntityId() { return ENTITY_COUNTER.incrementAndGet(); } diff --git a/patches/server/0511-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch b/patches/server/0511-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch index d71261900..7eac0be75 100644 --- a/patches/server/0511-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch +++ b/patches/server/0511-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix deop kicking non-whitelisted player when white list is diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 135b3e44fb6054d360327a0ce46decc451974e30..b75522558c5277c2e8ec725e5b12eb6d4cb2c36c 100644 +index 9f27e35abf7ad6fd1a13a0aca660375354ef288f..1febf1e49f3ebe68c04efed2fd2da1ab1c6a900c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2045,13 +2045,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 1.0D) { -@@ -1295,9 +1317,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1301,9 +1323,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser AABB axisalignedbb = this.player.getBoundingBox(); diff --git a/patches/server/0515-Optimise-getType-calls.patch b/patches/server/0515-Optimise-getType-calls.patch index 0e53779ca..acb74296b 100644 --- a/patches/server/0515-Optimise-getType-calls.patch +++ b/patches/server/0515-Optimise-getType-calls.patch @@ -28,10 +28,10 @@ index 76133c77e8ebce7c9e5402e3e7cd50b30aa1c2e0..348a91a760bd728f8e732e1a35c86ab7 super(block, propertyMap, codec); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java -index dc1b73816e0e02d3a35a64e02904a034fbaeb8c9..83f8c3ab5ed1f491902e86e4cf605cfa6b10ae52 100644 +index 996cf334e3b59330d021a1b9cf991ed3c144345d..031cc00df50a3a2f68c1ab3b09f05a15d6b141c6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java -@@ -80,7 +80,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { +@@ -83,7 +83,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { public Material getBlockType(int x, int y, int z) { this.validateChunkCoordinates(x, y, z); @@ -41,10 +41,10 @@ index dc1b73816e0e02d3a35a64e02904a034fbaeb8c9..83f8c3ab5ed1f491902e86e4cf605cfa @Override diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 980f0ec9d343b4186dfeb07b9b08edfde9efeb33..aa783fb4d77c9edb58c56ff98c604a87d9583767 100644 +index 5fbfa060fc476236face04af724356dc5a21b5b5..17cfa5bd58417c541e2d922c7d7b57676246f0d8 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -215,7 +215,7 @@ public class CraftBlock implements Block { +@@ -217,7 +217,7 @@ public class CraftBlock implements Block { @Override public Material getType() { @@ -67,7 +67,7 @@ index 0a755f38fae9dc84440f43113920c5b4c6d8218b..7b9e943b391c061782fccd2b8d705cee public void setFlag(int flag) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 0949ce5ea6aa8e28494e4435e3a7f3ee07052d34..4e06795e3a74c2c3467376bd6c95aecdef125ea4 100644 +index afc69b0077f180c3e7ace3db11aa0eccc602516f..4cc67caac2be8c75cd60be5ac63c9aefcc6e2c9c 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java @@ -44,7 +44,7 @@ public class CraftBlockData implements BlockData { diff --git a/patches/server/0517-Improve-inlinig-for-some-hot-IBlockData-methods.patch b/patches/server/0517-Improve-inlinig-for-some-hot-IBlockData-methods.patch index 00f981169..75788a359 100644 --- a/patches/server/0517-Improve-inlinig-for-some-hot-IBlockData-methods.patch +++ b/patches/server/0517-Improve-inlinig-for-some-hot-IBlockData-methods.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Improve inlinig for some hot IBlockData methods diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index aba21b3f30e56dc19aa914cc05c1abb364f3f348..ce4848bdd00c091b9eb5fa2d47b03378d43c91b2 100644 +index e5e8de790b1ab546d35ddf48583461c0b8d91acd..471c4600c6663375eb340c190edaee330bf59ef2 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -700,8 +700,14 @@ public abstract class BlockBehaviour { +@@ -702,8 +702,14 @@ public abstract class BlockBehaviour { return this.shapeExceedsCube; } // Paper end @@ -23,7 +23,7 @@ index aba21b3f30e56dc19aa914cc05c1abb364f3f348..ce4848bdd00c091b9eb5fa2d47b03378 if (!this.getBlock().hasDynamicShape()) { this.cache = new BlockBehaviour.BlockStateBase.Cache(this.asState()); } -@@ -745,15 +751,15 @@ public abstract class BlockBehaviour { +@@ -747,15 +753,15 @@ public abstract class BlockBehaviour { return this.shapeExceedsCube; // Paper - moved into shape cache init } @@ -42,7 +42,7 @@ index aba21b3f30e56dc19aa914cc05c1abb364f3f348..ce4848bdd00c091b9eb5fa2d47b03378 return this.isAir; } -@@ -827,7 +833,7 @@ public abstract class BlockBehaviour { +@@ -829,7 +835,7 @@ public abstract class BlockBehaviour { } } @@ -51,7 +51,7 @@ index aba21b3f30e56dc19aa914cc05c1abb364f3f348..ce4848bdd00c091b9eb5fa2d47b03378 return this.canOcclude; } -@@ -1020,12 +1026,12 @@ public abstract class BlockBehaviour { +@@ -1030,12 +1036,12 @@ public abstract class BlockBehaviour { return this.getBlock() == block; } @@ -69,10 +69,10 @@ index aba21b3f30e56dc19aa914cc05c1abb364f3f348..ce4848bdd00c091b9eb5fa2d47b03378 public long getSeed(BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/material/FluidState.java b/src/main/java/net/minecraft/world/level/material/FluidState.java -index b0611b985efc2cc8a528ff4589fd11cbcc84ac39..5e7dc3868dbf676b7ddfc39ec1ea97ff2a9dbaae 100644 +index 2cad3a8ada797e0e8f3c24431eeca5b91740b009..3c3c873035908294a24c1e4f80d65f980c0f3db4 100644 --- a/src/main/java/net/minecraft/world/level/material/FluidState.java +++ b/src/main/java/net/minecraft/world/level/material/FluidState.java -@@ -23,8 +23,12 @@ public final class FluidState extends StateHolder { +@@ -26,8 +26,12 @@ public final class FluidState extends StateHolder { public static final int AMOUNT_MAX = 9; public static final int AMOUNT_FULL = 8; @@ -85,7 +85,7 @@ index b0611b985efc2cc8a528ff4589fd11cbcc84ac39..5e7dc3868dbf676b7ddfc39ec1ea97ff } public Fluid getType() { -@@ -40,7 +44,7 @@ public final class FluidState extends StateHolder { +@@ -43,7 +47,7 @@ public final class FluidState extends StateHolder { } public boolean isEmpty() { diff --git a/patches/server/0518-Retain-block-place-order-when-capturing-blockstates.patch b/patches/server/0518-Retain-block-place-order-when-capturing-blockstates.patch index 649c440af..f32ff304e 100644 --- a/patches/server/0518-Retain-block-place-order-when-capturing-blockstates.patch +++ b/patches/server/0518-Retain-block-place-order-when-capturing-blockstates.patch @@ -10,10 +10,10 @@ In general, look at making this logic more robust (i.e properly handling cases where a captured entry is overriden) - but for now this will do. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index eec0e1b28f90083ac2422d0c61ceed2b26a9a25d..043b43dbb21c7086031353d146a596e126e35162 100644 +index 4095b3ebacb8a55744fa99fea7e08d31e42d8b47..7d7d6ac3ae38eda0aed9f52059fccd3970718890 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -151,7 +151,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -149,7 +149,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public boolean captureBlockStates = false; public boolean captureTreeGeneration = false; public Map capturedBlockStates = new java.util.LinkedHashMap<>(); // Paper diff --git a/patches/server/0519-Reduce-blockpos-allocation-from-pathfinding.patch b/patches/server/0519-Reduce-blockpos-allocation-from-pathfinding.patch index 27a1ee6c3..08bd69837 100644 --- a/patches/server/0519-Reduce-blockpos-allocation-from-pathfinding.patch +++ b/patches/server/0519-Reduce-blockpos-allocation-from-pathfinding.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reduce blockpos allocation from pathfinding diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -index e23679b8c2bc35de82cb3245f35b53b44058f53d..737d0405a195d322ffe9a57acadb9f6d645c03b8 100644 +index 2d42df635b1ce8d975278fb36f00fe9b8b8f060f..c7926d45c32a739b32d2b97b1ed2f8b89fb18620 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -471,7 +471,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { +@@ -475,7 +475,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { return BlockPathTypes.DANGER_FIRE; } @@ -17,7 +17,7 @@ index e23679b8c2bc35de82cb3245f35b53b44058f53d..737d0405a195d322ffe9a57acadb9f6d return BlockPathTypes.WATER_BORDER; } } // Paper -@@ -502,7 +502,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { +@@ -506,7 +506,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { } else if (blockState.is(Blocks.COCOA)) { return BlockPathTypes.COCOA; } else { diff --git a/patches/server/0523-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch b/patches/server/0523-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch index d61dbeae6..7e3683901 100644 --- a/patches/server/0523-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch +++ b/patches/server/0523-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch @@ -8,10 +8,10 @@ This can realistically only happen if there's custom loot active on fishing which can return 0 items. This would disconnect the player who's fishing. diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index abab779379e60d4b775f7b39cc46943e91c8749c..1037d0a0cdd4fd7aa99a958ee969759c5883fdc0 100644 +index 90a5a5ede2c65d74dec4ac247e8411636fc20f78..cc288174b22f959e8ef11e43f0ea4008bae7bdc5 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -@@ -496,9 +496,15 @@ public class FishingHook extends Projectile { +@@ -499,9 +499,15 @@ public class FishingHook extends Projectile { while (iterator.hasNext()) { ItemStack itemstack1 = (ItemStack) iterator.next(); @@ -29,7 +29,7 @@ index abab779379e60d4b775f7b39cc46943e91c8749c..1037d0a0cdd4fd7aa99a958ee969759c playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1); this.level.getCraftServer().getPluginManager().callEvent(playerFishEvent); -@@ -511,8 +517,12 @@ public class FishingHook extends Projectile { +@@ -514,8 +520,12 @@ public class FishingHook extends Projectile { double d2 = entityhuman.getZ() - this.getZ(); double d3 = 0.1D; diff --git a/patches/server/0524-Add-getOfflinePlayerIfCached-String.patch b/patches/server/0524-Add-getOfflinePlayerIfCached-String.patch index 528197aa8..f86dc2c52 100644 --- a/patches/server/0524-Add-getOfflinePlayerIfCached-String.patch +++ b/patches/server/0524-Add-getOfflinePlayerIfCached-String.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add getOfflinePlayerIfCached(String) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 01fc3f252f6a05aa97df29b88acf0ff3ef8dfcb7..e116d734d482ac918cc88cf038c3aeae13c1a531 100644 +index 18cd4950472d91d711c301a80f0946520dd87f84..6124142faeeb792c0f7f6c167f8da47af446cba9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1802,6 +1802,28 @@ public final class CraftServer implements Server { +@@ -1794,6 +1794,28 @@ public final class CraftServer implements Server { return result; } diff --git a/patches/server/0525-Add-ignore-discounts-API.patch b/patches/server/0525-Add-ignore-discounts-API.patch index fc5b6ad9c..2c2b5e411 100644 --- a/patches/server/0525-Add-ignore-discounts-API.patch +++ b/patches/server/0525-Add-ignore-discounts-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add ignore discounts API diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 8bcb6df10e99e47dee35f441261847aa8e62e165..9bd07dfbedbffb8f7d4f82f74af0a543027d4c7c 100644 +index f7b8804394ad55e3f6c7c8c3a8f0fe7894385c90..089fb4640cb4e74d7cc90088a8772743d5cbe0c4 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -487,6 +487,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -489,6 +489,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler while (iterator.hasNext()) { MerchantOffer merchantrecipe = (MerchantOffer) iterator.next(); @@ -16,7 +16,7 @@ index 8bcb6df10e99e47dee35f441261847aa8e62e165..9bd07dfbedbffb8f7d4f82f74af0a543 merchantrecipe.addToSpecialPriceDiff(-Mth.floor((float) i * merchantrecipe.getPriceMultiplier())); } -@@ -499,6 +500,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -501,6 +502,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler while (iterator1.hasNext()) { MerchantOffer merchantrecipe1 = (MerchantOffer) iterator1.next(); diff --git a/patches/server/0530-Beacon-API-custom-effect-ranges.patch b/patches/server/0530-Beacon-API-custom-effect-ranges.patch index 6da9cb0f3..6c611b18c 100644 --- a/patches/server/0530-Beacon-API-custom-effect-ranges.patch +++ b/patches/server/0530-Beacon-API-custom-effect-ranges.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Beacon API - custom effect ranges diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -index 76a401bcfdacded2137142ed38d739ed65d9fae6..008d486f4166d9f384e3aab48af6d66a255f3564 100644 +index 4b7da0df927f669845c7d4c9b4a0acfab8efe657..82976b3675f581a9f3ccb9e23048bd44864203f8 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -@@ -78,6 +78,26 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { +@@ -77,6 +77,26 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { return (BeaconBlockEntity.hasSecondaryEffect(this.levels, this.primaryPower, this.secondaryPower)) ? CraftPotionUtil.toBukkit(new MobEffectInstance(this.secondaryPower, BeaconBlockEntity.getLevel(this.levels), BeaconBlockEntity.getAmplification(this.levels, this.primaryPower, this.secondaryPower), true, true)) : null; } // CraftBukkit end @@ -35,7 +35,7 @@ index 76a401bcfdacded2137142ed38d739ed65d9fae6..008d486f4166d9f384e3aab48af6d66a public BeaconBlockEntity(BlockPos pos, BlockState state) { super(BlockEntityType.BEACON, pos, state); -@@ -181,7 +201,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { +@@ -180,7 +200,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { } if (blockEntity.levels > 0 && !blockEntity.beamSections.isEmpty()) { @@ -44,7 +44,7 @@ index 76a401bcfdacded2137142ed38d739ed65d9fae6..008d486f4166d9f384e3aab48af6d66a BeaconBlockEntity.playSound(world, pos, SoundEvents.BEACON_AMBIENT); } } -@@ -267,8 +287,13 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { +@@ -266,8 +286,13 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { } public static List getHumansInRange(Level world, BlockPos blockposition, int i) { @@ -59,7 +59,7 @@ index 76a401bcfdacded2137142ed38d739ed65d9fae6..008d486f4166d9f384e3aab48af6d66a AABB axisalignedbb = (new AABB(blockposition)).inflate(d0).expandTowards(0.0D, (double) world.getHeight(), 0.0D); List list = world.getEntitiesOfClass(Player.class, axisalignedbb); -@@ -309,12 +334,17 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { +@@ -308,12 +333,17 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { } private static void applyEffects(Level world, BlockPos pos, int beaconLevel, @Nullable MobEffect primaryEffect, @Nullable MobEffect secondaryEffect) { @@ -78,7 +78,7 @@ index 76a401bcfdacded2137142ed38d739ed65d9fae6..008d486f4166d9f384e3aab48af6d66a BeaconBlockEntity.applyEffect(list, primaryEffect, j, b0, true, pos); // Paper - BeaconEffectEvent -@@ -364,6 +394,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { +@@ -363,6 +393,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { } this.lockKey = LockCode.fromTag(nbt); @@ -86,7 +86,7 @@ index 76a401bcfdacded2137142ed38d739ed65d9fae6..008d486f4166d9f384e3aab48af6d66a } @Override -@@ -377,6 +408,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { +@@ -376,6 +407,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { } this.lockKey.addToTag(nbt); diff --git a/patches/server/0531-Add-API-for-quit-reason.patch b/patches/server/0531-Add-API-for-quit-reason.patch index a39ba6478..b6c8adfa0 100644 --- a/patches/server/0531-Add-API-for-quit-reason.patch +++ b/patches/server/0531-Add-API-for-quit-reason.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add API for quit reason diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 93a75f66935b19475aa878ebb00b44f35b3e29d6..ea7444d5d242e15fe3fb1d87ddb98f3074d3e979 100644 +index 1c63947958d202d00593e2b76d113c8b327706d7..932b494ea2a5e849b233c73bd2472d5c85f5ba52 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -142,12 +142,15 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -152,12 +152,15 @@ public class Connection extends SimpleChannelInboundHandler> { this.handlingFault = true; if (this.channel.isOpen()) { @@ -25,10 +25,10 @@ index 93a75f66935b19475aa878ebb00b44f35b3e29d6..ea7444d5d242e15fe3fb1d87ddb98f30 Connection.LOGGER.debug("Failed to sent packet", throwable); ConnectionProtocol enumprotocol = this.getCurrentProtocol(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index c68b95ef0d4c3e0d942e61bfccf23a00d0d8afd9..57ca53876941faf6a1cbefd6e0382ee0ce2e678f 100644 +index 1136a3e406b3683ba7498a7903ed32e7053ffd1d..8874f9a3d64b706fdc857c805fe279316da99dd8 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -257,6 +257,7 @@ public class ServerPlayer extends Player { +@@ -255,6 +255,7 @@ public class ServerPlayer extends Player { public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper @@ -37,7 +37,7 @@ index c68b95ef0d4c3e0d942e61bfccf23a00d0d8afd9..57ca53876941faf6a1cbefd6e0382ee0 public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) { super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3ab42e5c83d96f05f60c53a200b579193b4b57fa..64bd37e70997d1cbafa6a5f9b800352a7c105f28 100644 +index ed205249d7d2c2eb63fc6dab113a2b63ef1f36cb..85b7a53d43b0ea86ea211a6476edda3f95644e63 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -441,6 +441,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -49,7 +49,7 @@ index 3ab42e5c83d96f05f60c53a200b579193b4b57fa..64bd37e70997d1cbafa6a5f9b800352a this.connection.disconnect(ichatbasecomponent); }); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 35cf9c8235534a5c59065718ff57873f9c00bfdc..e5ed9784b0e7d208604b41f51f1adf9c8f50fe08 100644 +index 1dcdc093e7e304ca2479b268bd4e8a07b8c5735a..96d481a113551fe77fb8d3c78633ad89434125e6 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -600,7 +600,7 @@ public abstract class PlayerList { diff --git a/patches/server/0533-Significantly-improve-performance-of-the-end-generat.patch b/patches/server/0533-Significantly-improve-performance-of-the-end-generat.patch index 49888cfa4..bbe9da525 100644 --- a/patches/server/0533-Significantly-improve-performance-of-the-end-generat.patch +++ b/patches/server/0533-Significantly-improve-performance-of-the-end-generat.patch @@ -12,13 +12,13 @@ Co-authored-by: Dylan Xaldin Co-authored-by: pop4959 diff --git a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java -index d090bdc063480ee6e28b0d60447ebe4063e6d688..ff0255e7f3c75e9972e8516058c234c7b58a0bd7 100644 +index 3f9127f93c9720c89b578d36a1bcdb89fc01222a..9004d9d7dcb1466047da62d0a6d01e7b4ac6a216 100644 --- a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java +++ b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java @@ -29,6 +29,16 @@ public class TheEndBiomeSource extends BiomeSource { - private final Biome midlands; - private final Biome islands; - private final Biome barrens; + private final Holder midlands; + private final Holder islands; + private final Holder barrens; + // Paper start + private static final class NoiseCache { + public long[] keys = new long[8192]; @@ -31,8 +31,8 @@ index d090bdc063480ee6e28b0d60447ebe4063e6d688..ff0255e7f3c75e9972e8516058c234c7 + // Paper end public TheEndBiomeSource(Registry biomeRegistry, long seed) { - this(biomeRegistry, seed, biomeRegistry.getOrThrow(Biomes.THE_END), biomeRegistry.getOrThrow(Biomes.END_HIGHLANDS), biomeRegistry.getOrThrow(Biomes.END_MIDLANDS), biomeRegistry.getOrThrow(Biomes.SMALL_END_ISLANDS), biomeRegistry.getOrThrow(Biomes.END_BARRENS)); -@@ -88,12 +98,26 @@ public class TheEndBiomeSource extends BiomeSource { + this(seed, biomeRegistry.getOrCreateHolder(Biomes.THE_END), biomeRegistry.getOrCreateHolder(Biomes.END_HIGHLANDS), biomeRegistry.getOrCreateHolder(Biomes.END_MIDLANDS), biomeRegistry.getOrCreateHolder(Biomes.SMALL_END_ISLANDS), biomeRegistry.getOrCreateHolder(Biomes.END_BARRENS)); +@@ -87,12 +97,26 @@ public class TheEndBiomeSource extends BiomeSource { float f = 100.0F - Mth.sqrt((long) i * (long) i + (long) j * (long) j) * 8.0F; // Paper - cast ints to long to avoid integer overflow f = Mth.clamp(f, -100.0F, 80.0F); diff --git a/patches/server/0534-Expose-world-spawn-angle.patch b/patches/server/0534-Expose-world-spawn-angle.patch index 10ade3487..f3d1afa4d 100644 --- a/patches/server/0534-Expose-world-spawn-angle.patch +++ b/patches/server/0534-Expose-world-spawn-angle.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expose world spawn angle diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index e5ed9784b0e7d208604b41f51f1adf9c8f50fe08..8ce5f463f16857b5862b6e0a77c63d8118b34d67 100644 +index 96d481a113551fe77fb8d3c78633ad89434125e6..1e131bf7f56f0c69e0edaa80c39b014ee8f265a4 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -878,7 +878,7 @@ public abstract class PlayerList { @@ -18,10 +18,10 @@ index e5ed9784b0e7d208604b41f51f1adf9c8f50fe08..8ce5f463f16857b5862b6e0a77c63d81 Player respawnPlayer = entityplayer1.getBukkitEntity(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 5012fc9626e522b34e79f265f794365e8f359b96..997a21a8344adf8d5298fbe54a50631ae3f40693 100644 +index e8dd6a2de3a09e6144d42d16071de186a2b32817..180b4b1659c35324089c6606fcdad8824e3b8b3e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -244,7 +244,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -247,7 +247,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public Location getSpawnLocation() { BlockPos spawn = this.world.getSharedSpawnPos(); diff --git a/patches/server/0535-Add-Destroy-Speed-API.patch b/patches/server/0535-Add-Destroy-Speed-API.patch index 4d39857a4..cfd4fa1a5 100644 --- a/patches/server/0535-Add-Destroy-Speed-API.patch +++ b/patches/server/0535-Add-Destroy-Speed-API.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add Destroy Speed API Co-authored-by: Jake Potrebic diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index cdd1b36fa5e856df3eb7d31b3d6a3fbfcbb83be6..90ad83db94e4cfb98470b9a607fe3ddec2e51c6c 100644 +index 17cfa5bd58417c541e2d922c7d7b57676246f0d8..437daff6408357a4a19420422100914b3308b465 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -630,5 +630,26 @@ public class CraftBlock implements Block { +@@ -636,5 +636,26 @@ public class CraftBlock implements Block { public String translationKey() { return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); } diff --git a/patches/server/0540-Climbing-should-not-bypass-cramming-gamerule.patch b/patches/server/0540-Climbing-should-not-bypass-cramming-gamerule.patch index 1aad231c2..2589f7592 100644 --- a/patches/server/0540-Climbing-should-not-bypass-cramming-gamerule.patch +++ b/patches/server/0540-Climbing-should-not-bypass-cramming-gamerule.patch @@ -21,10 +21,10 @@ index f46d0d22b99582070747e2fde3c6328b0ab6d707..b9164fb28a49ccc3113f7010786960ec private void keepLoadedRange() { keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 56c138d69423cd7fc99003ff4ddf124ede1c5b95..925f9b57e347bb609c159bb9d750a528ad2b87dd 100644 +index 51711841c072e0ac59922a45271298d2930e3581..d030dc5faa84a0848d2b704a9dcf489fbecb0a70 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1743,6 +1743,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1748,6 +1748,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public boolean isPushable() { @@ -61,10 +61,10 @@ index 22f36cd3df49160f1b6668befdd05c2268edaa49..e39965c2e50bc8ee424ea07819346e06 } else if (entity.level.isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) { return false; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 371ae3291afa84a41821edc37cdcabe7723a45d0..efc4ebcd1bb024ee7549047147bfe4da2b3fa3f8 100644 +index aebf02fbd3823eb05a0823a843e35d94c05a8afe..1dc2af88b8db9f93a92c348e3a73bfe774699dc8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3297,7 +3297,7 @@ public abstract class LivingEntity extends Entity { +@@ -3300,7 +3300,7 @@ public abstract class LivingEntity extends Entity { return; } // Paper end - don't run getEntities if we're not going to use its result @@ -73,7 +73,7 @@ index 371ae3291afa84a41821edc37cdcabe7723a45d0..efc4ebcd1bb024ee7549047147bfe4da if (!list.isEmpty()) { // Paper - move up -@@ -3468,9 +3468,16 @@ public abstract class LivingEntity extends Entity { +@@ -3463,9 +3463,16 @@ public abstract class LivingEntity extends Entity { return !this.isRemoved() && this.collides; // CraftBukkit } @@ -92,10 +92,10 @@ index 371ae3291afa84a41821edc37cdcabe7723a45d0..efc4ebcd1bb024ee7549047147bfe4da // CraftBukkit start - collidable API diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java -index 3b34f1e7ae8aa33d957a9ff7ebe4a8e7fed73f3c..29dfbcecfbb2560e6ecde997abd5224a16c08c94 100644 +index f37f9118ff3305d688f55ba978b6fd5f3a428fc7..ed617223942b410fb6f799be7db2001909db67ed 100644 --- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java +++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java -@@ -83,7 +83,7 @@ public class Bat extends AmbientCreature { +@@ -82,7 +82,7 @@ public class Bat extends AmbientCreature { } @Override @@ -105,10 +105,10 @@ index 3b34f1e7ae8aa33d957a9ff7ebe4a8e7fed73f3c..29dfbcecfbb2560e6ecde997abd5224a } diff --git a/src/main/java/net/minecraft/world/entity/animal/Parrot.java b/src/main/java/net/minecraft/world/entity/animal/Parrot.java -index daec622f4b47c5ccd474ae7f56042fa6434091e1..dd80d9e0614445ba088c295784dc30584dedaa2b 100644 +index 5f690ffab2a8305ee1229e552ba9d282fcb479a2..eb66cfebce7e8bb9ebce066e5aabff256a8a518d 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java +++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java -@@ -383,8 +383,8 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal { +@@ -381,8 +381,8 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal { } @Override @@ -146,10 +146,10 @@ index 0d468631b9c260091e732925da43c177ebda892f..e5ef24d92de21c4c0e6a98e06985e52d } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -index 6f9cbba0c063b272afd6aacc3eab02df405b3061..75cff07051d3b81d37926fb1da50af5ba27c34dc 100644 +index 46ceed03caed9015acfcc45a5afc0d0c9521c9df..110006087af3f87457031dad7756235363af0506 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -@@ -148,7 +148,7 @@ public abstract class AbstractMinecart extends Entity { +@@ -147,7 +147,7 @@ public abstract class AbstractMinecart extends Entity { } @Override @@ -159,10 +159,10 @@ index 6f9cbba0c063b272afd6aacc3eab02df405b3061..75cff07051d3b81d37926fb1da50af5b } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java -index 11632004d16fe254e7b20cf6db25d4fc24887867..b4516094996c80886b8d7af599ba7c3d4229ba9d 100644 +index a7f248394d11f0e4a9d5056ffb6fc66cac53cd02..c75e45bcb8cd6da154c7ca1719711622c009f463 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java -@@ -158,7 +158,7 @@ public class Boat extends Entity { +@@ -157,7 +157,7 @@ public class Boat extends Entity { } @Override diff --git a/patches/server/0542-Add-PlayerShearBlockEvent.patch b/patches/server/0542-Add-PlayerShearBlockEvent.patch index aa9a8b120..80f40f1eb 100644 --- a/patches/server/0542-Add-PlayerShearBlockEvent.patch +++ b/patches/server/0542-Add-PlayerShearBlockEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerShearBlockEvent diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java -index 56d2e0ca2414c2f1fdde3f1d9a3aa3c93fb46b03..bcfd5bfa7839738396b6137effc3f66c445c2e0c 100644 +index e5a544dee741bf0df9b4be8b7cef6fe74938f6a2..e9974415e8f016f50a93a5eea117afe25a6b735d 100644 --- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java -@@ -116,7 +116,7 @@ public class BeehiveBlock extends BaseEntityBlock { +@@ -113,7 +113,7 @@ public class BeehiveBlock extends BaseEntityBlock { } public static void dropHoneycomb(Level world, BlockPos pos) { @@ -17,7 +17,7 @@ index 56d2e0ca2414c2f1fdde3f1d9a3aa3c93fb46b03..bcfd5bfa7839738396b6137effc3f66c } @Override -@@ -129,8 +129,19 @@ public class BeehiveBlock extends BaseEntityBlock { +@@ -126,8 +126,19 @@ public class BeehiveBlock extends BaseEntityBlock { Item item = itemstack.getItem(); if (itemstack.is(Items.SHEARS)) { diff --git a/patches/server/0543-Fix-curing-zombie-villager-discount-exploit.patch b/patches/server/0543-Fix-curing-zombie-villager-discount-exploit.patch index 6fdd548a6..a874b056d 100644 --- a/patches/server/0543-Fix-curing-zombie-villager-discount-exploit.patch +++ b/patches/server/0543-Fix-curing-zombie-villager-discount-exploit.patch @@ -8,7 +8,7 @@ and curing a villager on repeat by simply resetting the relevant part of the reputation when it is cured. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 8a266d1276595d5b2bd0b60f08d99d4cceea929a..0dafb6b4837f9b68249e64a9f0b7f8f727d58327 100644 +index b9164fb28a49ccc3113f7010786960ec36080df6..17e4ee9224a79eded353a7098f277d502269ad38 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -99,6 +99,11 @@ public class PaperWorldConfig { @@ -24,10 +24,10 @@ index 8a266d1276595d5b2bd0b60f08d99d4cceea929a..0dafb6b4837f9b68249e64a9f0b7f8f7 private void keepLoadedRange() { keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 9bd07dfbedbffb8f7d4f82f74af0a543027d4c7c..ea612b3c3ed7305b504d65eb6d38ed99547fd488 100644 +index 089fb4640cb4e74d7cc90088a8772743d5cbe0c4..268524e256a034520438d5c825e5e419d72d29ce 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -1064,6 +1064,15 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -1066,6 +1066,15 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @Override public void onReputationEventFrom(ReputationEventType interaction, Entity entity) { if (interaction == ReputationEventType.ZOMBIE_VILLAGER_CURED) { diff --git a/patches/server/0544-Limit-recipe-packets.patch b/patches/server/0544-Limit-recipe-packets.patch index 2a6600cd1..3d81489c1 100644 --- a/patches/server/0544-Limit-recipe-packets.patch +++ b/patches/server/0544-Limit-recipe-packets.patch @@ -23,7 +23,7 @@ index ec42fb00b6f4a691fa710c68131f80b242e3e6e8..d5ae781d65016e0382cb3497cb8cac20 public static boolean velocityOnlineMode; public static byte[] velocitySecretKey; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 64bd37e70997d1cbafa6a5f9b800352a7c105f28..f93b6822f5180720849db4bd47c53366060bbe89 100644 +index 85b7a53d43b0ea86ea211a6476edda3f95644e63..ade4e224020950337bfe1427efc25222a46297f0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -230,6 +230,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -42,7 +42,7 @@ index 64bd37e70997d1cbafa6a5f9b800352a7c105f28..f93b6822f5180720849db4bd47c53366 /* Use thread-safe field access instead if (this.chatSpamTickCount > 0) { --this.chatSpamTickCount; -@@ -2817,6 +2819,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2843,6 +2845,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { diff --git a/patches/server/0546-MC-4-Fix-item-position-desync.patch b/patches/server/0546-MC-4-Fix-item-position-desync.patch index 1d307cc5a..8e303b4a3 100644 --- a/patches/server/0546-MC-4-Fix-item-position-desync.patch +++ b/patches/server/0546-MC-4-Fix-item-position-desync.patch @@ -43,10 +43,10 @@ index b30c08bfb8c55161543a4ef09f2e462e0a1fe4ae..ec93f5300cc7d423ec0d292f0f8443f9 public Vec3 updateEntityPosition(Vec3 orig) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 925f9b57e347bb609c159bb9d750a528ad2b87dd..6b1ea58389e32d6144e930adc72efeb4ba570d89 100644 +index d030dc5faa84a0848d2b704a9dcf489fbecb0a70..615934ced9c383c6ee37c9cb5cf07e92185662e3 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3811,6 +3811,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3828,6 +3828,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) { // Paper end diff --git a/patches/server/0547-Player-Chunk-Load-Unload-Events.patch b/patches/server/0547-Player-Chunk-Load-Unload-Events.patch index 294a930cb..3f52ecd3b 100644 --- a/patches/server/0547-Player-Chunk-Load-Unload-Events.patch +++ b/patches/server/0547-Player-Chunk-Load-Unload-Events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Player Chunk Load/Unload Events diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 57ca53876941faf6a1cbefd6e0382ee0ce2e678f..ab1c7a35c6a6f04bc90264a3227c0a3dbffe9b5d 100644 +index 8874f9a3d64b706fdc857c805fe279316da99dd8..5f02f0d179d40c63d785c53090833efdab627f27 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -2109,11 +2109,21 @@ public class ServerPlayer extends Player { +@@ -2107,11 +2107,21 @@ public class ServerPlayer extends Player { public void trackChunk(ChunkPos chunkPos, Packet chunkDataPacket) { this.connection.send(chunkDataPacket); diff --git a/patches/server/0552-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch b/patches/server/0552-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch index a32b1130c..3d353e6e7 100644 --- a/patches/server/0552-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch +++ b/patches/server/0552-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch @@ -37,10 +37,10 @@ index 742ffe531bb8f3a9ca34dea99b044123d90cfff9..bd283f71cb05ffbe1fed39afb41ae54d CriteriaTriggers.TRADE.trigger((ServerPlayer) this.tradingPlayer, this, offer.getResult()); } diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -index 36834f30ccefd229df4da2dbc7b22edcb83429c3..49ac1e922c0c3b38ed48adda46870e1fc0fb09dc 100644 +index b42ef24e9851ae1bd1313110cfe59ad424d21535..a0bfce13f024f993534d8f72a24f1a09b586464e 100644 --- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -741,6 +741,14 @@ public abstract class AbstractContainerMenu { +@@ -753,6 +753,14 @@ public abstract class AbstractContainerMenu { public abstract boolean stillValid(Player player); protected boolean moveItemStackTo(ItemStack stack, int startIndex, int endIndex, boolean fromLast) { @@ -55,7 +55,7 @@ index 36834f30ccefd229df4da2dbc7b22edcb83429c3..49ac1e922c0c3b38ed48adda46870e1f boolean flag1 = false; int k = startIndex; -@@ -763,18 +771,27 @@ public abstract class AbstractContainerMenu { +@@ -775,18 +783,27 @@ public abstract class AbstractContainerMenu { slot = (Slot) this.slots.get(k); itemstack1 = slot.getItem(); @@ -83,7 +83,7 @@ index 36834f30ccefd229df4da2dbc7b22edcb83429c3..49ac1e922c0c3b38ed48adda46870e1f flag1 = true; } } -@@ -805,14 +822,33 @@ public abstract class AbstractContainerMenu { +@@ -817,14 +834,33 @@ public abstract class AbstractContainerMenu { slot = (Slot) this.slots.get(k); itemstack1 = slot.getItem(); @@ -118,7 +118,7 @@ index 36834f30ccefd229df4da2dbc7b22edcb83429c3..49ac1e922c0c3b38ed48adda46870e1f break; } diff --git a/src/main/java/net/minecraft/world/inventory/MerchantMenu.java b/src/main/java/net/minecraft/world/inventory/MerchantMenu.java -index 589527215b10aa848a079b964e748c8c2e6137a1..a6e036165ce1a387195cf3db190a42c5d8249b95 100644 +index 0d3002c5b13cbac0e021e8cdcf7d0685b256268a..3e3dfbe30fc5357e144aa176bc5df1b8a7ae6d64 100644 --- a/src/main/java/net/minecraft/world/inventory/MerchantMenu.java +++ b/src/main/java/net/minecraft/world/inventory/MerchantMenu.java @@ -134,12 +134,12 @@ public class MerchantMenu extends AbstractContainerMenu { diff --git a/patches/server/0554-Additional-Block-Material-API-s.patch b/patches/server/0554-Additional-Block-Material-API-s.patch index dadc9b7cd..8d23c9d90 100644 --- a/patches/server/0554-Additional-Block-Material-API-s.patch +++ b/patches/server/0554-Additional-Block-Material-API-s.patch @@ -9,10 +9,10 @@ process to do this in the Bukkit API Adds API for buildable, replaceable, burnable too. diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 90ad83db94e4cfb98470b9a607fe3ddec2e51c6c..23d243c004af58bd8d37c594ff4bcbd314031604 100644 +index 437daff6408357a4a19420422100914b3308b465..0be0ddcb8ea184683c1d0c619a932f3b03064941 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -450,6 +450,25 @@ public class CraftBlock implements Block { +@@ -456,6 +456,25 @@ public class CraftBlock implements Block { return this.getNMS().getMaterial().isLiquid(); } diff --git a/patches/server/0557-Cache-burn-durations.patch b/patches/server/0557-Cache-burn-durations.patch index e833ebe63..9ef84f0bb 100644 --- a/patches/server/0557-Cache-burn-durations.patch +++ b/patches/server/0557-Cache-burn-durations.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Cache burn durations diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index fd1fb954ef1eb2624939a5c5d0d2c258d3398ff2..b05019614a172ef071aaefc5fcc1d18627cc0402 100644 +index 635d47d4bea679e96736ef891c40f57488cbc6a1..e62fa09ca481183be2ee158b0717172c90de1b92 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -127,7 +127,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -129,7 +129,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit this.recipeType = recipeType; } @@ -22,7 +22,7 @@ index fd1fb954ef1eb2624939a5c5d0d2c258d3398ff2..b05019614a172ef071aaefc5fcc1d186 Map map = Maps.newLinkedHashMap(); AbstractFurnaceBlockEntity.add(map, (ItemLike) Items.LAVA_BUCKET, 20000); -@@ -192,7 +198,10 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -194,7 +200,10 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.COMPOSTER, 300); AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.AZALEA, 100); AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.FLOWERING_AZALEA, 100); diff --git a/patches/server/0559-Fix-Not-a-string-Map-Conversion-spam.patch b/patches/server/0559-Fix-Not-a-string-Map-Conversion-spam.patch index 61ebd79af..8967f3f73 100644 --- a/patches/server/0559-Fix-Not-a-string-Map-Conversion-spam.patch +++ b/patches/server/0559-Fix-Not-a-string-Map-Conversion-spam.patch @@ -12,10 +12,10 @@ requesting the world. Track spigot issue to see when fixed: https://hub.spigotmc.org/jira/browse/SPIGOT-6181 diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index a6219dd70ab76959b2aaa155d5d17acc22095753..77fde68dae2e64ef54b1cee7ab8b33f4609b3675 100644 +index 913fabc7f42c05ccec6501247a5e8d1d481756ee..4acbcafc158cf11af51d9518ba5b83aaa75f52a1 100644 --- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -@@ -14,6 +14,8 @@ import net.minecraft.core.BlockPos; +@@ -15,6 +15,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtOps; @@ -28,7 +28,7 @@ index a6219dd70ab76959b2aaa155d5d17acc22095753..77fde68dae2e64ef54b1cee7ab8b33f4 } public static MapItemSavedData load(CompoundTag nbt) { -- DataResult dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, nbt.get("dimension"))); +- DataResult> dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, nbt.get("dimension"))); // CraftBukkit - decompile error + // Paper start - fix "Not a string" spam + Tag dimension = nbt.get("dimension"); + if (dimension instanceof NumericTag && ((NumericTag) dimension).getAsInt() >= CraftWorld.CUSTOM_DIMENSION_OFFSET) { diff --git a/patches/server/0561-Fix-interact-event-not-being-called-in-adventure.patch b/patches/server/0561-Fix-interact-event-not-being-called-in-adventure.patch index 315cdf34e..c56c2554d 100644 --- a/patches/server/0561-Fix-interact-event-not-being-called-in-adventure.patch +++ b/patches/server/0561-Fix-interact-event-not-being-called-in-adventure.patch @@ -6,19 +6,19 @@ Subject: [PATCH] Fix interact event not being called in adventure Call PlayerInteractEvent when left-clicking on a block in adventure mode diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f93b6822f5180720849db4bd47c53366060bbe89..5d749940aad4634df2066f7e9228543adc2d61b2 100644 +index ade4e224020950337bfe1427efc25222a46297f0..5fd41a511709e5299a6d62521a46409fdb717664 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1746,7 +1746,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser - MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{i - 1})).withStyle(ChatFormatting.RED); +@@ -1760,7 +1760,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{i - 1})).withStyle(ChatFormatting.RED); - this.player.sendMessage(ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID); -- } else if (enuminteractionresult.shouldSwing()) { + this.player.sendMessage(ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID); +- } else if (enuminteractionresult.shouldSwing()) { + } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { - this.player.swing(enumhand, true); - } - } -@@ -2218,7 +2218,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + this.player.swing(enumhand, true); + } + } +@@ -2238,7 +2238,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser Vec3 vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); HitResult movingobjectposition = this.player.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.player)); diff --git a/patches/server/0563-Fix-nerfed-slime-when-splitting.patch b/patches/server/0563-Fix-nerfed-slime-when-splitting.patch index f85801609..31fe051bd 100644 --- a/patches/server/0563-Fix-nerfed-slime-when-splitting.patch +++ b/patches/server/0563-Fix-nerfed-slime-when-splitting.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix nerfed slime when splitting diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java -index 6ec81054bcf25d99aec567d568c361eea84ed384..5722d9b30223fb229b80f54d7fb9edf41254a7f7 100644 +index 8d03466e2f546aae705c1d4dd2d562d3db2f2671..85edba5de3ce6c1fce8872855544863de84e7759 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Slime.java +++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java -@@ -241,6 +241,7 @@ public class Slime extends Mob implements Enemy { +@@ -239,6 +239,7 @@ public class Slime extends Mob implements Enemy { entityslime.setPersistenceRequired(); } diff --git a/patches/server/0566-Added-WorldGameRuleChangeEvent.patch b/patches/server/0566-Added-WorldGameRuleChangeEvent.patch index 58ddfe790..21b356a05 100644 --- a/patches/server/0566-Added-WorldGameRuleChangeEvent.patch +++ b/patches/server/0566-Added-WorldGameRuleChangeEvent.patch @@ -18,7 +18,7 @@ index f2e53fbb067a3909f386386eb3b89dfe090ee096..6f6292e7945cec1bdc69632dbfb950d6 return t0.getCommandResult(); } diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java -index 888d812118c15c212284687ae5842a94f5715d52..e7ca5d6fb8922e7e8065864f736b06056be080a0 100644 +index 74e10d581f8c1b0b026d8f940194971efbdef434..798afc145c54306fcf0838d8daef2bdf17763da9 100644 --- a/src/main/java/net/minecraft/world/level/GameRules.java +++ b/src/main/java/net/minecraft/world/level/GameRules.java @@ -261,10 +261,10 @@ public class GameRules { @@ -64,10 +64,10 @@ index 888d812118c15c212284687ae5842a94f5715d52..e7ca5d6fb8922e7e8065864f736b0605 public int get() { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 997a21a8344adf8d5298fbe54a50631ae3f40693..b6c4d0f4fbe0dc8a4148939e231426cac42dbc18 100644 +index 180b4b1659c35324089c6606fcdad8824e3b8b3e..f701061688d9058ec89dcf5c8ae337c17ff0d7eb 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1794,8 +1794,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1797,8 +1797,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { if (!this.isGameRule(rule)) return false; @@ -82,7 +82,7 @@ index 997a21a8344adf8d5298fbe54a50631ae3f40693..b6c4d0f4fbe0dc8a4148939e231426ca handle.onChanged(this.getHandle().getServer()); return true; } -@@ -1830,8 +1835,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1833,8 +1838,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { if (!this.isGameRule(rule.getName())) return false; diff --git a/patches/server/0567-Added-ServerResourcesReloadedEvent.patch b/patches/server/0567-Added-ServerResourcesReloadedEvent.patch index 4c706db0b..5b9a96aef 100644 --- a/patches/server/0567-Added-ServerResourcesReloadedEvent.patch +++ b/patches/server/0567-Added-ServerResourcesReloadedEvent.patch @@ -5,33 +5,34 @@ Subject: [PATCH] Added ServerResourcesReloadedEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b75522558c5277c2e8ec725e5b12eb6d4cb2c36c..b5b7bb3c0147f95ac4036e7d2aa8f26ac755f4df 100644 +index 1febf1e49f3ebe68c04efed2fd2da1ab1c6a900c..16ab255e5aba0d0975cf77ae70dca74cba767ad6 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1958,7 +1958,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop reloadResources(Collection datapacks) { -+ return this.reloadResources(datapacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); + public CompletableFuture reloadResources(Collection dataPacks) { +- RegistryAccess.Frozen iregistrycustom_dimension = this.registryAccess(); ++ return this.reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); + } -+ public CompletableFuture reloadResources(Collection datapacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause cause) { ++ public CompletableFuture reloadResources(Collection dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause cause) { + // Paper end CompletableFuture completablefuture = CompletableFuture.supplyAsync(() -> { - Stream stream = datapacks.stream(); // CraftBukkit - decompile error + Stream stream = dataPacks.stream(); // CraftBukkit - decompile error PackRepository resourcepackrepository = this.packRepository; -@@ -1974,6 +1980,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { this.getServer().execute(() -> { diff --git a/patches/server/0578-Add-StructureLocateEvent.patch b/patches/server/0578-Add-StructureLocateEvent.patch index 61178fc4a..06a35aac4 100644 --- a/patches/server/0578-Add-StructureLocateEvent.patch +++ b/patches/server/0578-Add-StructureLocateEvent.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Add StructureLocateEvent diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index 408624c5fcc5277dfb13d76c67746228d5bf24dc..e2b7da265e9616ac47e6be72cc6e6d2c75cfec44 100644 +index f9fc2fc63080a60fe61ebb08ddd93c4f189df84d..4864fce027b0871e50b2060880be9e24bfdd3887 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -183,6 +183,20 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { +@@ -294,6 +294,20 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { @Nullable - public BlockPos findNearestMapFeature(ServerLevel world, StructureFeature structureFeature, BlockPos center, int radius, boolean skipExistingChunks) { + public Pair>> findNearestMapFeature(ServerLevel worldserver, HolderSet> holderset, BlockPos center, int radius, boolean skipExistingChunks) { + // Paper start -+ org.bukkit.World world1 = world.getWorld(); ++ /*org.bukkit.World world1 = worldserver.getWorld(); + org.bukkit.Location originLocation = new org.bukkit.Location(world1, center.getX(), center.getY(), center.getZ()); + io.papermc.paper.event.world.StructureLocateEvent event = new io.papermc.paper.event.world.StructureLocateEvent(world1, originLocation, org.bukkit.StructureType.getStructureTypes().get(structureFeature.getFeatureName()), radius, skipExistingChunks); + if(!event.callEvent()) return null; @@ -24,8 +24,8 @@ index 408624c5fcc5277dfb13d76c67746228d5bf24dc..e2b7da265e9616ac47e6be72cc6e6d2c + // Get radius and whether to find unexplored structures (re)defined by event call. + radius = event.getRadius(); + skipExistingChunks = event.shouldFindUnexplored(); -+ structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(event.getType().getName()); ++ structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(event.getType().getName());*/ + // Paper end - if (structureFeature == StructureFeature.STRONGHOLD) { - this.generateStrongholds(); - BlockPos blockposition1 = null; + Set> set = (Set) holderset.stream().flatMap((holder) -> { + return ((ConfiguredStructureFeature) holder.value()).biomes().stream(); + }).collect(Collectors.toSet()); diff --git a/patches/server/0579-Collision-option-for-requiring-a-player-participant.patch b/patches/server/0579-Collision-option-for-requiring-a-player-participant.patch index 3d307f2fd..b0e2dbaaf 100644 --- a/patches/server/0579-Collision-option-for-requiring-a-player-participant.patch +++ b/patches/server/0579-Collision-option-for-requiring-a-player-participant.patch @@ -28,10 +28,10 @@ index 797275dd2dc0f7c2ef24311ebdd9659e8b2fdf2f..55c997bc5fb41e16d965c6017128c903 public int wanderingTraderSpawnDayTicks = 24000; public int wanderingTraderSpawnChanceFailureIncrement = 25; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index e64f17f859fc975fed07b86dfda2376018e97f6f..e0d1798b604b5977177714774da26a4d797ac448 100644 +index 615934ced9c383c6ee37c9cb5cf07e92185662e3..6e14c3616164ff735841d03174161b6802c6aa8a 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1626,6 +1626,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1631,6 +1631,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public void push(Entity entity) { if (!this.isPassengerOfSameVehicle(entity)) { if (!entity.noPhysics && !this.noPhysics) { @@ -40,10 +40,10 @@ index e64f17f859fc975fed07b86dfda2376018e97f6f..e0d1798b604b5977177714774da26a4d double d1 = entity.getZ() - this.getZ(); double d2 = Mth.absMax(d0, d1); diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -index 75cff07051d3b81d37926fb1da50af5ba27c34dc..ad49dcc3473fbad306d21cbac4600574e80220a7 100644 +index 110006087af3f87457031dad7756235363af0506..96a7bfd921e59f298f0ee502d356cc3552c30ce8 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -@@ -832,6 +832,7 @@ public abstract class AbstractMinecart extends Entity { +@@ -831,6 +831,7 @@ public abstract class AbstractMinecart extends Entity { public void push(Entity entity) { if (!this.level.isClientSide) { if (!entity.noPhysics && !this.noPhysics) { @@ -52,10 +52,10 @@ index 75cff07051d3b81d37926fb1da50af5ba27c34dc..ad49dcc3473fbad306d21cbac4600574 // CraftBukkit start VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity()); diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java -index b4516094996c80886b8d7af599ba7c3d4229ba9d..c3d111204601270b57389e1f85456a9e2ada4629 100644 +index c75e45bcb8cd6da154c7ca1719711622c009f463..a8f37fab9c8020e884bf029145d03e3be57b7f2b 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java -@@ -240,6 +240,7 @@ public class Boat extends Entity { +@@ -239,6 +239,7 @@ public class Boat extends Entity { @Override public void push(Entity entity) { diff --git a/patches/server/0581-Return-chat-component-with-empty-text-instead-of-thr.patch b/patches/server/0581-Return-chat-component-with-empty-text-instead-of-thr.patch index 988a54be9..1b7dfd030 100644 --- a/patches/server/0581-Return-chat-component-with-empty-text-instead-of-thr.patch +++ b/patches/server/0581-Return-chat-component-with-empty-text-instead-of-thr.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Return chat component with empty text instead of throwing diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -index 49ac1e922c0c3b38ed48adda46870e1fc0fb09dc..1f4d3a48553a467bcbd4799735d1950c9c2dbe23 100644 +index a0bfce13f024f993534d8f72a24f1a09b586464e..f45943ce80e78fe189fa2fffa27586b0a5a30c3d 100644 --- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -21,6 +21,7 @@ import net.minecraft.ReportedException; +@@ -22,6 +22,7 @@ import net.minecraft.ReportedException; import net.minecraft.core.NonNullList; import net.minecraft.core.Registry; import net.minecraft.network.chat.Component; @@ -17,7 +17,7 @@ index 49ac1e922c0c3b38ed48adda46870e1fc0fb09dc..1f4d3a48553a467bcbd4799735d1950c import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket; import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.Mth; -@@ -84,7 +85,12 @@ public abstract class AbstractContainerMenu { +@@ -88,7 +89,12 @@ public abstract class AbstractContainerMenu { } private Component title; public final Component getTitle() { diff --git a/patches/server/0585-added-Wither-API.patch b/patches/server/0585-added-Wither-API.patch index 16df60938..80d4af7f3 100644 --- a/patches/server/0585-added-Wither-API.patch +++ b/patches/server/0585-added-Wither-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] added Wither API diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -index 4f9f64def9b5da5bd2714c5f3ba36a4339623758..3657b7021d8b505653fadbdfbd515c112cd11177 100644 +index 32b302aad0319ce3ee412912425c1c8db9979f8a..92734f767fde60351a179a88350a97b861be0e88 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -85,6 +85,11 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob +@@ -84,6 +84,11 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob return entityliving.getMobType() != MobType.UNDEAD && entityliving.attackable(); }; private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0D).selector(WitherBoss.LIVING_ENTITY_SELECTOR); @@ -20,7 +20,7 @@ index 4f9f64def9b5da5bd2714c5f3ba36a4339623758..3657b7021d8b505653fadbdfbd515c11 public WitherBoss(EntityType type, Level world) { super(type, world); -@@ -603,7 +608,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob +@@ -602,7 +607,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob @Override public boolean canChangeDimensions() { diff --git a/patches/server/0586-Added-firing-of-PlayerChangeBeaconEffectEvent.patch b/patches/server/0586-Added-firing-of-PlayerChangeBeaconEffectEvent.patch index 3ec45e2a4..0c470fc8f 100644 --- a/patches/server/0586-Added-firing-of-PlayerChangeBeaconEffectEvent.patch +++ b/patches/server/0586-Added-firing-of-PlayerChangeBeaconEffectEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Added firing of PlayerChangeBeaconEffectEvent diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java -index a974b8b9fe6c2071d978afcc2d00bb65861fb82e..4a16f7d06431ae9cbc477d94ca930d814603cae0 100644 +index 063998751c21b4f75cf3bfff6c51c4e8c42bd5f3..a515898e718effe92c91fd0ac45fbb70ddb5d626 100644 --- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java +++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java -@@ -161,10 +161,16 @@ public class BeaconMenu extends AbstractContainerMenu { +@@ -160,10 +160,16 @@ public class BeaconMenu extends AbstractContainerMenu { public void updateEffects(int primaryEffectId, int secondaryEffectId) { if (this.paymentSlot.hasItem()) { diff --git a/patches/server/0589-Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/server/0589-Add-dropLeash-variable-to-EntityUnleashEvent.patch index 2727739c3..766d05e28 100644 --- a/patches/server/0589-Add-dropLeash-variable-to-EntityUnleashEvent.patch +++ b/patches/server/0589-Add-dropLeash-variable-to-EntityUnleashEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 94ec938800846ef79792b7fb800963f01677734e..6f47a27e9e48a4e49d5827ca3a3a2613680639aa 100644 +index 7b671d833cf717c16761b878d45cf04b79c7dbd1..ca9d4c5741c76457fbb7d238a9df1ad5268bbb6b 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -1234,12 +1234,15 @@ public abstract class Mob extends LivingEntity { @@ -101,10 +101,10 @@ index 999d18610666ec442bb038da5c452e3cd77e7428..5f256c1ac5d49e19cfccf174dd555063 } else if (f > 6.0F) { double d0 = (entity.getX() - this.getX()) / (double) f; diff --git a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java -index cf932116a0cafd315e44159fbf7c5d25d43782ff..03bda898a5a263053ecd79f74799d37095bbeb54 100644 +index ae277032a8748b13cca6ab7892691732e78b6752..6daee9cc30fef287df81d949b6fa0b91fa21d759 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java +++ b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java -@@ -123,11 +123,14 @@ public class LeashFenceKnotEntity extends HangingEntity { +@@ -122,11 +122,14 @@ public class LeashFenceKnotEntity extends HangingEntity { entityinsentient = (Mob) iterator.next(); if (entityinsentient.isLeashed() && entityinsentient.getLeashHolder() == this) { // CraftBukkit start diff --git a/patches/server/0590-Reset-shield-blocking-on-dimension-change.patch b/patches/server/0590-Reset-shield-blocking-on-dimension-change.patch index 87e0e7657..e80304d90 100644 --- a/patches/server/0590-Reset-shield-blocking-on-dimension-change.patch +++ b/patches/server/0590-Reset-shield-blocking-on-dimension-change.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reset shield blocking on dimension change diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index ab1c7a35c6a6f04bc90264a3227c0a3dbffe9b5d..88eef461048dafaa13681f91bfe69f71a4481b95 100644 +index 5f02f0d179d40c63d785c53090833efdab627f27..1dd7bebbedd8cf5e8b7b72738d9ebf869509ce24 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1169,6 +1169,11 @@ public class ServerPlayer extends Player { +@@ -1167,6 +1167,11 @@ public class ServerPlayer extends Player { this.level.getCraftServer().getPluginManager().callEvent(changeEvent); // CraftBukkit end } diff --git a/patches/server/0592-EntityMoveEvent.patch b/patches/server/0592-EntityMoveEvent.patch index 8bda79771..885079f8c 100644 --- a/patches/server/0592-EntityMoveEvent.patch +++ b/patches/server/0592-EntityMoveEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] EntityMoveEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 88168eccb8224cb018afa40b7c391ce5814e8853..6f5047f97a1daa1ea6d30fac72a21f1ac5419371 100644 +index 16ab255e5aba0d0975cf77ae70dca74cba767ad6..3e8b73dccfb9ffdd0bc013edb2d05e3cae934fb7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1505,6 +1505,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper @@ -17,10 +17,10 @@ index 88168eccb8224cb018afa40b7c391ce5814e8853..6f5047f97a1daa1ea6d30fac72a21f1a this.profiler.push(() -> { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 753da2465d650d0889e0304b456ad754f4cd1c0b..3066d70a84eb3b23e16edf44f7540f6eb8da7eb2 100644 +index 47dbdbf8c879fb50818ab9316c715fdcec96d581..b7156e36d7d7907cf0390dcf3312b9754a4782ae 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -208,6 +208,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -209,6 +209,7 @@ public class ServerLevel extends Level implements WorldGenLevel { public final LevelStorageSource.LevelStorageAccess convertable; public final UUID uuid; public boolean hasPhysicsEvent = true; // Paper @@ -29,10 +29,10 @@ index 753da2465d650d0889e0304b456ad754f4cd1c0b..3066d70a84eb3b23e16edf44f7540f6e return new Throwable(entity + " Added to world at " + new java.util.Date()); } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index efc4ebcd1bb024ee7549047147bfe4da2b3fa3f8..8b9d61ee5384d530f80ea7496b93ceac24735e36 100644 +index 1dc2af88b8db9f93a92c348e3a73bfe774699dc8..9a85187a111116f6dabf9b40867a4f3cdcf64c6a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3243,6 +3243,20 @@ public abstract class LivingEntity extends Entity { +@@ -3246,6 +3246,20 @@ public abstract class LivingEntity extends Entity { this.pushEntities(); this.level.getProfiler().pop(); diff --git a/patches/server/0593-added-option-to-disable-pathfinding-updates-on-block.patch b/patches/server/0593-added-option-to-disable-pathfinding-updates-on-block.patch index fbd212c28..3a7562ecf 100644 --- a/patches/server/0593-added-option-to-disable-pathfinding-updates-on-block.patch +++ b/patches/server/0593-added-option-to-disable-pathfinding-updates-on-block.patch @@ -21,10 +21,10 @@ index e6b8f71c81daf1e886a9d46a2bed18d4d414e18d..59675e523625b95169236bd0ead063cf public boolean phantomOnlyAttackInsomniacs = true; private void phantomSettings() { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 558a202fb147f4c466d5c8b958105cbf43be0788..d76668ab79d6afa0972fd54408a8475781b1c928 100644 +index b7156e36d7d7907cf0390dcf3312b9754a4782ae..33e2da5fb3cf6dd21e3df601bb9ee9a4991102e4 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1400,6 +1400,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1403,6 +1403,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } this.getChunkSource().blockChanged(pos); @@ -32,7 +32,7 @@ index 558a202fb147f4c466d5c8b958105cbf43be0788..d76668ab79d6afa0972fd54408a84757 VoxelShape voxelshape = oldState.getCollisionShape(this, pos); VoxelShape voxelshape1 = newState.getCollisionShape(this, pos); -@@ -1441,6 +1442,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1444,6 +1445,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } diff --git a/patches/server/0604-Improve-ServerGUI.patch b/patches/server/0604-Improve-ServerGUI.patch index 1599e3103..e573bd2f5 100644 --- a/patches/server/0604-Improve-ServerGUI.patch +++ b/patches/server/0604-Improve-ServerGUI.patch @@ -39,22 +39,10 @@ index 23239679d6584f1088b2b94c46eb9a5c1f9ad91d..fa56cd09102a89692b42f1d142579905 + } } diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java -index e5f071c6449dc12cfed939b6b8a21a20cd7c38f7..d105b4133a906342a8ee76df3030cef8557fde53 100644 +index 66464c10a6b33414c6d1b67b926a66c343d5f887..c07918aa1ed2469ad7a76a0add60ab648ff7f421 100644 --- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java +++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java -@@ -32,6 +32,11 @@ import net.minecraft.DefaultUncaughtExceptionHandler; - import net.minecraft.server.dedicated.DedicatedServer; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -+// Paper start -+import java.io.IOException; -+import java.util.Objects; -+import javax.imageio.ImageIO; -+// Paper end - - public class MinecraftServerGui extends JComponent { - -@@ -59,6 +64,15 @@ public class MinecraftServerGui extends JComponent { +@@ -59,6 +59,15 @@ public class MinecraftServerGui extends JComponent { jframe.pack(); jframe.setLocationRelativeTo((Component) null); jframe.setVisible(true); @@ -62,8 +50,8 @@ index e5f071c6449dc12cfed939b6b8a21a20cd7c38f7..d105b4133a906342a8ee76df3030cef8 + + // Paper start - Add logo as frame image + try { -+ jframe.setIconImage(ImageIO.read(Objects.requireNonNull(MinecraftServerGui.class.getClassLoader().getResourceAsStream("logo.png")))); -+ } catch (IOException ignore) { ++ jframe.setIconImage(javax.imageio.ImageIO.read(Objects.requireNonNull(MinecraftServerGui.class.getClassLoader().getResourceAsStream("logo.png")))); ++ } catch (java.io.IOException ignore) { + } + // Paper end + diff --git a/patches/server/0606-fix-converting-txt-to-json-file.patch b/patches/server/0606-fix-converting-txt-to-json-file.patch index c24f51f24..e43fa63a7 100644 --- a/patches/server/0606-fix-converting-txt-to-json-file.patch +++ b/patches/server/0606-fix-converting-txt-to-json-file.patch @@ -5,7 +5,7 @@ Subject: [PATCH] fix converting txt to json file diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java -index 04d2ed6ae4c2f250bb13ea732280108f91dc5660..21613cd49ebcccfd3837991dba1df0a188c42760 100644 +index d83bed436d2ad51cef83ecbf0c7df227a67ff404..dc96b30c70cd79d7b2a0322f32b9399a0f2faa41 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java @@ -17,6 +17,11 @@ public class DedicatedPlayerList extends PlayerList { @@ -21,10 +21,10 @@ index 04d2ed6ae4c2f250bb13ea732280108f91dc5660..21613cd49ebcccfd3837991dba1df0a1 this.saveUserBanList(); this.loadIpBanList(); diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index e968b880e435b8753314d85b919a0abc4f35be25..02d7b16f81ebf9f902a36d4f31802b20d1820d6e 100644 +index 8eca8825008713467a20f84d71ed0f32d5a40e47..e842e96fe566e89b37e38429c718318a2dd303f5 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -203,6 +203,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -206,6 +206,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface org.spigotmc.SpigotConfig.init((java.io.File) options.valueOf("spigot-settings")); org.spigotmc.SpigotConfig.registerCommands(); // Spigot end @@ -37,7 +37,7 @@ index e968b880e435b8753314d85b919a0abc4f35be25..02d7b16f81ebf9f902a36d4f31802b20 // Paper start try { com.destroystokyo.paper.PaperConfig.init((java.io.File) options.valueOf("paper-settings")); -@@ -265,9 +271,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -268,9 +274,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file."); } @@ -48,7 +48,7 @@ index e968b880e435b8753314d85b919a0abc4f35be25..02d7b16f81ebf9f902a36d4f31802b20 if (!OldUsersConverter.serverReadyAfterUserconversion(this)) { return false; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 0052a9c5d19db44331bb7ee93544d783b471e70a..bcdbdc648a76d2c57f4b0d86ae6f577fbc4be3d8 100644 +index 056cfea2595540110ccbf0f10b9349fca4929f41..87af28ec546a7b0bb5f23ec36d0820aa4e0c1557 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -174,6 +174,7 @@ public abstract class PlayerList { diff --git a/patches/server/0610-Add-recipe-to-cook-events.patch b/patches/server/0610-Add-recipe-to-cook-events.patch index 3dd0f5b9f..183bc8098 100644 --- a/patches/server/0610-Add-recipe-to-cook-events.patch +++ b/patches/server/0610-Add-recipe-to-cook-events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add recipe to cook events diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index 83daa40a79c841d03a9a831c46e9ee2876b89da0..c0803a17b3cd25aea02047287effa0cc76456bbc 100644 +index e62fa09ca481183be2ee158b0717172c90de1b92..18eff3a00ae5137ec71c31bc3466a864c60d9fde 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -425,7 +425,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -427,7 +427,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit CraftItemStack source = CraftItemStack.asCraftMirror(itemstack); org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1); @@ -18,7 +18,7 @@ index 83daa40a79c841d03a9a831c46e9ee2876b89da0..c0803a17b3cd25aea02047287effa0cc if (furnaceSmeltEvent.isCancelled()) { diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java -index dd272fe24d330c04f2f3f44db9357b3d35034c4e..7c48b26dc4baa3b4046840356132170c6e05a1d6 100644 +index 02cdd957e7f79f6c00ee015a0d382def8aa2aead..1d2dbaec8201de12fb65e2c01ca8a1ead7e873a7 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java @@ -52,7 +52,10 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { diff --git a/patches/server/0611-Add-Block-isValidTool.patch b/patches/server/0611-Add-Block-isValidTool.patch index da2e3ef77..8442851de 100644 --- a/patches/server/0611-Add-Block-isValidTool.patch +++ b/patches/server/0611-Add-Block-isValidTool.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Block#isValidTool diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 23d243c004af58bd8d37c594ff4bcbd314031604..7f9ba247b67c1a8ab54b7d70bdc31b847531e725 100644 +index 0be0ddcb8ea184683c1d0c619a932f3b03064941..55f830598e67943674aa54ddfefc02bb3a3a3dcc 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -670,5 +670,9 @@ public class CraftBlock implements Block { +@@ -676,5 +676,9 @@ public class CraftBlock implements Block { } return speed; } diff --git a/patches/server/0612-Allow-using-signs-inside-spawn-protection.patch b/patches/server/0612-Allow-using-signs-inside-spawn-protection.patch index f2098a95d..634231671 100644 --- a/patches/server/0612-Allow-using-signs-inside-spawn-protection.patch +++ b/patches/server/0612-Allow-using-signs-inside-spawn-protection.patch @@ -19,15 +19,15 @@ index 59675e523625b95169236bd0ead063cf0d87847e..bdd531806a4f006085be113c34b5780c + } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5d749940aad4634df2066f7e9228543adc2d61b2..506d26fb19a94f08c88d148d555b9781217c699a 100644 +index 5fd41a511709e5299a6d62521a46409fdb717664..69810e000f886ad105f587cfda8cb991730553b2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1738,7 +1738,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser - // Paper end +@@ -1752,7 +1752,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + int i = this.player.level.getMaxBuildHeight(); - if (blockposition.getY() < i) { -- if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) { // CraftBukkit - reuse value // Paper - revert CB change -+ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && (worldserver.mayInteract(this.player, blockposition) || (worldserver.paperConfig.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // CraftBukkit - reuse value // Paper - revert CB change // Paper - sign check - this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706 - InteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock); + if (blockposition.getY() < i) { +- if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) { ++ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && (worldserver.mayInteract(this.player, blockposition) || (worldserver.paperConfig.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper - sign check + this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706 + InteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock); diff --git a/patches/server/0613-Implement-Keyed-on-World.patch b/patches/server/0613-Implement-Keyed-on-World.patch index fe721a153..fac235d7a 100644 --- a/patches/server/0613-Implement-Keyed-on-World.patch +++ b/patches/server/0613-Implement-Keyed-on-World.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement Keyed on World diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index e116d734d482ac918cc88cf038c3aeae13c1a531..bd92d9671d99b81af401a0f7509ef65ca221024e 100644 +index 6124142faeeb792c0f7f6c167f8da47af446cba9..153c2551544dffe36e836fa62f2752160e2cd64a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1239,7 +1239,7 @@ public final class CraftServer implements Server { +@@ -1231,7 +1231,7 @@ public final class CraftServer implements Server { } else if (name.equals(levelName + "_the_end")) { worldKey = net.minecraft.world.level.Level.END; } else { @@ -16,8 +16,8 @@ index e116d734d482ac918cc88cf038c3aeae13c1a531..bd92d9671d99b81af401a0f7509ef65c + worldKey = ResourceKey.create(Registry.DIMENSION_REGISTRY, new net.minecraft.resources.ResourceLocation(creator.key().getNamespace().toLowerCase(java.util.Locale.ENGLISH), creator.key().getKey().toLowerCase(java.util.Locale.ENGLISH))); // Paper } - ServerLevel internal = (ServerLevel) new ServerLevel(this.console, console.executor, worldSession, worlddata, worldKey, dimensionmanager, this.getServer().progressListenerFactory.create(11), -@@ -1331,6 +1331,15 @@ public final class CraftServer implements Server { + ServerLevel internal = (ServerLevel) new ServerLevel(this.console, console.executor, worldSession, worlddata, worldKey, holder, this.getServer().progressListenerFactory.create(11), +@@ -1323,6 +1323,15 @@ public final class CraftServer implements Server { return null; } @@ -34,10 +34,10 @@ index e116d734d482ac918cc88cf038c3aeae13c1a531..bd92d9671d99b81af401a0f7509ef65c // Check if a World already exists with the UID. if (this.getWorld(world.getUID()) != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index b6c4d0f4fbe0dc8a4148939e231426cac42dbc18..80c1bc9581ba227144b97e5bd2d6fbae0cd37edd 100644 +index f701061688d9058ec89dcf5c8ae337c17ff0d7eb..5f77172bcd7c250d33a9ecbd40dbf70f370dcc9e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2017,6 +2017,11 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2020,6 +2020,11 @@ public class CraftWorld extends CraftRegionAccessor implements World { return java.util.concurrent.CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk()); }, net.minecraft.server.MinecraftServer.getServer()); } diff --git a/patches/server/0616-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch b/patches/server/0616-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch index eef34ce85..ff46048dc 100644 --- a/patches/server/0616-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch +++ b/patches/server/0616-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Only set despawnTimer for Wandering Traders spawned by diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 05ca012854100013714e3d6e8803a2959938cba4..d17bde781ff574799054d9696e4d4480fe04a52c 100644 +index 05a3d736193775c1aa6ce3759e13a1f76f747d09..5e25d055665bab4d06a9b641892d4149da01218a 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -334,6 +334,12 @@ public class EntityType implements EntityTypeTest { +@@ -338,6 +338,12 @@ public class EntityType implements EntityTypeTest { @Nullable public T spawn(ServerLevel worldserver, @Nullable CompoundTag nbttagcompound, @Nullable Component ichatbasecomponent, @Nullable Player entityhuman, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { @@ -22,7 +22,7 @@ index 05ca012854100013714e3d6e8803a2959938cba4..d17bde781ff574799054d9696e4d4480 // Paper start - Call PreCreatureSpawnEvent org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityType.getKey(this).getPath()); if (type != null) { -@@ -349,6 +355,7 @@ public class EntityType implements EntityTypeTest { +@@ -353,6 +359,7 @@ public class EntityType implements EntityTypeTest { } // Paper end T t0 = this.create(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1); @@ -31,10 +31,10 @@ index 05ca012854100013714e3d6e8803a2959938cba4..d17bde781ff574799054d9696e4d4480 if (t0 != null) { worldserver.addFreshEntityWithPassengers(t0, spawnReason); diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -index 1101989e93758294c1adebbef0ab12a3c046e326..087a2c4dd89c63fc6c269cc38b7662051c051571 100644 +index d7cb3d8b37f225ee4796246aa907da1092fa9a0d..abb2c5c4ac481c7529aa29322babb1929235e15a 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java +++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -@@ -60,7 +60,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill +@@ -59,7 +59,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill public WanderingTrader(EntityType type, Level world) { super(type, world); @@ -44,7 +44,7 @@ index 1101989e93758294c1adebbef0ab12a3c046e326..087a2c4dd89c63fc6c269cc38b766205 @Override diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java -index 487dfa0dd39b99994a82ff3858903c28d7676c0d..323eea2bccacfcc85849b5d82c2b30d991e0c0d8 100644 +index 0eddd793fa590a68bd094d417ffb90941532522c..4e478c30714a8e4cd95f02e73615d166836d1e4b 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java +++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java @@ -121,7 +121,7 @@ public class WanderingTraderSpawner implements CustomSpawner { diff --git a/patches/server/0619-forced-whitelist-use-configurable-kick-message.patch b/patches/server/0619-forced-whitelist-use-configurable-kick-message.patch index 0e9fa76a3..cbdc17294 100644 --- a/patches/server/0619-forced-whitelist-use-configurable-kick-message.patch +++ b/patches/server/0619-forced-whitelist-use-configurable-kick-message.patch @@ -5,10 +5,10 @@ Subject: [PATCH] forced whitelist: use configurable kick message diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 18830fa8e43c70c9da417eb771d553353b06bb48..5de82c5d7da2ca6eeee4b804b916fa9d385cc25c 100644 +index 3e8b73dccfb9ffdd0bc013edb2d05e3cae934fb7..236832905eec0eba651e6978737ccb150154c16b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -73,7 +73,6 @@ import net.minecraft.nbt.NbtOps; +@@ -73,7 +73,6 @@ import net.minecraft.gametest.framework.GameTestTicker; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TextComponent; @@ -16,7 +16,7 @@ index 18830fa8e43c70c9da417eb771d553353b06bb48..5de82c5d7da2ca6eeee4b804b916fa9d import net.minecraft.network.protocol.game.ClientboundChangeDifficultyPacket; import net.minecraft.network.protocol.game.ClientboundSetTimePacket; import net.minecraft.network.protocol.status.ServerStatus; -@@ -2061,7 +2060,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements EntityTypeTest { - final Spliterator spliterator = entityNbtList.spliterator(); +@@ -564,9 +564,20 @@ public class EntityType implements EntityTypeTest { + final Spliterator spliterator = entityNbtList.spliterator(); return StreamSupport.stream(new Spliterator() { + final java.util.Map, Integer> loadedEntityCounts = new java.util.HashMap<>(); // Paper @@ -86,7 +86,7 @@ index d17bde781ff574799054d9696e4d4480fe04a52c..419a7e9614af2328ed401fc954196056 return entity; }); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java -index ac1e1a56698bda3a02d76c843562d4f66ad9ffa3..bc46fdff45b174d9c266d1b6b546061a39b4997d 100644 +index edc81a67678bdcb7acb3ae4c8bfa8230792ad7a2..7d00e21ea5f93936b5fea9a9100e1dd6db9526cf 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java @@ -90,7 +90,18 @@ public class EntityStorage implements EntityPersistentStorage { diff --git a/patches/server/0622-fix-cancelling-block-falling-causing-client-desync.patch b/patches/server/0622-fix-cancelling-block-falling-causing-client-desync.patch index e68d092a8..33b450544 100644 --- a/patches/server/0622-fix-cancelling-block-falling-causing-client-desync.patch +++ b/patches/server/0622-fix-cancelling-block-falling-causing-client-desync.patch @@ -5,27 +5,15 @@ Subject: [PATCH] fix cancelling block falling causing client desync diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index e74a87336b47611fa29df4cd3d272fb08b91630b..0c94b4cb6ee0c3dffe0b67a2291d0160ae0ef96f 100644 +index 483127e9418489ad7ba1fbcb14a045d91c1c3c30..880521f25a6c8483c79043f237866cb7a49c3a54 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -128,8 +128,18 @@ public class FallingBlockEntity extends Entity { +@@ -192,7 +192,7 @@ public class FallingBlockEntity extends Entity { - if (this.time++ == 0) { - blockposition = this.blockPosition(); -- if (this.level.getBlockState(blockposition).is(block) && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) { -- this.level.removeBlock(blockposition, false); -+ // Paper start - fix cancelling block falling causing client desync -+ if (this.level.getBlockState(blockposition).is(block)) { -+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) { -+ if (this.level.getBlockState(blockposition).is(block)) { //if listener didn't update the block -+ ((ServerLevel) level).getChunkSource().blockChanged(blockposition); -+ } -+ this.discard(); -+ return; -+ } else { -+ this.level.removeBlock(blockposition, false); -+ } -+ // Paper end - fix cancelling block falling causing client desync - } else if (!this.level.isClientSide) { - this.discard(); - return; + // CraftBukkit start + if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, this.blockState).isCancelled()) { +- this.discard(); // SPIGOT-6586 called before the event in previous versions ++ this.discard(); // SPIGOT-6586 called before the event in previous versions //TODO test if desync happens on cancel + return; + } + // CraftBukkit end diff --git a/patches/server/0624-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch b/patches/server/0624-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch index 252b086d8..51fbaae52 100644 --- a/patches/server/0624-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch +++ b/patches/server/0624-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow for Component suggestion tooltips in diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5a7c0f201a4c84c8c8bf138b21e92b59946abff2..6c0c45ec3fd376a2863b54e49120db662d176491 100644 +index 25c78a8c32210cdb670be9efb0a52727b6a86985..269b0910f8e39511dbb0f29404f79ad96ce511ae 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -761,12 +761,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -767,12 +767,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper start - async tab completion com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event; @@ -24,7 +24,7 @@ index 5a7c0f201a4c84c8c8bf138b21e92b59946abff2..6c0c45ec3fd376a2863b54e49120db66 // If the event isn't handled, we can assume that we have no completions, and so we'll ask the server if (!event.isHandled()) { if (!event.isCancelled()) { -@@ -785,10 +784,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -791,10 +790,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser }); } } else if (!completions.isEmpty()) { diff --git a/patches/server/0625-Enhance-console-tab-completions-for-brigadier-comman.patch b/patches/server/0625-Enhance-console-tab-completions-for-brigadier-comman.patch index 950901ff4..ee304b677 100644 --- a/patches/server/0625-Enhance-console-tab-completions-for-brigadier-comman.patch +++ b/patches/server/0625-Enhance-console-tab-completions-for-brigadier-comman.patch @@ -216,10 +216,10 @@ index 0000000000000000000000000000000000000000..5ab8365b806dd035800ba9b449c9bc92 + public void setErrorIndex(final int errorIndex) {} +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 02d7b16f81ebf9f902a36d4f31802b20d1820d6e..77f49329cc903ba687c60032ba4b21786f79a56b 100644 +index e842e96fe566e89b37e38429c718318a2dd303f5..a97e4ac808ed746c5e6bbcbe90839beb00c57c52 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -182,7 +182,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -185,7 +185,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface thread.setDaemon(true); thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER)); @@ -228,7 +228,7 @@ index 02d7b16f81ebf9f902a36d4f31802b20d1820d6e..77f49329cc903ba687c60032ba4b2178 DedicatedServer.LOGGER.info("Starting minecraft server version {}", SharedConstants.getCurrentVersion().getName()); if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); -@@ -216,6 +216,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -219,6 +219,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface DedicatedServer.LOGGER.error("Unable to load server configuration", e); return false; } diff --git a/patches/server/0626-Fix-PlayerItemConsumeEvent-cancelling-properly.patch b/patches/server/0626-Fix-PlayerItemConsumeEvent-cancelling-properly.patch index 52faf360a..7141d18a5 100644 --- a/patches/server/0626-Fix-PlayerItemConsumeEvent-cancelling-properly.patch +++ b/patches/server/0626-Fix-PlayerItemConsumeEvent-cancelling-properly.patch @@ -9,10 +9,10 @@ till their item is switched. This patch clears the active item when the event is cancelled diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8b9d61ee5384d530f80ea7496b93ceac24735e36..f0d309ad128359c01e6723a462a27670cfd29751 100644 +index 9a85187a111116f6dabf9b40867a4f3cdcf64c6a..fd2d5e274a3bf889b954bed17d286d1157cd208e 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3729,6 +3729,7 @@ public abstract class LivingEntity extends Entity { +@@ -3719,6 +3719,7 @@ public abstract class LivingEntity extends Entity { level.getCraftServer().getPluginManager().callEvent(event); if (event.isCancelled()) { diff --git a/patches/server/0628-Set-area-affect-cloud-rotation.patch b/patches/server/0628-Set-area-affect-cloud-rotation.patch index b5db28297..b0f478a35 100644 --- a/patches/server/0628-Set-area-affect-cloud-rotation.patch +++ b/patches/server/0628-Set-area-affect-cloud-rotation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Set area affect cloud rotation diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java -index 2c5ca6e91269aa27d18358b6f9b6e146a23ad933..abd9429ece67fc1649750a77045c8157c57309a1 100644 +index 9d247664e5867a31376b3681b7ed0c3404ea46d8..850131e601047ab1c585a6f8883ac3c0d0e97ba1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java -@@ -893,6 +893,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor { +@@ -894,6 +894,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor { entity.moveTo(location.getX(), location.getY(), location.getZ()); } else if (AreaEffectCloud.class.isAssignableFrom(clazz)) { entity = new net.minecraft.world.entity.AreaEffectCloud(world, x, y, z); diff --git a/patches/server/0630-Fix-duplicating-give-items-on-item-drop-cancel.patch b/patches/server/0630-Fix-duplicating-give-items-on-item-drop-cancel.patch index 88b9af1f6..1fdb5f16e 100644 --- a/patches/server/0630-Fix-duplicating-give-items-on-item-drop-cancel.patch +++ b/patches/server/0630-Fix-duplicating-give-items-on-item-drop-cancel.patch @@ -42,10 +42,10 @@ index 58941830a4bd024fcdb97df47783c82062e9167f..a0dc380e90415de9068ea408d62a1605 itemEntity2.makeFakeItem(); } diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 95b03fbdc0a5483761fce5c5542ce8f3187761c5..af0ff22ab9fde658b10604f08d29c28071a9fd06 100644 +index 4e604e902145ea91811e8e7769952024fcbd1a3d..0a486c8c4ad6abfdca804887e5db1487f53c1098 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -683,6 +683,13 @@ public abstract class Player extends LivingEntity { +@@ -693,6 +693,13 @@ public abstract class Player extends LivingEntity { @Nullable public ItemEntity drop(ItemStack stack, boolean throwRandomly, boolean retainOwnership) { @@ -59,7 +59,7 @@ index 95b03fbdc0a5483761fce5c5542ce8f3187761c5..af0ff22ab9fde658b10604f08d29c280 if (stack.isEmpty()) { return null; } else { -@@ -724,7 +731,7 @@ public abstract class Player extends LivingEntity { +@@ -734,7 +741,7 @@ public abstract class Player extends LivingEntity { PlayerDropItemEvent event = new PlayerDropItemEvent(player, drop); this.level.getCraftServer().getPluginManager().callEvent(event); diff --git a/patches/server/0631-add-consumeFuel-to-FurnaceBurnEvent.patch b/patches/server/0631-add-consumeFuel-to-FurnaceBurnEvent.patch index e993dfbfd..ffb906203 100644 --- a/patches/server/0631-add-consumeFuel-to-FurnaceBurnEvent.patch +++ b/patches/server/0631-add-consumeFuel-to-FurnaceBurnEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] add consumeFuel to FurnaceBurnEvent diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index c0803a17b3cd25aea02047287effa0cc76456bbc..11b2fcb783422216b45c8fcf5df37842b2b4e7b2 100644 +index 18eff3a00ae5137ec71c31bc3466a864c60d9fde..888e1f2bc6ea4ddbbcc5466f177233f25b290459 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -346,7 +346,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -348,7 +348,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit if (blockEntity.isLit() && furnaceBurnEvent.isBurning()) { // CraftBukkit end flag1 = true; diff --git a/patches/server/0635-fix-PlayerItemHeldEvent-firing-twice.patch b/patches/server/0635-fix-PlayerItemHeldEvent-firing-twice.patch index 63f4ac517..e8a861e58 100644 --- a/patches/server/0635-fix-PlayerItemHeldEvent-firing-twice.patch +++ b/patches/server/0635-fix-PlayerItemHeldEvent-firing-twice.patch @@ -5,10 +5,10 @@ Subject: [PATCH] fix PlayerItemHeldEvent firing twice diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6c0c45ec3fd376a2863b54e49120db662d176491..1044534df2d8355d6485d08fa1f9b325bd165cda 100644 +index 269b0910f8e39511dbb0f29404f79ad96ce511ae..89d1e34e0c2be7328ffe7635b64d1a8f2256bafe 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1939,6 +1939,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1959,6 +1959,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (this.player.isImmobile()) return; // CraftBukkit if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) { diff --git a/patches/server/0636-Added-PlayerDeepSleepEvent.patch b/patches/server/0636-Added-PlayerDeepSleepEvent.patch index 1255d32c2..00b71569b 100644 --- a/patches/server/0636-Added-PlayerDeepSleepEvent.patch +++ b/patches/server/0636-Added-PlayerDeepSleepEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Added PlayerDeepSleepEvent diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index af0ff22ab9fde658b10604f08d29c28071a9fd06..ec44db1e6a6c92d8aff241b5f9acf743d3088fea 100644 +index 0a486c8c4ad6abfdca804887e5db1487f53c1098..f4c861c86b718d67ae13ac02c6d1f20433312725 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -245,6 +245,11 @@ public abstract class Player extends LivingEntity { +@@ -246,6 +246,11 @@ public abstract class Player extends LivingEntity { if (this.isSleeping()) { ++this.sleepCounter; diff --git a/patches/server/0637-More-World-API.patch b/patches/server/0637-More-World-API.patch index 154eeb4c5..7b0b96730 100644 --- a/patches/server/0637-More-World-API.patch +++ b/patches/server/0637-More-World-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] More World API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 80c1bc9581ba227144b97e5bd2d6fbae0cd37edd..e053a6be61f1e9a98d108b8eb7cd4fc053f6c75e 100644 +index 5f77172bcd7c250d33a9ecbd40dbf70f370dcc9e..fc7f17f05ef5457cce545424b19537c9d3e9bf01 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1963,6 +1963,65 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1966,6 +1966,65 @@ public class CraftWorld extends CraftRegionAccessor implements World { return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ()); } diff --git a/patches/server/0639-Implement-methods-to-convert-between-Component-and-B.patch b/patches/server/0639-Implement-methods-to-convert-between-Component-and-B.patch index a48314225..ad3e98c8b 100644 --- a/patches/server/0639-Implement-methods-to-convert-between-Component-and-B.patch +++ b/patches/server/0639-Implement-methods-to-convert-between-Component-and-B.patch @@ -42,10 +42,10 @@ index 0000000000000000000000000000000000000000..dd6012b6a097575b2d1471be5069ecce + } +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 77f49329cc903ba687c60032ba4b21786f79a56b..331c85d236922d7a4b5732cb09aa708830e1393c 100644 +index a97e4ac808ed746c5e6bbcbe90839beb00c57c52..fa6adf12e8272c90c3376bc93350dc57eb1cd461 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -220,6 +220,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -223,6 +223,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface com.destroystokyo.paper.PaperConfig.registerCommands(); com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // load mappings for stacktrace deobf and etc. diff --git a/patches/server/0641-Introduce-beacon-activation-deactivation-events.patch b/patches/server/0641-Introduce-beacon-activation-deactivation-events.patch index 766214f6e..4858e0f40 100644 --- a/patches/server/0641-Introduce-beacon-activation-deactivation-events.patch +++ b/patches/server/0641-Introduce-beacon-activation-deactivation-events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Introduce beacon activation/deactivation events diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -index 008d486f4166d9f384e3aab48af6d66a255f3564..423560afba1bc03c0bb2b7d5d028451f34e59ec5 100644 +index 82976b3675f581a9f3ccb9e23048bd44864203f8..8d5c9813010a0256bd2712a1eabbc91f0f473a41 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -@@ -205,6 +205,15 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { +@@ -204,6 +204,15 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { BeaconBlockEntity.playSound(world, pos, SoundEvents.BEACON_AMBIENT); } } @@ -24,7 +24,7 @@ index 008d486f4166d9f384e3aab48af6d66a255f3564..423560afba1bc03c0bb2b7d5d028451f if (blockEntity.lastCheckY >= l) { blockEntity.lastCheckY = world.getMinBuildHeight() - 1; -@@ -262,6 +271,10 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { +@@ -261,6 +270,10 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { @Override public void setRemoved() { diff --git a/patches/server/0642-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/server/0642-add-RespawnFlags-to-PlayerRespawnEvent.patch index 5eb09ca96..5e9f9d090 100644 --- a/patches/server/0642-add-RespawnFlags-to-PlayerRespawnEvent.patch +++ b/patches/server/0642-add-RespawnFlags-to-PlayerRespawnEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 1044534df2d8355d6485d08fa1f9b325bd165cda..7a76e5a83f98295bbac29b89e8b8900b38ed5bad 100644 +index 89d1e34e0c2be7328ffe7635b64d1a8f2256bafe..1083e5c23065f9bf5e2edd1e16fd80366ab931f8 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2477,7 +2477,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2497,7 +2497,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser case PERFORM_RESPAWN: if (this.player.wonGame) { this.player.wonGame = false; @@ -18,7 +18,7 @@ index 1044534df2d8355d6485d08fa1f9b325bd165cda..7a76e5a83f98295bbac29b89e8b8900b } else { if (this.player.getHealth() > 0.0F) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index b5c9c959de02430aee46bb8a1e55cef8fc6f69bd..3900e885988bc1f2865b95f825cba34d04919731 100644 +index 976f55eeb9fb0bc6cafdc9e39f347e6ba8d9e1ac..6419a548fe9a552bef69a68bfd0c45460f31be77 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -810,6 +810,12 @@ public abstract class PlayerList { diff --git a/patches/server/0644-Send-empty-commands-if-tab-completion-is-disabled.patch b/patches/server/0644-Send-empty-commands-if-tab-completion-is-disabled.patch index 8ec39c7cd..2b52bb534 100644 --- a/patches/server/0644-Send-empty-commands-if-tab-completion-is-disabled.patch +++ b/patches/server/0644-Send-empty-commands-if-tab-completion-is-disabled.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Send empty commands if tab completion is disabled diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 09bc5589fec90336ba1a116d0f4fbeccd61c88cd..112dddca796f9d987c321174bf9d6ad98dbb7a5e 100644 +index e195ef979984ea7ffe4558c42ebabadf2a00950a..8f51b814c5b1c2c14378565363119df45af25726 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -343,7 +343,12 @@ public class Commands { +@@ -345,7 +345,12 @@ public class Commands { } public void sendCommands(ServerPlayer player) { diff --git a/patches/server/0645-Add-more-WanderingTrader-API.patch b/patches/server/0645-Add-more-WanderingTrader-API.patch index fd2be763c..65d351d6d 100644 --- a/patches/server/0645-Add-more-WanderingTrader-API.patch +++ b/patches/server/0645-Add-more-WanderingTrader-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add more WanderingTrader API diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -index 087a2c4dd89c63fc6c269cc38b7662051c051571..642279bb7e15db9f662094ffd6ded2e3c7af3fd6 100644 +index abb2c5c4ac481c7529aa29322babb1929235e15a..86e1ba898d6b92735258419fa74352e5116226dc 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java +++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -@@ -57,6 +57,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill +@@ -56,6 +56,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill @Nullable private BlockPos wanderTarget; private int despawnDelay; @@ -19,7 +19,7 @@ index 087a2c4dd89c63fc6c269cc38b7662051c051571..642279bb7e15db9f662094ffd6ded2e3 public WanderingTrader(EntityType type, Level world) { super(type, world); -@@ -67,10 +71,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill +@@ -66,10 +70,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill protected void registerGoals() { this.goalSelector.addGoal(0, new FloatGoal(this)); this.goalSelector.addGoal(0, new UseItemGoal<>(this, PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.INVISIBILITY), SoundEvents.WANDERING_TRADER_DISAPPEARED, (entityvillagertrader) -> { diff --git a/patches/server/0646-Add-EntityBlockStorage-clearEntities.patch b/patches/server/0646-Add-EntityBlockStorage-clearEntities.patch index 2ed1fae3b..4742b14da 100644 --- a/patches/server/0646-Add-EntityBlockStorage-clearEntities.patch +++ b/patches/server/0646-Add-EntityBlockStorage-clearEntities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add EntityBlockStorage#clearEntities() diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java -index 0dca7b0f40af9337bdda75ba40cb064f39723bf8..e5e65bb68a92fffbf765eb140fe1e1ec77059c49 100644 +index e4e879cdfe7d257161bf8e98305c0f2e9b9539f9..19127ec5d89235ea9af549810b24783e0af85a3d 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java -@@ -139,6 +139,11 @@ public class BeehiveBlockEntity extends BlockEntity { +@@ -138,6 +138,11 @@ public class BeehiveBlockEntity extends BlockEntity { return this.stored.size(); } diff --git a/patches/server/0648-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch b/patches/server/0648-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch index 699e712c8..0b8862465 100644 --- a/patches/server/0648-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch +++ b/patches/server/0648-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add raw address to AsyncPlayerPreLoginEvent diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 8dc1e8bba37986c75966e321614ebb6366729c29..45db764f4499ee71bef691d37b604f21da120fe7 100644 +index ab21f25a3eb0575d08aeac717ba2b74160f54fa9..4e23e9ac3579dd0cedf0dfdbb231f6fae111745c 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -352,12 +352,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -355,12 +355,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener // Paper end String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName(); java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(); @@ -16,10 +16,10 @@ index 8dc1e8bba37986c75966e321614ebb6366729c29..45db764f4499ee71bef691d37b604f21 java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId(); final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; - // Paper start - PlayerProfile profile = CraftPlayerProfile.asBukkitMirror(ServerLoginPacketListenerImpl.this.gameProfile); -- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, profile); -+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile); + // Paper start + com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(ServerLoginPacketListenerImpl.this.gameProfile); +- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, profile); ++ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile); // Paper - add rawAddress server.getPluginManager().callEvent(asyncEvent); - profile = asyncEvent.getPlayerProfile(); - profile.complete(true); + profile = asyncEvent.getPlayerProfile(); + profile.complete(true); // Paper - setPlayerProfileAPI diff --git a/patches/server/0650-call-PortalCreateEvent-players-and-end-platform.patch b/patches/server/0650-call-PortalCreateEvent-players-and-end-platform.patch index 65f4f53c0..ea0c79702 100644 --- a/patches/server/0650-call-PortalCreateEvent-players-and-end-platform.patch +++ b/patches/server/0650-call-PortalCreateEvent-players-and-end-platform.patch @@ -5,10 +5,10 @@ Subject: [PATCH] call PortalCreateEvent players and end platform diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 88eef461048dafaa13681f91bfe69f71a4481b95..fd6eb3b3953ca0413af6a71c52503c9674917a9e 100644 +index 1dd7bebbedd8cf5e8b7b72738d9ebf869509ce24..160b1a7396472b682236d5f626ebf267bc8a5aea 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1196,15 +1196,21 @@ public class ServerPlayer extends Player { +@@ -1194,15 +1194,21 @@ public class ServerPlayer extends Player { private void createEndPlatform(ServerLevel world, BlockPos centerPos) { BlockPos.MutableBlockPos blockposition_mutableblockposition = centerPos.mutable(); diff --git a/patches/server/0653-Add-basic-Datapack-API.patch b/patches/server/0653-Add-basic-Datapack-API.patch index b7e33230d..9d3354fc6 100644 --- a/patches/server/0653-Add-basic-Datapack-API.patch +++ b/patches/server/0653-Add-basic-Datapack-API.patch @@ -92,10 +92,10 @@ index 0000000000000000000000000000000000000000..cf4374493c11057451a62a655514415c + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index bd92d9671d99b81af401a0f7509ef65ca221024e..f551ff9565dec612c007b4569362061a96135d59 100644 +index 153c2551544dffe36e836fa62f2752160e2cd64a..cca74c494c089e8668750eead58b508e61689515 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -284,6 +284,7 @@ public final class CraftServer implements Server { +@@ -280,6 +280,7 @@ public final class CraftServer implements Server { public boolean ignoreVanillaPermissions = false; private final List playerView; public int reloadCount; @@ -103,7 +103,7 @@ index bd92d9671d99b81af401a0f7509ef65ca221024e..f551ff9565dec612c007b4569362061a public static Exception excessiveVelEx; // Paper - Velocity warnings static { -@@ -365,6 +366,7 @@ public final class CraftServer implements Server { +@@ -361,6 +362,7 @@ public final class CraftServer implements Server { TicketType.PLUGIN.timeout = Math.min(20, this.configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second this.minimumAPI = this.configuration.getString("settings.minimum-api"); this.loadIcon(); @@ -111,7 +111,7 @@ index bd92d9671d99b81af401a0f7509ef65ca221024e..f551ff9565dec612c007b4569362061a } public boolean getCommandBlockOverride(String command) { -@@ -2709,5 +2711,11 @@ public final class CraftServer implements Server { +@@ -2701,5 +2703,11 @@ public final class CraftServer implements Server { public com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() { return mobGoals; } diff --git a/patches/server/0654-Add-environment-variable-to-disable-server-gui.patch b/patches/server/0654-Add-environment-variable-to-disable-server-gui.patch index 6ec5d1936..a8785b7a2 100644 --- a/patches/server/0654-Add-environment-variable-to-disable-server-gui.patch +++ b/patches/server/0654-Add-environment-variable-to-disable-server-gui.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add environment variable to disable server gui diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index d7975e6f0c855955ac04552cfbd4c9a8c86ae188..3835a8340792837674bdbcd5583ce74446b0460b 100644 +index 11ed386c6358e55fe5c0e5e8496fa7f7c663a7e2..69dc1271be0a3f3f2fb4ce15981ed25d24dce785 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -249,6 +249,7 @@ public class Main { +@@ -272,6 +272,7 @@ public class Main { */ boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui"); diff --git a/patches/server/0655-additions-to-PlayerGameModeChangeEvent.patch b/patches/server/0655-additions-to-PlayerGameModeChangeEvent.patch index ba40ef434..21b44ab5e 100644 --- a/patches/server/0655-additions-to-PlayerGameModeChangeEvent.patch +++ b/patches/server/0655-additions-to-PlayerGameModeChangeEvent.patch @@ -45,10 +45,10 @@ index d75f78d2e3fb1376e8f6a8668c98a04a693c99e1..79f6089b934124c3309c6bee2e48b36b } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index fd6eb3b3953ca0413af6a71c52503c9674917a9e..77ba7fe43ceffcb816d209da45ab0c5de2112ee3 100644 +index 160b1a7396472b682236d5f626ebf267bc8a5aea..f1661e228ed982f38e0bc3e9e0c1720608e0b4a4 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1805,8 +1805,15 @@ public class ServerPlayer extends Player { +@@ -1803,8 +1803,15 @@ public class ServerPlayer extends Player { } public boolean setGameMode(GameType gameMode) { @@ -66,7 +66,7 @@ index fd6eb3b3953ca0413af6a71c52503c9674917a9e..77ba7fe43ceffcb816d209da45ab0c5d } else { this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId())); if (gameMode == GameType.SPECTATOR) { -@@ -1818,7 +1825,7 @@ public class ServerPlayer extends Player { +@@ -1816,7 +1823,7 @@ public class ServerPlayer extends Player { this.onUpdateAbilities(); this.updateEffectVisibility(); @@ -75,7 +75,7 @@ index fd6eb3b3953ca0413af6a71c52503c9674917a9e..77ba7fe43ceffcb816d209da45ab0c5d } } -@@ -2200,6 +2207,16 @@ public class ServerPlayer extends Player { +@@ -2198,6 +2205,16 @@ public class ServerPlayer extends Player { } public void loadGameTypes(@Nullable CompoundTag nbt) { @@ -93,10 +93,10 @@ index fd6eb3b3953ca0413af6a71c52503c9674917a9e..77ba7fe43ceffcb816d209da45ab0c5d } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 53a0e74de9d50e0ece28f9d73a96135012b5d645..dcfb5fd1763979f081cc253716f518bc371dd546 100644 +index f97d97426144527cff9ebb91b26fe8541a9c6d9b..b6eef41079120fffd63f06f681378b1b628b95e0 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -72,18 +72,24 @@ public class ServerPlayerGameMode { +@@ -74,18 +74,24 @@ public class ServerPlayerGameMode { } public boolean changeGameModeForPlayer(GameType gameMode) { @@ -126,10 +126,10 @@ index 53a0e74de9d50e0ece28f9d73a96135012b5d645..dcfb5fd1763979f081cc253716f518bc } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 7a76e5a83f98295bbac29b89e8b8900b38ed5bad..8a1041d8ef225131428cebf9e293563e540944bf 100644 +index 1083e5c23065f9bf5e2edd1e16fd80366ab931f8..43f2fc30b4a7d5b05d3c9399eda1d3fc69469e8f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2486,7 +2486,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2506,7 +2506,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player = this.server.getPlayerList().respawn(this.player, false); if (this.server.isHardcore()) { diff --git a/patches/server/0658-Fix-and-optimise-world-force-upgrading.patch b/patches/server/0658-Fix-and-optimise-world-force-upgrading.patch index 576a01b93..17d524900 100644 --- a/patches/server/0658-Fix-and-optimise-world-force-upgrading.patch +++ b/patches/server/0658-Fix-and-optimise-world-force-upgrading.patch @@ -246,18 +246,18 @@ index 0000000000000000000000000000000000000000..748e6923338d40d67e31251e9ab60016 + } +} diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 3835a8340792837674bdbcd5583ce74446b0460b..e2c8f716af55ebb7e4233c2a3d6515f8f4a239fa 100644 +index 69dc1271be0a3f3f2fb4ce15981ed25d24dce785..04359306ba6a117e447966e04ef1376b6e2d7e99 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -13,6 +13,7 @@ import java.nio.file.Paths; +@@ -15,6 +15,7 @@ import java.nio.file.Path; + import java.nio.file.Paths; import java.util.Optional; - import java.util.concurrent.CompletableFuture; import java.util.function.BooleanSupplier; +import io.papermc.paper.world.ThreadedWorldUpgrader; import joptsimple.NonOptionArgumentSpec; import joptsimple.OptionParser; import joptsimple.OptionSet; -@@ -293,6 +294,15 @@ public class Main { +@@ -316,6 +317,15 @@ public class Main { } // Paper end @@ -274,7 +274,7 @@ index 3835a8340792837674bdbcd5583ce74446b0460b..e2c8f716af55ebb7e4233c2a3d6515f8 Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, generatorOptions, eraseCache); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d5029567bfe6f34e175e06ff7dae0e4947b2600c..860540a50c3281ab35acffd845f536dadab285d7 100644 +index 236832905eec0eba651e6978737ccb150154c16b..069c13952ac1ea1640f5331f0814adf0ffacba61 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -557,11 +557,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here @@ -359,10 +359,10 @@ index 4bc33c31d497aa7d69226ab870fd78902bedfd5b..089e8414c7bdc102ba0d914af576df1a return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ())); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f551ff9565dec612c007b4569362061a96135d59..dfc1f5a9203acd85f481658d76193f9ed943f01c 100644 +index cca74c494c089e8668750eead58b508e61689515..e2662b3500bbc9aeb4b8eaf0adc04f7951af72df 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1200,12 +1200,7 @@ public final class CraftServer implements Server { +@@ -1192,12 +1192,7 @@ public final class CraftServer implements Server { } worlddata.checkName(name); worlddata.setModdedInfo(this.console.getServerModName(), this.console.getModdedStatus().shouldReportAsModified()); @@ -376,7 +376,7 @@ index f551ff9565dec612c007b4569362061a96135d59..dfc1f5a9203acd85f481658d76193f9e long j = BiomeManager.obfuscateSeed(creator.seed()); List list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata)); -@@ -1234,6 +1229,14 @@ public final class CraftServer implements Server { +@@ -1226,6 +1221,14 @@ public final class CraftServer implements Server { } } diff --git a/patches/server/0660-Add-Unix-domain-socket-support.patch b/patches/server/0660-Add-Unix-domain-socket-support.patch index 5c0940448..6c525d425 100644 --- a/patches/server/0660-Add-Unix-domain-socket-support.patch +++ b/patches/server/0660-Add-Unix-domain-socket-support.patch @@ -11,10 +11,10 @@ Tested-by: Mariell Hoversholm Reviewed-by: Mariell Hoversholm diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index ea7444d5d242e15fe3fb1d87ddb98f3074d3e979..2a9d5d977932e63ff7cae2fb8a7cfe7860172a39 100644 +index 932b494ea2a5e849b233c73bd2472d5c85f5ba52..8536dd544876e245a611379a7ed1446b0ed06eac 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -614,6 +614,11 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -626,6 +626,11 @@ public class Connection extends SimpleChannelInboundHandler> { // Spigot Start public SocketAddress getRawAddress() { @@ -27,10 +27,10 @@ index ea7444d5d242e15fe3fb1d87ddb98f3074d3e979..2a9d5d977932e63ff7cae2fb8a7cfe78 } // Spigot End diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 331c85d236922d7a4b5732cb09aa708830e1393c..82cee660a029547eda8abdf4188b9d1fb4ba0d53 100644 +index fa6adf12e8272c90c3376bc93350dc57eb1cd461..12020ec70e47499962ad19d03c89da8e2891536e 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -231,6 +231,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -234,6 +234,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface this.setEnforceWhitelist(dedicatedserverproperties.enforceWhitelist); // this.worldData.setGameType(dedicatedserverproperties.gamemode); // CraftBukkit - moved to world loading DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode); @@ -51,7 +51,7 @@ index 331c85d236922d7a4b5732cb09aa708830e1393c..82cee660a029547eda8abdf4188b9d1f InetAddress inetaddress = null; if (!this.getLocalIp().isEmpty()) { -@@ -240,12 +254,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -243,12 +257,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface if (this.getPort() < 0) { this.setPort(dedicatedserverproperties.serverPort); } @@ -69,7 +69,7 @@ index 331c85d236922d7a4b5732cb09aa708830e1393c..82cee660a029547eda8abdf4188b9d1f DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!"); DedicatedServer.LOGGER.warn("The exception was: {}", ioexception.toString()); diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index 3d78b1f06839fa6534c84979a32bb80ec5de6d84..70b0c7fea72397f7bbdf02ce2794e7fb6fbd3742 100644 +index c36089ead51d2e7dc3369d5f9a1869f58ff5391c..bfa519b9335c960a5baec50b0da95d95cd5ee958 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -78,7 +78,12 @@ public class ServerConnectionListener { diff --git a/patches/server/0661-Add-EntityInsideBlockEvent.patch b/patches/server/0661-Add-EntityInsideBlockEvent.patch index ca973e9b0..2c221ccde 100644 --- a/patches/server/0661-Add-EntityInsideBlockEvent.patch +++ b/patches/server/0661-Add-EntityInsideBlockEvent.patch @@ -29,10 +29,10 @@ index 7cc20edb0cc3994a6c23ae99801bb254869e424f..2036006b934ba1f27da606320b4c456a int i = this.getSignalForState(state); diff --git a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java -index bc472d86ae79437dab87454caa60d64399a14715..3f434ac77611a81889b15c118a0fca57cc10a6bb 100644 +index e3079d858d9252f13a24f51a2da097bfb6524ea4..45a5343c1109c63ce7864327837979282b904367 100644 --- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java -@@ -171,6 +171,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone +@@ -170,6 +170,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -65,10 +65,10 @@ index 70161d554163779ba53ad278c6af95b9da87edce..b7f37475192bf79252482314080c9ba0 this.checkPressed(state, world, pos); } diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java -index 00ada22889dafb7ae8e8740cd3eb8370fbb417eb..fa36ad3bb63764778aa7201d90e331e64292c7b4 100644 +index f1bbfc85582d29a50a82f9207509985dcb76b693..4323e5cc2054804243e8e2f24fd5447280f218de 100644 --- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java -@@ -117,6 +117,7 @@ public class CactusBlock extends Block { +@@ -116,6 +116,7 @@ public class CactusBlock extends Block { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -77,10 +77,10 @@ index 00ada22889dafb7ae8e8740cd3eb8370fbb417eb..fa36ad3bb63764778aa7201d90e331e6 entity.hurt(DamageSource.CACTUS, 1.0F); CraftEventFactory.blockDamage = null; // CraftBukkit diff --git a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java -index eeb729428356b116f650d54f44dacf5694969f7d..0b60b545271e62df86a0eb3c1f0f315a014b24cd 100644 +index 6d28b4724f7befc56534ba52b6d45068f6b06868..b29d1fd37f3f265e01128ff6fb1d56da2280f6e0 100644 --- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java -@@ -94,6 +94,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB +@@ -93,6 +93,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { diff --git a/patches/server/0663-Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/server/0663-Add-cause-to-Weather-ThunderChangeEvents.patch index e5f0eb359..3e4a65265 100644 --- a/patches/server/0663-Add-cause-to-Weather-ThunderChangeEvents.patch +++ b/patches/server/0663-Add-cause-to-Weather-ThunderChangeEvents.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add cause to Weather/ThunderChangeEvents diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 777584bf6858df530812c378e9651339155e4cd7..a8befb2fabd24b6129887fc4ebab39caf1f5d803 100644 +index 33e2da5fb3cf6dd21e3df601bb9ee9a4991102e4..3fac2eba419cfa41c80ea461964ec8963bcd91ab 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -471,8 +471,8 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -474,8 +474,8 @@ public class ServerLevel extends Level implements WorldGenLevel { this.serverLevelData.setClearWeatherTime(clearDuration); this.serverLevelData.setRainTime(rainDuration); this.serverLevelData.setThunderTime(rainDuration); @@ -19,7 +19,7 @@ index 777584bf6858df530812c378e9651339155e4cd7..a8befb2fabd24b6129887fc4ebab39ca } @Override -@@ -862,8 +862,8 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -865,8 +865,8 @@ public class ServerLevel extends Level implements WorldGenLevel { this.serverLevelData.setThunderTime(j); this.serverLevelData.setRainTime(k); this.serverLevelData.setClearWeatherTime(i); @@ -30,7 +30,7 @@ index 777584bf6858df530812c378e9651339155e4cd7..a8befb2fabd24b6129887fc4ebab39ca } this.oThunderLevel = this.thunderLevel; -@@ -929,14 +929,14 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -932,14 +932,14 @@ public class ServerLevel extends Level implements WorldGenLevel { private void resetWeatherCycle() { // CraftBukkit start @@ -48,10 +48,10 @@ index 777584bf6858df530812c378e9651339155e4cd7..a8befb2fabd24b6129887fc4ebab39ca // If we stop due to everyone sleeping we should reset the weather duration to some other random value. // Not that everyone ever manages to get the whole server to sleep at the same time.... diff --git a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java -index 2dfff38f9720159939ee9b288366218131d4c35e..2ae71dd7fbbd2017c9faaa69c3fa2d4c0a0db069 100644 +index 1bd338c7860adf3b846cd6caa33312b3269ac3ef..95635cc7367b757d149bb2c81326a041f84782f0 100644 --- a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java +++ b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java -@@ -344,6 +344,11 @@ public class PrimaryLevelData implements ServerLevelData, WorldData { +@@ -346,6 +346,11 @@ public class PrimaryLevelData implements ServerLevelData, WorldData { @Override public void setThundering(boolean thundering) { @@ -63,7 +63,7 @@ index 2dfff38f9720159939ee9b288366218131d4c35e..2ae71dd7fbbd2017c9faaa69c3fa2d4c // CraftBukkit start if (this.thundering == thundering) { return; -@@ -351,7 +356,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData { +@@ -353,7 +358,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData { org.bukkit.World world = Bukkit.getWorld(this.getLevelName()); if (world != null) { @@ -72,7 +72,7 @@ index 2dfff38f9720159939ee9b288366218131d4c35e..2ae71dd7fbbd2017c9faaa69c3fa2d4c Bukkit.getServer().getPluginManager().callEvent(thunder); if (thunder.isCancelled()) { return; -@@ -378,6 +383,12 @@ public class PrimaryLevelData implements ServerLevelData, WorldData { +@@ -380,6 +385,12 @@ public class PrimaryLevelData implements ServerLevelData, WorldData { @Override public void setRaining(boolean raining) { @@ -85,7 +85,7 @@ index 2dfff38f9720159939ee9b288366218131d4c35e..2ae71dd7fbbd2017c9faaa69c3fa2d4c // CraftBukkit start if (this.raining == raining) { return; -@@ -385,7 +396,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData { +@@ -387,7 +398,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData { org.bukkit.World world = Bukkit.getWorld(this.getLevelName()); if (world != null) { @@ -95,10 +95,10 @@ index 2dfff38f9720159939ee9b288366218131d4c35e..2ae71dd7fbbd2017c9faaa69c3fa2d4c if (weather.isCancelled()) { return; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index e053a6be61f1e9a98d108b8eb7cd4fc053f6c75e..fb37aa387918e2970c5a5d9a94d86935cb854a72 100644 +index fc7f17f05ef5457cce545424b19537c9d3e9bf01..bbc0f333b59743973652ec4bf13936821a7e596a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1179,7 +1179,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1182,7 +1182,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void setStorm(boolean hasStorm) { @@ -107,7 +107,7 @@ index e053a6be61f1e9a98d108b8eb7cd4fc053f6c75e..fb37aa387918e2970c5a5d9a94d86935 this.setWeatherDuration(0); // Reset weather duration (legacy behaviour) this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands) } -@@ -1201,7 +1201,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1204,7 +1204,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void setThundering(boolean thundering) { diff --git a/patches/server/0666-Add-PlayerKickEvent-causes.patch b/patches/server/0666-Add-PlayerKickEvent-causes.patch index 5600be0c6..4f486fcda 100644 --- a/patches/server/0666-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0666-Add-PlayerKickEvent-causes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerKickEvent causes diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 860540a50c3281ab35acffd845f536dadab285d7..79e5b8a05828bbc07468d2deeb0f4dad51ca12a5 100644 +index 069c13952ac1ea1640f5331f0814adf0ffacba61..95179d309f668b3fe299ce4641164a1859517d33 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2064,7 +2064,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 80) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString()); - this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage); // Paper - use configurable kick message @@ -131,7 +131,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 if (this.cserver.getServer().isRunning()) { this.cserver.getPluginManager().callEvent(event); -@@ -501,7 +509,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -505,7 +513,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) { @@ -140,7 +140,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 } else { Entity entity = this.player.getRootVehicle(); -@@ -742,13 +750,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -748,13 +756,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async // CraftBukkit start if (this.chatSpamTickCount.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable @@ -156,7 +156,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 return; } // Paper end -@@ -900,7 +908,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -906,7 +914,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper start - validate pick item position if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); @@ -165,7 +165,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 return; } this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed -@@ -1065,7 +1073,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1071,7 +1079,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; if (byteLength > 256 * 4) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!"); @@ -174,7 +174,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 return; } byteTotal += byteLength; -@@ -1088,14 +1096,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1094,14 +1102,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser if (byteTotal > byteAllowed) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); @@ -191,7 +191,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 return; } this.lastBookTick = MinecraftServer.currentTick; -@@ -1219,7 +1227,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1225,7 +1233,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser public void handleMovePlayer(ServerboundMovePlayerPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) { @@ -200,7 +200,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 } else { ServerLevel worldserver = this.player.getLevel(); -@@ -1645,7 +1653,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1652,7 +1660,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.dropCount++; if (this.dropCount >= 20) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!"); @@ -209,7 +209,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 return; } } -@@ -1851,7 +1859,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1871,7 +1879,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) { ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName()); @@ -218,7 +218,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 } // Paper start PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()]; -@@ -1956,7 +1964,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1976,7 +1984,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player.resetLastActionTime(); } else { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); @@ -227,7 +227,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 } } -@@ -1972,7 +1980,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1992,7 +2000,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -236,7 +236,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 return; } } -@@ -2045,7 +2053,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2065,7 +2073,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser Waitable waitable = new Waitable() { @Override protected Object evaluate() { @@ -245,7 +245,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 return null; } }; -@@ -2060,7 +2068,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2080,7 +2088,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser throw new RuntimeException(e); } } else { @@ -254,7 +254,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 } // CraftBukkit end } -@@ -2333,7 +2341,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2353,7 +2361,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Spigot Start if ( entity == this.player && !this.player.isSpectator() ) { @@ -263,7 +263,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 return; } // Spigot End -@@ -2428,7 +2436,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2448,7 +2456,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } // CraftBukkit end } else { @@ -272,7 +272,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); } } -@@ -2828,7 +2836,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2854,7 +2862,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper start if (!org.bukkit.Bukkit.isPrimaryThread()) { if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) { @@ -281,7 +281,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 return; } } -@@ -3013,7 +3021,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3042,7 +3050,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } else if (!this.isSingleplayerOwner()) { // Paper start - This needs to be handled on the main thread for plugins server.submit(() -> { @@ -290,7 +290,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 }); // Paper end } -@@ -3059,7 +3067,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3088,7 +3096,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); @@ -299,7 +299,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 } } else if (packet.identifier.equals(CUSTOM_UNREGISTER)) { try { -@@ -3069,7 +3077,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3098,7 +3106,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); @@ -308,7 +308,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 } } else { try { -@@ -3087,7 +3095,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3116,7 +3124,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); @@ -318,7 +318,7 @@ index 8a1041d8ef225131428cebf9e293563e540944bf..9862fc84a2b988983663bc2621a20b76 } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 3900e885988bc1f2865b95f825cba34d04919731..cad8a98951795706b89ff3ea3985033f511da58b 100644 +index 6419a548fe9a552bef69a68bfd0c45460f31be77..87ff48190bfc9687b95db7634c0e48f0ccb56577 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -719,7 +719,7 @@ public abstract class PlayerList { diff --git a/patches/server/0669-Synchronize-PalettedContainer-instead-of-ReentrantLo.patch b/patches/server/0669-Synchronize-PalettedContainer-instead-of-ReentrantLo.patch index df2a76b8a..4691f7dea 100644 --- a/patches/server/0669-Synchronize-PalettedContainer-instead-of-ReentrantLo.patch +++ b/patches/server/0669-Synchronize-PalettedContainer-instead-of-ReentrantLo.patch @@ -13,7 +13,7 @@ contention situations. And this is extremely a low contention situation. diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index cdd357a8dd82cfd2a8abd45c1b7937b409af4b05..5bbbb10a567963a451db8cf29d8d16f1cd013a16 100644 +index 5bae276dd55d080cbf8fca53c99c9c3636d8f33f..c225ef6eb1b094f605548d3f72165a6ebc156157 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java @@ -35,17 +35,17 @@ public class PalettedContainer implements PaletteResize { @@ -31,7 +31,7 @@ index cdd357a8dd82cfd2a8abd45c1b7937b409af4b05..5bbbb10a567963a451db8cf29d8d16f1 // Paper start - Anti-Xray - Add preset values @Deprecated public static Codec> codec(IdMap idList, Codec entryCodec, PalettedContainer.Strategy provider, T object) { return PalettedContainer.codec(idList, entryCodec, provider, object, null); } // Notice for updates: Please make sure this function isn't used anywhere - public static Codec> codec(IdMap idList, Codec entryCodec, PalettedContainer.Strategy provider, T object, T[] presetValues) { + public static Codec> codec(IdMap idList, Codec entryCodec, PalettedContainer.Strategy provider, T object, T @org.jetbrains.annotations.Nullable [] presetValues) { - return RecordCodecBuilder.create((instance) -> { + return RecordCodecBuilder.>create((instance) -> { // Paper - decompile fixes return instance.group(entryCodec.mapResult(ExtraCodecs.orElsePartial(object)).listOf().fieldOf("palette").forGetter(PalettedContainer.DiscData::paletteEntries), Codec.LONG_STREAM.optionalFieldOf("data").forGetter(PalettedContainer.DiscData::storage)).apply(instance, PalettedContainer.DiscData::new); diff --git a/patches/server/0671-Add-BellRevealRaiderEvent.patch b/patches/server/0671-Add-BellRevealRaiderEvent.patch index 069c85f11..587e0f040 100644 --- a/patches/server/0671-Add-BellRevealRaiderEvent.patch +++ b/patches/server/0671-Add-BellRevealRaiderEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add BellRevealRaiderEvent diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java -index b06e911acb825883c93da73358fa81653e8a0d4a..41e139c750dd3aadb7692e362e2d83f43799c905 100644 +index feaad48e9bbc1e658324ef9e1e7e73aca0b3bf48..b9d2c38e80924f52dcf76ec1042d2d746e77ffc6 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java @@ -138,7 +138,7 @@ public class BellBlockEntity extends BlockEntity { @@ -18,7 +18,7 @@ index b06e911acb825883c93da73358fa81653e8a0d4a..41e139c750dd3aadb7692e362e2d83f4 private static void showBellParticles(Level world, BlockPos pos, List hearingEntities) { @@ -170,7 +170,11 @@ public class BellBlockEntity extends BlockEntity { - return entity.isAlive() && !entity.isRemoved() && pos.closerThan(entity.position(), 48.0D) && entity.getType().is(EntityTypeTags.RAIDERS); + return entity.isAlive() && !entity.isRemoved() && pos.closerToCenterThan(entity.position(), 48.0D) && entity.getType().is(EntityTypeTags.RAIDERS); } - private static void glow(LivingEntity entity) { diff --git a/patches/server/0674-Fix-dangerous-end-portal-logic.patch b/patches/server/0674-Fix-dangerous-end-portal-logic.patch index d80b65918..c4e3dbc52 100644 --- a/patches/server/0674-Fix-dangerous-end-portal-logic.patch +++ b/patches/server/0674-Fix-dangerous-end-portal-logic.patch @@ -11,10 +11,10 @@ Move the tick logic into the post tick, where portaling was designed to happen in the first place. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index e0d1798b604b5977177714774da26a4d797ac448..7ba5761791bdbfdc924bdf8b1ed239c9fb640cac 100644 +index 6e14c3616164ff735841d03174161b6802c6aa8a..7cd731c123e01a71ae9c98c1d6d4ec87d5852849 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -394,6 +394,36 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -397,6 +397,36 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i return chunkMap.playerEntityTrackerTrackMaps[type.ordinal()].getObjectsInRange(MCUtil.getCoordinateKey(this)); } // Paper end - optimise entity tracking @@ -51,7 +51,7 @@ index e0d1798b604b5977177714774da26a4d797ac448..7ba5761791bdbfdc924bdf8b1ed239c9 public Entity(EntityType type, Level world) { this.id = Entity.ENTITY_COUNTER.incrementAndGet(); -@@ -2545,6 +2575,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2561,6 +2591,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } this.processPortalCooldown(); diff --git a/patches/server/0677-Line-Of-Sight-Changes.patch b/patches/server/0677-Line-Of-Sight-Changes.patch index 06352e117..7284a4c46 100644 --- a/patches/server/0677-Line-Of-Sight-Changes.patch +++ b/patches/server/0677-Line-Of-Sight-Changes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Line Of Sight Changes diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f0d309ad128359c01e6723a462a27670cfd29751..4dd329bc38272840b9b3c4a27978b88349dd2b89 100644 +index fd2d5e274a3bf889b954bed17d286d1157cd208e..709ca3f249a5c4d3a405e94ca353864df349ffcd 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3454,7 +3454,8 @@ public abstract class LivingEntity extends Entity { +@@ -3449,7 +3449,8 @@ public abstract class LivingEntity extends Entity { Vec3 vec3d = new Vec3(this.getX(), this.getEyeY(), this.getZ()); Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ()); @@ -19,10 +19,10 @@ index f0d309ad128359c01e6723a462a27670cfd29751..4dd329bc38272840b9b3c4a27978b883 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index fb37aa387918e2970c5a5d9a94d86935cb854a72..081e900534d4447471dcace27ca4a209f6fda96b 100644 +index bbc0f333b59743973652ec4bf13936821a7e596a..a986f6470a6112ddd6b6d81f99479e7bc9d6ff91 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -196,6 +196,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -199,6 +199,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { public io.papermc.paper.world.MoonPhase getMoonPhase() { return io.papermc.paper.world.MoonPhase.getPhase(getFullTime() / 24000L); } diff --git a/patches/server/0678-add-per-world-spawn-limits.patch b/patches/server/0678-add-per-world-spawn-limits.patch index fcf9ee5ef..dc5081368 100644 --- a/patches/server/0678-add-per-world-spawn-limits.patch +++ b/patches/server/0678-add-per-world-spawn-limits.patch @@ -44,10 +44,10 @@ index d980e31884ea70493628e4934e19fa68314ba8e2..54a1fb5b6d1dee73761851c55c6bdc1c private void lightQueueSize() { lightQueueSize = getInt("light-queue-size", lightQueueSize); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 081e900534d4447471dcace27ca4a209f6fda96b..1e46c61205a479419b3c2d641568c7f4bb6d7466 100644 +index a986f6470a6112ddd6b6d81f99479e7bc9d6ff91..29c2abd452364f34671e761f69b1c67aa1e9cf34 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -218,6 +218,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -221,6 +221,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { this.biomeProvider = biomeProvider; this.environment = env; diff --git a/patches/server/0679-Fix-PotionSplashEvent-for-water-splash-potions.patch b/patches/server/0679-Fix-PotionSplashEvent-for-water-splash-potions.patch index 77e8e4be3..56f02dad6 100644 --- a/patches/server/0679-Fix-PotionSplashEvent-for-water-splash-potions.patch +++ b/patches/server/0679-Fix-PotionSplashEvent-for-water-splash-potions.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix PotionSplashEvent for water splash potions Fixes SPIGOT-6221: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-6221 diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java -index 517a0f6bf847c5bf01851ae326d1b12332c2672c..aca9d1c2cf92ee47c646de060ae8e8f4eb7b3ddd 100644 +index ebe9b713905d33a4107fe32874a783e154bd0524..fee09e6ff72cf1da389d5811dd005642cd50a5b4 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java -@@ -122,30 +122,47 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie +@@ -121,30 +121,47 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie } } @@ -66,7 +66,7 @@ index 517a0f6bf847c5bf01851ae326d1b12332c2672c..aca9d1c2cf92ee47c646de060ae8e8f4 } } -@@ -166,6 +183,7 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie +@@ -165,6 +182,7 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie double d0 = this.distanceToSqr((Entity) entityliving); if (d0 < 16.0D) { diff --git a/patches/server/0680-Add-more-LimitedRegion-API.patch b/patches/server/0680-Add-more-LimitedRegion-API.patch index 09e0a4fcb..e9e7611f9 100644 --- a/patches/server/0680-Add-more-LimitedRegion-API.patch +++ b/patches/server/0680-Add-more-LimitedRegion-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add more LimitedRegion API diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java -index a98b39271123e3e7a595d74882f9c453645ee44b..5cc735c973d7c84475c82d93ee4339dd3be64873 100644 +index 992fc24a040c147596e6fe9f27936b4820ebc4b3..392701b0022e05d0fd03ee5836fd18f00502f028 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java -@@ -225,4 +225,45 @@ public class CraftLimitedRegion extends CraftRegionAccessor implements LimitedRe +@@ -226,4 +226,45 @@ public class CraftLimitedRegion extends CraftRegionAccessor implements LimitedRe public void addEntityToWorld(net.minecraft.world.entity.Entity entity, CreatureSpawnEvent.SpawnReason reason) { this.entities.add(entity); } diff --git a/patches/server/0681-Fix-PlayerDropItemEvent-using-wrong-item.patch b/patches/server/0681-Fix-PlayerDropItemEvent-using-wrong-item.patch index 48d78de6b..6ae023df0 100644 --- a/patches/server/0681-Fix-PlayerDropItemEvent-using-wrong-item.patch +++ b/patches/server/0681-Fix-PlayerDropItemEvent-using-wrong-item.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix PlayerDropItemEvent using wrong item diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 77ba7fe43ceffcb816d209da45ab0c5de2112ee3..6f5be46ae4c4f53695cdc5954352a2589842ede6 100644 +index f1661e228ed982f38e0bc3e9e0c1720608e0b4a4..ca9a30a279e7d12c63b351e437fb9dcc11e2ed56 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -2176,7 +2176,7 @@ public class ServerPlayer extends Player { +@@ -2174,7 +2174,7 @@ public class ServerPlayer extends Player { if (retainOwnership) { if (!itemstack1.isEmpty()) { @@ -18,10 +18,10 @@ index 77ba7fe43ceffcb816d209da45ab0c5de2112ee3..6f5be46ae4c4f53695cdc5954352a258 this.awardStat(Stats.DROP); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index ec44db1e6a6c92d8aff241b5f9acf743d3088fea..ef18f69b54b68da84f6ab9f70aa47e2f716cf9a5 100644 +index f4c861c86b718d67ae13ac02c6d1f20433312725..be2f492343770af9d360c4e7ed7495d196b2424c 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -703,6 +703,11 @@ public abstract class Player extends LivingEntity { +@@ -713,6 +713,11 @@ public abstract class Player extends LivingEntity { } double d0 = this.getEyeY() - 0.30000001192092896D; diff --git a/patches/server/0683-Ensure-disconnect-for-book-edit-is-called-on-main.patch b/patches/server/0683-Ensure-disconnect-for-book-edit-is-called-on-main.patch index 520e7e2e3..395831754 100644 --- a/patches/server/0683-Ensure-disconnect-for-book-edit-is-called-on-main.patch +++ b/patches/server/0683-Ensure-disconnect-for-book-edit-is-called-on-main.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ensure disconnect for book edit is called on main diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 9862fc84a2b988983663bc2621a20b76c0132d28..81c752a903060904ce595a5b5b14229d26dfa4fe 100644 +index ebd6d424bd5ccd1a3f3cb6f3964176e5935fe590..c52b292f4fe13a3fa586caa6452016bf0937ddf4 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1103,7 +1103,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1109,7 +1109,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper end // CraftBukkit start if (this.lastBookTick + 20 > MinecraftServer.currentTick) { diff --git a/patches/server/0684-Fix-return-value-of-Block-applyBoneMeal-always-being.patch b/patches/server/0684-Fix-return-value-of-Block-applyBoneMeal-always-being.patch index c65206e8e..179e87842 100644 --- a/patches/server/0684-Fix-return-value-of-Block-applyBoneMeal-always-being.patch +++ b/patches/server/0684-Fix-return-value-of-Block-applyBoneMeal-always-being.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix return value of Block#applyBoneMeal always being false diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 7f9ba247b67c1a8ab54b7d70bdc31b847531e725..b51c4be42842e747c4f4630709ef40a0e39a34d0 100644 +index 55f830598e67943674aa54ddfefc02bb3a3a3dcc..bb1f39fb215bbd422d6bb9ed0928d4d749d61dab 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -515,7 +515,7 @@ public class CraftBlock implements Block { +@@ -521,7 +521,7 @@ public class CraftBlock implements Block { Direction direction = CraftBlock.blockFaceToNotch(face); UseOnContext context = new UseOnContext(this.getCraftWorld().getHandle(), null, InteractionHand.MAIN_HAND, Items.BONE_MEAL.getDefaultInstance(), new BlockHitResult(Vec3.ZERO, direction, this.getPosition(), false)); diff --git a/patches/server/0685-Use-getChunkIfLoadedImmediately-in-places.patch b/patches/server/0685-Use-getChunkIfLoadedImmediately-in-places.patch index b87fec7a8..4b994b8d6 100644 --- a/patches/server/0685-Use-getChunkIfLoadedImmediately-in-places.patch +++ b/patches/server/0685-Use-getChunkIfLoadedImmediately-in-places.patch @@ -8,10 +8,10 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk load in that case). diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 49640474611c4e1781a93c6eaa627a2865f5f72e..d4129cb5ffa6bea474020c47b82d8905d1f4d9f5 100644 +index 3fac2eba419cfa41c80ea461964ec8963bcd91ab..3f912338b9fc5ec85a9d6748df6dbe490d08dbcf 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -214,7 +214,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -215,7 +215,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } @Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI @@ -21,10 +21,10 @@ index 49640474611c4e1781a93c6eaa627a2865f5f72e..d4129cb5ffa6bea474020c47b82d8905 @Override diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 81c752a903060904ce595a5b5b14229d26dfa4fe..85a0883b50a9f858e9acbcff6363ccf44cf373a4 100644 +index c52b292f4fe13a3fa586caa6452016bf0937ddf4..7b94ef26b03b6e19956e9d5a6a72ce2678001069 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1314,7 +1314,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1320,7 +1320,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser speed = this.player.getAbilities().walkingSpeed * 10f; } // Paper start - Prevent moving into unloaded chunks @@ -34,10 +34,10 @@ index 81c752a903060904ce595a5b5b14229d26dfa4fe..85a0883b50a9f858e9acbcff6363ccf4 return; } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 980c0c391d4090da062650634276a418cf38c45e..48fdf3aebb252a2670899011f112b1c802ccc0e6 100644 +index c3ae2b4b5b4eb14d24f2c15a7e8ace8ebee84c1a..c293531a6913b365c3bf804d6d0bfae24378dc43 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -191,6 +191,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -189,6 +189,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return (CraftServer) Bukkit.getServer(); } @@ -50,8 +50,8 @@ index 980c0c391d4090da062650634276a418cf38c45e..48fdf3aebb252a2670899011f112b1c8 + public abstract ResourceKey getTypeKey(); - protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, final DimensionType dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor -@@ -1365,7 +1372,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor +@@ -1366,7 +1373,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { for (int l1 = j; l1 <= l; ++l1) { for (int i2 = k; i2 <= i1; ++i2) { diff --git a/patches/server/0687-Adds-PlayerArmSwingEvent.patch b/patches/server/0687-Adds-PlayerArmSwingEvent.patch index b9073a0a3..0402650e9 100644 --- a/patches/server/0687-Adds-PlayerArmSwingEvent.patch +++ b/patches/server/0687-Adds-PlayerArmSwingEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Adds PlayerArmSwingEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 85a0883b50a9f858e9acbcff6363ccf44cf373a4..0525fea70de86e639fa6b686b69bd0abb3190216 100644 +index 7b94ef26b03b6e19956e9d5a6a72ce2678001069..6cfb8618b3d17b8b0c63ac743629de797ff4c144 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2237,7 +2237,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2257,7 +2257,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } // Arm swing animation diff --git a/patches/server/0688-Fixes-kick-event-leave-message-not-being-sent.patch b/patches/server/0688-Fixes-kick-event-leave-message-not-being-sent.patch index 9c4ceb3ec..febc1ca1a 100644 --- a/patches/server/0688-Fixes-kick-event-leave-message-not-being-sent.patch +++ b/patches/server/0688-Fixes-kick-event-leave-message-not-being-sent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fixes kick event leave message not being sent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0525fea70de86e639fa6b686b69bd0abb3190216..44a8fba1461b455b085bd66d6562190f13097c2c 100644 +index 6cfb8618b3d17b8b0c63ac743629de797ff4c144..9f681ddb310600790a124da061e1a082fc41d526 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -455,7 +455,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -17,7 +17,7 @@ index 0525fea70de86e639fa6b686b69bd0abb3190216..44a8fba1461b455b085bd66d6562190f this.connection.setReadOnly(); MinecraftServer minecraftserver = this.server; Connection networkmanager = this.connection; -@@ -1884,6 +1884,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1904,6 +1904,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void onDisconnect(Component reason) { @@ -29,7 +29,7 @@ index 0525fea70de86e639fa6b686b69bd0abb3190216..44a8fba1461b455b085bd66d6562190f // CraftBukkit start - Rarely it would send a disconnect line twice if (this.processedDisconnect) { return; -@@ -1900,7 +1905,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1920,7 +1925,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player.disconnect(); // Paper start - Adventure @@ -39,7 +39,7 @@ index 0525fea70de86e639fa6b686b69bd0abb3190216..44a8fba1461b455b085bd66d6562190f this.server.getPlayerList().broadcastMessage(PaperAdventure.asVanilla(quitMessage), ChatType.SYSTEM, Util.NIL_UUID); // Paper end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index cad8a98951795706b89ff3ea3985033f511da58b..5be363282ba6046c38794a3de3af845968d26296 100644 +index 87ff48190bfc9687b95db7634c0e48f0ccb56577..ebd416bbaea3fe10aa6812599624cebf7a2bd901 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -591,6 +591,11 @@ public abstract class PlayerList { diff --git a/patches/server/0689-Add-config-for-mobs-immune-to-default-effects.patch b/patches/server/0689-Add-config-for-mobs-immune-to-default-effects.patch index de390845a..1ce7549cb 100644 --- a/patches/server/0689-Add-config-for-mobs-immune-to-default-effects.patch +++ b/patches/server/0689-Add-config-for-mobs-immune-to-default-effects.patch @@ -31,10 +31,10 @@ index 047d2b47b5af22087359e76362d84dc69ae26707..36730b851203602a49d5a76b25a9e3a1 private void nerfNetherPortalPigmen() { nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 3d197ddb412e7df6723be0e86db86d9326281bc1..73ff544665eed9d999b13462b9635e79866c927c 100644 +index 1c7888d997111ef3cfa0cd59704b2ba7070fad8a..fadf212cef6aa6ea28af397a5e2fac9241b07af9 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1127,7 +1127,7 @@ public abstract class LivingEntity extends Entity { +@@ -1130,7 +1130,7 @@ public abstract class LivingEntity extends Entity { if (this.getMobType() == MobType.UNDEAD) { MobEffect mobeffectlist = effect.getEffect(); @@ -44,10 +44,10 @@ index 3d197ddb412e7df6723be0e86db86d9326281bc1..73ff544665eed9d999b13462b9635e79 } } diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -index 3657b7021d8b505653fadbdfbd515c112cd11177..ede0ced64d74d71547d1b8bb6853c5aacc1b486a 100644 +index 92734f767fde60351a179a88350a97b861be0e88..d347ab0a638a972ea53a982f29af40423919870c 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -613,7 +613,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob +@@ -612,7 +612,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob @Override public boolean canBeAffected(MobEffectInstance effect) { diff --git a/patches/server/0691-Don-t-apply-cramming-damage-to-players.patch b/patches/server/0691-Don-t-apply-cramming-damage-to-players.patch index be5f3fb4a..2e2e9543a 100644 --- a/patches/server/0691-Don-t-apply-cramming-damage-to-players.patch +++ b/patches/server/0691-Don-t-apply-cramming-damage-to-players.patch @@ -25,10 +25,10 @@ index 36730b851203602a49d5a76b25a9e3a11c005033..e3551edd1693c388f22436db1c2bee22 + } } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 6f5be46ae4c4f53695cdc5954352a2589842ede6..e87d4071604a642c0a08129b469e707a609bf83d 100644 +index ca9a30a279e7d12c63b351e437fb9dcc11e2ed56..ec202a84a37acf2c58492380789a24b31032dc40 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1435,7 +1435,7 @@ public class ServerPlayer extends Player { +@@ -1433,7 +1433,7 @@ public class ServerPlayer extends Player { @Override public boolean isInvulnerableTo(DamageSource damageSource) { diff --git a/patches/server/0695-Fix-incosistency-issue-with-empty-map-items-in-CB.patch b/patches/server/0695-Fix-incosistency-issue-with-empty-map-items-in-CB.patch index 77196f4ae..8d4fe001d 100644 --- a/patches/server/0695-Fix-incosistency-issue-with-empty-map-items-in-CB.patch +++ b/patches/server/0695-Fix-incosistency-issue-with-empty-map-items-in-CB.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix incosistency issue with empty map items in CB diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java -index 602e6bc05c053baf821c11c30b24538320b9ac61..7baf8039c5cf2bd68ba79d4a095ed4b58a847081 100644 +index 6f86f00d33cd50a2b67409c2f0f5400c869b802a..b714417cb3712a8f1d9bbdd47cff66436a49ba07 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java -@@ -71,7 +71,7 @@ public class MapItem extends ComplexItem { +@@ -70,7 +70,7 @@ public class MapItem extends ComplexItem { public static Integer getMapId(ItemStack stack) { CompoundTag nbttagcompound = stack.getTag(); diff --git a/patches/server/0696-Add-System.out-err-catcher.patch b/patches/server/0696-Add-System.out-err-catcher.patch index 82dca1898..c6fb8f742 100644 --- a/patches/server/0696-Add-System.out-err-catcher.patch +++ b/patches/server/0696-Add-System.out-err-catcher.patch @@ -105,10 +105,10 @@ index 0000000000000000000000000000000000000000..76d0d00cd6742991e3f3ec827a75ee87 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index bf2718441e46c47f227862c4f79fae08db1ad123..7075ee9ea0f2ac12cee7644a5f84410bb317ab70 100644 +index e2662b3500bbc9aeb4b8eaf0adc04f7951af72df..da5549f62c08ca4b2e6942269be1c0970a85ae8c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -286,6 +286,7 @@ public final class CraftServer implements Server { +@@ -282,6 +282,7 @@ public final class CraftServer implements Server { public int reloadCount; private final io.papermc.paper.datapack.PaperDatapackManager datapackManager; // Paper public static Exception excessiveVelEx; // Paper - Velocity warnings diff --git a/patches/server/0699-Improve-boat-collision-performance.patch b/patches/server/0699-Improve-boat-collision-performance.patch index b3749fc5e..24fc31529 100644 --- a/patches/server/0699-Improve-boat-collision-performance.patch +++ b/patches/server/0699-Improve-boat-collision-performance.patch @@ -5,22 +5,22 @@ Subject: [PATCH] Improve boat collision performance diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 6c87ad6e015729db5b10f795b59aa785dff4368a..4605e80bb7dc5408daafb5ccba52efa138ca7cdd 100644 +index a8772417eb54e1a52c490b75b470a502a480f925..c072819c1ebc772f524649c6c2f8b48d919bf805 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -84,6 +84,7 @@ public class Util { +@@ -85,6 +85,7 @@ public class Util { }).findFirst().orElseThrow(() -> { return new IllegalStateException("No jar file system provider found"); }); + public static final double COLLISION_EPSILON = 1.0E-7; // Paper - private static Consumer thePauser = (string) -> { + private static Consumer thePauser = (message) -> { }; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 91b81a72f6bba408b7885ea23589746bc4c947b2..fba2239a33c5510581e9a09cf670499e51127479 100644 +index 1f35368f9f44c578be76d66a85da937f497df655..d64e946a3228b871fb8a9703a8631008078e4bec 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1315,7 +1315,7 @@ public abstract class LivingEntity extends Entity { +@@ -1318,7 +1318,7 @@ public abstract class LivingEntity extends Entity { if (!source.isProjectile()) { Entity entity = source.getDirectEntity(); @@ -29,7 +29,7 @@ index 91b81a72f6bba408b7885ea23589746bc4c947b2..fba2239a33c5510581e9a09cf670499e this.blockUsingShield((LivingEntity) entity); } } -@@ -1423,11 +1423,12 @@ public abstract class LivingEntity extends Entity { +@@ -1426,11 +1426,12 @@ public abstract class LivingEntity extends Entity { } if (entity1 != null) { @@ -44,7 +44,7 @@ index 91b81a72f6bba408b7885ea23589746bc4c947b2..fba2239a33c5510581e9a09cf670499e d0 = (Math.random() - Math.random()) * 0.01D; } -@@ -2106,7 +2107,7 @@ public abstract class LivingEntity extends Entity { +@@ -2109,7 +2110,7 @@ public abstract class LivingEntity extends Entity { this.hurtCurrentlyUsedShield((float) -event.getDamage(DamageModifier.BLOCKING)); Entity entity = damagesource.getDirectEntity(); @@ -54,10 +54,10 @@ index 91b81a72f6bba408b7885ea23589746bc4c947b2..fba2239a33c5510581e9a09cf670499e } } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java -index c3d111204601270b57389e1f85456a9e2ada4629..b967177cb10041f96831322c311579e409050e88 100644 +index a8f37fab9c8020e884bf029145d03e3be57b7f2b..0dbc85c450797d7384e641f80e1b1f8c56fd14fc 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java -@@ -687,8 +687,8 @@ public class Boat extends Entity { +@@ -686,8 +686,8 @@ public class Boat extends Entity { this.invFriction = 0.05F; if (this.oldStatus == Boat.Status.IN_AIR && this.status != Boat.Status.IN_AIR && this.status != Boat.Status.ON_LAND) { this.waterLevel = this.getY(1.0D); diff --git a/patches/server/0701-Allow-skipping-writing-of-comments-to-server.propert.patch b/patches/server/0701-Allow-skipping-writing-of-comments-to-server.propert.patch index d4d19d0e6..6395f3f4a 100644 --- a/patches/server/0701-Allow-skipping-writing-of-comments-to-server.propert.patch +++ b/patches/server/0701-Allow-skipping-writing-of-comments-to-server.propert.patch @@ -8,48 +8,33 @@ Makes less git noise, as it won't update the date every single time Use -DPaper.skipServerPropertiesComments=true flag to disable writing it diff --git a/src/main/java/net/minecraft/server/dedicated/Settings.java b/src/main/java/net/minecraft/server/dedicated/Settings.java -index 71767307062e99262afb994016720e1f1555b820..b285e8f6172154af1aa942ab164d73bc885c5fa4 100644 +index 7c35fb22df0bca2c2ca885a872ee42d6073d852f..aafa84578c7fb25feeee043259f9c056929ca008 100644 --- a/src/main/java/net/minecraft/server/dedicated/Settings.java +++ b/src/main/java/net/minecraft/server/dedicated/Settings.java -@@ -1,6 +1,8 @@ - package net.minecraft.server.dedicated; +@@ -23,6 +23,7 @@ public abstract class Settings> { - import com.google.common.base.MoreObjects; -+ -+import java.io.BufferedOutputStream; // Paper - import java.io.IOException; - import java.io.InputStream; - import java.io.OutputStream; -@@ -18,11 +20,13 @@ import org.apache.logging.log4j.Logger; - - import joptsimple.OptionSet; // CraftBukkit - import net.minecraft.core.RegistryAccess; -+import org.jetbrains.annotations.NotNull; // Paper - - public abstract class Settings> { - - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); public final Properties properties; + private static final boolean skipComments = Boolean.getBoolean("Paper.skipServerPropertiesComments"); // Paper - allow skipping server.properties comments // CraftBukkit start private OptionSet options = null; -@@ -79,9 +83,47 @@ public abstract class Settings> { +@@ -79,9 +80,47 @@ public abstract class Settings> { } // CraftBukkit end OutputStream outputstream = Files.newOutputStream(path); + // Paper start - disable writing comments to properties file -+ BufferedOutputStream bufferedOutputStream = !skipComments ? new BufferedOutputStream(outputstream) : new BufferedOutputStream(outputstream) { ++ java.io.BufferedOutputStream bufferedOutputStream = !skipComments ? new java.io.BufferedOutputStream(outputstream) : new java.io.BufferedOutputStream(outputstream) { + private boolean isRightAfterNewline = true; // If last written char was newline + private boolean isComment = false; // Are we writing comment currently? + + @Override -+ public void write(@NotNull byte[] b) throws IOException { ++ public void write(@org.jetbrains.annotations.NotNull byte[] b) throws IOException { + this.write(b, 0, b.length); + } + + @Override -+ public void write(@NotNull byte[] bbuf, int off, int len) throws IOException { ++ public void write(@org.jetbrains.annotations.NotNull byte[] bbuf, int off, int len) throws IOException { + int latest_offset = off; // The latest offset, updated when comment ends + for (int index = off; index < off + len; ++index ) { + byte c = bbuf[index]; diff --git a/patches/server/0702-Add-PlayerSetSpawnEvent.patch b/patches/server/0702-Add-PlayerSetSpawnEvent.patch index 0dfca5ca1..c00d694ef 100644 --- a/patches/server/0702-Add-PlayerSetSpawnEvent.patch +++ b/patches/server/0702-Add-PlayerSetSpawnEvent.patch @@ -18,10 +18,10 @@ index e95f2222814e104bf9194a96385737dffe2cb2b5..249ab7357aa19d87179fa4c3ae89d9d3 String string = resourceKey.location().toString(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index e87d4071604a642c0a08129b469e707a609bf83d..6c0c1f7f4f3407164ee39abf4c87ffcc057994fd 100644 +index ec202a84a37acf2c58492380789a24b31032dc40..55bdc0abb1fe42c02479678c3840d1d4da3253ae 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1276,7 +1276,7 @@ public class ServerPlayer extends Player { +@@ -1274,7 +1274,7 @@ public class ServerPlayer extends Player { } else if (this.bedBlocked(blockposition, enumdirection)) { return Either.left(Player.BedSleepingProblem.OBSTRUCTED); } else { @@ -30,7 +30,7 @@ index e87d4071604a642c0a08129b469e707a609bf83d..6c0c1f7f4f3407164ee39abf4c87ffcc if (this.level.isDay()) { return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW); } else { -@@ -2104,12 +2104,33 @@ public class ServerPlayer extends Player { +@@ -2102,12 +2102,33 @@ public class ServerPlayer extends Player { return this.respawnForced; } @@ -67,7 +67,7 @@ index e87d4071604a642c0a08129b469e707a609bf83d..6c0c1f7f4f3407164ee39abf4c87ffcc this.respawnPosition = pos; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 5be363282ba6046c38794a3de3af845968d26296..8feadac9d9d4fb6c1ae290ca2ab2499b707bd56a 100644 +index ebd416bbaea3fe10aa6812599624cebf7a2bd901..0c2d1a8feb15bc2bc6ce2674b24222d5c501cd18 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -895,7 +895,7 @@ public abstract class PlayerList { diff --git a/patches/server/0705-Config-option-for-Piglins-guarding-chests.patch b/patches/server/0705-Config-option-for-Piglins-guarding-chests.patch index a5ae275da..4134b7a5f 100644 --- a/patches/server/0705-Config-option-for-Piglins-guarding-chests.patch +++ b/patches/server/0705-Config-option-for-Piglins-guarding-chests.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Config option for Piglins guarding chests diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 9e31046c1e6f1138e75aee11647b0ff9bf45503d..e85835f3ec7bb5e5ef5a827a4cb6614780255326 100644 +index 45a317c46bbe05dfaf5b555d9a8c281ff8d9103d..b33a8e15153375316b9c8e856c14669667599225 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -72,6 +72,11 @@ public class PaperWorldConfig { @@ -21,10 +21,10 @@ index 9e31046c1e6f1138e75aee11647b0ff9bf45503d..e85835f3ec7bb5e5ef5a827a4cb66147 private void useEigencraftRedstone() { useEigencraftRedstone = this.getBoolean("use-faster-eigencraft-redstone", false); diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java -index 08d17a26bf8a7f3757f4f5b2df4592edbdde9f2e..f362e007aece208036a37d9bda8bb481a78eeaff 100644 +index 65480f1ee70a55abbb35a88388d9161e366765a5..57f593e5f797d646ceb70fa61ec2e966cf4dabc1 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java +++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java -@@ -464,6 +464,7 @@ public class PiglinAi { +@@ -463,6 +463,7 @@ public class PiglinAi { } public static void angerNearbyPiglins(Player player, boolean blockOpen) { diff --git a/patches/server/0706-Added-EntityDamageItemEvent.patch b/patches/server/0706-Added-EntityDamageItemEvent.patch index bab8258ae..0f5056e7c 100644 --- a/patches/server/0706-Added-EntityDamageItemEvent.patch +++ b/patches/server/0706-Added-EntityDamageItemEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Added EntityDamageItemEvent diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 9afecaa4cfa0466abb691977e55bcddb64b7feda..66f808cabcf6a9a6584849b285f1c60133adc7b4 100644 +index dc192218aa2e325040dc2bf0f8586e1c1577e4c7..a61a309bb921deba8b8022bc4e9fd04c2f8eba63 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -525,7 +525,7 @@ public final class ItemStack { +@@ -535,7 +535,7 @@ public final class ItemStack { return this.getItem().getMaxDamage(); } @@ -17,7 +17,7 @@ index 9afecaa4cfa0466abb691977e55bcddb64b7feda..66f808cabcf6a9a6584849b285f1c601 if (!this.isDamageableItem()) { return false; } else { -@@ -543,8 +543,8 @@ public final class ItemStack { +@@ -553,8 +553,8 @@ public final class ItemStack { amount -= k; // CraftBukkit start @@ -28,7 +28,7 @@ index 9afecaa4cfa0466abb691977e55bcddb64b7feda..66f808cabcf6a9a6584849b285f1c601 event.getPlayer().getServer().getPluginManager().callEvent(event); if (amount != event.getDamage() || event.isCancelled()) { -@@ -555,6 +555,14 @@ public final class ItemStack { +@@ -565,6 +565,14 @@ public final class ItemStack { } amount = event.getDamage(); @@ -43,7 +43,7 @@ index 9afecaa4cfa0466abb691977e55bcddb64b7feda..66f808cabcf6a9a6584849b285f1c601 } // CraftBukkit end if (amount <= 0) { -@@ -562,8 +570,8 @@ public final class ItemStack { +@@ -572,8 +580,8 @@ public final class ItemStack { } } @@ -54,7 +54,7 @@ index 9afecaa4cfa0466abb691977e55bcddb64b7feda..66f808cabcf6a9a6584849b285f1c601 } j = this.getDamageValue() + amount; -@@ -575,7 +583,7 @@ public final class ItemStack { +@@ -585,7 +593,7 @@ public final class ItemStack { public void hurtAndBreak(int amount, T entity, Consumer breakCallback) { if (!entity.level.isClientSide && (!(entity instanceof net.minecraft.world.entity.player.Player) || !((net.minecraft.world.entity.player.Player) entity).getAbilities().instabuild)) { if (this.isDamageableItem()) { diff --git a/patches/server/0707-Optimize-indirect-passenger-iteration.patch b/patches/server/0707-Optimize-indirect-passenger-iteration.patch index e89d46101..864b1e2a7 100644 --- a/patches/server/0707-Optimize-indirect-passenger-iteration.patch +++ b/patches/server/0707-Optimize-indirect-passenger-iteration.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize indirect passenger iteration diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c6f7c52b017d0f58ab84b3e213b5500b512bfab9..4d9e2881bfbda4efe8dc25c5efcdbda949b9c792 100644 +index 7cd731c123e01a71ae9c98c1d6d4ec87d5852849..260ce781fe0bc8d4c9cbf80bb8c8ca4762402273 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3517,26 +3517,41 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3534,26 +3534,41 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } private Stream getIndirectPassengersStream() { diff --git a/patches/server/0708-Fix-block-drops-position-losing-precision-millions-o.patch b/patches/server/0708-Fix-block-drops-position-losing-precision-millions-o.patch index 7077043f4..a32af5a89 100644 --- a/patches/server/0708-Fix-block-drops-position-losing-precision-millions-o.patch +++ b/patches/server/0708-Fix-block-drops-position-losing-precision-millions-o.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix block drops position losing precision millions of blocks diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index a37213bce34f45898f56a22196b0d5ef1470e812..76b3d78f4c866a11bd7798af6b330340d898d7d9 100644 +index 17c369b49272ac72119708b507e6fa119343706e..6b4cd795f23bd8d51dff5f2b72f588ca51404b99 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -342,9 +342,11 @@ public class Block extends BlockBehaviour implements ItemLike { +@@ -344,9 +344,11 @@ public class Block extends BlockBehaviour implements ItemLike { public static void popResource(Level world, BlockPos pos, ItemStack stack) { float f = EntityType.ITEM.getHeight() / 2.0F; @@ -24,7 +24,7 @@ index a37213bce34f45898f56a22196b0d5ef1470e812..76b3d78f4c866a11bd7798af6b330340 Block.popResource(world, () -> { return new ItemEntity(world, d0, d1, d2, stack); -@@ -357,9 +359,11 @@ public class Block extends BlockBehaviour implements ItemLike { +@@ -359,9 +361,11 @@ public class Block extends BlockBehaviour implements ItemLike { int k = direction.getStepZ(); float f = EntityType.ITEM.getWidth() / 2.0F; float f1 = EntityType.ITEM.getHeight() / 2.0F; diff --git a/patches/server/0711-Clear-bucket-NBT-after-dispense.patch b/patches/server/0711-Clear-bucket-NBT-after-dispense.patch index 046e7d2e5..50f3155d7 100644 --- a/patches/server/0711-Clear-bucket-NBT-after-dispense.patch +++ b/patches/server/0711-Clear-bucket-NBT-after-dispense.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Clear bucket NBT after dispense diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -index 89921ffeae7cc715aa18cbf8687e7c8e612e5612..59db245fe11384282af84ec1d5be08ab0e9484ca 100644 +index 047dd5600e3aae8b19bfc33566ee60541131e60a..4b151444f8d7ed26dc87c9ae55fa8a14a8d84ed7 100644 --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -634,8 +634,7 @@ public interface DispenseItemBehavior { +@@ -633,8 +633,7 @@ public interface DispenseItemBehavior { Item item = Items.BUCKET; stack.shrink(1); if (stack.isEmpty()) { diff --git a/patches/server/0714-Add-BlockBreakBlockEvent.patch b/patches/server/0714-Add-BlockBreakBlockEvent.patch index 18cf6e58e..b7f264d94 100644 --- a/patches/server/0714-Add-BlockBreakBlockEvent.patch +++ b/patches/server/0714-Add-BlockBreakBlockEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add BlockBreakBlockEvent diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index 76b3d78f4c866a11bd7798af6b330340d898d7d9..ab5b9f00123e2ede2931ffc520684e482aac49b4 100644 +index 6b4cd795f23bd8d51dff5f2b72f588ca51404b99..a80f4dc0a642c744223a155232291ace6e007636 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -329,6 +329,23 @@ public class Block extends BlockBehaviour implements ItemLike { +@@ -331,6 +331,23 @@ public class Block extends BlockBehaviour implements ItemLike { } } @@ -33,23 +33,23 @@ index 76b3d78f4c866a11bd7798af6b330340d898d7d9..ab5b9f00123e2ede2931ffc520684e48 public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, Entity entity, ItemStack stack) { if (world instanceof ServerLevel) { diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -index 2e95de4250f3b53591749ebbe7a5f2b607f6b7fa..ed70d63db8b674d987ad468a5bb27fd7567bcdc7 100644 +index f4f49cc4109d4ae72c0a50f7acbd181d05bf415a..322b3119682fbab5e790ce9255e96a519f03143d 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -@@ -400,7 +400,7 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -399,7 +399,7 @@ public class PistonBaseBlock extends DirectionalBlock { iblockdata1 = world.getBlockState(blockposition3); BlockEntity tileentity = iblockdata1.hasBlockEntity() ? world.getBlockEntity(blockposition3) : null; - dropResources(iblockdata1, world, blockposition3, tileentity); + dropResources(iblockdata1, world, blockposition3, tileentity, pos); // Paper world.setBlock(blockposition3, Blocks.AIR.defaultBlockState(), 18); - if (!iblockdata1.is((Tag) BlockTags.FIRE)) { + if (!iblockdata1.is(BlockTags.FIRE)) { world.addDestroyBlockEffect(blockposition3, iblockdata1); diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java -index 49b8e9a764a868975ec832ea354bb0df99f9721a..6f5f9d8a38bf023969c883b3e3a230c3cdc62104 100644 +index 02be7c3d104fe3b3a2772201f5ebdfb6d16e9b49..ff40fe323964f173561a6838fb443e79abf9df38 100644 --- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java -@@ -295,7 +295,7 @@ public abstract class FlowingFluid extends Fluid { +@@ -294,7 +294,7 @@ public abstract class FlowingFluid extends Fluid { ((LiquidBlockContainer) state.getBlock()).placeLiquid(world, pos, state, fluidState); } else { if (!state.isAir()) { @@ -58,7 +58,7 @@ index 49b8e9a764a868975ec832ea354bb0df99f9721a..6f5f9d8a38bf023969c883b3e3a230c3 } world.setBlock(pos, fluidState.createLegacyBlock(), 3); -@@ -303,6 +303,7 @@ public abstract class FlowingFluid extends Fluid { +@@ -302,6 +302,7 @@ public abstract class FlowingFluid extends Fluid { } diff --git a/patches/server/0718-Add-back-EntityPortalExitEvent.patch b/patches/server/0718-Add-back-EntityPortalExitEvent.patch index 7e7b78835..c9bdb45f7 100644 --- a/patches/server/0718-Add-back-EntityPortalExitEvent.patch +++ b/patches/server/0718-Add-back-EntityPortalExitEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add back EntityPortalExitEvent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4d9e2881bfbda4efe8dc25c5efcdbda949b9c792..296efe4970b1f0b6673e8e09ff0f6ac46e624c5f 100644 +index 260ce781fe0bc8d4c9cbf80bb8c8ca4762402273..4a10dbd66013858f8b7e519888c839804ea545d9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3022,6 +3022,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3039,6 +3039,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } else { // CraftBukkit start worldserver = shapedetectorshape.world; @@ -32,7 +32,7 @@ index 4d9e2881bfbda4efe8dc25c5efcdbda949b9c792..296efe4970b1f0b6673e8e09ff0f6ac4 if (worldserver == this.level) { // SPIGOT-6782: Just move the entity if a plugin changed the world to the one the entity is already in this.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot); -@@ -3041,8 +3058,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3058,8 +3075,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i if (entity != null) { entity.restoreFrom(this); diff --git a/patches/server/0719-Add-methods-to-find-targets-for-lightning-strikes.patch b/patches/server/0719-Add-methods-to-find-targets-for-lightning-strikes.patch index 61ac7a358..d9d2a6b33 100644 --- a/patches/server/0719-Add-methods-to-find-targets-for-lightning-strikes.patch +++ b/patches/server/0719-Add-methods-to-find-targets-for-lightning-strikes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add methods to find targets for lightning strikes diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 47f9fec531b7e83ba8f5305df05ae89eb7aa84b5..111b02348059f8c730b8027a6bfa5d71b62bc332 100644 +index 3f912338b9fc5ec85a9d6748df6dbe490d08dbcf..de293811673a247219c799d247e1ca94a7c934f5 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -751,6 +751,11 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -754,6 +754,11 @@ public class ServerLevel extends Level implements WorldGenLevel { } protected BlockPos findLightningTargetAround(BlockPos pos) { @@ -20,7 +20,7 @@ index 47f9fec531b7e83ba8f5305df05ae89eb7aa84b5..111b02348059f8c730b8027a6bfa5d71 BlockPos blockposition1 = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos); Optional optional = this.findLightningRod(blockposition1); -@@ -765,6 +770,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -768,6 +773,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (!list.isEmpty()) { return ((LivingEntity) list.get(this.random.nextInt(list.size()))).blockPosition(); } else { @@ -29,10 +29,10 @@ index 47f9fec531b7e83ba8f5305df05ae89eb7aa84b5..111b02348059f8c730b8027a6bfa5d71 blockposition1 = blockposition1.above(2); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 1e46c61205a479419b3c2d641568c7f4bb6d7466..d82795b119a7d6d8bde42f052d1915621f65bace 100644 +index 29c2abd452364f34671e761f69b1c67aa1e9cf34..18cbb6052de6c79095f34ebdb1feb13c4e95afe8 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -698,6 +698,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -701,6 +701,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { return (LightningStrike) lightning.getBukkitEntity(); } diff --git a/patches/server/0724-Add-critical-damage-API.patch b/patches/server/0724-Add-critical-damage-API.patch index b0f3655c5..ca4be99b0 100644 --- a/patches/server/0724-Add-critical-damage-API.patch +++ b/patches/server/0724-Add-critical-damage-API.patch @@ -29,10 +29,10 @@ index 80d19af2ad423bd3de0e039c5bb8f97af536aaa9..a828cad27fcd39f8bfbaefa97052a2a3 public static DamageSource sting(LivingEntity attacker) { return new EntityDamageSource("sting", attacker); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 0748142a70a677413eb53a7fc7d72e4490243db8..7a5a55353a259c4756fb6b8b3f432f42218a8465 100644 +index be2f492343770af9d360c4e7ed7495d196b2424c..3b235e98072664047c352dbb07fdcf2bd8553970 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -1214,7 +1214,7 @@ public abstract class Player extends LivingEntity { +@@ -1227,7 +1227,7 @@ public abstract class Player extends LivingEntity { flag1 = true; } @@ -41,7 +41,7 @@ index 0748142a70a677413eb53a7fc7d72e4490243db8..7a5a55353a259c4756fb6b8b3f432f42 flag2 = flag2 && !level.paperConfig.disablePlayerCrits; // Paper flag2 = flag2 && !this.isSprinting(); -@@ -1254,7 +1254,7 @@ public abstract class Player extends LivingEntity { +@@ -1267,7 +1267,7 @@ public abstract class Player extends LivingEntity { } Vec3 vec3d = target.getDeltaMovement(); @@ -50,7 +50,7 @@ index 0748142a70a677413eb53a7fc7d72e4490243db8..7a5a55353a259c4756fb6b8b3f432f42 if (flag5) { if (i > 0) { -@@ -1282,7 +1282,7 @@ public abstract class Player extends LivingEntity { +@@ -1295,7 +1295,7 @@ public abstract class Player extends LivingEntity { if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) { // CraftBukkit start - Only apply knockback if the damage hits diff --git a/patches/server/0726-Add-isCollidable-methods-to-various-places.patch b/patches/server/0726-Add-isCollidable-methods-to-various-places.patch index ac5c3075c..3a5a20927 100644 --- a/patches/server/0726-Add-isCollidable-methods-to-various-places.patch +++ b/patches/server/0726-Add-isCollidable-methods-to-various-places.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add isCollidable methods to various places diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index b51c4be42842e747c4f4630709ef40a0e39a34d0..bf7d216d9307a96005dcca64696af72a84a68716 100644 +index bb1f39fb215bbd422d6bb9ed0928d4d749d61dab..88c8817a85546ff92424b1164abcd74a15ff0917 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -467,6 +467,11 @@ public class CraftBlock implements Block { +@@ -473,6 +473,11 @@ public class CraftBlock implements Block { public boolean isSolid() { return getNMS().getMaterial().blocksMotion(); } @@ -37,7 +37,7 @@ index 7b9e943b391c061782fccd2b8d705ceec8db50fe..966ac60daebb7bb211ab8096fc0c5f33 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 965d15f4596b8ebf07d89829088b94146cb6a302..42f70f0def442d636d83d315121451015b0d2fda 100644 +index 11a269b7384432d919fcd14cec3cf1d94c5d7fa2..c9c701208ce11aa413642221ca0dd08196adea80 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -555,6 +555,12 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0727-Goat-ram-API.patch b/patches/server/0727-Goat-ram-API.patch index 641bebca8..f1fcff3a2 100644 --- a/patches/server/0727-Goat-ram-API.patch +++ b/patches/server/0727-Goat-ram-API.patch @@ -5,13 +5,14 @@ Subject: [PATCH] Goat ram API diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -index d3c4f93ee2aa1902eeca197c72eb17199fc41fb2..cc5687f43f8ac99995667fdc53c5c0586f70f367 100644 +index 8618790938f182e4aa0e27ea79dea1d35a36ec6e..78f1082b0a3bad923c1e142d15bc7dad2ae5ff15 100644 --- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -@@ -285,6 +285,17 @@ public class Goat extends Animal { - return world.getBlockState(pos.below()).is((Tag) BlockTags.GOATS_SPAWNABLE_ON) && isBrightEnoughToSpawn(world, pos); +@@ -274,4 +274,15 @@ public class Goat extends Animal { + public static boolean checkGoatSpawnRules(EntityType entityType, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) { + return world.getBlockState(pos.below()).is(BlockTags.GOATS_SPAWNABLE_ON) && isBrightEnoughToSpawn(world, pos); } - ++ + // Paper start - Goat ram API + public void ram(net.minecraft.world.entity.LivingEntity entity) { + Brain brain = this.getBrain(); @@ -22,10 +23,7 @@ index d3c4f93ee2aa1902eeca197c72eb17199fc41fb2..cc5687f43f8ac99995667fdc53c5c058 + brain.setActiveActivityIfPossible(net.minecraft.world.entity.schedule.Activity.RAM); + } + // Paper end -+ - private static class GoatPathNavigation extends GroundPathNavigation { - - GoatPathNavigation(Goat goat, Level world) { + } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java index ae74df5c9845ac125968a52897f4343b0f348217..436aa41563b8fab112d03c8cc516cf6ff37587bd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java diff --git a/patches/server/0729-Add-Raw-Byte-Entity-Serialization.patch b/patches/server/0729-Add-Raw-Byte-Entity-Serialization.patch index fdc707b4d..b3e64a8f4 100644 --- a/patches/server/0729-Add-Raw-Byte-Entity-Serialization.patch +++ b/patches/server/0729-Add-Raw-Byte-Entity-Serialization.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Raw Byte Entity Serialization diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 296efe4970b1f0b6673e8e09ff0f6ac46e624c5f..445c292cbfd151148945f57ad8dd2f0a2481936f 100644 +index 4a10dbd66013858f8b7e519888c839804ea545d9..1db65d69cb3b81d2e4eee016b9a8735fe45bdc50 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1832,6 +1832,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1837,6 +1837,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } } @@ -45,7 +45,7 @@ index 49738cdb2f712d9ce76d3fff92b79e829bfa2370..788148145eddc90eac35881bc847e958 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 42f70f0def442d636d83d315121451015b0d2fda..4be7b18b4e794734439d1e8bec4304d88328c91e 100644 +index c9c701208ce11aa413642221ca0dd08196adea80..d8f4d351a66c6d1e60e1a470ce64f538c7718232 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -448,6 +448,30 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0730-Vanilla-command-permission-fixes.patch b/patches/server/0730-Vanilla-command-permission-fixes.patch index b5097e576..d9b53520f 100644 --- a/patches/server/0730-Vanilla-command-permission-fixes.patch +++ b/patches/server/0730-Vanilla-command-permission-fixes.patch @@ -30,10 +30,10 @@ index 899008b2980d13f1be6280cd8cb959c53a29bebf..f875507241ac6769545e91cd3285232b private RedirectModifier modifier = null; private boolean forks; diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 112dddca796f9d987c321174bf9d6ad98dbb7a5e..f6b73f8c6638ddf79e45042f5c8902ea1f271f5c 100644 +index 8f51b814c5b1c2c14378565363119df45af25726..13a0f78abbb00b489b63d88ce14f60cb04402085 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -211,6 +211,13 @@ public class Commands { +@@ -213,6 +213,13 @@ public class Commands { PublishCommand.register(this.dispatcher); } @@ -45,7 +45,7 @@ index 112dddca796f9d987c321174bf9d6ad98dbb7a5e..f6b73f8c6638ddf79e45042f5c8902ea + } + // Paper end this.dispatcher.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> { - // CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", this.dispatcher.getPath(commandnode1), this.dispatcher.getPath(commandnode2), collection); // CraftBukkit + // CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", new Object[]{this.dispatcher.getPath(commandnode1), this.dispatcher.getPath(commandnode2), collection}); // CraftBukkit }); diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java index 0377c706c9aec6f367e83f859f9a3432ad5bba4a..e9d1fb479855194da5a05e86861848158736cbb4 100644 diff --git a/patches/server/0731-Make-CallbackExecutor-strict-again.patch b/patches/server/0731-Make-CallbackExecutor-strict-again.patch index 9157c7a0e..4a1378e4a 100644 --- a/patches/server/0731-Make-CallbackExecutor-strict-again.patch +++ b/patches/server/0731-Make-CallbackExecutor-strict-again.patch @@ -10,10 +10,10 @@ schedules. Effectively, use the callback executor as a tool of finding issues rather than hiding these issues. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index a737fb56fef791f53ed3b0252e5a0369c22bcc7d..2d706507abc74b9fdc76958acd97dc3c6417eada 100644 +index ff19cdf52ce614daad046ab94eaa5ea58b602782..8ed9b3a0704ede73005007406b8b2e5ddd229c55 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -160,17 +160,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -164,17 +164,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable { diff --git a/patches/server/0732-Do-not-allow-the-server-to-unload-chunks-at-request-.patch b/patches/server/0732-Do-not-allow-the-server-to-unload-chunks-at-request-.patch index 8e1bf7409..d2c7c618d 100644 --- a/patches/server/0732-Do-not-allow-the-server-to-unload-chunks-at-request-.patch +++ b/patches/server/0732-Do-not-allow-the-server-to-unload-chunks-at-request-.patch @@ -10,10 +10,10 @@ to be unloaded will simply be unloaded next tick, rather than immediately. diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 3b0e254f569576a6193750811c06f1c102a2aeac..55cc46fb065246ef9fc8332ecc1db75a20986c81 100644 +index 1b81ae617a43aa4723a879c150ce8e611c5369d9..c97692440f4f0403714cdd7d1fba5496e324b40c 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -884,6 +884,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -880,6 +880,7 @@ public class ServerChunkCache extends ChunkSource { // CraftBukkit start - modelled on below public void purgeUnload() { diff --git a/patches/server/0733-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch b/patches/server/0733-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch index 54c4441f2..c132c7913 100644 --- a/patches/server/0733-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch +++ b/patches/server/0733-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch @@ -9,10 +9,10 @@ chunk through it. This should also be OK from a leak prevention/ state desync POV because the TE is getting unloaded anyways. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index cd262cbe8f5f9588dd1d9fcd308eeb0418f54922..bc6f48892290ac3e6909fb401a559b1148b405b4 100644 +index de293811673a247219c799d247e1ca94a7c934f5..0e23cac2140c7edaba2ce13d4bb05e304826e75c 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1306,9 +1306,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1309,9 +1309,13 @@ public class ServerLevel extends Level implements WorldGenLevel { // Spigot Start for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) { if (tileentity instanceof net.minecraft.world.Container) { @@ -28,10 +28,10 @@ index cd262cbe8f5f9588dd1d9fcd308eeb0418f54922..bc6f48892290ac3e6909fb401a559b11 } // Spigot End diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 6c0c1f7f4f3407164ee39abf4c87ffcc057994fd..a3274d3506b90422e4acdf6446e351b2da65b29c 100644 +index 55bdc0abb1fe42c02479678c3840d1d4da3253ae..1a2dd16ec1f189c3b53a57c0224a15f451b92501 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1577,6 +1577,18 @@ public class ServerPlayer extends Player { +@@ -1575,6 +1575,18 @@ public class ServerPlayer extends Player { this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId)); this.doCloseContainer(); } @@ -51,10 +51,10 @@ index 6c0c1f7f4f3407164ee39abf4c87ffcc057994fd..a3274d3506b90422e4acdf6446e351b2 public void doCloseContainer() { this.containerMenu.removed(this); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 2a61de30508266768fc2b55420d5272ab538330c..570d2325997e2465a8e17803ea882bc07ca64c38 100644 +index 3b235e98072664047c352dbb07fdcf2bd8553970..9c767096ca950d55d6002282c7a3fe2884bcd630 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -496,6 +496,11 @@ public abstract class Player extends LivingEntity { +@@ -497,6 +497,11 @@ public abstract class Player extends LivingEntity { this.containerMenu = this.inventoryMenu; } // Paper end diff --git a/patches/server/0734-Correctly-handle-recursion-for-chunkholder-updates.patch b/patches/server/0734-Correctly-handle-recursion-for-chunkholder-updates.patch index 531c87e6e..48e805996 100644 --- a/patches/server/0734-Correctly-handle-recursion-for-chunkholder-updates.patch +++ b/patches/server/0734-Correctly-handle-recursion-for-chunkholder-updates.patch @@ -8,10 +8,10 @@ cause a recursive call which would handle the increase but then the caller would think the chunk would be unloaded. diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index c2a040f735db091b5fb6017aa28a95f91ebcd9d3..49247d12e743f987113524121e60a3e0ba4a825a 100644 +index 7407fd045c2f2d5934fb67028633575041ed7930..6f7794a6e5c832328ddc16ca9b76414ea08020ad 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -443,8 +443,10 @@ public class ChunkHolder { +@@ -456,8 +456,10 @@ public class ChunkHolder { playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state); } @@ -22,7 +22,7 @@ index c2a040f735db091b5fb6017aa28a95f91ebcd9d3..49247d12e743f987113524121e60a3e0 ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel); ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel); boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE; -@@ -486,6 +488,12 @@ public class ChunkHolder { +@@ -499,6 +501,12 @@ public class ChunkHolder { // Run callback right away if the future was already done chunkStorage.callbackExecutor.run(); diff --git a/patches/server/0736-Fix-chunks-refusing-to-unload-at-low-TPS.patch b/patches/server/0736-Fix-chunks-refusing-to-unload-at-low-TPS.patch index 72e104097..2598db231 100644 --- a/patches/server/0736-Fix-chunks-refusing-to-unload-at-low-TPS.patch +++ b/patches/server/0736-Fix-chunks-refusing-to-unload-at-low-TPS.patch @@ -10,15 +10,15 @@ chunk future to complete. We can simply schedule to the immediate executor to get this effect, rather than the main mailbox. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 73cd4d12a4991a69adf3f19665bfb5672b7f2ecf..a7bc1d6ce7eebfe0b10f8c179b6a1441169d8fc1 100644 +index a93a971dd7e2fbe5e6d9196ca1e95f5f8c3c660e..be8303e64e481e37a6ab25ee99c4008037670303 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1273,9 +1273,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1315,9 +1315,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return chunk; }); - }, (runnable) -> { -- this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable)); +- this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, () -> ChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request. - }); + }, this.mainThreadExecutor); // Paper - queue to execute immediately so this doesn't delay chunk unloading } diff --git a/patches/server/0737-Do-not-allow-ticket-level-changes-while-unloading-pl.patch b/patches/server/0737-Do-not-allow-ticket-level-changes-while-unloading-pl.patch index 2a955f5ec..9a86e8f68 100644 --- a/patches/server/0737-Do-not-allow-ticket-level-changes-while-unloading-pl.patch +++ b/patches/server/0737-Do-not-allow-ticket-level-changes-while-unloading-pl.patch @@ -8,10 +8,10 @@ Sync loading the chunk at this stage would cause it to load older data, as well as screwing our region state. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index a7bc1d6ce7eebfe0b10f8c179b6a1441169d8fc1..c773d6ca536389aac5efda6112440e1b0b85594d 100644 +index be8303e64e481e37a6ab25ee99c4008037670303..77f17937e90c9b12839f0e64131aa24b5df25dae 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -309,6 +309,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -313,6 +313,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } // Paper end @@ -19,7 +19,7 @@ index a7bc1d6ce7eebfe0b10f8c179b6a1441169d8fc1..c773d6ca536389aac5efda6112440e1b public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) { super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); this.visibleChunkMap = this.updatingChunkMap.clone(); -@@ -671,6 +672,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -707,6 +708,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @Nullable ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k) { @@ -27,7 +27,7 @@ index a7bc1d6ce7eebfe0b10f8c179b6a1441169d8fc1..c773d6ca536389aac5efda6112440e1b if (k > ChunkMap.MAX_CHUNK_DISTANCE && level > ChunkMap.MAX_CHUNK_DISTANCE) { return holder; } else { -@@ -884,6 +886,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -924,6 +926,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (completablefuture1 != completablefuture) { this.scheduleUnload(pos, holder); } else { @@ -40,19 +40,19 @@ index a7bc1d6ce7eebfe0b10f8c179b6a1441169d8fc1..c773d6ca536389aac5efda6112440e1b // Paper start boolean removed; if ((removed = this.pendingUnloads.remove(pos, holder)) && ichunkaccess != null) { -@@ -920,6 +928,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z); - } - } // Paper end +@@ -961,6 +969,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z); + } + } // Paper end + } finally { this.unloadingPlayerChunk = unloadingBefore; } // Paper - do not allow ticket level changes while unloading chunks } }; diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 9cb9bd439be0595e8c94bf128fecc2bd6c1647fc..fc404951b8a910594ffa42aee5ebb8bc3d9bbca4 100644 +index c97692440f4f0403714cdd7d1fba5496e324b40c..755537ca7b83a08357a59e00a6ef35107b0696e9 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -820,6 +820,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -816,6 +816,7 @@ public class ServerChunkCache extends ChunkSource { public boolean runDistanceManagerUpdates() { if (distanceManager.delayDistanceManagerTick) return false; // Paper - Chunk priority diff --git a/patches/server/0738-Do-not-allow-ticket-level-changes-when-updating-chun.patch b/patches/server/0738-Do-not-allow-ticket-level-changes-when-updating-chun.patch index 0d4632a0e..d0f51016f 100644 --- a/patches/server/0738-Do-not-allow-ticket-level-changes-when-updating-chun.patch +++ b/patches/server/0738-Do-not-allow-ticket-level-changes-when-updating-chun.patch @@ -8,10 +8,10 @@ This WILL cause state corruption if it happens. So, don't allow it. diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 49247d12e743f987113524121e60a3e0ba4a825a..b473a0e3235405dde46d9d6cb300e88d6b1d121b 100644 +index 6f7794a6e5c832328ddc16ca9b76414ea08020ad..fbfbe9adeca7364e6346c887616890bf968f38a1 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -423,7 +423,13 @@ public class ChunkHolder { +@@ -436,7 +436,13 @@ public class ChunkHolder { CompletableFuture completablefuture1 = new CompletableFuture(); completablefuture1.thenRunAsync(() -> { @@ -25,7 +25,7 @@ index 49247d12e743f987113524121e60a3e0ba4a825a..b473a0e3235405dde46d9d6cb300e88d }, executor); this.pendingFullStateConfirmation = completablefuture1; completablefuture.thenAccept((either) -> { -@@ -440,7 +446,12 @@ public class ChunkHolder { +@@ -453,7 +459,12 @@ public class ChunkHolder { private void demoteFullChunk(ChunkMap playerchunkmap, ChunkHolder.FullChunkStatus playerchunk_state) { this.pendingFullStateConfirmation.cancel(false); diff --git a/patches/server/0739-Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/0739-Do-not-submit-profile-lookups-to-worldgen-threads.patch index 534570379..b1de32908 100644 --- a/patches/server/0739-Do-not-submit-profile-lookups-to-worldgen-threads.patch +++ b/patches/server/0739-Do-not-submit-profile-lookups-to-worldgen-threads.patch @@ -10,10 +10,10 @@ out due to a sync load, as the worldgen threads will be stalling on profile lookups. diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 5bdd1958dff2fc9321bf858e6aa4cc5ad0a5a9ca..354e8096d404bfca8055aafcd80b2de29a7bc929 100644 +index c072819c1ebc772f524649c6c2f8b48d919bf805..0a92ef3a1470b1944d0d912f9c2d9641d5464c98 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -76,6 +76,22 @@ public class Util { +@@ -71,6 +71,22 @@ public class Util { private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1); private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap", -2); // Paper - add -2 priority private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority @@ -35,9 +35,9 @@ index 5bdd1958dff2fc9321bf858e6aa4cc5ad0a5a9ca..354e8096d404bfca8055aafcd80b2de2 + // Paper end - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread private static final ExecutorService IO_POOL = makeIoExecutor(); public static LongSupplier timeSource = System::nanoTime; - public static final UUID NIL_UUID = new UUID(0L, 0L); + public static final Ticker TICKER = new Ticker() { diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index a157f71cf55b9e97fac56c7c55b552da86000fd5..4e2833dc941863cc54416c81f09c688b5616d7a4 100644 +index 6349b33939909435120fdef5e506480108cfbfc1..ea739fae40e819fd82bc275c0af5c8269e12d656 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java @@ -200,7 +200,7 @@ public class GameProfileCache { diff --git a/patches/server/0741-Add-paper-mobcaps-and-paper-playermobcaps.patch b/patches/server/0741-Add-paper-mobcaps-and-paper-playermobcaps.patch index b495c3f91..b62bab9ac 100644 --- a/patches/server/0741-Add-paper-mobcaps-and-paper-playermobcaps.patch +++ b/patches/server/0741-Add-paper-mobcaps-and-paper-playermobcaps.patch @@ -272,7 +272,7 @@ index f436ab35798c9b6e6cb2eb60d2c02cbf9b742e69..be1da6ebf8c1468182cbb92a16e4866b List worlds; if (args.length < 2 || args[1].equals("*")) { diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 8e63d93a574f2c37094770099ea8e1f45cde3db5..6dba117b4f5dc6c4e078a32037a4026b45bf2176 100644 +index 1622450b53e0f0f48c3ca107e4d705b4ad29dadf..f6a225eed29eed364b7e2ea6bc85d55d8a325a11 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -191,6 +191,16 @@ public final class NaturalSpawner { @@ -293,10 +293,10 @@ index 8e63d93a574f2c37094770099ea8e1f45cde3db5..6dba117b4f5dc6c4e078a32037a4026b public static void spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner) { spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index e0e7fb4cc5516d8712f384fb5cb4d22c5bdceff5..51f537069c195edf1b7a60f233997d3cc03d304a 100644 +index da5549f62c08ca4b2e6942269be1c0970a85ae8c..c1b79f21bff6f9f83f06c338a67f9a942f75da68 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2145,6 +2145,11 @@ public final class CraftServer implements Server { +@@ -2137,6 +2137,11 @@ public final class CraftServer implements Server { @Override public int getSpawnLimit(SpawnCategory spawnCategory) { @@ -309,10 +309,10 @@ index e0e7fb4cc5516d8712f384fb5cb4d22c5bdceff5..51f537069c195edf1b7a60f233997d3c } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d82795b119a7d6d8bde42f052d1915621f65bace..f1301ffcfc03298f65186b043ed3ba173f2a923b 100644 +index 18cbb6052de6c79095f34ebdb1feb13c4e95afe8..b3f447e77619a7a0954a7709f36ad22678fce5f4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1714,9 +1714,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1717,9 +1717,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { Validate.notNull(spawnCategory, "SpawnCategory cannot be null"); Validate.isTrue(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory." + spawnCategory + " are not supported."); diff --git a/patches/server/0742-Prevent-unload-calls-removing-tickets-for-sync-loads.patch b/patches/server/0742-Prevent-unload-calls-removing-tickets-for-sync-loads.patch index 14502c64a..8a78c56d8 100644 --- a/patches/server/0742-Prevent-unload-calls-removing-tickets-for-sync-loads.patch +++ b/patches/server/0742-Prevent-unload-calls-removing-tickets-for-sync-loads.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent unload() calls removing tickets for sync loads diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index b3b10baad56bf14a31a11a3375000195ce84d4d3..7c3a1622f161409e92c4ccfa13e8c1fc1d66c947 100644 +index 755537ca7b83a08357a59e00a6ef35107b0696e9..7771fd7c7918aa4852371dc88d46163c168f020e 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -725,6 +725,8 @@ public class ServerChunkCache extends ChunkSource { +@@ -721,6 +721,8 @@ public class ServerChunkCache extends ChunkSource { return completablefuture; } @@ -17,7 +17,7 @@ index b3b10baad56bf14a31a11a3375000195ce84d4d3..7c3a1622f161409e92c4ccfa13e8c1fc private CompletableFuture> getChunkFutureMainThread(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) { // Paper start - add isUrgent - old sig left in place for dirty nms plugins return getChunkFutureMainThread(chunkX, chunkZ, leastStatus, create, false); -@@ -743,9 +745,12 @@ public class ServerChunkCache extends ChunkSource { +@@ -739,9 +741,12 @@ public class ServerChunkCache extends ChunkSource { ChunkHolder.FullChunkStatus currentChunkState = ChunkHolder.getFullChunkStatus(playerchunk.getTicketLevel()); currentlyUnloading = (oldChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !currentChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)); } @@ -30,7 +30,7 @@ index b3b10baad56bf14a31a11a3375000195ce84d4d3..7c3a1622f161409e92c4ccfa13e8c1fc if (isUrgent) this.distanceManager.markUrgent(chunkcoordintpair); // Paper - Chunk priority if (this.chunkAbsent(playerchunk, l)) { ProfilerFiller gameprofilerfiller = this.level.getProfiler(); -@@ -756,13 +761,21 @@ public class ServerChunkCache extends ChunkSource { +@@ -752,13 +757,21 @@ public class ServerChunkCache extends ChunkSource { playerchunk = this.getVisibleChunkIfPresent(k); gameprofilerfiller.pop(); if (this.chunkAbsent(playerchunk, l)) { diff --git a/patches/server/0744-Optimise-general-POI-access.patch b/patches/server/0744-Optimise-general-POI-access.patch index 9f914bbfd..7fa35796d 100644 --- a/patches/server/0744-Optimise-general-POI-access.patch +++ b/patches/server/0744-Optimise-general-POI-access.patch @@ -908,12 +908,12 @@ index 4a972b26242cf4c9d7e8f655cb1264cddad5f143..8a569e3300543cb171c3befae5996962 public boolean release(BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java -index 63f283f32bdad02299d4a16c305a28c3bfbce9a8..de94f25792261c6c89986ad3dee3255c2a89357b 100644 +index 3959eeb9090e8e4c999d89ec32fac8c46d5cdc75..4d71c4a43d6624d4292e9902ee8dad5fd4d9b8fb 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java -@@ -25,7 +25,7 @@ import org.apache.logging.log4j.Logger; +@@ -25,7 +25,7 @@ import org.slf4j.Logger; public class PoiSection { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final Short2ObjectMap records = new Short2ObjectOpenHashMap<>(); - private final Map> byType = Maps.newHashMap(); + private final Map> byType = Maps.newHashMap(); public final Map> getData() { return this.byType; } // Paper - public accessor @@ -921,10 +921,10 @@ index 63f283f32bdad02299d4a16c305a28c3bfbce9a8..de94f25792261c6c89986ad3dee3255c private boolean isValid; diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -index ff6cadec530dedf9efc5d6226e48a096a1073ad6..d73b99d7fde724da4503b5176c3ad7b013197c6a 100644 +index 3e08ff74979c78b27537403bbcaf13459e9e06b1..c4bb280aef31c14e71337db0d6dbc5f06d9b9730 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -@@ -61,11 +61,11 @@ public class SectionStorage extends RegionFileStorage implements AutoCloseabl +@@ -65,11 +65,11 @@ public class SectionStorage extends RegionFileStorage implements AutoCloseabl } @Nullable diff --git a/patches/server/0745-Allow-controlled-flushing-for-network-manager.patch b/patches/server/0745-Allow-controlled-flushing-for-network-manager.patch index 8423c76c9..9b061bed5 100644 --- a/patches/server/0745-Allow-controlled-flushing-for-network-manager.patch +++ b/patches/server/0745-Allow-controlled-flushing-for-network-manager.patch @@ -9,10 +9,10 @@ This patch will be used to optimise out flush calls in later patches. diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 2a9d5d977932e63ff7cae2fb8a7cfe7860172a39..4ed1373fdd8f39b3d8d9b4d5cd88f70d3259e2e4 100644 +index 8536dd544876e245a611379a7ed1446b0ed06eac..2717252c8c87abeb90c9a0ee82e574276e9d01cf 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -94,6 +94,39 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -104,6 +104,39 @@ public class Connection extends SimpleChannelInboundHandler> { public ConnectionProtocol protocol; // Paper end @@ -52,7 +52,7 @@ index 2a9d5d977932e63ff7cae2fb8a7cfe7860172a39..4ed1373fdd8f39b3d8d9b4d5cd88f70d public Connection(PacketFlow side) { this.receiving = side; } -@@ -255,7 +288,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -267,7 +300,7 @@ public class Connection extends SimpleChannelInboundHandler> { net.minecraft.server.MCUtil.isMainThread() && packet.isReady() && this.queue.isEmpty() && (packet.getExtraPackets() == null || packet.getExtraPackets().isEmpty()) ))) { @@ -61,7 +61,7 @@ index 2a9d5d977932e63ff7cae2fb8a7cfe7860172a39..4ed1373fdd8f39b3d8d9b4d5cd88f70d return; } // write the packets to the queue, then flush - antixray hooks there already -@@ -279,6 +312,14 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -291,6 +324,14 @@ public class Connection extends SimpleChannelInboundHandler> { } private void sendPacket(Packet packet, @Nullable GenericFutureListener> callback) { @@ -76,7 +76,7 @@ index 2a9d5d977932e63ff7cae2fb8a7cfe7860172a39..4ed1373fdd8f39b3d8d9b4d5cd88f70d ConnectionProtocol enumprotocol = ConnectionProtocol.getProtocolForPacket(packet); ConnectionProtocol enumprotocol1 = this.getCurrentProtocol(); -@@ -289,16 +330,21 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -301,16 +342,21 @@ public class Connection extends SimpleChannelInboundHandler> { } if (this.channel.eventLoop().inEventLoop()) { @@ -100,7 +100,7 @@ index 2a9d5d977932e63ff7cae2fb8a7cfe7860172a39..4ed1373fdd8f39b3d8d9b4d5cd88f70d if (packetState != currentState) { this.setProtocol(packetState); } -@@ -312,7 +358,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -324,7 +370,7 @@ public class Connection extends SimpleChannelInboundHandler> { try { // Paper end @@ -109,7 +109,7 @@ index 2a9d5d977932e63ff7cae2fb8a7cfe7860172a39..4ed1373fdd8f39b3d8d9b4d5cd88f70d if (callback != null) { channelfuture.addListener(callback); -@@ -354,6 +400,10 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -366,6 +412,10 @@ public class Connection extends SimpleChannelInboundHandler> { } private boolean processQueue() { if (this.queue.isEmpty()) return true; @@ -120,7 +120,7 @@ index 2a9d5d977932e63ff7cae2fb8a7cfe7860172a39..4ed1373fdd8f39b3d8d9b4d5cd88f70d // If we are on main, we are safe here in that nothing else should be processing queue off main anymore // But if we are not on main due to login/status, the parent is synchronized on packetQueue java.util.Iterator iterator = this.queue.iterator(); -@@ -361,16 +411,22 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -373,16 +423,22 @@ public class Connection extends SimpleChannelInboundHandler> { PacketHolder queued = iterator.next(); // poll -> peek // Fix NPE (Spigot bug caused by handleDisconnection()) diff --git a/patches/server/0747-Rewrite-entity-bounding-box-lookup-calls.patch b/patches/server/0747-Rewrite-entity-bounding-box-lookup-calls.patch index 7893ed296..c7080fe86 100644 --- a/patches/server/0747-Rewrite-entity-bounding-box-lookup-calls.patch +++ b/patches/server/0747-Rewrite-entity-bounding-box-lookup-calls.patch @@ -914,10 +914,10 @@ index 0000000000000000000000000000000000000000..3ba094e640d7fe7803e2bbdab8ff3beb + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index f2d3d35dc7cde7717986ffb6da40a6680308fe39..9362b39f4cc321bf0d4fc272bc3fb0463c47d4ce 100644 +index 0e23cac2140c7edaba2ce13d4bb05e304826e75c..69dc366684db5229a882c18075465abc389cc8fa 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -428,7 +428,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -431,7 +431,7 @@ public class ServerLevel extends Level implements WorldGenLevel { DataFixer datafixer = minecraftserver.getFixerUpper(); EntityPersistentStorage entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver); @@ -927,10 +927,10 @@ index f2d3d35dc7cde7717986ffb6da40a6680308fe39..9362b39f4cc321bf0d4fc272bc3fb046 int j = this.spigotConfig.viewDistance; // Spigot int k = this.spigotConfig.simulationDistance; // Spigot diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -index de5e18a331178da8f7e82aa2419a0ee606e801ee..9b25d36fe5230e287d81b99be31b9eddd8e76002 100644 +index 8fdda1e5805534d08c0a06b15e89d85b3d9c21e9..a24f605bd033f249a374e83ba094880106260eee 100644 --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -@@ -496,4 +496,21 @@ public class WorldGenRegion implements WorldGenLevel { +@@ -490,4 +490,21 @@ public class WorldGenRegion implements WorldGenLevel { public long nextSubTickCount() { return this.subTickCount.getAndIncrement(); } @@ -953,10 +953,10 @@ index de5e18a331178da8f7e82aa2419a0ee606e801ee..9b25d36fe5230e287d81b99be31b9edd + // Paper end } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 445c292cbfd151148945f57ad8dd2f0a2481936f..9d16faa522cf627bc59df56b04d28b4d4896cb7c 100644 +index 1db65d69cb3b81d2e4eee016b9a8735fe45bdc50..af19659eb52abd900a67b1b354bac958f0d37a70 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -425,6 +425,56 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -428,6 +428,56 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } // Paper end - make end portalling safe @@ -1013,7 +1013,7 @@ index 445c292cbfd151148945f57ad8dd2f0a2481936f..9d16faa522cf627bc59df56b04d28b4d public Entity(EntityType type, Level world) { this.id = Entity.ENTITY_COUNTER.incrementAndGet(); this.passengers = ImmutableList.of(); -@@ -2294,11 +2344,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2298,11 +2348,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i return InteractionResult.PASS; } @@ -1051,59 +1051,10 @@ index 99f69f11e86fdee801504303fe025797f7959db8..f9527d1d867f93b4e0e2758485cfa1f6 List getEntities(EntityTypeTest filter, AABB box, Predicate predicate); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 48fdf3aebb252a2670899011f112b1c802ccc0e6..c603dcbe89a49e9e7de7fbc5c863e4b3a9869f95 100644 +index c293531a6913b365c3bf804d6d0bfae24378dc43..944519c4433710610ac5015d3d3de380d9ec39c9 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -200,6 +200,48 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - - public abstract ResourceKey getTypeKey(); - -+ // Paper start -+ protected final io.papermc.paper.world.EntitySliceManager entitySliceManager; -+ -+ public org.bukkit.entity.Entity[] getChunkEntities(int chunkX, int chunkZ) { -+ io.papermc.paper.world.ChunkEntitySlices slices = this.entitySliceManager.getChunk(chunkX, chunkZ); -+ if (slices == null) { -+ return new org.bukkit.entity.Entity[0]; -+ } -+ return slices.getChunkEntities(); -+ } -+ -+ @Override -+ public List getHardCollidingEntities(Entity except, AABB box, Predicate predicate) { -+ List ret = new java.util.ArrayList<>(); -+ this.entitySliceManager.getEntities(except, box, ret, predicate); -+ return ret; -+ } -+ -+ @Override -+ public void getEntities(Entity except, AABB box, Predicate predicate, List into) { -+ this.entitySliceManager.getEntities(except, box, into, predicate); -+ } -+ -+ @Override -+ public void getHardCollidingEntities(Entity except, AABB box, Predicate predicate, List into) { -+ this.entitySliceManager.getHardCollidingEntities(except, box, into, predicate); -+ } -+ -+ @Override -+ public void getEntitiesByClass(Class clazz, Entity except, final AABB box, List into, -+ Predicate predicate) { -+ this.entitySliceManager.getEntities((Class)clazz, except, box, (List)into, (Predicate)predicate); -+ } -+ -+ @Override -+ public List getEntitiesOfClass(Class entityClass, AABB box, Predicate predicate) { -+ List ret = new java.util.ArrayList<>(); -+ this.entitySliceManager.getEntities(entityClass, null, box, ret, predicate); -+ return ret; -+ } -+ // Paper end -+ - protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, final DimensionType dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor - this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot - this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper -@@ -279,6 +321,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -278,6 +278,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); this.chunkPacketBlockController = this.paperConfig.antiXray ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray @@ -1111,7 +1062,7 @@ index 48fdf3aebb252a2670899011f112b1c802ccc0e6..c603dcbe89a49e9e7de7fbc5c863e4b3 } // Paper start -@@ -989,26 +1032,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -988,26 +989,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public List getEntities(@Nullable Entity except, AABB box, Predicate predicate) { this.getProfiler().incrementCounter("getEntities"); List list = Lists.newArrayList(); @@ -1139,7 +1090,7 @@ index 48fdf3aebb252a2670899011f112b1c802ccc0e6..c603dcbe89a49e9e7de7fbc5c863e4b3 return list; } -@@ -1017,27 +1041,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1016,27 +998,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.getProfiler().incrementCounter("getEntities"); List list = Lists.newArrayList(); @@ -1182,8 +1133,55 @@ index 48fdf3aebb252a2670899011f112b1c802ccc0e6..c603dcbe89a49e9e7de7fbc5c863e4b3 return list; } +@@ -1389,4 +1366,46 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + public long nextSubTickCount() { + return (long) (this.subTickCount++); + } ++ ++ // Paper start ++ protected final io.papermc.paper.world.EntitySliceManager entitySliceManager; ++ ++ public org.bukkit.entity.Entity[] getChunkEntities(int chunkX, int chunkZ) { ++ io.papermc.paper.world.ChunkEntitySlices slices = this.entitySliceManager.getChunk(chunkX, chunkZ); ++ if (slices == null) { ++ return new org.bukkit.entity.Entity[0]; ++ } ++ return slices.getChunkEntities(); ++ } ++ ++ @Override ++ public List getHardCollidingEntities(Entity except, AABB box, Predicate predicate) { ++ List ret = new java.util.ArrayList<>(); ++ this.entitySliceManager.getEntities(except, box, ret, predicate); ++ return ret; ++ } ++ ++ @Override ++ public void getEntities(Entity except, AABB box, Predicate predicate, List into) { ++ this.entitySliceManager.getEntities(except, box, into, predicate); ++ } ++ ++ @Override ++ public void getHardCollidingEntities(Entity except, AABB box, Predicate predicate, List into) { ++ this.entitySliceManager.getHardCollidingEntities(except, box, into, predicate); ++ } ++ ++ @Override ++ public void getEntitiesByClass(Class clazz, Entity except, final AABB box, List into, ++ Predicate predicate) { ++ this.entitySliceManager.getEntities((Class)clazz, except, box, (List)into, (Predicate)predicate); ++ } ++ ++ @Override ++ public List getEntitiesOfClass(Class entityClass, AABB box, Predicate predicate) { ++ List ret = new java.util.ArrayList<>(); ++ this.entitySliceManager.getEntities(entityClass, null, box, ret, predicate); ++ return ret; ++ } ++ // Paper end + } diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -index aa3217425a64fdd691f255dcc5529a29b8c2c86b..a0c66689c954823e7c20664594557dc26afbd246 100644 +index 35e3926a878dd87f05bb41e9e52b4e04e30752eb..5029ab81e3d7943a001b6367083eb511ce7d3572 100644 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java @@ -49,8 +49,10 @@ public class PersistentEntitySectionManager implements A @@ -1224,17 +1222,17 @@ index aa3217425a64fdd691f255dcc5529a29b8c2c86b..a0c66689c954823e7c20664594557dc2 if (!this.currentSection.remove(this.entity)) { @@ -503,6 +508,7 @@ public class PersistentEntitySectionManager implements A if (!this.currentSection.remove(this.entity)) { - PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (destroying due to {})", this.entity, SectionPos.of(this.currentSectionKey), reason); + PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (destroying due to {})", new Object[]{this.entity, SectionPos.of(this.currentSectionKey), reason}); } + PersistentEntitySectionManager.this.entitySliceManager.removeEntity((Entity)this.entity); // Paper Visibility visibility = PersistentEntitySectionManager.getEffectiveStatus(this.entity, this.currentSection.getStatus()); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 155933ef7c324ea17c2349a1f73ede29169ec4f2..7a042de919fc8335455bc45f7749648ca2f00735 100644 +index ecab8b4d6850cf182c28869ecbdbc92d45fbe637..58a99a6867642c74cba7db1edff87a071065f28d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -@@ -132,9 +132,7 @@ public class CraftChunk implements Chunk { +@@ -133,9 +133,7 @@ public class CraftChunk implements Chunk { long pair = ChunkPos.asLong(x, z); if (entityManager.areEntitiesLoaded(pair)) { @@ -1245,7 +1243,7 @@ index 155933ef7c324ea17c2349a1f73ede29169ec4f2..7a042de919fc8335455bc45f7749648c } entityManager.ensureChunkQueuedForLoad(pair); // Start entity loading -@@ -170,9 +168,7 @@ public class CraftChunk implements Chunk { +@@ -171,9 +169,7 @@ public class CraftChunk implements Chunk { } } @@ -1257,10 +1255,10 @@ index 155933ef7c324ea17c2349a1f73ede29169ec4f2..7a042de919fc8335455bc45f7749648c @Override diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java -index 9ab8159975f58a0014edbe3a368490b3590882ea..4c6cbfbcb5a7876e6b556b59c54e9a4cedf7843e 100644 +index 13e887e9d06c3eb8649613d1ecb3d26de6b9d6ef..34e2e14ebb007cceb8b64d3eb321646e834215d4 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java -@@ -258,4 +258,20 @@ public class DummyGeneratorAccess implements WorldGenLevel { +@@ -251,4 +251,20 @@ public class DummyGeneratorAccess implements WorldGenLevel { public boolean destroyBlock(BlockPos pos, boolean drop, Entity breakingEntity, int maxUpdateDepth) { return false; // SPIGOT-6515 } diff --git a/patches/server/0748-Optimise-chunk-tick-iteration.patch b/patches/server/0748-Optimise-chunk-tick-iteration.patch index c3263b021..588489465 100644 --- a/patches/server/0748-Optimise-chunk-tick-iteration.patch +++ b/patches/server/0748-Optimise-chunk-tick-iteration.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimise chunk tick iteration Use a dedicated list of entity ticking chunks to reduce the cost diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index b473a0e3235405dde46d9d6cb300e88d6b1d121b..43f97571f0b837cbba5c3e889edbc5737a6e7b54 100644 +index fbfbe9adeca7364e6346c887616890bf968f38a1..bd43fbc8a93afa7604aa467392520ed7b30a1d83 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -83,11 +83,21 @@ public class ChunkHolder { +@@ -86,11 +86,21 @@ public class ChunkHolder { long key = net.minecraft.server.MCUtil.getCoordinateKey(this.pos); this.playersInMobSpawnRange = this.chunkMap.playerMobSpawnMap.getObjectsInRange(key); this.playersInChunkTickRange = this.chunkMap.playerChunkTickRangeMap.getObjectsInRange(key); @@ -31,7 +31,7 @@ index b473a0e3235405dde46d9d6cb300e88d6b1d121b..43f97571f0b837cbba5c3e889edbc573 } // Paper end - optimise anyPlayerCloseEnoughForSpawning long lastAutoSaveTime; // Paper - incremental autosave -@@ -242,7 +252,7 @@ public class ChunkHolder { +@@ -246,7 +256,7 @@ public class ChunkHolder { if (i < 0 || i >= this.changedBlocksPerSection.length) return; // CraftBukkit - SPIGOT-6086, SPIGOT-6296 if (this.changedBlocksPerSection[i] == null) { @@ -40,15 +40,15 @@ index b473a0e3235405dde46d9d6cb300e88d6b1d121b..43f97571f0b837cbba5c3e889edbc573 this.changedBlocksPerSection[i] = new ShortOpenHashSet(); } -@@ -259,6 +269,7 @@ public class ChunkHolder { - int k = this.lightEngine.getMaxLightSection(); +@@ -266,6 +276,7 @@ public class ChunkHolder { + int k = this.lightEngine.getMaxLightSection(); - if (y >= j && y <= k) { -+ this.addToBroadcastMap(); // Paper - optimise chunk tick iteration - int l = y - j; + if (y >= j && y <= k) { ++ this.addToBroadcastMap(); // Paper - optimise chunk tick iteration + int l = y - j; - if (lightType == LightLayer.SKY) { -@@ -271,8 +282,19 @@ public class ChunkHolder { + if (lightType == LightLayer.SKY) { +@@ -279,8 +290,19 @@ public class ChunkHolder { } } @@ -70,10 +70,10 @@ index b473a0e3235405dde46d9d6cb300e88d6b1d121b..43f97571f0b837cbba5c3e889edbc573 int i = 0; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index c773d6ca536389aac5efda6112440e1b0b85594d..a7fcf3042e6d26739051ed37efbef4a722561c5a 100644 +index 77f17937e90c9b12839f0e64131aa24b5df25dae..6a9f9d93be96bd27be5ac3a7d2e142fda2f45efa 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -155,6 +155,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -159,6 +159,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private final Queue unloadQueue; int viewDistance; public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobDistanceMap; // Paper @@ -82,18 +82,18 @@ index c773d6ca536389aac5efda6112440e1b0b85594d..a7fcf3042e6d26739051ed37efbef4a7 // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() public final CallbackExecutor callbackExecutor = new CallbackExecutor(); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 59ebce5b9f4db5e48b4b46d68e7325f2d2820bd6..ab1b24820a5ec576f33095ad5688aaecd44910f4 100644 +index 7771fd7c7918aa4852371dc88d46163c168f020e..e5d8e00199a7aecc67565d01f4d7dc46cf5ea1d7 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -50,6 +50,7 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper - import java.util.function.Function; // Paper +@@ -46,6 +46,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana + import net.minecraft.world.level.storage.DimensionDataStorage; + import net.minecraft.world.level.storage.LevelData; + import net.minecraft.world.level.storage.LevelStorageSource; +import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; // Paper public class ServerChunkCache extends ChunkSource { -@@ -995,34 +996,42 @@ public class ServerChunkCache extends ChunkSource { +@@ -994,34 +995,42 @@ public class ServerChunkCache extends ChunkSource { this.lastSpawnState = spawnercreature_d; gameprofilerfiller.popPush("filteringLoadedChunks"); @@ -144,15 +144,15 @@ index 59ebce5b9f4db5e48b4b46d68e7325f2d2820bd6..ab1b24820a5ec576f33095ad5688aaec + // Paper end - optimise chunk tick iteration ChunkPos chunkcoordintpair = chunk1.getPos(); -- if (this.level.isPositionEntityTicking(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkproviderserver_a.holder, chunkcoordintpair, false)) { // Paper - optimise anyPlayerCloseEnoughForSpawning -+ if (this.level.isPositionEntityTicking(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, false)) { // Paper - optimise anyPlayerCloseEnoughForSpawning +- if (this.level.isNaturalSpawningAllowed(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkproviderserver_a.holder, chunkcoordintpair, false)) { // Paper - optimise anyPlayerCloseEnoughForSpawning ++ if (this.level.isNaturalSpawningAllowed(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, false)) { // Paper - optimise anyPlayerCloseEnoughForSpawning chunk1.incrementInhabitedTime(j); - if (flag2 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkproviderserver_a.holder, chunkcoordintpair, true)) { // Spigot // Paper - optimise anyPlayerCloseEnoughForSpawning + if (flag2 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, true)) { // Spigot // Paper - optimise anyPlayerCloseEnoughForSpawning & optimise chunk tick iteration NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1); } -@@ -1030,7 +1039,16 @@ public class ServerChunkCache extends ChunkSource { +@@ -1029,7 +1038,16 @@ public class ServerChunkCache extends ChunkSource { this.level.tickChunk(chunk1, k); } } @@ -169,7 +169,7 @@ index 59ebce5b9f4db5e48b4b46d68e7325f2d2820bd6..ab1b24820a5ec576f33095ad5688aaec this.level.timings.chunkTicks.stopTiming(); // Paper gameprofilerfiller.popPush("customSpawners"); if (flag2) { -@@ -1038,15 +1056,24 @@ public class ServerChunkCache extends ChunkSource { +@@ -1037,15 +1055,24 @@ public class ServerChunkCache extends ChunkSource { this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); } // Paper - timings } diff --git a/patches/server/0749-Execute-chunk-tasks-mid-tick.patch b/patches/server/0749-Execute-chunk-tasks-mid-tick.patch index 31d7a1e24..05d17ac63 100644 --- a/patches/server/0749-Execute-chunk-tasks-mid-tick.patch +++ b/patches/server/0749-Execute-chunk-tasks-mid-tick.patch @@ -19,13 +19,22 @@ index b27021a42cbed3f0648a8d0903d00d03922ae221..eada966d7f108a6081be7a848f5c1dfc private MinecraftTimings() {} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 79e5b8a05828bbc07468d2deeb0f4dad51ca12a5..7be369cf60e45a551fb2d274b9514856dca7b2e5 100644 +index 95179d309f668b3fe299ce4641164a1859517d33..eb9a3fecb7c1526d0c5f6194c78ff3a740c94c7e 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -332,6 +332,76 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop void guardEntityTick(Consumer tickConsumer, T entity) { try { tickConsumer.accept(entity); diff --git a/patches/server/0750-Do-not-copy-visible-chunks.patch b/patches/server/0750-Do-not-copy-visible-chunks.patch index d9e08e0b9..6b5f5cee4 100644 --- a/patches/server/0750-Do-not-copy-visible-chunks.patch +++ b/patches/server/0750-Do-not-copy-visible-chunks.patch @@ -35,10 +35,10 @@ index b3516862d796c2d9fcc1c67a6073445403d73088..b61abf227a04b4565c2525e5f469db30 List allChunks = new ArrayList<>(visibleChunks.values()); List players = world.players; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index a7fcf3042e6d26739051ed37efbef4a722561c5a..58dc590cf659cba84d7cb4f7205fdb0bdefded79 100644 +index 6a9f9d93be96bd27be5ac3a7d2e142fda2f45efa..09e2d5bd3ab14a2c43547313394bf1167168d6cc 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -120,9 +120,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -123,9 +123,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private static final int MIN_VIEW_DISTANCE = 3; public static final int MAX_VIEW_DISTANCE = 33; public static final int MAX_CHUNK_DISTANCE = 33 + ChunkStatus.maxDistance(); @@ -52,7 +52,7 @@ index a7fcf3042e6d26739051ed37efbef4a722561c5a..58dc590cf659cba84d7cb4f7205fdb0b private final Long2ObjectLinkedOpenHashMap pendingUnloads; public final LongSet entitiesInLevel; public final ServerLevel level; -@@ -313,7 +315,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -317,7 +319,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider boolean unloadingPlayerChunk = false; // Paper - do not allow ticket level changes while unloading chunks public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) { super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); @@ -61,7 +61,7 @@ index a7fcf3042e6d26739051ed37efbef4a722561c5a..58dc590cf659cba84d7cb4f7205fdb0b this.pendingUnloads = new Long2ObjectLinkedOpenHashMap(); this.entitiesInLevel = new LongOpenHashSet(); this.toDrop = new LongOpenHashSet(); -@@ -536,12 +538,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -541,12 +543,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @Nullable public ChunkHolder getUpdatingChunkIfPresent(long pos) { @@ -81,7 +81,7 @@ index a7fcf3042e6d26739051ed37efbef4a722561c5a..58dc590cf659cba84d7cb4f7205fdb0b } protected IntSupplier getChunkQueueLevel(long pos) { -@@ -703,7 +710,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -739,7 +746,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // Paper end } @@ -90,7 +90,7 @@ index a7fcf3042e6d26739051ed37efbef4a722561c5a..58dc590cf659cba84d7cb4f7205fdb0b this.modified = true; } -@@ -783,7 +790,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -819,7 +826,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider protected void saveAllChunks(boolean flush) { if (flush) { @@ -99,7 +99,7 @@ index a7fcf3042e6d26739051ed37efbef4a722561c5a..58dc590cf659cba84d7cb4f7205fdb0b MutableBoolean mutableboolean = new MutableBoolean(); do { -@@ -814,7 +821,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -850,7 +857,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider //this.flushWorker(); // Paper - nuke IOWorker this.level.asyncChunkTaskManager.flush(); // Paper - flush to preserve behavior compat with pre-async behaviour } else { @@ -108,7 +108,7 @@ index a7fcf3042e6d26739051ed37efbef4a722561c5a..58dc590cf659cba84d7cb4f7205fdb0b } } -@@ -848,7 +855,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -888,7 +895,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider while (longiterator.hasNext()) { // Spigot long j = longiterator.nextLong(); longiterator.remove(); // Spigot @@ -117,7 +117,7 @@ index a7fcf3042e6d26739051ed37efbef4a722561c5a..58dc590cf659cba84d7cb4f7205fdb0b if (playerchunk != null) { playerchunk.onChunkRemove(); // Paper -@@ -948,7 +955,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -989,7 +996,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (!this.modified) { return false; } else { @@ -131,7 +131,7 @@ index a7fcf3042e6d26739051ed37efbef4a722561c5a..58dc590cf659cba84d7cb4f7205fdb0b this.modified = false; return true; } -@@ -1426,7 +1438,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1480,7 +1492,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.viewDistance = j; this.distanceManager.updatePlayerTickets(this.viewDistance + 1); @@ -140,7 +140,7 @@ index a7fcf3042e6d26739051ed37efbef4a722561c5a..58dc590cf659cba84d7cb4f7205fdb0b while (objectiterator.hasNext()) { ChunkHolder playerchunk = (ChunkHolder) objectiterator.next(); -@@ -1469,7 +1481,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1523,7 +1535,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public int size() { @@ -149,7 +149,7 @@ index a7fcf3042e6d26739051ed37efbef4a722561c5a..58dc590cf659cba84d7cb4f7205fdb0b } public DistanceManager getDistanceManager() { -@@ -1477,13 +1489,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1531,13 +1543,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } protected Iterable getChunks() { @@ -166,10 +166,10 @@ index a7fcf3042e6d26739051ed37efbef4a722561c5a..58dc590cf659cba84d7cb4f7205fdb0b while (objectbidirectionaliterator.hasNext()) { Entry entry = (Entry) objectbidirectionaliterator.next(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index f1301ffcfc03298f65186b043ed3ba173f2a923b..99784a6531eb17d2758ff374f30b7b38656de2e2 100644 +index b3f447e77619a7a0954a7709f36ad22678fce5f4..71eb9d86738db8eb79ec5dc5574ea9afa934da62 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -157,7 +157,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -160,7 +160,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public int getTileEntityCount() { // We don't use the full world tile entity list, so we must iterate chunks @@ -178,7 +178,7 @@ index f1301ffcfc03298f65186b043ed3ba173f2a923b..99784a6531eb17d2758ff374f30b7b38 int size = 0; for (ChunkHolder playerchunk : chunks.values()) { net.minecraft.world.level.chunk.LevelChunk chunk = playerchunk.getTickingChunk(); -@@ -178,7 +178,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -181,7 +181,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { public int getChunkCount() { int ret = 0; @@ -187,7 +187,7 @@ index f1301ffcfc03298f65186b043ed3ba173f2a923b..99784a6531eb17d2758ff374f30b7b38 if (chunkHolder.getTickingChunk() != null) { ++ret; } -@@ -351,7 +351,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -354,7 +354,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public Chunk[] getLoadedChunks() { @@ -207,7 +207,7 @@ index f1301ffcfc03298f65186b043ed3ba173f2a923b..99784a6531eb17d2758ff374f30b7b38 return chunks.values().stream().map(ChunkHolder::getFullChunk).filter(Objects::nonNull).map(net.minecraft.world.level.chunk.LevelChunk::getBukkitChunk).toArray(Chunk[]::new); } -@@ -427,7 +438,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -430,7 +441,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean refreshChunk(int x, int z) { diff --git a/patches/server/0751-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch b/patches/server/0751-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch index 3df620fe0..17b4beb57 100644 --- a/patches/server/0751-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch +++ b/patches/server/0751-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch @@ -10,11 +10,11 @@ hoping that at least then we don't swap chunks, and maybe recover them all. diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 8866ded0567fee710aa301dbc89f4c45b7283447..75ef7c9ddafc23fa122c1421f55b3d7e0dcb2eef 100644 +index 7de66cec1eeaf797d61c815a34267c3dc85f0719..61b26c2cb332afd7215c013fbdf144b4a023d898 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -66,6 +66,18 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -68,6 +68,18 @@ import net.minecraft.world.ticks.ProtoChunkTicks; + import org.slf4j.Logger; public class ChunkSerializer { + // Paper start @@ -31,8 +31,8 @@ index 8866ded0567fee710aa301dbc89f4c45b7283447..75ef7c9ddafc23fa122c1421f55b3d7e + // Paper end public static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), null); // Paper - Anti-Xray - Add preset block states - private static final Logger LOGGER = LogManager.getLogger(); -@@ -454,7 +466,7 @@ public class ChunkSerializer { + private static final Logger LOGGER = LogUtils.getLogger(); +@@ -456,7 +468,7 @@ public class ChunkSerializer { nbttagcompound.putInt("xPos", chunkcoordintpair.x); nbttagcompound.putInt("yPos", chunk.getMinSection()); nbttagcompound.putInt("zPos", chunkcoordintpair.z); @@ -87,10 +87,10 @@ index c8298a597818227de33a4afce4698ec0666cf758..6baceb6ce9021c489be6e79d338a9704 this.used.set(start, start + size); } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index 293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3..950efcc80455f73ec8ca4e991fcf9a5b2b7fa22e 100644 +index 861a25a15f1aab20e3245b6d5cdad5d23bdfd6d0..8ff8855c5267379b3a5f5d8baa4a275ffee2c4bf 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -@@ -52,6 +52,355 @@ public class RegionFile implements AutoCloseable { +@@ -51,6 +51,355 @@ public class RegionFile implements AutoCloseable { public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper public final Path regionFile; // Paper @@ -178,7 +178,7 @@ index 293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3..950efcc80455f73ec8ca4e991fcf9a5b + } + ChunkPos ourLowerLeftPosition = RegionFileStorage.getRegionFileCoordinates(this.regionFile); + if (ourLowerLeftPosition == null) { -+ LOGGER.fatal("Unable to get chunk location of regionfile " + this.regionFile.toAbsolutePath() + ", cannot recover header"); ++ LOGGER.error("Unable to get chunk location of regionfile " + this.regionFile.toAbsolutePath() + ", cannot recover header"); + return false; + } + synchronized (this) { @@ -433,7 +433,7 @@ index 293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3..950efcc80455f73ec8ca4e991fcf9a5b + this.file.force(true); // try to ensure it goes through... + LOGGER.info("Successfully wrote new header to disk for regionfile " + this.regionFile.toAbsolutePath()); + } catch (IOException ex) { -+ LOGGER.fatal("Failed to write new header to disk for regionfile " + this.regionFile.toAbsolutePath(), ex); ++ LOGGER.error("Failed to write new header to disk for regionfile " + this.regionFile.toAbsolutePath(), ex); + } + } + @@ -444,9 +444,9 @@ index 293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3..950efcc80455f73ec8ca4e991fcf9a5b + // Paper end + // Paper start - Cache chunk status - private final ChunkStatus[] statuses = new ChunkStatus[32 * 32]; + private final net.minecraft.world.level.chunk.ChunkStatus[] statuses = new net.minecraft.world.level.chunk.ChunkStatus[32 * 32]; -@@ -79,8 +428,19 @@ public class RegionFile implements AutoCloseable { +@@ -78,8 +427,19 @@ public class RegionFile implements AutoCloseable { public RegionFile(Path file, Path directory, boolean dsync) throws IOException { this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync); } @@ -466,7 +466,7 @@ index 293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3..950efcc80455f73ec8ca4e991fcf9a5b this.header = ByteBuffer.allocateDirect(8192); this.regionFile = file; // Paper initOversizedState(); // Paper -@@ -109,14 +469,16 @@ public class RegionFile implements AutoCloseable { +@@ -108,14 +468,16 @@ public class RegionFile implements AutoCloseable { RegionFile.LOGGER.warn("Region file {} has truncated header: {}", file, i); } @@ -488,14 +488,14 @@ index 293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3..950efcc80455f73ec8ca4e991fcf9a5b // Spigot start if (j1 == 255) { // We're maxed out, so we need to read the proper length from the section -@@ -125,32 +487,102 @@ public class RegionFile implements AutoCloseable { +@@ -124,32 +486,102 @@ public class RegionFile implements AutoCloseable { j1 = (realLen.getInt(0) + 4) / 4096 + 1; } // Spigot end + sectorLength = j1; // Paper - diff on change, we expect this to be sector length of region if (i1 < 2) { - RegionFile.LOGGER.warn("Region file {} has invalid sector at index: {}; sector {} overlaps with header", file, k, i1); + RegionFile.LOGGER.warn("Region file {} has invalid sector at index: {}; sector {} overlaps with header", new Object[]{file, k, i1}); - this.offsets.put(k, 0); + //this.offsets.put(k, 0); // Paper - we catch this, but need it in the header for the summary change } else if (j1 == 0) { @@ -503,7 +503,7 @@ index 293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3..950efcc80455f73ec8ca4e991fcf9a5b - this.offsets.put(k, 0); + //this.offsets.put(k, 0); // Paper - we catch this, but need it in the header for the summary change } else if ((long) i1 * 4096L > j) { - RegionFile.LOGGER.warn("Region file {} has an invalid sector at index: {}; sector {} is out of bounds", file, k, i1); + RegionFile.LOGGER.warn("Region file {} has an invalid sector at index: {}; sector {} is out of bounds", new Object[]{file, k, i1}); - this.offsets.put(k, 0); + //this.offsets.put(k, 0); // Paper - we catch this, but need it in the header for the summary change } else { @@ -518,7 +518,7 @@ index 293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3..950efcc80455f73ec8ca4e991fcf9a5b + break; + } else { + // location = chunkX | (chunkZ << 5); -+ LOGGER.fatal("Detected invalid header for regionfile " + this.regionFile.toAbsolutePath() + ++ LOGGER.error("Detected invalid header for regionfile " + this.regionFile.toAbsolutePath() + + "! Cannot recalculate, removing local chunk (" + (headerLocation & 31) + "," + (headerLocation >>> 5) + ") from header"); + if (!hasBackedUp) { + hasBackedUp = true; @@ -535,7 +535,7 @@ index 293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3..950efcc80455f73ec8ca4e991fcf9a5b } + if (failedToAllocate & !canRecalcHeader) { + // location = chunkX | (chunkZ << 5); -+ LOGGER.fatal("Detected invalid header for regionfile " + this.regionFile.toAbsolutePath() + ++ LOGGER.error("Detected invalid header for regionfile " + this.regionFile.toAbsolutePath() + + "! Cannot recalculate, removing local chunk (" + (headerLocation & 31) + "," + (headerLocation >>> 5) + ") from header"); + if (!hasBackedUp) { + hasBackedUp = true; @@ -596,10 +596,10 @@ index 293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3..950efcc80455f73ec8ca4e991fcf9a5b @Nullable public synchronized DataInputStream getChunkDataInputStream(ChunkPos pos) throws IOException { int i = this.getOffset(pos); -@@ -174,6 +606,11 @@ public class RegionFile implements AutoCloseable { +@@ -173,6 +605,11 @@ public class RegionFile implements AutoCloseable { ((java.nio.Buffer) bytebuffer).flip(); // CraftBukkit - decompile error if (bytebuffer.remaining() < 5) { - RegionFile.LOGGER.error("Chunk {} header is truncated: expected {} but read {}", pos, l, bytebuffer.remaining()); + RegionFile.LOGGER.error("Chunk {} header is truncated: expected {} but read {}", new Object[]{pos, l, bytebuffer.remaining()}); + // Paper start - recalculate header on regionfile corruption + if (this.canRecalcHeader && this.recalculateHeader()) { + return this.getChunkDataInputStream(pos); @@ -608,7 +608,7 @@ index 293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3..950efcc80455f73ec8ca4e991fcf9a5b return null; } else { int i1 = bytebuffer.getInt(); -@@ -181,6 +618,11 @@ public class RegionFile implements AutoCloseable { +@@ -180,6 +617,11 @@ public class RegionFile implements AutoCloseable { if (i1 == 0) { RegionFile.LOGGER.warn("Chunk {} is allocated, but stream is missing", pos); @@ -620,7 +620,7 @@ index 293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3..950efcc80455f73ec8ca4e991fcf9a5b return null; } else { int j1 = i1 - 1; -@@ -188,17 +630,44 @@ public class RegionFile implements AutoCloseable { +@@ -187,17 +629,44 @@ public class RegionFile implements AutoCloseable { if (RegionFile.isExternalStreamChunk(b0)) { if (j1 != 0) { RegionFile.LOGGER.warn("Chunk has both internal and external streams"); @@ -640,7 +640,7 @@ index 293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3..950efcc80455f73ec8ca4e991fcf9a5b + return ret; + // Paper end - recalculate header on regionfile corruption } else if (j1 > bytebuffer.remaining()) { - RegionFile.LOGGER.error("Chunk {} stream is truncated: expected {} but read {}", pos, j1, bytebuffer.remaining()); + RegionFile.LOGGER.error("Chunk {} stream is truncated: expected {} but read {}", new Object[]{pos, j1, bytebuffer.remaining()}); + // Paper start - recalculate header on regionfile corruption + if (this.canRecalcHeader && this.recalculateHeader()) { + return this.getChunkDataInputStream(pos); @@ -667,7 +667,7 @@ index 293cce2c80fbdc18480977f5f6b24d6b4fa8dcf3..950efcc80455f73ec8ca4e991fcf9a5b } } } -@@ -373,10 +842,15 @@ public class RegionFile implements AutoCloseable { +@@ -372,10 +841,15 @@ public class RegionFile implements AutoCloseable { } private ByteBuffer createExternalStub() { diff --git a/patches/server/0753-Detail-more-information-in-watchdog-dumps.patch b/patches/server/0753-Detail-more-information-in-watchdog-dumps.patch index 053b764c0..beff46dc9 100644 --- a/patches/server/0753-Detail-more-information-in-watchdog-dumps.patch +++ b/patches/server/0753-Detail-more-information-in-watchdog-dumps.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Detail more information in watchdog dumps - Dump player name, player uuid, position, and world for packet handling diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 4ed1373fdd8f39b3d8d9b4d5cd88f70d3259e2e4..3cb89b76887e46f82a660c3832474bd7dbee5f57 100644 +index 2717252c8c87abeb90c9a0ee82e574276e9d01cf..47eadb4a08953a45300d769518af22b1463f4d11 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -452,7 +452,14 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -464,7 +464,14 @@ public class Connection extends SimpleChannelInboundHandler> { } if (this.packetListener instanceof ServerGamePacketListenerImpl) { @@ -26,12 +26,12 @@ index 4ed1373fdd8f39b3d8d9b4d5cd88f70d3259e2e4..3cb89b76887e46f82a660c3832474bd7 if (!this.isConnected() && !this.disconnectionHandled) { diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -index bcf53ec07b8eeec7a88fb67e6fb908362e6f51b0..acc12307f61e1e055896b68fe16654c9c4a606a0 100644 +index 97b05b7145c6a3a379de31b8988c909da9b21139..f7bb26e8b7a74a9ae5b469351b2fccc6fc80ab6a 100644 --- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java +++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -@@ -20,6 +20,24 @@ public class PacketUtils { +@@ -15,6 +15,24 @@ public class PacketUtils { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); + // Paper start - detailed watchdog information + public static final java.util.concurrent.ConcurrentLinkedDeque packetProcessing = new java.util.concurrent.ConcurrentLinkedDeque<>(); @@ -54,16 +54,16 @@ index bcf53ec07b8eeec7a88fb67e6fb908362e6f51b0..acc12307f61e1e055896b68fe16654c9 public PacketUtils() {} public static void ensureRunningOnSameThread(Packet packet, T listener, ServerLevel world) throws RunningOnDifferentThreadException { -@@ -30,6 +48,8 @@ public class PacketUtils { +@@ -24,6 +42,8 @@ public class PacketUtils { + public static void ensureRunningOnSameThread(Packet packet, T listener, BlockableEventLoop engine) throws RunningOnDifferentThreadException { if (!engine.isSameThread()) { - Timing timing = MinecraftTimings.getPacketTiming(packet); // Paper - timings - engine.execute(() -> { + engine.executeIfPossible(() -> { + packetProcessing.push(listener); // Paper - detailed watchdog information + try { // Paper - detailed watchdog information if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590 if (listener.getConnection().isConnected()) { - try (Timing ignored = timing.startTiming()) { // Paper - timings -@@ -53,6 +73,12 @@ public class PacketUtils { + co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings +@@ -45,6 +65,12 @@ public class PacketUtils { } else { PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet); } @@ -77,10 +77,10 @@ index bcf53ec07b8eeec7a88fb67e6fb908362e6f51b0..acc12307f61e1e055896b68fe16654c9 }); throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index d932a4d0688cccac8cf7418bf2eaaa40fa2b649d..8b37f9048495f0da85b811caf4d26930b334edb9 100644 +index 8a68dd633bf67b934f52b2ba286b9d2a05acd369..2a215b9b35978caa61e687c3915df7d5edfae97a 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -978,7 +978,26 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -981,7 +981,26 @@ public class ServerLevel extends Level implements WorldGenLevel { } @@ -107,7 +107,7 @@ index d932a4d0688cccac8cf7418bf2eaaa40fa2b649d..8b37f9048495f0da85b811caf4d26930 ++TimingHistory.entityTicks; // Paper - timings // Spigot start co.aikar.timings.Timing timer; // Paper -@@ -1018,7 +1037,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1021,7 +1040,13 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(entity, entity1); } // } finally { timer.stopTiming(); } // Paper - timings - move up @@ -123,10 +123,10 @@ index d932a4d0688cccac8cf7418bf2eaaa40fa2b649d..8b37f9048495f0da85b811caf4d26930 private void tickPassenger(Entity vehicle, Entity passenger) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9d16faa522cf627bc59df56b04d28b4d4896cb7c..e4d6133253fc982858a7b33c2d1104347b149a83 100644 +index af19659eb52abd900a67b1b354bac958f0d37a70..320128ff98867993aa7785cc77b769bdce451795 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -904,7 +904,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -908,7 +908,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i return this.onGround; } @@ -169,7 +169,7 @@ index 9d16faa522cf627bc59df56b04d28b4d4896cb7c..e4d6133253fc982858a7b33c2d110434 if (this.noPhysics) { this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); } else { -@@ -1066,6 +1101,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1079,6 +1114,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i this.level.getProfiler().pop(); } } @@ -183,7 +183,7 @@ index 9d16faa522cf627bc59df56b04d28b4d4896cb7c..e4d6133253fc982858a7b33c2d110434 } protected boolean isHorizontalCollisionMinor(Vec3 adjustedMovement) { -@@ -3869,7 +3911,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3886,7 +3928,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public void setDeltaMovement(Vec3 velocity) { @@ -193,7 +193,7 @@ index 9d16faa522cf627bc59df56b04d28b4d4896cb7c..e4d6133253fc982858a7b33c2d110434 } public void setDeltaMovement(double x, double y, double z) { -@@ -3945,7 +3989,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3962,7 +4006,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } // Paper end - fix MC-4 if (this.position.x != x || this.position.y != y || this.position.z != z) { diff --git a/patches/server/0755-Distance-manager-tick-timings.patch b/patches/server/0755-Distance-manager-tick-timings.patch index d4a9a9561..4902ee8af 100644 --- a/patches/server/0755-Distance-manager-tick-timings.patch +++ b/patches/server/0755-Distance-manager-tick-timings.patch @@ -19,10 +19,10 @@ index eada966d7f108a6081be7a848f5c1dfcb1eed676..a977f7483f37df473096b2234dc1308b public static final Timing midTickChunkTasks = Timings.ofSafe("Mid Tick Chunk Tasks"); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 264105bb8b806d64d1a108bb438a8623c502c990..5bd358983f4b501adb0433e10df320d06816e6e7 100644 +index be59f4ec068947fbb78ae8b140527bb417395860..469bc5f71a72217514c0496977de33e2fa4d391e 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -835,6 +835,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -831,6 +831,7 @@ public class ServerChunkCache extends ChunkSource { public boolean runDistanceManagerUpdates() { if (distanceManager.delayDistanceManagerTick) return false; // Paper - Chunk priority if (this.chunkMap.unloadingPlayerChunk) { net.minecraft.server.MinecraftServer.LOGGER.fatal("Cannot tick distance manager while unloading playerchunks", new Throwable()); throw new IllegalStateException("Cannot tick distance manager while unloading playerchunks"); } // Paper @@ -30,7 +30,7 @@ index 264105bb8b806d64d1a108bb438a8623c502c990..5bd358983f4b501adb0433e10df320d0 boolean flag = this.distanceManager.runAllUpdates(this.chunkMap); boolean flag1 = this.chunkMap.promoteChunkMap(); -@@ -844,6 +845,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -840,6 +841,7 @@ public class ServerChunkCache extends ChunkSource { this.clearCache(); return true; } diff --git a/patches/server/0757-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch b/patches/server/0757-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch index e98b61b2b..661b165d8 100644 --- a/patches/server/0757-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch +++ b/patches/server/0757-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch @@ -13,10 +13,10 @@ Paper recently reverted this optimisation, so it's been reintroduced here. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 1a76c8a52926bf15f55640d5c053a7235c58d3ed..f0eb297e0a894864de4e4198396edcbef9ae191e 100644 +index d17c2bcc1537f2a7eb575984b06c5da1bb511e6b..89c9deb19a6ad80e8e70246b7728c2c583c545b6 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -396,6 +396,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -353,6 +353,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @Override public final LevelChunk getChunk(int chunkX, int chunkZ) { // Paper - final to help inline diff --git a/patches/server/0758-Add-packet-limiter-config.patch b/patches/server/0758-Add-packet-limiter-config.patch index f300878eb..8703e85ab 100644 --- a/patches/server/0758-Add-packet-limiter-config.patch +++ b/patches/server/0758-Add-packet-limiter-config.patch @@ -131,10 +131,10 @@ index 06a479af429a92e441eb9e58f36760d0ff75fe7e..eeae1a043ef185f206e923a5799e173c + } } diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 3cb89b76887e46f82a660c3832474bd7dbee5f57..201ddfa8fe6231265dcc1a7c8141badbdadbea47 100644 +index 47eadb4a08953a45300d769518af22b1463f4d11..b27610cde8eaa7ff35c777039a0ca9d8eab748fe 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -126,6 +126,22 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -136,6 +136,22 @@ public class Connection extends SimpleChannelInboundHandler> { } } // Paper end - allow controlled flushing @@ -157,7 +157,7 @@ index 3cb89b76887e46f82a660c3832474bd7dbee5f57..201ddfa8fe6231265dcc1a7c8141badb public Connection(PacketFlow side) { this.receiving = side; -@@ -206,6 +222,45 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -216,6 +232,45 @@ public class Connection extends SimpleChannelInboundHandler> { protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet packet) { if (this.channel.isOpen()) { diff --git a/patches/server/0759-Lag-compensate-block-breaking.patch b/patches/server/0759-Lag-compensate-block-breaking.patch index 98c632dc1..835f0807c 100644 --- a/patches/server/0759-Lag-compensate-block-breaking.patch +++ b/patches/server/0759-Lag-compensate-block-breaking.patch @@ -21,10 +21,10 @@ index eeae1a043ef185f206e923a5799e173cf3cf485d..b591b47fc663289682c35f480f851b7e + } } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index dcfb5fd1763979f081cc253716f518bc371dd546..cc5dbc86c8265540948e6b1445d84ecf0b7762aa 100644 +index b6eef41079120fffd63f06f681378b1b628b95e0..891199d02539fa46454cd0aa7c133637e5dc8235 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -54,14 +54,28 @@ public class ServerPlayerGameMode { +@@ -56,14 +56,28 @@ public class ServerPlayerGameMode { @Nullable private GameType previousGameModeForPlayer; private boolean isDestroyingBlock; @@ -55,7 +55,7 @@ index dcfb5fd1763979f081cc253716f518bc371dd546..cc5dbc86c8265540948e6b1445d84ecf public ServerPlayerGameMode(ServerPlayer player) { this.gameModeForPlayer = GameType.DEFAULT_MODE; this.destroyPos = BlockPos.ZERO; -@@ -128,7 +142,7 @@ public class ServerPlayerGameMode { +@@ -130,7 +144,7 @@ public class ServerPlayerGameMode { if (iblockdata == null || iblockdata.isAir()) { // Paper this.hasDelayedDestroy = false; } else { @@ -64,7 +64,7 @@ index dcfb5fd1763979f081cc253716f518bc371dd546..cc5dbc86c8265540948e6b1445d84ecf if (f >= 1.0F) { this.hasDelayedDestroy = false; -@@ -148,7 +162,7 @@ public class ServerPlayerGameMode { +@@ -150,7 +164,7 @@ public class ServerPlayerGameMode { this.lastSentState = -1; this.isDestroyingBlock = false; } else { @@ -73,7 +73,7 @@ index dcfb5fd1763979f081cc253716f518bc371dd546..cc5dbc86c8265540948e6b1445d84ecf } } -@@ -156,6 +170,12 @@ public class ServerPlayerGameMode { +@@ -158,6 +172,12 @@ public class ServerPlayerGameMode { private float incrementDestroyProgress(BlockState state, BlockPos pos, int i) { int j = this.gameTicks - i; @@ -86,7 +86,7 @@ index dcfb5fd1763979f081cc253716f518bc371dd546..cc5dbc86c8265540948e6b1445d84ecf float f = state.getDestroyProgress(this.player, this.player.level, pos) * (float) (j + 1); int k = (int) (f * 10.0F); -@@ -224,7 +244,7 @@ public class ServerPlayerGameMode { +@@ -234,7 +254,7 @@ public class ServerPlayerGameMode { return; } @@ -94,8 +94,8 @@ index dcfb5fd1763979f081cc253716f518bc371dd546..cc5dbc86c8265540948e6b1445d84ecf + this.destroyProgressStart = this.gameTicks; this.lastDigTime = System.nanoTime(); // Paper - lag compensate block breaking float f = 1.0F; - iblockdata = this.level.getBlockState(pos); -@@ -277,12 +297,12 @@ public class ServerPlayerGameMode { + iblockdata1 = this.level.getBlockState(pos); +@@ -287,12 +307,12 @@ public class ServerPlayerGameMode { int j = (int) (f * 10.0F); this.level.destroyBlockProgress(this.player.getId(), pos, j); @@ -108,9 +108,9 @@ index dcfb5fd1763979f081cc253716f518bc371dd546..cc5dbc86c8265540948e6b1445d84ecf - int k = this.gameTicks - this.destroyProgressStart; + int k = this.getTimeDiggingLagCompensate(); // Paper - lag compensate block breaking - iblockdata = this.level.getBlockState(pos); - if (!iblockdata.isAir()) { -@@ -299,12 +319,18 @@ public class ServerPlayerGameMode { + iblockdata1 = this.level.getBlockState(pos); + if (!iblockdata1.isAir()) { +@@ -309,12 +329,18 @@ public class ServerPlayerGameMode { this.isDestroyingBlock = false; this.hasDelayedDestroy = true; this.delayedDestroyPos = pos; @@ -130,7 +130,7 @@ index dcfb5fd1763979f081cc253716f518bc371dd546..cc5dbc86c8265540948e6b1445d84ecf } else if (action == ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK) { this.isDestroyingBlock = false; if (!Objects.equals(this.destroyPos, pos) && !BlockPos.ZERO.equals(this.destroyPos)) { -@@ -316,7 +342,7 @@ public class ServerPlayerGameMode { +@@ -326,7 +352,7 @@ public class ServerPlayerGameMode { } this.level.destroyBlockProgress(this.player.getId(), pos, -1); @@ -139,7 +139,7 @@ index dcfb5fd1763979f081cc253716f518bc371dd546..cc5dbc86c8265540948e6b1445d84ecf CraftEventFactory.callBlockDamageAbortEvent(this.player, pos, this.player.getInventory().getSelected()); // CraftBukkit } -@@ -328,7 +354,13 @@ public class ServerPlayerGameMode { +@@ -338,7 +364,13 @@ public class ServerPlayerGameMode { public void destroyAndAck(BlockPos pos, ServerboundPlayerActionPacket.Action action, String reason) { if (this.destroyBlock(pos)) { diff --git a/patches/server/0760-Use-correct-LevelStem-registry-when-loading-default-.patch b/patches/server/0760-Use-correct-LevelStem-registry-when-loading-default-.patch index 7cd2d9c9f..aa16023c8 100644 --- a/patches/server/0760-Use-correct-LevelStem-registry-when-loading-default-.patch +++ b/patches/server/0760-Use-correct-LevelStem-registry-when-loading-default-.patch @@ -6,22 +6,22 @@ Subject: [PATCH] Use correct LevelStem registry when loading default diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c245c1f4611f7273c8da629f774e0c64e9f98fc2..481a5dbad82f3f8dd5b1bf8ab207d82ec73d5bbd 100644 +index eb9a3fecb7c1526d0c5f6194c78ff3a740c94c7e..cdbee0c0d0f6154dc6396be87eeea1db67ad5dbf 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -635,7 +635,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(iworlddataserver)); -- LevelStem worlddimension = (LevelStem) registrymaterials.get(dimensionKey); +- LevelStem worlddimension = (LevelStem) iregistry.get(dimensionKey); + // Paper start - Use correct LevelStem registry + final LevelStem worlddimension; + if (dimensionKey == LevelStem.END || dimensionKey == LevelStem.NETHER) { + worlddimension = generatorsettings.dimensions().get(dimensionKey); + } else { -+ worlddimension = registrymaterials.get(dimensionKey); ++ worlddimension = iregistry.get(dimensionKey); + } + // Paper end - DimensionType dimensionmanager; + Holder holder; ChunkGenerator chunkgenerator; diff --git a/patches/server/0762-Consolidate-flush-calls-for-entity-tracker-packets.patch b/patches/server/0762-Consolidate-flush-calls-for-entity-tracker-packets.patch index 5fb927506..cc16a5e2b 100644 --- a/patches/server/0762-Consolidate-flush-calls-for-entity-tracker-packets.patch +++ b/patches/server/0762-Consolidate-flush-calls-for-entity-tracker-packets.patch @@ -22,10 +22,10 @@ With this change I could get all 200 on at 0ms ping. So in general this patch should reduce Netty I/O thread load. diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 5bd358983f4b501adb0433e10df320d06816e6e7..98be0ea366732695f76bc5b1a78e0a36060515bd 100644 +index 469bc5f71a72217514c0496977de33e2fa4d391e..ef5321f230f66383e3760bf97e7eca1be3a5b02e 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -1078,7 +1078,24 @@ public class ServerChunkCache extends ChunkSource { +@@ -1077,7 +1077,24 @@ public class ServerChunkCache extends ChunkSource { this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing gameprofilerfiller.pop(); // Paper end - use set of chunks requiring updates, rather than iterating every single one loaded diff --git a/patches/server/0767-Oprimise-map-impl-for-tracked-players.patch b/patches/server/0767-Oprimise-map-impl-for-tracked-players.patch index 4e52c8b1c..84ace1e48 100644 --- a/patches/server/0767-Oprimise-map-impl-for-tracked-players.patch +++ b/patches/server/0767-Oprimise-map-impl-for-tracked-players.patch @@ -7,18 +7,18 @@ Reference2BooleanOpenHashMap is going to have better lookups than HashMap. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 58dc590cf659cba84d7cb4f7205fdb0bdefded79..72443ab38931a3774641bdc52999e7dcd2586de0 100644 +index 09e2d5bd3ab14a2c43547313394bf1167168d6cc..99a42f57d7cbab085dd9ac053b7b1cae7db3fd6c 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -108,6 +108,7 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -110,6 +110,7 @@ import org.apache.commons.lang3.mutable.MutableObject; + import org.slf4j.Logger; import org.bukkit.entity.Player; // CraftBukkit end +import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; // Paper public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider { -@@ -2116,7 +2117,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -2170,7 +2171,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final Entity entity; private final int range; SectionPos lastSectionPos; diff --git a/patches/server/0768-Optimise-BlockSoil-nearby-water-lookup.patch b/patches/server/0768-Optimise-BlockSoil-nearby-water-lookup.patch index ab3e7cfa1..f3fe0f0f1 100644 --- a/patches/server/0768-Optimise-BlockSoil-nearby-water-lookup.patch +++ b/patches/server/0768-Optimise-BlockSoil-nearby-water-lookup.patch @@ -7,10 +7,10 @@ Apparently the abstract block iteration was taking about 75% of the method call. diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java -index afd4dc6f69389f43c1a95069840e01a33ac86b63..d0720d5e6612d98d1e86e33e8e6564e371595630 100644 +index 26a88f9d55538761da4737c9518bc7042dc6f6ea..499eae5ab30921f49045dc73bd077941255f727a 100644 --- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java -@@ -139,19 +139,28 @@ public class FarmBlock extends Block { +@@ -138,19 +138,27 @@ public class FarmBlock extends Block { } private static boolean isNearWater(LevelReader world, BlockPos pos) { @@ -42,11 +42,10 @@ index afd4dc6f69389f43c1a95069840e01a33ac86b63..d0720d5e6612d98d1e86e33e8e6564e3 + } - blockposition1 = (BlockPos) iterator.next(); -- } while (!world.getFluidState(blockposition1).is((Tag) FluidTags.WATER)); +- } while (!world.getFluidState(blockposition1).is(FluidTags.WATER)); - - return true; + return false; -+ // Paper end - remove abstract block iteration } @Override diff --git a/patches/server/0770-Optimise-random-block-ticking.patch b/patches/server/0770-Optimise-random-block-ticking.patch index 2be2578a7..7e265be8e 100644 --- a/patches/server/0770-Optimise-random-block-ticking.patch +++ b/patches/server/0770-Optimise-random-block-ticking.patch @@ -71,10 +71,10 @@ index 0000000000000000000000000000000000000000..e8b4053babe46999980b926431254050 + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 8b37f9048495f0da85b811caf4d26930b334edb9..9e252fcb7f08d801cf5700234ae6414ce9dc6dca 100644 +index 2a215b9b35978caa61e687c3915df7d5edfae97a..f0ab54b45a5e1fb6ee49fea757cb908088873d80 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -642,6 +642,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -645,6 +645,10 @@ public class ServerLevel extends Level implements WorldGenLevel { entityplayer.stopSleepInBed(false, false); }); } @@ -85,7 +85,7 @@ index 8b37f9048495f0da85b811caf4d26930b334edb9..9e252fcb7f08d801cf5700234ae6414c public void tickChunk(LevelChunk chunk, int randomTickSpeed) { ChunkPos chunkcoordintpair = chunk.getPos(); -@@ -651,10 +655,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -654,10 +658,10 @@ public class ServerLevel extends Level implements WorldGenLevel { ProfilerFiller gameprofilerfiller = this.getProfiler(); gameprofilerfiller.push("thunder"); @@ -98,21 +98,19 @@ index 8b37f9048495f0da85b811caf4d26930b334edb9..9e252fcb7f08d801cf5700234ae6414c if (this.isRainingAt(blockposition)) { DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * paperConfig.skeleHorseSpawnChance && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper -@@ -677,65 +681,78 @@ public class ServerLevel extends Level implements WorldGenLevel { - } +@@ -681,64 +685,75 @@ public class ServerLevel extends Level implements WorldGenLevel { gameprofilerfiller.popPush("iceandsnow"); -- if (!this.paperConfig.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow + if (!this.paperConfig.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow - blockposition = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.getBlockRandomPos(j, 0, k, 15)); - BlockPos blockposition1 = blockposition.below(); -+ if (!this.paperConfig.disableIceAndSnow && this.randomTickRandom.nextInt(16) == 0) { // Paper - Disable ice and snow // Paper - optimise random ticking + // Paper start - optimise chunk ticking + this.getRandomBlockPosition(j, 0, k, 15, blockposition); + int normalY = chunk.getHeight(Heightmap.Types.MOTION_BLOCKING, blockposition.getX() & 15, blockposition.getZ() & 15) + 1; + int downY = normalY - 1; + blockposition.setY(normalY); + // Paper end - Biome biomebase = this.getBiome(blockposition); + Biome biomebase = (Biome) this.getBiome(blockposition).value(); - if (biomebase.shouldFreeze(this, blockposition1)) { - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE.defaultBlockState(), null); // CraftBukkit @@ -130,10 +128,8 @@ index 8b37f9048495f0da85b811caf4d26930b334edb9..9e252fcb7f08d801cf5700234ae6414c } - BlockState iblockdata = this.getBlockState(blockposition1); -+ blockposition.setY(downY); // Paper + BlockState iblockdata = this.getBlockState(blockposition); // Paper -+ blockposition.setY(normalY); // Paper - Biome.Precipitation biomebase_precipitation = this.getBiome(blockposition).getPrecipitation(); + Biome.Precipitation biomebase_precipitation = biomebase.getPrecipitation(); - if (biomebase_precipitation == Biome.Precipitation.RAIN && biomebase.coldEnoughToSnow(blockposition1)) { + blockposition.setY(downY); // Paper @@ -284,10 +280,10 @@ index 9686ce7536c9924b1b2aced4f013f46759cbc72e..5d8e9bdf5538b19681f21949368d862f public void getAll(IntConsumer action) { for(int i = 0; i < this.size; ++i) { diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java -index 60e1111f3c2c43398f21c541248f38524f41f4fb..56e9c0d15249562ebea8eb451d4bcc9ff5e7d594 100644 +index 1b0be28ebfd7ec2f978b5d87f6d26e4d5913fb06..ac17fd4454730db831cf9b781963062db8614bb7 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java +++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java -@@ -87,7 +87,7 @@ public class Turtle extends Animal { +@@ -85,7 +85,7 @@ public class Turtle extends Animal { } public void setHomePos(BlockPos pos) { @@ -297,11 +293,11 @@ index 60e1111f3c2c43398f21c541248f38524f41f4fb..56e9c0d15249562ebea8eb451d4bcc9f public BlockPos getHomePos() { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 6b23c2a62d13cfda7036c1ae8bcbda4b62032834..a3977a94a8fbc633c56e2b043f259464deac6413 100644 +index 843c36a8272ea5affe0a4f3baa9e15823ad74059..67cb2f94f1f2f2b8ae82d65e19b7f173157076b9 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -1359,10 +1359,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - public abstract TagContainer getTagManager(); +@@ -1318,10 +1318,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + public abstract RecipeManager getRecipeManager(); public BlockPos getBlockRandomPos(int x, int y, int z, int l) { + // Paper start - allow use of mutable pos @@ -321,18 +317,18 @@ index 6b23c2a62d13cfda7036c1ae8bcbda4b62032834..a3977a94a8fbc633c56e2b043f259464 public boolean noSave() { diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -index 836f036550cf76f40d6e0eb8b229238d311c1e35..d5ceebee36885c6470917bc1d0952733e983f030 100644 +index cdd17e501c678a4f4bebbaaccdaec1682351e2f2..6afad987f6dd1fd7243dfa6c50549c2a88768962 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -@@ -25,6 +25,7 @@ public class LevelChunkSection { +@@ -26,6 +26,7 @@ public class LevelChunkSection { private short tickingFluidCount; public final PalettedContainer states; - private final PalettedContainer biomes; + private final PalettedContainer> biomes; + public final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper - public LevelChunkSection(int chunkPos, PalettedContainer blockStateContainer, PalettedContainer biomeContainer) { + public LevelChunkSection(int chunkPos, PalettedContainer blockStateContainer, PalettedContainer> biomeContainer) { this.bottomBlockY = LevelChunkSection.getBottomBlockY(chunkPos); -@@ -82,6 +83,9 @@ public class LevelChunkSection { +@@ -83,6 +84,9 @@ public class LevelChunkSection { --this.nonEmptyBlockCount; if (iblockdata1.isRandomlyTicking()) { --this.tickingBlockCount; @@ -342,7 +338,7 @@ index 836f036550cf76f40d6e0eb8b229238d311c1e35..d5ceebee36885c6470917bc1d0952733 } } -@@ -93,6 +97,9 @@ public class LevelChunkSection { +@@ -94,6 +98,9 @@ public class LevelChunkSection { ++this.nonEmptyBlockCount; if (state.isRandomlyTicking()) { ++this.tickingBlockCount; @@ -352,43 +348,69 @@ index 836f036550cf76f40d6e0eb8b229238d311c1e35..d5ceebee36885c6470917bc1d0952733 } } -@@ -124,23 +131,29 @@ public class LevelChunkSection { +@@ -125,40 +132,31 @@ public class LevelChunkSection { } public void recalcBlockCounts() { -+ // Paper start +- class a implements PalettedContainer.CountConsumer { +- +- public int nonEmptyBlockCount; +- public int tickingBlockCount; +- public int tickingFluidCount; +- +- a() {} +- +- public void accept(BlockState iblockdata, int i) { +- FluidState fluid = iblockdata.getFluidState(); +- +- if (!iblockdata.isAir()) { +- this.nonEmptyBlockCount += i; +- if (iblockdata.isRandomlyTicking()) { +- this.tickingBlockCount += i; +- } ++ // Paper start - unfuck this + this.tickingList.clear(); -+ // Paper end - this.nonEmptyBlockCount = 0; - this.tickingBlockCount = 0; - this.tickingFluidCount = 0; -- this.states.count((iblockdata, i) -> { -+ this.states.forEachLocation((iblockdata, i) -> { // Paper - FluidState fluid = iblockdata.getFluidState(); - - if (!iblockdata.isAir()) { -- this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + i); -+ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); // Paper - if (iblockdata.isRandomlyTicking()) { -- this.tickingBlockCount = (short) (this.tickingBlockCount + i); -+ // Paper start ++ this.nonEmptyBlockCount = 0; ++ this.tickingBlockCount = 0; ++ this.tickingFluidCount = 0; ++ this.states.forEachLocation((BlockState iblockdata, int i) -> { ++ FluidState fluid = iblockdata.getFluidState(); ++ ++ if (!iblockdata.isAir()) { ++ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); ++ if (iblockdata.isRandomlyTicking()) { + this.tickingBlockCount = (short)(this.tickingBlockCount + 1); + this.tickingList.add(i, iblockdata); -+ // Paper end } - } ++ } - if (!fluid.isEmpty()) { -- this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + i); -+ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); // Paper - if (fluid.isRandomlyTicking()) { -- this.tickingFluidCount = (short) (this.tickingFluidCount + i); -+ this.tickingFluidCount = (short) (this.tickingFluidCount + 1); // Paper +- if (!fluid.isEmpty()) { +- this.nonEmptyBlockCount += i; +- if (fluid.isRandomlyTicking()) { +- this.tickingFluidCount += i; +- } ++ if (!fluid.isEmpty()) { ++ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); ++ if (fluid.isRandomlyTicking()) { ++ this.tickingFluidCount = (short) (this.tickingFluidCount + 1); } +- } +- } +- a a0 = new a(); +- +- this.states.count(a0); +- this.nonEmptyBlockCount = (short) a0.nonEmptyBlockCount; +- this.tickingBlockCount = (short) a0.tickingBlockCount; +- this.tickingFluidCount = (short) a0.tickingFluidCount; ++ }); ++ // Paper end + } + + public PalettedContainer getStates() { diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index 5bbbb10a567963a451db8cf29d8d16f1cd013a16..d850cae1ec024a557e62cd561fbca137dc2be96c 100644 +index c225ef6eb1b094f605548d3f72165a6ebc156157..9b84407b2d56186c1c9614371ea38297c9b893f4 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java @@ -355,6 +355,14 @@ public class PalettedContainer implements PaletteResize { diff --git a/patches/server/0771-Optimise-non-flush-packet-sending.patch b/patches/server/0771-Optimise-non-flush-packet-sending.patch index f23ce220d..f4d6e1b6b 100644 --- a/patches/server/0771-Optimise-non-flush-packet-sending.patch +++ b/patches/server/0771-Optimise-non-flush-packet-sending.patch @@ -20,19 +20,19 @@ up on this optimisation before he came along. Locally this patch drops the entity tracker tick by a full 1.5x. diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 201ddfa8fe6231265dcc1a7c8141badbdadbea47..c14294923a0c15aafe98bf5006866acaa9803280 100644 +index b27610cde8eaa7ff35c777039a0ca9d8eab748fe..d3a25cc5262843b5c9736ff32e300264d9847c9b 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -49,6 +49,8 @@ import org.apache.logging.log4j.Logger; - import org.apache.logging.log4j.Marker; - import org.apache.logging.log4j.MarkerManager; +@@ -51,6 +51,8 @@ import org.slf4j.Logger; + import org.slf4j.Marker; + import org.slf4j.MarkerFactory; + +import io.netty.util.concurrent.AbstractEventExecutor; // Paper public class Connection extends SimpleChannelInboundHandler> { private static final float AVERAGE_PACKETS_SMOOTHING = 0.75F; -@@ -387,9 +389,19 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -399,9 +401,19 @@ public class Connection extends SimpleChannelInboundHandler> { if (this.channel.eventLoop().inEventLoop()) { this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter } else { diff --git a/patches/server/0772-Optimise-nearby-player-lookups.patch b/patches/server/0772-Optimise-nearby-player-lookups.patch index 1dede6fa6..774bfe3e3 100644 --- a/patches/server/0772-Optimise-nearby-player-lookups.patch +++ b/patches/server/0772-Optimise-nearby-player-lookups.patch @@ -9,10 +9,10 @@ since the penalty of a map lookup could outweigh the benefits of searching less players (as it basically did in the outside range patch). diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 43f97571f0b837cbba5c3e889edbc5737a6e7b54..f5b6d0f69e727b8f5e425340f8c1381a82a24ce3 100644 +index bd43fbc8a93afa7604aa467392520ed7b30a1d83..1a7fc533afced7235162f81b2de8148cef05414a 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -88,6 +88,12 @@ public class ChunkHolder { +@@ -91,6 +91,12 @@ public class ChunkHolder { this.chunkMap.needsChangeBroadcasting.add(this); } // Paper end - optimise chunk tick iteration @@ -25,7 +25,7 @@ index 43f97571f0b837cbba5c3e889edbc5737a6e7b54..f5b6d0f69e727b8f5e425340f8c1381a } void onChunkRemove() { -@@ -98,6 +104,12 @@ public class ChunkHolder { +@@ -101,6 +107,12 @@ public class ChunkHolder { this.chunkMap.needsChangeBroadcasting.remove(this); } // Paper end - optimise chunk tick iteration @@ -39,10 +39,10 @@ index 43f97571f0b837cbba5c3e889edbc5737a6e7b54..f5b6d0f69e727b8f5e425340f8c1381a // Paper end - optimise anyPlayerCloseEnoughForSpawning long lastAutoSaveTime; // Paper - incremental autosave diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 72443ab38931a3774641bdc52999e7dcd2586de0..69533a1239f12c41a255bf9deeb5640695edfa13 100644 +index 99a42f57d7cbab085dd9ac053b7b1cae7db3fd6c..405a6bdffbdf7af3837d68fe98cae62cc576b85e 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -160,6 +160,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -164,6 +164,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobDistanceMap; // Paper public final ReferenceOpenHashSet needsChangeBroadcasting = new ReferenceOpenHashSet<>(); @@ -56,7 +56,7 @@ index 72443ab38931a3774641bdc52999e7dcd2586de0..69533a1239f12c41a255bf9deeb56406 // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable { -@@ -237,6 +244,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -241,6 +248,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // Paper end - use distance map to optimise entity tracker // Note: players need to be explicitly added to distance maps before they can be updated this.playerChunkTickRangeMap.add(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning @@ -64,7 +64,7 @@ index 72443ab38931a3774641bdc52999e7dcd2586de0..69533a1239f12c41a255bf9deeb56406 // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.add(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance()); -@@ -255,6 +263,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -259,6 +267,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.playerMobSpawnMap.remove(player); this.playerChunkTickRangeMap.remove(player); // Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning @@ -72,7 +72,7 @@ index 72443ab38931a3774641bdc52999e7dcd2586de0..69533a1239f12c41a255bf9deeb56406 // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.remove(player); -@@ -275,6 +284,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -279,6 +288,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } // Paper end - use distance map to optimise entity tracker this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning @@ -80,7 +80,7 @@ index 72443ab38931a3774641bdc52999e7dcd2586de0..69533a1239f12c41a255bf9deeb56406 // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.update(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance()); -@@ -435,6 +445,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -440,6 +450,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } }); // Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning @@ -105,10 +105,10 @@ index 72443ab38931a3774641bdc52999e7dcd2586de0..69533a1239f12c41a255bf9deeb56406 protected ChunkGenerator generator() { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 4b18dfbf559214dc511003bb3396acbcfb80fdda..9c73cb316522302bf88b671398ba53c0eb2d29d5 100644 +index f0ab54b45a5e1fb6ee49fea757cb908088873d80..a186109d12e6c68244683feb26d90f0734ee5b31 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -399,6 +399,83 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -400,6 +400,83 @@ public class ServerLevel extends Level implements WorldGenLevel { return this.getServer().getPlayerList().getPlayer(uuid); } // Paper end @@ -191,8 +191,8 @@ index 4b18dfbf559214dc511003bb3396acbcfb80fdda..9c73cb316522302bf88b671398ba53c0 + // Paper end - optimise get nearest players for entity AI // Add env and gen to constructor, WorldData -> WorldDataServer - public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { -@@ -487,6 +564,14 @@ public class ServerLevel extends Level implements WorldGenLevel { + public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey resourcekey, Holder holder, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { +@@ -490,6 +567,14 @@ public class ServerLevel extends Level implements WorldGenLevel { } public void tick(BooleanSupplier shouldKeepTicking) { @@ -208,7 +208,7 @@ index 4b18dfbf559214dc511003bb3396acbcfb80fdda..9c73cb316522302bf88b671398ba53c0 this.handlingTick = true; diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 736b51e411b009db0482d9a72f179cc7b6241265..031660f7d0ea270f87e5174a4fe65ccad1f7a561 100644 +index 829f5a82467e7106efddf9e367cd402bc0b36c5f..b1ae9b0d8b229e2a6797a173cb11ecc0f43e2592 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -792,7 +792,12 @@ public abstract class Mob extends LivingEntity { @@ -226,11 +226,11 @@ index 736b51e411b009db0482d9a72f179cc7b6241265..031660f7d0ea270f87e5174a4fe65cca if (entityhuman != null) { double d0 = entityhuman.distanceToSqr((Entity) this); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 742d4645a6d22d10bc2833e3b742a6bc653d473d..7dda99a5464816f1488fb110da587f12d751b3fb 100644 +index 67cb2f94f1f2f2b8ae82d65e19b7f173157076b9..03824f73ecbac8ef6da586feb82f851557f82b6a 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -241,6 +241,69 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - return ret; +@@ -195,6 +195,69 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + return this.getChunkIfLoaded(chunkX, chunkZ) != null; } // Paper end + // Paper start - optimise checkDespawn @@ -297,10 +297,10 @@ index 742d4645a6d22d10bc2833e3b742a6bc653d473d..7dda99a5464816f1488fb110da587f12 + } + // Paper end - optimise checkDespawn - protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, final DimensionType dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor - this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot + public abstract ResourceKey getTypeKey(); + diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 6dba117b4f5dc6c4e078a32037a4026b45bf2176..515e58e3db223fbdc01ca87607aca234c7010d51 100644 +index f6a225eed29eed364b7e2ea6bc85d55d8a325a11..13eded53a64d0f36f8c9bce2077de4f1c1ed2d56 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -259,7 +259,7 @@ public final class NaturalSpawner { @@ -316,13 +316,13 @@ index 6dba117b4f5dc6c4e078a32037a4026b45bf2176..515e58e3db223fbdc01ca87607aca234 } private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel world, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double squaredDistance) { -- return squaredDistance <= 576.0D ? false : (world.getSharedSpawnPos().closerThan((Position) (new Vec3((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D)), 24.0D) ? false : Objects.equals(new ChunkPos(pos), chunk.getPos()) || world.isPositionEntityTicking((BlockPos) pos)); -+ return squaredDistance <= 576.0D ? false : (world.getSharedSpawnPos().closerThan((Position) (new Vec3((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D)), 24.0D) ? false : Objects.equals(new ChunkPos(pos), chunk.getPos()) || world.isPositionEntityTicking((BlockPos) pos)); // Paper - diff on change, copy into caller +- return squaredDistance <= 576.0D ? false : (world.getSharedSpawnPos().closerToCenterThan(new Vec3((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D), 24.0D) ? false : Objects.equals(new ChunkPos(pos), chunk.getPos()) || world.isNaturalSpawningAllowed((BlockPos) pos)); ++ return squaredDistance <= 576.0D ? false : (world.getSharedSpawnPos().closerToCenterThan(new Vec3((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D), 24.0D) ? false : Objects.equals(new ChunkPos(pos), chunk.getPos()) || world.isNaturalSpawningAllowed((BlockPos) pos)); // Paper - diff on change, copy into caller } private static Boolean isValidSpawnPostitionForType(ServerLevel world, MobCategory group, StructureFeatureManager structureAccessor, ChunkGenerator chunkGenerator, MobSpawnSettings.SpawnerData spawnEntry, BlockPos.MutableBlockPos pos, double squaredDistance) { // Paper 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 8e03e63a00dd242791ba0d5a8a17922227b16165..0746300e8c0a29bedb9ec02803c194c2d03b78fb 100644 +index 937ff5dfb9d2950b80eff57dde27222551c352fe..b6f8600838f243f72c1f0a9a2425837338df8bf6 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -235,6 +235,98 @@ public class LevelChunk extends ChunkAccess { diff --git a/patches/server/0773-Optimise-WorldServer-notify.patch b/patches/server/0773-Optimise-WorldServer-notify.patch index 23df2c64b..ab15ed05d 100644 --- a/patches/server/0773-Optimise-WorldServer-notify.patch +++ b/patches/server/0773-Optimise-WorldServer-notify.patch @@ -8,10 +8,10 @@ Instead, only iterate over navigators in the current region that are eligible for repathing. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 69533a1239f12c41a255bf9deeb5640695edfa13..3c90c6514dc856490da7fca5c8a42023493836d7 100644 +index 405a6bdffbdf7af3837d68fe98cae62cc576b85e..2556647c724fdca7c81c5edb4ae19bdec92181de 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -297,15 +297,81 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -301,15 +301,81 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final io.papermc.paper.chunk.SingleThreadChunkRegionManager dataRegionManager; public static final class DataRegionData implements io.papermc.paper.chunk.SingleThreadChunkRegionManager.RegionData { @@ -93,7 +93,7 @@ index 69533a1239f12c41a255bf9deeb5640695edfa13..3c90c6514dc856490da7fca5c8a42023 } @Override -@@ -315,6 +381,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -319,6 +385,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final DataRegionSectionData sectionData = (DataRegionSectionData)section.sectionData; final DataRegionData oldRegionData = oldRegion == null ? null : (DataRegionData)oldRegion.regionData; final DataRegionData newRegionData = (DataRegionData)newRegion.regionData; @@ -110,10 +110,10 @@ index 69533a1239f12c41a255bf9deeb5640695edfa13..3c90c6514dc856490da7fca5c8a42023 } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index a55d652f9523df8274cec2aef8c903b100dce70e..546220bdc732f88b0dfe6c5caee399bfd795d71e 100644 +index a186109d12e6c68244683feb26d90f0734ee5b31..459cf01bcd1cbf7c315e2d9cb03e7dc4102588b9 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1095,6 +1095,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1096,6 +1096,7 @@ public class ServerLevel extends Level implements WorldGenLevel { public void tickNonPassenger(Entity entity) { // Paper start - log detailed entity tick information io.papermc.paper.util.TickThread.ensureTickThread("Cannot tick an entity off-main"); @@ -121,7 +121,7 @@ index a55d652f9523df8274cec2aef8c903b100dce70e..546220bdc732f88b0dfe6c5caee399bf try { if (currentlyTickingEntity.get() == null) { currentlyTickingEntity.lazySet(entity); -@@ -1547,9 +1548,18 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1548,9 +1549,18 @@ public class ServerLevel extends Level implements WorldGenLevel { if (Shapes.joinIsNotEmpty(voxelshape, voxelshape1, BooleanOp.NOT_SAME)) { List list = new ObjectArrayList(); @@ -142,7 +142,7 @@ index a55d652f9523df8274cec2aef8c903b100dce70e..546220bdc732f88b0dfe6c5caee399bf // CraftBukkit start - fix SPIGOT-6362 Mob entityinsentient; try { -@@ -1571,16 +1581,23 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1572,16 +1582,23 @@ public class ServerLevel extends Level implements WorldGenLevel { try { this.isUpdatingNavigations = true; @@ -169,7 +169,7 @@ index a55d652f9523df8274cec2aef8c903b100dce70e..546220bdc732f88b0dfe6c5caee399bf } } // Paper -@@ -2376,10 +2393,12 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2381,10 +2398,12 @@ public class ServerLevel extends Level implements WorldGenLevel { public void onTickingStart(Entity entity) { ServerLevel.this.entityTickList.add(entity); @@ -183,7 +183,7 @@ index a55d652f9523df8274cec2aef8c903b100dce70e..546220bdc732f88b0dfe6c5caee399bf public void onTrackingStart(Entity entity) { diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index b06789336098233b642b769b0fd60e740459874c..792366024a0d2a39e1d63509bbf0da51c973bdcf 100644 +index b47cd6d8ed02875bd9af54d27b7c1cda340e7f9f..d35032a8d2612d555c3dad1fe496d7ae1c5a285b 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java @@ -27,7 +27,7 @@ import net.minecraft.world.phys.Vec3; @@ -226,9 +226,9 @@ index b06789336098233b642b769b0fd60e740459874c..792366024a0d2a39e1d63509bbf0da51 + } else if (this.path != null && !this.path.isDone() && this.path.getNodeCount() != 0) { // Paper - diff on change - needed for isViableForPathRecalculationChecking() Node node = this.path.getEndNode(); Vec3 vec3 = new Vec3(((double)node.x + this.mob.getX()) / 2.0D, ((double)node.y + this.mob.getY()) / 2.0D, ((double)node.z + this.mob.getZ()) / 2.0D); - return pos.closerThan(vec3, (double)(this.path.getNodeCount() - this.path.getNextNodeIndex())); + return pos.closerToCenterThan(vec3, (double)(this.path.getNodeCount() - this.path.getNextNodeIndex())); diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -index a0c66689c954823e7c20664594557dc26afbd246..21f3c8a2fe91ff47486b4c63f2b3f1d54f83fdb6 100644 +index 5029ab81e3d7943a001b6367083eb511ce7d3572..db2ef605bccbb9024f787cd58f3cb93df03d5532 100644 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java @@ -71,6 +71,65 @@ public class PersistentEntitySectionManager implements A @@ -324,7 +324,7 @@ index a0c66689c954823e7c20664594557dc26afbd246..21f3c8a2fe91ff47486b4c63f2b3f1d5 + // Paper end if (!this.currentSection.remove(this.entity)) { - PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (moving to {})", this.entity, SectionPos.of(this.currentSectionKey), i); + PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (moving to {})", new Object[]{this.entity, SectionPos.of(this.currentSectionKey), i}); @@ -472,6 +545,11 @@ public class PersistentEntitySectionManager implements A entitysection.add(this.entity); this.currentSection = entitysection; diff --git a/patches/server/0775-Rewrite-dataconverter-system.patch b/patches/server/0775-Rewrite-dataconverter-system.patch index 99efaf889..cec2793d6 100644 --- a/patches/server/0775-Rewrite-dataconverter-system.patch +++ b/patches/server/0775-Rewrite-dataconverter-system.patch @@ -21640,7 +21640,7 @@ index a5a45118644fc1bc8caeefa59b5f897ed590e7ae..8dfac195e7f03f8fe18ba6ee79e195ef nbttagcompound.putInt("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion()); } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java -index 5c7c0dd87c42cdc83dd3e780778a4b65a5407f5b..acb484e074391d2f1b6b83978ea9483cfb5c214c 100644 +index 7d00e21ea5f93936b5fea9a9100e1dd6db9526cf..cbdd32ef0be241b16406ed8e3889d914e3e5e5d2 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java @@ -128,7 +128,7 @@ public class EntityStorage implements EntityPersistentStorage { @@ -21653,10 +21653,10 @@ index 5c7c0dd87c42cdc83dd3e780778a4b65a5407f5b..acb484e074391d2f1b6b83978ea9483c public static int getVersion(CompoundTag chunkNbt) { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -index d73b99d7fde724da4503b5176c3ad7b013197c6a..ec7aa86514f89042c885c0515f0744318c9bdf99 100644 +index c4bb280aef31c14e71337db0d6dbc5f06d9b9730..3cfc57b49fb3d85c4b9039907fc22bad3a0efe3e 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -@@ -135,7 +135,14 @@ public class SectionStorage extends RegionFileStorage implements AutoCloseabl +@@ -139,7 +139,14 @@ public class SectionStorage extends RegionFileStorage implements AutoCloseabl int j = getVersion(dynamic); int k = SharedConstants.getCurrentVersion().getWorldVersion(); boolean bl = j != k; @@ -21673,10 +21673,10 @@ index d73b99d7fde724da4503b5176c3ad7b013197c6a..ec7aa86514f89042c885c0515f074431 for(int l = this.levelHeightAccessor.getMinSection(); l < this.levelHeightAccessor.getMaxSection(); ++l) { diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java -index fa75190ef5fe322a4c78e62b2159bdf18fd014bb..22d3fd0b1951e72ac0315bfc6ab39531f0b2d075 100644 +index 5862fd38fb2a5aeec0a63d001cc043aac62188bb..ad7177615c7feedc416b543f635c4cd2f88814d0 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java -@@ -128,7 +128,7 @@ public class StructureCheck { +@@ -116,7 +116,7 @@ public class StructureCheck { CompoundTag compoundTag2; try { @@ -21686,7 +21686,7 @@ index fa75190ef5fe322a4c78e62b2159bdf18fd014bb..22d3fd0b1951e72ac0315bfc6ab39531 LOGGER.warn("Failed to partially datafix chunk {}", pos, var12); return StructureCheckResult.CHUNK_LOAD_NEEDED; diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java -index 6727468946ea5f60bd80549f827a7c2b9a42b98b..35c39aed9583275ef25d32c783715798b52bdb63 100644 +index d785efd61caa2237e05d9ce3dbf84d86076ff047..601f8099f74e81c17600566b3c9b7a6dd39c9bcb 100644 --- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java @@ -93,7 +93,7 @@ public class PlayerDataStorage { diff --git a/patches/server/0776-Use-Velocity-compression-and-cipher-natives.patch b/patches/server/0776-Use-Velocity-compression-and-cipher-natives.patch index c7f736331..f8e84e030 100644 --- a/patches/server/0776-Use-Velocity-compression-and-cipher-natives.patch +++ b/patches/server/0776-Use-Velocity-compression-and-cipher-natives.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Use Velocity compression and cipher natives diff --git a/build.gradle.kts b/build.gradle.kts -index 0ed1fa068da85543b161fe86869ad8c90e701b73..17cde4eaf23e01710c131fbea5d171fd25725250 100644 +index cc75f70b5ab381c0c7012c2d6e5c40d7e4a06c7b..eb6c5e292f748aad797a8b9d6a51b5b50e6e1f53 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -44,6 +44,11 @@ dependencies { @@ -268,10 +268,10 @@ index 792883afe53d2b7989c25a81c2f9a639d5e21d20..c04379ca8a4db0f4de46ad2b3b338431 return this.threshold; } diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index c14294923a0c15aafe98bf5006866acaa9803280..81dde0efc1a06420c0791520b9e40b24dd1f0318 100644 +index d3a25cc5262843b5c9736ff32e300264d9847c9b..42400b6f0b693dd0ec4a2303a82bd131753a24ba 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -628,11 +628,28 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -640,11 +640,28 @@ public class Connection extends SimpleChannelInboundHandler> { return networkmanager; } @@ -304,7 +304,7 @@ index c14294923a0c15aafe98bf5006866acaa9803280..81dde0efc1a06420c0791520b9e40b24 public boolean isEncrypted() { return this.encrypted; -@@ -661,16 +678,17 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -673,16 +690,17 @@ public class Connection extends SimpleChannelInboundHandler> { public void setupCompression(int compressionThreshold, boolean rejectsBadPackets) { if (compressionThreshold >= 0) { @@ -325,7 +325,7 @@ index c14294923a0c15aafe98bf5006866acaa9803280..81dde0efc1a06420c0791520b9e40b24 } else { if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) { diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index 70b0c7fea72397f7bbdf02ce2794e7fb6fbd3742..bce781b645cc95f399eacf65edad5ad321fd68a4 100644 +index bfa519b9335c960a5baec50b0da95d95cd5ee958..af4d9244102bd0ac204f44a8de7f3a7706e3692d 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -104,6 +104,11 @@ public class ServerConnectionListener { @@ -341,10 +341,10 @@ index 70b0c7fea72397f7bbdf02ce2794e7fb6fbd3742..bce781b645cc95f399eacf65edad5ad3 protected void initChannel(Channel channel) { try { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 45db764f4499ee71bef691d37b604f21da120fe7..d2dd8b802ecea7fd2efe5f07fcef65c26e1adfbc 100644 +index 4e23e9ac3579dd0cedf0dfdbb231f6fae111745c..4cd92875d60c2f1dcce67ac99e9ba257a10f87b1 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -276,12 +276,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -279,12 +279,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } SecretKey secretkey = packet.getSecretKey(privatekey); diff --git a/patches/server/0777-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch b/patches/server/0777-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch index 07f72d1a9..b94bc8f20 100644 --- a/patches/server/0777-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch +++ b/patches/server/0777-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reduce worldgen thread worker count for low core count CPUs diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 354e8096d404bfca8055aafcd80b2de29a7bc929..652c84fe3a4c3004fd9ef8123380836344608359 100644 +index 0a92ef3a1470b1944d0d912f9c2d9641d5464c98..ad49b5a0b3d7fb104eda273368e5ad1e2b1453dc 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -133,7 +133,19 @@ public class Util { +@@ -131,7 +131,19 @@ public class Util { private static ExecutorService makeExecutor(String s, int priorityModifier) { // Paper - add priority // Paper start - use simpler thread pool that allows 1 thread diff --git a/patches/server/0778-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch b/patches/server/0778-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch index e323782a3..47b15feb1 100644 --- a/patches/server/0778-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch +++ b/patches/server/0778-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch @@ -16,10 +16,10 @@ of a chance that we're about to eat a dirtload of chunk load callbacks, thus making this issue much more of an issue diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 7a042de919fc8335455bc45f7749648ca2f00735..ee6887111b591f174b9f871ce8680a30dc9e2725 100644 +index 58a99a6867642c74cba7db1edff87a071065f28d..5931e6a7bf57274c187db62de0482193557d572f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -@@ -128,46 +128,6 @@ public class CraftChunk implements Chunk { +@@ -129,46 +129,6 @@ public class CraftChunk implements Chunk { this.getWorld().getChunkAt(x, z); // Transient load for this tick } diff --git a/patches/server/0779-Async-catch-modifications-to-critical-entity-state.patch b/patches/server/0779-Async-catch-modifications-to-critical-entity-state.patch index 7b91e7da2..305329fc5 100644 --- a/patches/server/0779-Async-catch-modifications-to-critical-entity-state.patch +++ b/patches/server/0779-Async-catch-modifications-to-critical-entity-state.patch @@ -8,7 +8,7 @@ Now in 1.17, this state is _even more_ critical than it was before, so these must exist to catch stupid plugins. diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -index 21f3c8a2fe91ff47486b4c63f2b3f1d54f83fdb6..bd7967680d7a75caff98a827895c795f2d101f99 100644 +index db2ef605bccbb9024f787cd58f3cb93df03d5532..3d5f38a1ca0206e5bcae4ed49d3df7ce0967f722 100644 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java @@ -138,6 +138,7 @@ public class PersistentEntitySectionManager implements A @@ -129,5 +129,5 @@ index 21f3c8a2fe91ff47486b4c63f2b3f1d54f83fdb6..bd7967680d7a75caff98a827895c795f public void onRemove(Entity.RemovalReason reason) { + org.spigotmc.AsyncCatcher.catchOp("Entity remove"); // Paper if (!this.currentSection.remove(this.entity)) { - PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (destroying due to {})", this.entity, SectionPos.of(this.currentSectionKey), reason); + PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (destroying due to {})", new Object[]{this.entity, SectionPos.of(this.currentSectionKey), reason}); } diff --git a/patches/server/0781-Fix-merchant-inventory-not-closing-on-entity-removal.patch b/patches/server/0781-Fix-merchant-inventory-not-closing-on-entity-removal.patch index 32637d45c..635127217 100644 --- a/patches/server/0781-Fix-merchant-inventory-not-closing-on-entity-removal.patch +++ b/patches/server/0781-Fix-merchant-inventory-not-closing-on-entity-removal.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 546220bdc732f88b0dfe6c5caee399bfd795d71e..24b0912f3a99c19103f2a07e6f6ba66e23afe3bc 100644 +index 459cf01bcd1cbf7c315e2d9cb03e7dc4102588b9..4df54aa0828e79960469576cf1adaf002f32d8d3 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2477,6 +2477,11 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2482,6 +2482,11 @@ public class ServerLevel extends Level implements WorldGenLevel { // Spigot end // Spigot Start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message diff --git a/patches/server/0783-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch b/patches/server/0783-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch index 126cc6857..7150f1af4 100644 --- a/patches/server/0783-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch +++ b/patches/server/0783-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Don't respond to ServerboundCommandSuggestionPacket when diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index be57a11febb169051af99711b7b1704dddc77898..ea3db5e9168e6195b0680b9600d0bb12f04f0532 100644 +index 33e824ca56f3aa9f080d6c5ebec9613107e7aa37..fd858a8c1fd280ec7769e224c7191ca85731f8a7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -761,6 +761,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -767,6 +767,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } // Paper end // CraftBukkit end diff --git a/patches/server/0785-Ensure-valid-vehicle-status.patch b/patches/server/0785-Ensure-valid-vehicle-status.patch index 80521d64a..5715c2ca8 100644 --- a/patches/server/0785-Ensure-valid-vehicle-status.patch +++ b/patches/server/0785-Ensure-valid-vehicle-status.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ensure valid vehicle status diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index a3274d3506b90422e4acdf6446e351b2da65b29c..d626af3879e558cdfbe95b1e70e0b32e0f4d1170 100644 +index 1a2dd16ec1f189c3b53a57c0224a15f451b92501..f6410ba180a85b114a296c64ce293f0891f6b96c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -505,7 +505,7 @@ public class ServerPlayer extends Player { +@@ -503,7 +503,7 @@ public class ServerPlayer extends Player { } } diff --git a/patches/server/0786-Prevent-softlocked-end-exit-portal-generation.patch b/patches/server/0786-Prevent-softlocked-end-exit-portal-generation.patch index d7ec8ee0e..855c2ec83 100644 --- a/patches/server/0786-Prevent-softlocked-end-exit-portal-generation.patch +++ b/patches/server/0786-Prevent-softlocked-end-exit-portal-generation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent softlocked end exit portal generation diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 467e2af08698ca40fbbe1fa7b0bafb9561f4fa65..be5952133720bf0ac3483cc2fed334967e6fc0c4 100644 +index 7dbe0bc8082c8e7741f40bbd69bc7d7407945754..ed6ff35a2112cea4faa6e1458d1effc40fce5dd2 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -412,6 +412,12 @@ public class EndDragonFight { +@@ -412,6 +412,11 @@ public class EndDragonFight { } } @@ -17,7 +17,6 @@ index 467e2af08698ca40fbbe1fa7b0bafb9561f4fa65..be5952133720bf0ac3483cc2fed33496 + this.portalLocation = this.portalLocation.atY(this.level.getMinBuildHeight() + 1); + } + // Paper end -+ - endPodiumFeature.configured(FeatureConfiguration.NONE).place(this.level, this.level.getChunkSource().getGenerator(), new Random(), this.portalLocation); + endPodiumFeature.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), new Random(), this.portalLocation); } diff --git a/patches/server/0789-Mark-fish-and-axolotls-from-buckets-as-persistent.patch b/patches/server/0789-Mark-fish-and-axolotls-from-buckets-as-persistent.patch index aab8914cf..a29e83996 100644 --- a/patches/server/0789-Mark-fish-and-axolotls-from-buckets-as-persistent.patch +++ b/patches/server/0789-Mark-fish-and-axolotls-from-buckets-as-persistent.patch @@ -18,10 +18,10 @@ index 58428eebf24e328b3faf32ca473be8f19d4f6cca..3484defdfd5a487b11917310d7b1d154 @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index c2d5798cac21afab5133ce086f60bf54fa1b97b6..a3ad957a9131168656b8e30c82d762c77e96ae6e 100644 +index b1f46170fb039a6218292eb5dabe1dc5cc6ccb18..d54fc22639bb67a977c27585aac46e9d3dcafa6d 100644 --- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -@@ -243,7 +243,7 @@ public class Axolotl extends Animal implements LerpingModel, Bucketable { +@@ -245,7 +245,7 @@ public class Axolotl extends Animal implements LerpingModel, Bucketable { @Override public void setFromBucket(boolean fromBucket) { this.entityData.set(Axolotl.FROM_BUCKET, fromBucket); diff --git a/patches/server/0791-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch b/patches/server/0791-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch index 55761fb50..d7efb28ea 100644 --- a/patches/server/0791-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch +++ b/patches/server/0791-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch @@ -12,10 +12,10 @@ time to save, as flush saving performs a full flush at the end anyways. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 3c90c6514dc856490da7fca5c8a42023493836d7..8678640da7724283664e3f115230d6b2687967b1 100644 +index 2556647c724fdca7c81c5edb4ae19bdec92181de..5a4431adefa6d0baef1d46b97a2ee7d5d6a56ec9 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -892,6 +892,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -928,6 +928,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // Paper end protected void saveAllChunks(boolean flush) { @@ -32,7 +32,7 @@ index 3c90c6514dc856490da7fca5c8a42023493836d7..8678640da7724283664e3f115230d6b2 if (flush) { List list = (List) this.updatingChunks.getVisibleValuesCopy().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); // Paper MutableBoolean mutableboolean = new MutableBoolean(); -@@ -914,6 +924,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -950,6 +960,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }).filter((ichunkaccess) -> { return ichunkaccess instanceof ImposterProtoChunk || ichunkaccess instanceof LevelChunk; }).filter(this::save).forEach((ichunkaccess) -> { diff --git a/patches/server/0793-Update-head-rotation-in-missing-places.patch b/patches/server/0793-Update-head-rotation-in-missing-places.patch index c968ba444..1b0973774 100644 --- a/patches/server/0793-Update-head-rotation-in-missing-places.patch +++ b/patches/server/0793-Update-head-rotation-in-missing-places.patch @@ -8,10 +8,10 @@ This is because bukkit uses a separate head rotation field for yaw. This issue only applies to players. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a0ba2eb443c8ba63a813b97b69a80d77e7320867..2155c63e81ab241043deba30fef6f4c8482b9047 100644 +index 320128ff98867993aa7785cc77b769bdce451795..44d5a86dbe71d3e460947217916daa648f45217f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1660,6 +1660,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1665,6 +1665,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i this.setXRot(Mth.clamp(pitch, -90.0F, 90.0F) % 360.0F); this.yRotO = this.getYRot(); this.xRotO = this.getXRot(); @@ -19,7 +19,7 @@ index a0ba2eb443c8ba63a813b97b69a80d77e7320867..2155c63e81ab241043deba30fef6f4c8 } public void absMoveTo(double x, double y, double z) { -@@ -1698,6 +1699,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1703,6 +1704,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i this.setXRot(pitch); this.setOldPosAndRot(); this.reapplyPosition(); diff --git a/patches/server/0798-Add-config-option-for-logging-player-ip-addresses.patch b/patches/server/0798-Add-config-option-for-logging-player-ip-addresses.patch index 566a3bf54..401620d8e 100644 --- a/patches/server/0798-Add-config-option-for-logging-player-ip-addresses.patch +++ b/patches/server/0798-Add-config-option-for-logging-player-ip-addresses.patch @@ -21,28 +21,28 @@ index 31e057e16c04f6cb6a4fa42e6ac9e81198e24d79..609f7ff543353ede53dc46dafc5a2fd0 private static void maxJoinsPerTick() { maxJoinsPerTick = getInt("settings.max-joins-per-tick", 3); diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -index acc12307f61e1e055896b68fe16654c9c4a606a0..c958a00535c0f7a015a7a566b97e2c80fc9a0efd 100644 +index f7bb26e8b7a74a9ae5b469351b2fccc6fc80ab6a..230f5adc4df1679597f5b9aa9fcd36501efbebdd 100644 --- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java +++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -@@ -58,10 +58,11 @@ public class PacketUtils { - // Paper start - catch (Exception e) { - Connection networkmanager = listener.getConnection(); +@@ -51,10 +51,11 @@ public class PacketUtils { + packet.handle(listener); + } catch (Exception exception) { + net.minecraft.network.Connection networkmanager = listener.getConnection(); + String playerIP = com.destroystokyo.paper.PaperConfig.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : ""; // Paper if (networkmanager.getPlayer() != null) { -- LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getScoreboardName(), networkmanager.getRemoteAddress(), e); -+ LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getScoreboardName(), playerIP, e); // Paper +- LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getScoreboardName(), networkmanager.getRemoteAddress(), exception); ++ LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getScoreboardName(), playerIP, exception); // Paper } else { -- LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getRemoteAddress(), e); -+ LOGGER.error("Error whilst processing packet {} for connection from {}", packet, playerIP, e); // Paper +- LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getRemoteAddress(), exception); ++ LOGGER.error("Error whilst processing packet {} for connection from {}", packet, playerIP, exception); // Paper } - TextComponent error = new TextComponent("Packet processing error"); - networkmanager.send(new ClientboundDisconnectPacket(error), (future) -> { + net.minecraft.network.chat.TextComponent error = new net.minecraft.network.chat.TextComponent("Packet processing error"); + networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), (future) -> { diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java -index 3962e82d4e4c5f792a37e825891e6960e737452d..dddc97094f0a7847b2818e6ea3b3f6cd4eb72b38 100644 +index 53e87ea23dacd123cc47bd8ca43d0f19e69acaf2..a03cb44f2296b7df60fa39879e54a5c56b22a3d5 100644 --- a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java +++ b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java -@@ -185,7 +185,7 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter { +@@ -183,7 +183,7 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter { buf.release(); this.buf = null; @@ -50,9 +50,9 @@ index 3962e82d4e4c5f792a37e825891e6960e737452d..dddc97094f0a7847b2818e6ea3b3f6cd + LOGGER.debug("Ping: (1.6) from {}", com.destroystokyo.paper.PaperConfig.logPlayerIpAddresses ? ctx.channel().remoteAddress() : ""); // Paper InetSocketAddress virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(host, port); - com.destroystokyo.paper.event.server.PaperServerListPingEvent event = PaperLegacyStatusClient.processRequest( + com.destroystokyo.paper.event.server.PaperServerListPingEvent event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest( diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index bce781b645cc95f399eacf65edad5ad321fd68a4..54477f1d0d0e2f09fc2d2b1f4c57413e5a0736f9 100644 +index af4d9244102bd0ac204f44a8de7f3a7706e3692d..058fb3696c7ece4a7b6971886b1760b26add733b 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -204,7 +204,7 @@ public class ServerConnectionListener { @@ -65,10 +65,10 @@ index bce781b645cc95f399eacf65edad5ad321fd68a4..54477f1d0d0e2f09fc2d2b1f4c57413e networkmanager.send(new ClientboundDisconnectPacket(chatcomponenttext), (future) -> { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index d2dd8b802ecea7fd2efe5f07fcef65c26e1adfbc..33a29890435d6065a2cc4f8e8bf8209c01d5d114 100644 +index 4cd92875d60c2f1dcce67ac99e9ba257a10f87b1..f5c1dff1d571e89f960f11400edbcbbea0620575 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -224,7 +224,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -220,7 +220,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } public String getUserName() { @@ -81,7 +81,7 @@ index d2dd8b802ecea7fd2efe5f07fcef65c26e1adfbc..33a29890435d6065a2cc4f8e8bf8209c @Override diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 8feadac9d9d4fb6c1ae290ca2ab2499b707bd56a..80888d5adf7d4377e17e6f530f35053cfcc9eed4 100644 +index 0c2d1a8feb15bc2bc6ce2674b24222d5c501cd18..d9cd0bb20be6eca5db889f1350b829c0309e021f 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -238,7 +238,7 @@ public abstract class PlayerList { diff --git a/patches/server/0799-Configurable-feature-seeds.patch b/patches/server/0799-Configurable-feature-seeds.patch index 027a5ec91..e0ce52de0 100644 --- a/patches/server/0799-Configurable-feature-seeds.patch +++ b/patches/server/0799-Configurable-feature-seeds.patch @@ -79,26 +79,26 @@ index e5eeab49d167a9a151301ca910e1421550e14245..0a70dfd7880f5fcf1292dd2fdae2964b return getIntOrDefault(behaviorTickRates, typeName, entityType, def); } diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index 3461e62af6de8e4c5c72ff27937948d314bebf6a..3f0d83a90e1319baa0622b708b3ba940d3cee64a 100644 +index 4864fce027b0871e50b2060880be9e24bfdd3887..eb2f0bc997a6823c74f32ec01330ced39a14fdd0 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -277,7 +277,7 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { +@@ -521,7 +521,7 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { int j = list.size(); try { -- Registry iregistry = generatoraccessseed.registryAccess().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY); -+ Registry iregistry = generatoraccessseed.registryAccess().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY); // Paper - diff on change - Registry> iregistry1 = generatoraccessseed.registryAccess().registryOrThrow(Registry.STRUCTURE_FEATURE_REGISTRY); +- Registry iregistry1 = generatoraccessseed.registryAccess().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY); ++ Registry iregistry1 = generatoraccessseed.registryAccess().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY); // Paper - diff on change int k = Math.max(GenerationStep.Decoration.values().length, j); -@@ -351,7 +351,15 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { + for (int l = 0; l < k; ++l) { +@@ -594,7 +594,15 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { return (String) optional.orElseGet(placedfeature::toString); }; - seededrandom.setFeatureSeed(i, l1, l); + // Paper start - change populationSeed used in random + long featurePopulationSeed = i; -+ final net.minecraft.resources.ResourceLocation location = iregistry.getKey(placedfeature); ++ final net.minecraft.resources.ResourceLocation location = iregistry1.getKey(placedfeature); + final long configFeatureSeed = generatoraccessseed.getMinecraftWorld().paperConfig.featureSeeds.getLong(location); + if (configFeatureSeed != -1) { + featurePopulationSeed = seededrandom.setDecorationSeed(configFeatureSeed, blockposition.getX(), blockposition.getZ()); // See seededrandom.setDecorationSeed from above diff --git a/patches/server/0801-Add-root-admin-user-detection.patch b/patches/server/0801-Add-root-admin-user-detection.patch index 63ae0993b..b985f2b5b 100644 --- a/patches/server/0801-Add-root-admin-user-detection.patch +++ b/patches/server/0801-Add-root-admin-user-detection.patch @@ -57,10 +57,10 @@ index 0000000000000000000000000000000000000000..6bd0afddbcc461149dfe9a5c7a86fff6 + } +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 82cee660a029547eda8abdf4188b9d1fb4ba0d53..38a0fb9a7c4ade9cacfd30dffabfea7e6b773981 100644 +index 12020ec70e47499962ad19d03c89da8e2891536e..5c06cbc8680a06cc30a79c7115bb01c89d7a9cfa 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -188,6 +188,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -191,6 +191,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } diff --git a/patches/server/0803-don-t-attempt-to-teleport-dead-entities.patch b/patches/server/0803-don-t-attempt-to-teleport-dead-entities.patch index 71621e8ab..57489841d 100644 --- a/patches/server/0803-don-t-attempt-to-teleport-dead-entities.patch +++ b/patches/server/0803-don-t-attempt-to-teleport-dead-entities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] don't attempt to teleport dead entities diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2155c63e81ab241043deba30fef6f4c8482b9047..26546c030710685cdc1c75b8018462cd424b9ed6 100644 +index 44d5a86dbe71d3e460947217916daa648f45217f..f1c1f58ebb0398df9da9474778d1ad321d9e9433 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -712,7 +712,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -716,7 +716,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i // CraftBukkit start public void postTick() { // No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle diff --git a/patches/server/0804-Fix-anvil-prepare-event-not-working-with-zero-xp.patch b/patches/server/0804-Fix-anvil-prepare-event-not-working-with-zero-xp.patch index 408215402..efa5aa239 100644 --- a/patches/server/0804-Fix-anvil-prepare-event-not-working-with-zero-xp.patch +++ b/patches/server/0804-Fix-anvil-prepare-event-not-working-with-zero-xp.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix anvil prepare event not working with zero xp diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java -index b40377e882d9cc3571f527e706862e27c59b1fd0..073cec4838b88bf4e7444321a74ab73fff732486 100644 +index aa8c101b29f7d9269f3766476ff7d552c2ab0c36..af199f8bb4e25b25653aa780fd02573b5a974904 100644 --- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java -@@ -59,7 +59,7 @@ public class AnvilMenu extends ItemCombinerMenu { +@@ -58,7 +58,7 @@ public class AnvilMenu extends ItemCombinerMenu { @Override protected boolean mayPickup(Player player, boolean present) { diff --git a/patches/server/0805-Prevent-excessive-velocity-through-repeated-crits.patch b/patches/server/0805-Prevent-excessive-velocity-through-repeated-crits.patch index 211bbbaf6..430499383 100644 --- a/patches/server/0805-Prevent-excessive-velocity-through-repeated-crits.patch +++ b/patches/server/0805-Prevent-excessive-velocity-through-repeated-crits.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent excessive velocity through repeated crits diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index fba2239a33c5510581e9a09cf670499e51127479..a62d66121b7ff883bcad92f57adcc66adb5d868a 100644 +index d64e946a3228b871fb8a9703a8631008078e4bec..4240d5bcb550c591706d978ddabffd79104faa37 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -2591,14 +2591,27 @@ public abstract class LivingEntity extends Entity { +@@ -2594,14 +2594,27 @@ public abstract class LivingEntity extends Entity { return this.hasEffect(MobEffects.JUMP) ? (double) (0.1F * (float) (this.getEffect(MobEffects.JUMP).getAmplifier() + 1)) : 0.0D; } diff --git a/patches/server/0806-Remove-client-side-code-using-deprecated-for-removal.patch b/patches/server/0806-Remove-client-side-code-using-deprecated-for-removal.patch index 654a699a8..e024a62da 100644 --- a/patches/server/0806-Remove-client-side-code-using-deprecated-for-removal.patch +++ b/patches/server/0806-Remove-client-side-code-using-deprecated-for-removal.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Remove client-side code using deprecated for removal Fixes warnings on build diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 652c84fe3a4c3004fd9ef8123380836344608359..f6561599391583ba7d669af42b5716cda0df2d68 100644 +index ad49b5a0b3d7fb104eda273368e5ad1e2b1453dc..6d62358239b3e2ba653e439cea918dcbc9059775 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java @@ -23,7 +23,6 @@ import java.net.URL; @@ -18,7 +18,7 @@ index 652c84fe3a4c3004fd9ef8123380836344608359..f6561599391583ba7d669af42b5716cd import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.time.Duration; -@@ -780,21 +779,7 @@ public class Util { +@@ -764,21 +763,7 @@ public class Util { } public void openUrl(URL url) { diff --git a/patches/server/0807-Rewrite-the-light-engine.patch b/patches/server/0807-Rewrite-the-light-engine.patch index bec98e651..19214644e 100644 --- a/patches/server/0807-Rewrite-the-light-engine.patch +++ b/patches/server/0807-Rewrite-the-light-engine.patch @@ -4104,7 +4104,7 @@ index 0000000000000000000000000000000000000000..177d0a969f3d72a34e773e8309c3719a +} diff --git a/src/main/java/ca/spottedleaf/starlight/common/util/SaveUtil.java b/src/main/java/ca/spottedleaf/starlight/common/util/SaveUtil.java new file mode 100644 -index 0000000000000000000000000000000000000000..8cb5c999aa48892d0054e769962aca2fb9400e44 +index 0000000000000000000000000000000000000000..28c946390221613a442fba90901ba6af94e38902 --- /dev/null +++ b/src/main/java/ca/spottedleaf/starlight/common/util/SaveUtil.java @@ -0,0 +1,183 @@ @@ -4112,6 +4112,7 @@ index 0000000000000000000000000000000000000000..8cb5c999aa48892d0054e769962aca2f + +import ca.spottedleaf.starlight.common.light.SWMRNibbleArray; +import ca.spottedleaf.starlight.common.light.StarLightEngine; ++import com.mojang.logging.LogUtils; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.server.level.ServerLevel; @@ -4119,12 +4120,11 @@ index 0000000000000000000000000000000000000000..8cb5c999aa48892d0054e769962aca2f +import net.minecraft.world.level.Level; +import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.ChunkStatus; -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; ++import org.slf4j.Logger; + +public final class SaveUtil { + -+ private static final Logger LOGGER = LogManager.getLogger(); ++ private static final Logger LOGGER = LogUtils.getLogger(); + + private static final int STARLIGHT_LIGHT_VERSION = 6; + @@ -4419,10 +4419,10 @@ index c57999061a7a9adb7b5207a13af3d693529a43cd..76d27205b2bd08ba2b3530b46f0d9b4e Deque queue = new ArrayDeque<>(MCUtil.getSpiralOutChunks(center, radius)); updateLight(sender, world, lightengine, queue); diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index f5b6d0f69e727b8f5e425340f8c1381a82a24ce3..9c4e4ab16441555d7940863b6736a03ee4af545c 100644 +index 1a7fc533afced7235162f81b2de8148cef05414a..36b6e7295cf7484675c8c2b9624c1f6fea7aed1d 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -52,7 +52,7 @@ public class ChunkHolder { +@@ -55,7 +55,7 @@ public class ChunkHolder { private volatile CompletableFuture> fullChunkFuture; private int fullChunkCreateCount; private volatile boolean isFullChunkReady; // Paper - cache chunk ticking stage private volatile CompletableFuture> tickingChunkFuture; private volatile boolean isTickingReady; // Paper - cache chunk ticking stage private volatile CompletableFuture> entityTickingChunkFuture; private volatile boolean isEntityTickingReady; // Paper - cache chunk ticking stage @@ -4432,10 +4432,10 @@ index f5b6d0f69e727b8f5e425340f8c1381a82a24ce3..9c4e4ab16441555d7940863b6736a03e private final DebugBuffer chunkToSaveHistory; public int oldTicketLevel; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 8678640da7724283664e3f115230d6b2687967b1..29fdc1b991c67006a13231abbbe50e201744b5c2 100644 +index 5a4431adefa6d0baef1d46b97a2ee7d5d6a56ec9..0120480bc569f84d9036b90fd0c0f2f33c9c6a9f 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -130,7 +130,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -133,7 +133,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final LongSet entitiesInLevel; public final ServerLevel level; private final ThreadedLevelLightEngine lightEngine; @@ -4445,12 +4445,12 @@ index 8678640da7724283664e3f115230d6b2687967b1..29fdc1b991c67006a13231abbbe50e20 public ChunkGenerator generator; public final Supplier overworldDataStorage; diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java -index fec2a2a9f958492eefbbffcaf8179a2fac5a4d99..ef898d7735504809e9187becb7a1471640de4845 100644 +index bd475554a630fb68433dd6e6640586cf5240cfed..d572d44bdc053c29b2b10f4720d4b940fc47252f 100644 --- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java +++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java -@@ -25,6 +25,17 @@ import net.minecraft.world.level.lighting.LevelLightEngine; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -23,6 +23,17 @@ import net.minecraft.world.level.chunk.LightChunkGetter; + import net.minecraft.world.level.lighting.LevelLightEngine; + import org.slf4j.Logger; +// Paper start +import ca.spottedleaf.starlight.common.light.StarLightEngine; @@ -4464,9 +4464,9 @@ index fec2a2a9f958492eefbbffcaf8179a2fac5a4d99..ef898d7735504809e9187becb7a14716 +// Paper end + public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCloseable { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger(); private final ProcessorMailbox taskMailbox; -@@ -159,13 +170,168 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -157,13 +168,168 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl private volatile int taskPerBatch = 5; private final AtomicBoolean scheduled = new AtomicBoolean(); @@ -4606,7 +4606,7 @@ index fec2a2a9f958492eefbbffcaf8179a2fac5a4d99..ef898d7735504809e9187becb7a14716 + } + }, world.getChunkSource().chunkMap.mainThreadExecutor).whenComplete((final Void ignore, final Throwable thr) -> { + if (thr != null) { -+ LOGGER.fatal("Failed to remove ticket level for post chunk task " + new ChunkPos(chunkX, chunkZ), thr); ++ LOGGER.error("Failed to remove ticket level for post chunk task " + new ChunkPos(chunkX, chunkZ), thr); + } + }); + } @@ -4636,7 +4636,7 @@ index fec2a2a9f958492eefbbffcaf8179a2fac5a4d99..ef898d7735504809e9187becb7a14716 @Override public void close() { } -@@ -182,15 +348,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -180,15 +346,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @Override public void checkBlock(BlockPos pos) { @@ -4659,7 +4659,7 @@ index fec2a2a9f958492eefbbffcaf8179a2fac5a4d99..ef898d7735504809e9187becb7a14716 this.addTask(pos.x, pos.z, () -> { return 0; }, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -@@ -213,17 +380,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -211,17 +378,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @Override public void updateSectionStatus(SectionPos pos, boolean notReady) { @@ -4683,7 +4683,7 @@ index fec2a2a9f958492eefbbffcaf8179a2fac5a4d99..ef898d7735504809e9187becb7a14716 this.addTask(pos.x, pos.z, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { super.enableLightSources(pos, retainData); }, () -> { -@@ -233,6 +399,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -231,6 +397,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @Override public void queueSectionData(LightLayer lightType, SectionPos pos, @Nullable DataLayer nibbles, boolean nonEdge) { @@ -4691,7 +4691,7 @@ index fec2a2a9f958492eefbbffcaf8179a2fac5a4d99..ef898d7735504809e9187becb7a14716 this.addTask(pos.x(), pos.z(), () -> { return 0; }, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -@@ -254,6 +421,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -252,6 +419,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @Override public void retainData(ChunkPos pos, boolean retainData) { @@ -4699,7 +4699,7 @@ index fec2a2a9f958492eefbbffcaf8179a2fac5a4d99..ef898d7735504809e9187becb7a14716 this.addTask(pos.x, pos.z, () -> { return 0; }, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -@@ -264,6 +432,37 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -262,6 +430,37 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } public CompletableFuture lightChunk(ChunkAccess chunk, boolean excludeBlocks) { @@ -4729,7 +4729,7 @@ index fec2a2a9f958492eefbbffcaf8179a2fac5a4d99..ef898d7735504809e9187becb7a14716 + this.tryScheduleUpdate(); + }).whenComplete((final ChunkAccess c, final Throwable throwable) -> { + if (throwable != null) { -+ LOGGER.fatal("Failed to light chunk " + chunkPos, throwable); ++ LOGGER.error("Failed to light chunk " + chunkPos, throwable); + } + }); + } @@ -4737,7 +4737,7 @@ index fec2a2a9f958492eefbbffcaf8179a2fac5a4d99..ef898d7735504809e9187becb7a14716 ChunkPos chunkPos = chunk.getPos(); // Paper start //ichunkaccess.b(false); // Don't need to disable this -@@ -306,7 +505,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -304,7 +503,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } public void tryScheduleUpdate() { @@ -4746,7 +4746,7 @@ index fec2a2a9f958492eefbbffcaf8179a2fac5a4d99..ef898d7735504809e9187becb7a14716 this.taskMailbox.tell(() -> { this.runUpdate(); this.scheduled.set(false); -@@ -323,12 +522,12 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -321,12 +520,12 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl if (queue.poll(pre, post)) { pre.forEach(Runnable::run); pre.clear(); @@ -4774,10 +4774,10 @@ index 41ddcf6775f99c56cf4b13b284420061e5dd6bdc..ae46429264e6a7e5c88b6b6a41a6df4d public static TicketType create(String name, Comparator argumentComparator) { return new TicketType<>(name, argumentComparator, 0L); diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index ce4848bdd00c091b9eb5fa2d47b03378d43c91b2..1831588b275f11aff37573fead835f6ddabfece1 100644 +index 471c4600c6663375eb340c190edaee330bf59ef2..d545b05cfbb14e5a15b26efe372509e498605016 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -684,6 +684,7 @@ public abstract class BlockBehaviour { +@@ -686,6 +686,7 @@ public abstract class BlockBehaviour { this.isViewBlocking = blockbase_info.isViewBlocking; this.hasPostProcess = blockbase_info.hasPostProcess; this.emissiveRendering = blockbase_info.emissiveRendering; @@ -4785,7 +4785,7 @@ index ce4848bdd00c091b9eb5fa2d47b03378d43c91b2..1831588b275f11aff37573fead835f6d } // Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time private org.bukkit.craftbukkit.block.data.CraftBlockData cachedCraftBlockData; -@@ -704,6 +705,18 @@ public abstract class BlockBehaviour { +@@ -706,6 +707,18 @@ public abstract class BlockBehaviour { protected boolean isTicking; protected FluidState fluid; // Paper end @@ -4804,7 +4804,7 @@ index ce4848bdd00c091b9eb5fa2d47b03378d43c91b2..1831588b275f11aff37573fead835f6d public void initCache() { this.fluid = this.getBlock().getFluidState(this.asState()); // Paper - moved from getFluid() -@@ -712,6 +725,7 @@ public abstract class BlockBehaviour { +@@ -714,6 +727,7 @@ public abstract class BlockBehaviour { this.cache = new BlockBehaviour.BlockStateBase.Cache(this.asState()); } this.shapeExceedsCube = this.cache == null || this.cache.largeCollisionShape; // Paper - moved from actual method to here @@ -4813,10 +4813,10 @@ index ce4848bdd00c091b9eb5fa2d47b03378d43c91b2..1831588b275f11aff37573fead835f6d } diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index 6d5f867989eb786683e81e2d270ed0b085c1f072..96cb3e8cad9e7a5edd2a448ea88f2447104fbb5a 100644 +index 20b288fdef75c9994b174cb4d7d082c5e69eb26b..08433670b54c67319ce13ac3ef0f24bd3f819ea0 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -81,6 +81,47 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -84,6 +84,47 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry(); public org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer(ChunkAccess.DATA_TYPE_REGISTRY); // CraftBukkit end @@ -4865,11 +4865,11 @@ index 6d5f867989eb786683e81e2d270ed0b085c1f072..96cb3e8cad9e7a5edd2a448ea88f2447 public ChunkAccess(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor heightLimitView, Registry biome, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable BlendingData blendingData) { this.locX = pos.x; this.locZ = pos.z; // Paper - reduce need for field lookups diff --git a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java -index 7b0da3956be23e974d3bc2f50f9004046923635f..96009c4dbdf964ce0b695b43b9338a441053daa5 100644 +index a9c65c8d36e5c7080133706df1363b3ce52e3370..d1b175f2bb1bc96e4f044a97b14721feb44d78f5 100644 --- a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java -@@ -18,6 +18,38 @@ public class EmptyLevelChunk extends LevelChunk { - super(world, pos); +@@ -21,6 +21,38 @@ public class EmptyLevelChunk extends LevelChunk { + this.biome = holder; } + @Override @@ -4908,10 +4908,10 @@ index 7b0da3956be23e974d3bc2f50f9004046923635f..96009c4dbdf964ce0b695b43b9338a44 @Override public BlockState getBlockState(int x, int y, int z) { diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -index e15263a152c88371ebc65b47f0be938f7c19a8f2..59c053deb52c9307f1b4c1515384a7c627cfaa49 100644 +index 37e7f766e0de7b47c7240c9365bb134fda26a756..cac036ac3c7abb520fbd97b9cea4fb1c275a494b 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -@@ -30,6 +30,48 @@ public class ImposterProtoChunk extends ProtoChunk { +@@ -31,6 +31,48 @@ public class ImposterProtoChunk extends ProtoChunk { private final LevelChunk wrapped; private final boolean allowWrites; @@ -4961,7 +4961,7 @@ index e15263a152c88371ebc65b47f0be938f7c19a8f2..59c053deb52c9307f1b4c1515384a7c6 super(wrapped.getPos(), UpgradeData.EMPTY, wrapped.levelHeightAccessor, wrapped.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), wrapped.getBlendingData()); this.wrapped = wrapped; 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 0746300e8c0a29bedb9ec02803c194c2d03b78fb..55c0e9655ded14e25b0f284ad0c1f99eb5d0b192 100644 +index b6f8600838f243f72c1f0a9a2425837338df8bf6..a141071966428315484480831a58f02a2b0bc025 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -100,6 +100,10 @@ public class LevelChunk extends ChunkAccess { @@ -4989,7 +4989,7 @@ index 0746300e8c0a29bedb9ec02803c194c2d03b78fb..55c0e9655ded14e25b0f284ad0c1f99e while (iterator.hasNext()) { diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index d850cae1ec024a557e62cd561fbca137dc2be96c..eef1b58cfaf3cfa90f3786785dd94d050dfdd4c2 100644 +index 9b84407b2d56186c1c9614371ea38297c9b893f4..d8ce2b53f1ad3fbd50dd21bd5f12acd82da1eb8c 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java @@ -186,7 +186,7 @@ public class PalettedContainer implements PaletteResize { @@ -5002,10 +5002,10 @@ index d850cae1ec024a557e62cd561fbca137dc2be96c..eef1b58cfaf3cfa90f3786785dd94d05 return data.palette.valueFor(data.storage.get(index)); } diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -index acfd46c7035b4009d61bda8a7c8dd6953e4836e6..9e293afe94e85ecbc2a236b1b34df1a4926b83cb 100644 +index d3d2bd5ea57254a4af0572d5dab460127718ce09..3cd5c346425c63e511324ad11b120e281df4a56a 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -54,6 +54,12 @@ public class ProtoChunk extends ChunkAccess { +@@ -55,6 +55,12 @@ public class ProtoChunk extends ChunkAccess { public ProtoChunk(ChunkPos pos, UpgradeData upgradeData, @Nullable LevelChunkSection[] sections, ProtoChunkTicks blockTickScheduler, ProtoChunkTicks fluidTickScheduler, LevelHeightAccessor world, Registry biomeRegistry, @Nullable BlendingData blendingData) { super(pos, upgradeData, world, biomeRegistry, 0L, sections, blendingData); @@ -5019,10 +5019,10 @@ index acfd46c7035b4009d61bda8a7c8dd6953e4836e6..9e293afe94e85ecbc2a236b1b34df1a4 this.fluidTicks = fluidTickScheduler; } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 75ef7c9ddafc23fa122c1421f55b3d7e0dcb2eef..c553c926d147bae370ccd50dca74edc8b19c2f06 100644 +index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418e78e1ce6 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -85,6 +85,14 @@ public class ChunkSerializer { +@@ -87,6 +87,14 @@ public class ChunkSerializer { private static final String BLOCK_TICKS_TAG = "block_ticks"; private static final String FLUID_TICKS_TAG = "fluid_ticks"; @@ -5037,7 +5037,7 @@ index 75ef7c9ddafc23fa122c1421f55b3d7e0dcb2eef..c553c926d147bae370ccd50dca74edc8 public ChunkSerializer() {} // Paper start - guard against serializing mismatching coordinates -@@ -144,13 +152,20 @@ public class ChunkSerializer { +@@ -146,13 +154,20 @@ public class ChunkSerializer { } UpgradeData chunkconverter = nbt.contains("UpgradeData", 10) ? new UpgradeData(nbt.getCompound("UpgradeData"), world) : UpgradeData.EMPTY; @@ -5059,7 +5059,7 @@ index 75ef7c9ddafc23fa122c1421f55b3d7e0dcb2eef..c553c926d147bae370ccd50dca74edc8 if (flag) { tasksToExecuteOnMain.add(() -> { // Paper - delay this task since we're executing off-main -@@ -164,7 +179,7 @@ public class ChunkSerializer { +@@ -166,7 +181,7 @@ public class ChunkSerializer { DataResult dataresult; for (int j = 0; j < nbttaglist.size(); ++j) { @@ -5068,7 +5068,7 @@ index 75ef7c9ddafc23fa122c1421f55b3d7e0dcb2eef..c553c926d147bae370ccd50dca74edc8 byte b0 = nbttagcompound1.getByte("Y"); int k = world.getSectionIndexFromSectionY(b0); -@@ -209,23 +224,29 @@ public class ChunkSerializer { +@@ -211,23 +226,29 @@ public class ChunkSerializer { } if (flag) { @@ -5112,7 +5112,7 @@ index 75ef7c9ddafc23fa122c1421f55b3d7e0dcb2eef..c553c926d147bae370ccd50dca74edc8 } } -@@ -254,6 +275,8 @@ public class ChunkSerializer { +@@ -256,6 +277,8 @@ public class ChunkSerializer { }, chunkPos); object = new LevelChunk(world.getLevel(), chunkPos, chunkconverter, levelchunkticks, levelchunkticks1, l, achunksection, ChunkSerializer.postLoadChunk(world, nbt), blendingdata); @@ -5121,7 +5121,7 @@ index 75ef7c9ddafc23fa122c1421f55b3d7e0dcb2eef..c553c926d147bae370ccd50dca74edc8 } else { ProtoChunkTicks protochunkticklist = ProtoChunkTicks.load(nbt.getList("block_ticks", 10), (s) -> { return Registry.BLOCK.getOptional(ResourceLocation.tryParse(s)); -@@ -262,6 +285,8 @@ public class ChunkSerializer { +@@ -264,6 +287,8 @@ public class ChunkSerializer { return Registry.FLUID.getOptional(ResourceLocation.tryParse(s)); }, chunkPos); ProtoChunk protochunk = new ProtoChunk(chunkPos, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, world, iregistry, blendingdata); @@ -5130,7 +5130,7 @@ index 75ef7c9ddafc23fa122c1421f55b3d7e0dcb2eef..c553c926d147bae370ccd50dca74edc8 object = protochunk; protochunk.setInhabitedTime(l); -@@ -407,7 +432,7 @@ public class ChunkSerializer { +@@ -409,7 +434,7 @@ public class ChunkSerializer { DataLayer[] blockLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()]; DataLayer[] skyLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()]; @@ -5139,7 +5139,7 @@ index 75ef7c9ddafc23fa122c1421f55b3d7e0dcb2eef..c553c926d147bae370ccd50dca74edc8 DataLayer blockArray = lightenginethreaded.getLayerListener(LightLayer.BLOCK).getDataLayerData(SectionPos.of(chunkPos, i)); DataLayer skyArray = lightenginethreaded.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(chunkPos, i)); -@@ -459,6 +484,12 @@ public class ChunkSerializer { +@@ -461,6 +486,12 @@ public class ChunkSerializer { } public static CompoundTag saveChunk(ServerLevel world, ChunkAccess chunk, @org.checkerframework.checker.nullness.qual.Nullable AsyncSaveData asyncsavedata) { // Paper end @@ -5152,7 +5152,7 @@ index 75ef7c9ddafc23fa122c1421f55b3d7e0dcb2eef..c553c926d147bae370ccd50dca74edc8 ChunkPos chunkcoordintpair = chunk.getPos(); CompoundTag nbttagcompound = new CompoundTag(); -@@ -509,20 +540,14 @@ public class ChunkSerializer { +@@ -511,20 +542,14 @@ public class ChunkSerializer { for (int i = lightenginethreaded.getMinLightSection(); i < lightenginethreaded.getMaxLightSection(); ++i) { int j = chunk.getSectionIndexFromSectionY(i); boolean flag1 = j >= 0 && j < achunksection.length; @@ -5180,7 +5180,7 @@ index 75ef7c9ddafc23fa122c1421f55b3d7e0dcb2eef..c553c926d147bae370ccd50dca74edc8 if (flag1) { LevelChunkSection chunksection = achunksection[j]; -@@ -537,13 +562,27 @@ public class ChunkSerializer { +@@ -539,13 +564,27 @@ public class ChunkSerializer { nbttagcompound1.put("biomes", (Tag) dataresult1.getOrThrow(false, logger1::error)); } @@ -5212,7 +5212,7 @@ index 75ef7c9ddafc23fa122c1421f55b3d7e0dcb2eef..c553c926d147bae370ccd50dca74edc8 if (!nbttagcompound1.isEmpty()) { nbttagcompound1.putByte("Y", (byte) i); -@@ -554,7 +593,8 @@ public class ChunkSerializer { +@@ -556,7 +595,8 @@ public class ChunkSerializer { nbttagcompound.put("sections", nbttaglist); if (flag) { diff --git a/patches/server/0808-Always-parse-protochunk-light-sources-unless-it-is-m.patch b/patches/server/0808-Always-parse-protochunk-light-sources-unless-it-is-m.patch index c1ca1cdb1..a1b655d7c 100644 --- a/patches/server/0808-Always-parse-protochunk-light-sources-unless-it-is-m.patch +++ b/patches/server/0808-Always-parse-protochunk-light-sources-unless-it-is-m.patch @@ -8,10 +8,10 @@ Chunks not marked as lit will always go through the light engine, so they should always have their block sources parsed. diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index c553c926d147bae370ccd50dca74edc8b19c2f06..8246204ce5d8f825c7796f87006e658d7a019876 100644 +index 54ade15cdab222e9818f2635a8a12418e78e1ce6..887b3bc6370d23d2ff38e8fdbe286d678b035cc7 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -310,16 +310,33 @@ public class ChunkSerializer { +@@ -312,16 +312,33 @@ public class ChunkSerializer { BelowZeroRetrogen belowzeroretrogen = protochunk.getBelowZeroRetrogen(); boolean flag2 = chunkstatus.isOrAfter(ChunkStatus.LIGHT) || belowzeroretrogen != null && belowzeroretrogen.targetStatus().isOrAfter(ChunkStatus.LIGHT); diff --git a/patches/server/0810-Prevent-sending-oversized-item-data-in-equipment-and.patch b/patches/server/0810-Prevent-sending-oversized-item-data-in-equipment-and.patch index 90f7e1804..e35fbc79b 100644 --- a/patches/server/0810-Prevent-sending-oversized-item-data-in-equipment-and.patch +++ b/patches/server/0810-Prevent-sending-oversized-item-data-in-equipment-and.patch @@ -18,7 +18,7 @@ index 3eb6bf4258b1de4697f96c2011df493cf7414a0c..bbf4e6b0ca0fe046469c675fc9e0929b @Override diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 703ac671b19636859648f16a5431b2700791e7d5..d8ef6137133716b9ee519e6e4668d2e1ae5d9ca3 100644 +index 9760ff4b6ca0e555f01151968cbfe0cdb8960e35..7464336f0c7ee59e59552afbad7bed0afcecef87 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -319,7 +319,10 @@ public class ServerEntity { @@ -34,10 +34,10 @@ index 703ac671b19636859648f16a5431b2700791e7d5..d8ef6137133716b9ee519e6e4668d2e1 } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index a62d66121b7ff883bcad92f57adcc66adb5d868a..4f457aaebdc8100d69f6dd787e36bc40eb103c27 100644 +index 4240d5bcb550c591706d978ddabffd79104faa37..626e53564d4130b98440982e174fd7c23b7df863 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3074,7 +3074,10 @@ public abstract class LivingEntity extends Entity { +@@ -3077,7 +3077,10 @@ public abstract class LivingEntity extends Entity { equipmentChanges.forEach((enumitemslot, itemstack) -> { ItemStack itemstack1 = itemstack.copy(); @@ -49,7 +49,7 @@ index a62d66121b7ff883bcad92f57adcc66adb5d868a..4f457aaebdc8100d69f6dd787e36bc40 switch (enumitemslot.getType()) { case HAND: this.setLastHandItem(enumitemslot, itemstack1); -@@ -3087,6 +3090,34 @@ public abstract class LivingEntity extends Entity { +@@ -3090,6 +3093,34 @@ public abstract class LivingEntity extends Entity { ((ServerLevel) this.level).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list)); } diff --git a/patches/server/0811-Hide-unnecessary-itemmeta-from-clients.patch b/patches/server/0811-Hide-unnecessary-itemmeta-from-clients.patch index 24b2f5bd9..9231e57b2 100644 --- a/patches/server/0811-Hide-unnecessary-itemmeta-from-clients.patch +++ b/patches/server/0811-Hide-unnecessary-itemmeta-from-clients.patch @@ -23,7 +23,7 @@ index 0a70dfd7880f5fcf1292dd2fdae2964bc2f51d61..365c907efc100bbb5cf9223a10f6b56e log(" " + type + ":"); com.google.common.collect.Table table = com.google.common.collect.HashBasedTable.create(); diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index d8ef6137133716b9ee519e6e4668d2e1ae5d9ca3..9a6c67b614944f841813ec2892381c3342bc365c 100644 +index 7464336f0c7ee59e59552afbad7bed0afcecef87..fe29bf349b987d633b185b9d44d221053fa2cc83 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -321,7 +321,7 @@ public class ServerEntity { @@ -36,10 +36,10 @@ index d8ef6137133716b9ee519e6e4668d2e1ae5d9ca3..9a6c67b614944f841813ec2892381c33 } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 4f457aaebdc8100d69f6dd787e36bc40eb103c27..a7f302a9d22e0475ec295ca69ba17770d668ae30 100644 +index 626e53564d4130b98440982e174fd7c23b7df863..a1c43c61ab3a618f864bfefb9e481386d82621e8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3076,7 +3076,7 @@ public abstract class LivingEntity extends Entity { +@@ -3079,7 +3079,7 @@ public abstract class LivingEntity extends Entity { // Paper start - prevent oversized data ItemStack toSend = sanitizeItemStack(itemstack1, true); @@ -48,7 +48,7 @@ index 4f457aaebdc8100d69f6dd787e36bc40eb103c27..a7f302a9d22e0475ec295ca69ba17770 // Paper end switch (enumitemslot.getType()) { case HAND: -@@ -3090,6 +3090,51 @@ public abstract class LivingEntity extends Entity { +@@ -3093,6 +3093,51 @@ public abstract class LivingEntity extends Entity { ((ServerLevel) this.level).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list)); } diff --git a/patches/server/0814-Add-PlayerItemFrameChangeEvent.patch b/patches/server/0814-Add-PlayerItemFrameChangeEvent.patch index 8e8fbb1fb..464f2144c 100644 --- a/patches/server/0814-Add-PlayerItemFrameChangeEvent.patch +++ b/patches/server/0814-Add-PlayerItemFrameChangeEvent.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Add PlayerItemFrameChangeEvent diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java -index 30159f4f387b61b50589fad61f91c9e5a4adaf12..0f8513ee6f56148cf63f4cd6a60acb7f70280ff1 100644 +index d02f507ac58bae5d4f669dae52cc01c35651cee5..f134a2e68d50fba021b19fac4c75fb35d0e252c6 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java -@@ -1,6 +1,7 @@ - package net.minecraft.world.entity.decoration; +@@ -2,6 +2,7 @@ package net.minecraft.world.entity.decoration; + import com.mojang.logging.LogUtils; import javax.annotation.Nullable; +import io.papermc.paper.event.player.PlayerItemFrameChangeEvent; // Paper import net.minecraft.core.BlockPos; diff --git a/patches/server/0817-Allow-delegation-to-vanilla-chunk-gen.patch b/patches/server/0817-Allow-delegation-to-vanilla-chunk-gen.patch index c2b1a1767..a0c4e5811 100644 --- a/patches/server/0817-Allow-delegation-to-vanilla-chunk-gen.patch +++ b/patches/server/0817-Allow-delegation-to-vanilla-chunk-gen.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow delegation to vanilla chunk gen diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 51f537069c195edf1b7a60f233997d3cc03d304a..f81638de69a0f6935291062484244bf62e3e8a9e 100644 +index c1b79f21bff6f9f83f06c338a67f9a942f75da68..14f0b550bdbe42c67456e54d88289f0de56ca04e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2313,6 +2313,107 @@ public final class CraftServer implements Server { +@@ -2305,6 +2305,107 @@ public final class CraftServer implements Server { return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), world); // Paper - Anti-Xray - Add parameters } diff --git a/patches/server/0818-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch b/patches/server/0818-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch index 7a657d63b..971b898e8 100644 --- a/patches/server/0818-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch +++ b/patches/server/0818-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch @@ -1180,10 +1180,10 @@ index 0000000000000000000000000000000000000000..d67a40e7be030142443680c89e1763fc + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index d626af3879e558cdfbe95b1e70e0b32e0f4d1170..7b23535a680d2a8534dcb8dd87770f66fb982c13 100644 +index f6410ba180a85b114a296c64ce293f0891f6b96c..b4d20c06a19e021317cff64a9789f0579b5f921d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -415,7 +415,7 @@ public class ServerPlayer extends Player { +@@ -413,7 +413,7 @@ public class ServerPlayer extends Player { if (blockposition1 != null) { this.moveTo(blockposition1, 0.0F, 0.0F); @@ -1192,7 +1192,7 @@ index d626af3879e558cdfbe95b1e70e0b32e0f4d1170..7b23535a680d2a8534dcb8dd87770f66 break; } } -@@ -423,7 +423,7 @@ public class ServerPlayer extends Player { +@@ -421,7 +421,7 @@ public class ServerPlayer extends Player { } else { this.moveTo(blockposition, 0.0F, 0.0F); @@ -1202,28 +1202,28 @@ index d626af3879e558cdfbe95b1e70e0b32e0f4d1170..7b23535a680d2a8534dcb8dd87770f66 } } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 80888d5adf7d4377e17e6f530f35053cfcc9eed4..fe9810c3b908339ca050ed832c2e67d62cc97b0b 100644 +index d9cd0bb20be6eca5db889f1350b829c0309e021f..639670e7570beec3dba24b348bc3da0ce0231393 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -936,7 +936,7 @@ public abstract class PlayerList { // CraftBukkit end worldserver1.getChunkSource().addRegionTicket(net.minecraft.server.level.TicketType.POST_TELEPORT, new net.minecraft.world.level.ChunkPos(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper -- while (avoidSuffocation && !worldserver1.noCollision(entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) { +- while (avoidSuffocation && !worldserver1.noCollision((Entity) entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) { + while (avoidSuffocation && !worldserver1.noCollision(entityplayer1, entityplayer1.getBoundingBox(), true) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) { // Paper - make sure this loads chunks, we default to NOT loading now entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); } // CraftBukkit start diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index bf3bf6f359bfbef0fa2c6f872ec3ff35739a15fc..fe6f2ec41c521c8f1ac17aa3af8bb7f7375e5a02 100644 +index f1c1f58ebb0398df9da9474778d1ad321d9e9433..9b1b038922be3bb29a6f0644d0642ca0c6feb4b5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1082,9 +1082,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1095,9 +1095,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i float f2 = this.getBlockSpeedFactor(); this.setDeltaMovement(this.getDeltaMovement().multiply((double) f2, 1.0D, (double) f2)); - if (this.level.getBlockStatesIfLoaded(this.getBoundingBox().deflate(1.0E-6D)).noneMatch((iblockdata1) -> { -- return iblockdata1.is((Tag) BlockTags.FIRE) || iblockdata1.is(Blocks.LAVA); +- return iblockdata1.is(BlockTags.FIRE) || iblockdata1.is(Blocks.LAVA); - })) { + // Paper start - remove expensive streams from here + boolean noneMatch = true; @@ -1253,7 +1253,7 @@ index bf3bf6f359bfbef0fa2c6f872ec3ff35739a15fc..fe6f2ec41c521c8f1ac17aa3af8bb7f7 + } + + BlockState type = chunk.getBlockStateFinal(fx, fy, fz); -+ if (type.is((Tag) BlockTags.FIRE) || type.is(Blocks.LAVA)) { ++ if (type.is(BlockTags.FIRE) || type.is(Blocks.LAVA)) { + noneMatch = false; + // can't break, we need to retain vanilla behavior by ensuring ALL chunks are loaded + } @@ -1266,7 +1266,7 @@ index bf3bf6f359bfbef0fa2c6f872ec3ff35739a15fc..fe6f2ec41c521c8f1ac17aa3af8bb7f7 if (this.remainingFireTicks <= 0) { this.setRemainingFireTicks(-this.getFireImmuneTicks()); } -@@ -1218,32 +1253,78 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1231,32 +1266,78 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } private Vec3 collide(Vec3 movement) { @@ -1366,21 +1366,38 @@ index bf3bf6f359bfbef0fa2c6f872ec3ff35739a15fc..fe6f2ec41c521c8f1ac17aa3af8bb7f7 } public static Vec3 collideBoundingBox(@Nullable Entity entity, Vec3 movement, AABB entityBoundingBox, Level world, List collisions) { -@@ -2376,11 +2457,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2380,11 +2461,30 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i float f = this.dimensions.width * 0.8F; - AABB axisalignedbb = AABB.ofSize(vec3d, (double) f, 1.0E-6D, (double) f); + AABB axisalignedbb = AABB.ofSize(this.getEyePosition(), (double) f, 1.0E-6D, (double) f); -- return this.level.getBlockStates(axisalignedbb).filter(Predicate.not(BlockBehaviour.BlockStateBase::isAir)).anyMatch((iblockdata) -> { -- BlockPos blockposition = new BlockPos(vec3d); -- -- return iblockdata.isSuffocating(this.level, blockposition) && Shapes.joinIsNotEmpty(iblockdata.getCollisionShape(this.level, blockposition).move(vec3d.x, vec3d.y, vec3d.z), Shapes.create(axisalignedbb), BooleanOp.AND); +- return BlockPos.betweenClosedStream(axisalignedbb).anyMatch((blockposition) -> { +- BlockState iblockdata = this.level.getBlockState(blockposition); ++ BlockPos.MutableBlockPos blockposition = new BlockPos.MutableBlockPos(); ++ int minX = Mth.floor(axisalignedbb.minX); ++ int minY = Mth.floor(axisalignedbb.minY); ++ int minZ = Mth.floor(axisalignedbb.minZ); ++ int maxX = Mth.floor(axisalignedbb.maxX); ++ int maxY = Mth.floor(axisalignedbb.maxY); ++ int maxZ = Mth.floor(axisalignedbb.maxZ); ++ for (int fz = minZ; fz <= maxZ; ++fz) { ++ for (int fx = minX; fx <= maxX; ++fx) { ++ for (int fy = minY; fy <= maxY; ++fy) { ++ net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)this.level.getChunkIfLoadedImmediately(fx >> 4, fz >> 4); ++ if (chunk == null) { ++ continue; ++ } + +- return !iblockdata.isAir() && iblockdata.isSuffocating(this.level, blockposition) && Shapes.joinIsNotEmpty(iblockdata.getCollisionShape(this.level, blockposition).move((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()), Shapes.create(axisalignedbb), BooleanOp.AND); - }); -+ // Paper start -+ return io.papermc.paper.util.CollisionUtil.getCollisionsForBlocksOrWorldBorder(this.level, this, axisalignedbb, null, -+ false, false, false, true, (BlockState blockState, BlockPos blockPos) -> { -+ return blockState.isSuffocating(this.level, blockPos); -+ }); -+ // Paper end ++ BlockState iblockdata = chunk.getBlockStateFinal(fx, fy, fz); ++ blockposition.set(fx, fy, fz); ++ if (!iblockdata.isAir() && iblockdata.isSuffocating(this.level, blockposition) && Shapes.joinIsNotEmpty(iblockdata.getCollisionShape(this.level, blockposition).move((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()), Shapes.create(axisalignedbb), BooleanOp.AND)) { ++ return true; ++ } ++ } ++ } ++ } ++ return false; } } @@ -1476,10 +1493,10 @@ index f9527d1d867f93b4e0e2758485cfa1f6efa0bf8b..1f4b72a0aca200b2e0860449c718e6e6 return List.of(); } else { diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 1831588b275f11aff37573fead835f6ddabfece1..eac017fc521bfd1391e75db8628f42b28329d681 100644 +index d545b05cfbb14e5a15b26efe372509e498605016..61590f2f04a797235299f1bd6b78a08f5bfe4a33 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -717,6 +717,13 @@ public abstract class BlockBehaviour { +@@ -719,6 +719,13 @@ public abstract class BlockBehaviour { return this.conditionallyFullOpaque; } // Paper end @@ -1493,7 +1510,7 @@ index 1831588b275f11aff37573fead835f6ddabfece1..eac017fc521bfd1391e75db8628f42b2 public void initCache() { this.fluid = this.getBlock().getFluidState(this.asState()); // Paper - moved from getFluid() -@@ -726,7 +733,35 @@ public abstract class BlockBehaviour { +@@ -728,7 +735,35 @@ public abstract class BlockBehaviour { } this.shapeExceedsCube = this.cache == null || this.cache.largeCollisionShape; // Paper - moved from actual method to here this.opacityIfCached = this.cache == null || this.isConditionallyFullOpaque() ? -1 : this.cache.lightBlock; // Paper - cache opacity for light @@ -1531,11 +1548,11 @@ index 1831588b275f11aff37573fead835f6ddabfece1..eac017fc521bfd1391e75db8628f42b2 public Block getBlock() { diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -index d5ceebee36885c6470917bc1d0952733e983f030..e962db693510dc261d6456706a459929369f2510 100644 +index 6afad987f6dd1fd7243dfa6c50549c2a88768962..b11ad90c0956ac1b8ee069fa3f4553a2b4ce88e9 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -@@ -43,6 +43,110 @@ public class LevelChunkSection { - this.biomes = new PalettedContainer<>(biomeRegistry, (Biome) biomeRegistry.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper - Anti-Xray - Add preset biomes +@@ -44,6 +44,110 @@ public class LevelChunkSection { + this.biomes = new PalettedContainer<>(biomeRegistry.asHolderIdMap(), biomeRegistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper - Anti-Xray - Add preset biomes } + // Paper start @@ -1645,7 +1662,7 @@ index d5ceebee36885c6470917bc1d0952733e983f030..e962db693510dc261d6456706a459929 public static int getBottomBlockY(int chunkPos) { return chunkPos << 4; } -@@ -67,8 +171,8 @@ public class LevelChunkSection { +@@ -68,8 +172,8 @@ public class LevelChunkSection { return this.setBlockState(x, y, z, state, true); } @@ -1656,7 +1673,7 @@ index d5ceebee36885c6470917bc1d0952733e983f030..e962db693510dc261d6456706a459929 if (lock) { iblockdata1 = (BlockState) this.states.getAndSet(x, y, z, state); -@@ -107,6 +211,7 @@ public class LevelChunkSection { +@@ -108,6 +212,7 @@ public class LevelChunkSection { ++this.tickingFluidCount; } @@ -1664,10 +1681,10 @@ index d5ceebee36885c6470917bc1d0952733e983f030..e962db693510dc261d6456706a459929 return iblockdata1; } -@@ -158,6 +263,7 @@ public class LevelChunkSection { - } +@@ -157,6 +262,7 @@ public class LevelChunkSection { }); + // Paper end + this.initBlockCollisionData(); // Paper } diff --git a/patches/server/0819-Optimise-collision-checking-in-player-move-packet-ha.patch b/patches/server/0819-Optimise-collision-checking-in-player-move-packet-ha.patch index 71e467db1..63a2b7f8a 100644 --- a/patches/server/0819-Optimise-collision-checking-in-player-move-packet-ha.patch +++ b/patches/server/0819-Optimise-collision-checking-in-player-move-packet-ha.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimise collision checking in player move packet handling Move collision logic to just the hasNewCollision call instead of getCubes + hasNewCollision diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ea3db5e9168e6195b0680b9600d0bb12f04f0532..f73a94ac7009d41cd99b229e28d969586d6df419 100644 +index fd858a8c1fd280ec7769e224c7191ca85731f8a7..99ffca8a6c23ccd588695ddaed4f673d52e3aad4 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -580,12 +580,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -584,7 +584,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser return; } @@ -18,29 +18,31 @@ index ea3db5e9168e6195b0680b9600d0bb12f04f0532..f73a94ac7009d41cd99b229e28d96958 d6 = d3 - this.vehicleLastGoodX; // Paper - diff on change, used for checking large move vectors above d7 = d4 - this.vehicleLastGoodY - 1.0E-6D; // Paper - diff on change, used for checking large move vectors above - d8 = d5 - this.vehicleLastGoodZ; // Paper - diff on change, used for checking large move vectors above +@@ -592,6 +592,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + boolean flag1 = entity.verticalCollisionBelow; + entity.move(MoverType.PLAYER, new Vec3(d6, d7, d8)); + boolean didCollide = toX != entity.getX() || toY != entity.getY() || toZ != entity.getZ(); // Paper - needed here as the difference in Y can be reset - also note: this is only a guess at whether collisions took place, floating point errors can make this true when it shouldn't be... double d11 = d7; d6 = d3 - entity.getX(); -@@ -599,16 +600,23 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser - boolean flag1 = false; +@@ -605,16 +606,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + boolean flag2 = false; if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot -- flag1 = true; -+ flag1 = true; // Paper - diff on change, this should be moved wrongly - ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", entity.getName().getString(), this.player.getName().getString(), Math.sqrt(d10)); +- flag2 = true; ++ flag2 = true; // Paper - diff on change, this should be moved wrongly + ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", new Object[]{entity.getName().getString(), this.player.getName().getString(), Math.sqrt(d10)}); } Location curPos = this.getCraftPlayer().getLocation(); // Spigot entity.absMoveTo(d3, d4, d5, f, f1); this.player.absMoveTo(d3, d4, d5, this.player.getYRot(), this.player.getXRot()); // CraftBukkit -- boolean flag2 = worldserver.noCollision(entity, entity.getBoundingBox().deflate(0.0625D)); -- -- if (flag && (flag1 || !flag2)) { +- boolean flag3 = worldserver.noCollision(entity, entity.getBoundingBox().deflate(0.0625D)); + +- if (flag && (flag2 || !flag3)) { + // Paper start - optimise out extra getCubes -+ boolean teleportBack = flag1; // violating this is always a fail ++ boolean teleportBack = flag2; // violating this is always a fail + if (!teleportBack) { + // note: only call after setLocation, or else getBoundingBox is wrong + AABB newBox = entity.getBoundingBox(); @@ -52,7 +54,7 @@ index ea3db5e9168e6195b0680b9600d0bb12f04f0532..f73a94ac7009d41cd99b229e28d96958 entity.absMoveTo(d0, d1, d2, f, f1); this.player.absMoveTo(d0, d1, d2, this.player.getYRot(), this.player.getXRot()); // CraftBukkit this.connection.send(new ClientboundMoveVehiclePacket(entity)); -@@ -694,7 +702,32 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -700,7 +709,32 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } private boolean noBlocksAround(Entity entity) { @@ -86,7 +88,7 @@ index ea3db5e9168e6195b0680b9600d0bb12f04f0532..f73a94ac7009d41cd99b229e28d96958 } @Override -@@ -1242,7 +1275,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1248,7 +1282,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } if (this.awaitingPositionFromClient != null) { @@ -95,7 +97,7 @@ index ea3db5e9168e6195b0680b9600d0bb12f04f0532..f73a94ac7009d41cd99b229e28d96958 this.awaitingTeleportTime = this.tickCount; this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot()); } -@@ -1336,7 +1369,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1342,7 +1376,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } } @@ -104,29 +106,29 @@ index ea3db5e9168e6195b0680b9600d0bb12f04f0532..f73a94ac7009d41cd99b229e28d96958 d7 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above d8 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above -@@ -1375,6 +1408,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser - } +@@ -1383,6 +1417,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + boolean flag1 = this.player.verticalCollisionBelow; this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9)); + boolean didCollide = toX != this.player.getX() || toY != this.player.getY() || toZ != this.player.getZ(); // Paper - needed here as the difference in Y can be reset - also note: this is only a guess at whether collisions took place, floating point errors can make this true when it shouldn't be... this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move // Paper start - prevent position desync if (this.awaitingPositionFromClient != null) { -@@ -1394,12 +1428,23 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser - boolean flag1 = false; +@@ -1402,12 +1437,23 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + boolean flag2 = false; if (!this.player.isChangingDimension() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot -- flag1 = true; -+ flag1 = true; // Paper - diff on change, this should be moved wrongly +- flag2 = true; ++ flag2 = true; // Paper - diff on change, this should be moved wrongly ServerGamePacketListenerImpl.LOGGER.warn("{} moved wrongly!", this.player.getName().getString()); } this.player.absMoveTo(d0, d1, d2, f, f1); -- if (!this.player.noPhysics && !this.player.isSleeping() && (flag1 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb))) { +- if (!this.player.noPhysics && !this.player.isSleeping() && (flag2 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb))) { + // Paper start - optimise out extra getCubes + // Original for reference: -+ // boolean teleportBack = flag1 && worldserver.getCubes(this.player, axisalignedbb) || (didCollide && this.a((IWorldReader) worldserver, axisalignedbb)); -+ boolean teleportBack = flag1; // violating this is always a fail ++ // boolean teleportBack = flag2 && worldserver.getCubes(this.player, axisalignedbb) || (didCollide && this.a((IWorldReader) worldserver, axisalignedbb)); ++ boolean teleportBack = flag2; // violating this is always a fail + if (!this.player.noPhysics && !this.player.isSleeping() && !teleportBack) { + AABB newBox = this.player.getBoundingBox(); + if (didCollide || !axisalignedbb.equals(newBox)) { @@ -138,7 +140,7 @@ index ea3db5e9168e6195b0680b9600d0bb12f04f0532..f73a94ac7009d41cd99b229e28d96958 this.teleport(d3, d4, d5, f, f1); } else { // CraftBukkit start - fire PlayerMoveEvent -@@ -1486,6 +1531,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1493,6 +1539,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } } diff --git a/patches/server/0820-Actually-unload-POI-data.patch b/patches/server/0820-Actually-unload-POI-data.patch index 21268f4bd..7a790c1ec 100644 --- a/patches/server/0820-Actually-unload-POI-data.patch +++ b/patches/server/0820-Actually-unload-POI-data.patch @@ -10,10 +10,10 @@ This patch also prevents the saving/unloading of POI data when world saving is disabled. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 29fdc1b991c67006a13231abbbe50e201744b5c2..79dbffe899dd7e31af648302c557e2993f170623 100644 +index 0120480bc569f84d9036b90fd0c0f2f33c9c6a9f..a0075aed85fc51cc48e01ecf2b187b04078fb488 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -812,6 +812,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -848,6 +848,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } // Paper end } @@ -21,8 +21,8 @@ index 29fdc1b991c67006a13231abbbe50e201744b5c2..79dbffe899dd7e31af648302c557e299 this.updatingChunks.queueUpdate(pos, holder); // Paper - Don't copy this.modified = true; -@@ -957,7 +958,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - gameprofilerfiller.pop(); +@@ -997,7 +998,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + return this.lightEngine.hasLightWork() || !this.pendingUnloads.isEmpty() || !this.updatingChunkMap.isEmpty() || this.poiManager.hasWork() || !this.toDrop.isEmpty() || !this.unloadQueue.isEmpty() || this.queueSorter.hasWork() || this.distanceManager.hasTickets(); } - private static final double UNLOAD_QUEUE_RESIZE_FACTOR = 0.90; // Spigot // Paper - unload more @@ -30,7 +30,7 @@ index 29fdc1b991c67006a13231abbbe50e201744b5c2..79dbffe899dd7e31af648302c557e299 private void processUnloads(BooleanSupplier shouldKeepTicking) { LongIterator longiterator = this.toDrop.iterator(); -@@ -1021,6 +1022,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1061,6 +1062,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z); } // Paper end @@ -38,15 +38,15 @@ index 29fdc1b991c67006a13231abbbe50e201744b5c2..79dbffe899dd7e31af648302c557e299 if (ichunkaccess instanceof LevelChunk) { ((LevelChunk) ichunkaccess).setLoaded(false); } -@@ -1049,6 +1051,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - for (int index = 0, len = this.regionManagers.size(); index < len; ++index) { - this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z); - } -+ this.getPoiManager().queueUnload(holder.pos.longKey, MinecraftServer.currentTickLong + 1); // Paper - unload POI data - } // Paper end +@@ -1090,6 +1092,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + for (int index = 0, len = this.regionManagers.size(); index < len; ++index) { + this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z); + } ++ this.getPoiManager().queueUnload(holder.pos.longKey, MinecraftServer.currentTickLong + 1); // Paper - unload POI data + } // Paper end } finally { this.unloadingPlayerChunk = unloadingBefore; } // Paper - do not allow ticket level changes while unloading chunks -@@ -1125,6 +1128,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1166,6 +1169,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } this.poiManager.loadInData(pos, chunkHolder.poiData); chunkHolder.tasks.forEach(Runnable::run); @@ -271,7 +271,7 @@ index 8a569e3300543cb171c3befae59969628adc424c..bbd9fdaa4b12543307b144da72b0604e @Override diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -index ec7aa86514f89042c885c0515f0744318c9bdf99..ed688841b1a2a48bacf7f69f177afe136468422c 100644 +index 3cfc57b49fb3d85c4b9039907fc22bad3a0efe3e..2df0b55a18e57163e49770e83ef067a5587d2126 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java @@ -52,6 +52,40 @@ public class SectionStorage extends RegionFileStorage implements AutoCloseabl @@ -313,9 +313,9 @@ index ec7aa86514f89042c885c0515f0744318c9bdf99..ed688841b1a2a48bacf7f69f177afe13 + // Paper end - actually unload POI data + protected void tick(BooleanSupplier shouldKeepTicking) { - while(!this.dirty.isEmpty() && shouldKeepTicking.getAsBoolean()) { + while(this.hasWork() && shouldKeepTicking.getAsBoolean()) { ChunkPos chunkPos = SectionPos.of(this.dirty.firstLong()).chunk(); -@@ -162,6 +196,7 @@ public class SectionStorage extends RegionFileStorage implements AutoCloseabl +@@ -166,6 +200,7 @@ public class SectionStorage extends RegionFileStorage implements AutoCloseabl }); } } diff --git a/patches/server/0821-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch b/patches/server/0821-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch index cf3cbe181..e44506cf5 100644 --- a/patches/server/0821-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch +++ b/patches/server/0821-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch @@ -6,15 +6,22 @@ Subject: [PATCH] Fix ChunkSnapshot#isSectionEmpty(int) and optimize diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index ee6887111b591f174b9f871ce8680a30dc9e2725..f20293426b104ed0c02a931b5ab77f87590f0c18 100644 +index 5931e6a7bf57274c187db62de0482193557d572f..8579c4e632ace486c406bbbe1f6a6c79d5dbdaa2 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -@@ -280,14 +280,17 @@ public class CraftChunk implements Chunk { +@@ -281,18 +281,26 @@ public class CraftChunk implements Chunk { boolean[] sectionEmpty = new boolean[cs.length]; - PalettedContainer[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null; + PalettedContainer>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null; -- Registry iregistry = this.worldServer.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); -- Codec> biomeCodec = PalettedContainer.codec(iregistry, iregistry.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getOrThrow(Biomes.PLAINS), null); // Paper - Anti-Xray - Add preset biomes ++<<<<<<< HEAD + Registry iregistry = this.worldServer.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); + <<<<<<< HEAD + Codec>> biomeCodec = PalettedContainer.codec(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS)); + ======= + Codec> biomeCodec = PalettedContainer.codec(iregistry, iregistry.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getOrThrow(Biomes.PLAINS), null); // Paper - Anti-Xray - Add preset biomes + >>>>>>> Anti-Xray ++======= ++>>>>>>> Fix ChunkSnapshot#isSectionEmpty(int) and optimize PalettedContainer copying by not using codecs for (int i = 0; i < cs.length; i++) { - CompoundTag data = new CompoundTag(); @@ -32,7 +39,7 @@ index ee6887111b591f174b9f871ce8680a30dc9e2725..f20293426b104ed0c02a931b5ab77f87 LevelLightEngine lightengine = chunk.level.getLightEngine(); DataLayer skyLightArray = lightengine.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(x, i, z)); -@@ -306,8 +309,7 @@ public class CraftChunk implements Chunk { +@@ -311,8 +319,7 @@ public class CraftChunk implements Chunk { } if (biome != null) { diff --git a/patches/server/0822-Update-Log4j.patch b/patches/server/0822-Update-Log4j.patch index 9f57674dd..7a09e1fa2 100644 --- a/patches/server/0822-Update-Log4j.patch +++ b/patches/server/0822-Update-Log4j.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Update Log4j diff --git a/build.gradle.kts b/build.gradle.kts -index 17cde4eaf23e01710c131fbea5d171fd25725250..028f6a1795ceb99d1760c73b0980238677b4b8bc 100644 +index eb6c5e292f748aad797a8b9d6a51b5b50e6e1f53..028f6a1795ceb99d1760c73b0980238677b4b8bc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -29,10 +29,11 @@ dependencies { @@ -17,8 +17,7 @@ index 17cde4eaf23e01710c131fbea5d171fd25725250..028f6a1795ceb99d1760c73b09802386 + implementation("org.apache.logging.log4j:log4j-core:2.17.1") // Paper - implementation + annotationProcessor("org.apache.logging.log4j:log4j-core:2.17.1") // Paper - Needed to generate meta for our Log4j plugins // Paper end -- implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper -+ implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper + implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper + implementation("org.apache.logging.log4j:log4j-slf4j18-impl:2.17.1") // Paper implementation("org.ow2.asm:asm:9.2") implementation("org.ow2.asm:asm-commons:9.2") // Paper - ASM event executor generation diff --git a/patches/server/0824-Fix-WorldGenRegion-leak-when-converting-pre-1.18-chu.patch b/patches/server/0824-Fix-WorldGenRegion-leak-when-converting-pre-1.18-chu.patch deleted file mode 100644 index 2768b9635..000000000 --- a/patches/server/0824-Fix-WorldGenRegion-leak-when-converting-pre-1.18-chu.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Sun, 12 Dec 2021 04:43:30 -0800 -Subject: [PATCH] Fix WorldGenRegion leak when converting pre-1.18 chunks - -The Blender passed in here holds a WorldGenRegion which contains a list of surrounding chunks - -diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index 96cb3e8cad9e7a5edd2a448ea88f2447104fbb5a..5aeaaae6f15050a2da271fe196d0a234ecafc8a1 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -410,6 +410,11 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom - } - - public NoiseChunk getOrCreateNoiseChunk(NoiseSampler noiseColumnSampler, Supplier columnSampler, NoiseGeneratorSettings chunkGeneratorSettings, Aquifer.FluidPicker fluidLevelSampler, Blender blender) { -+ // Paper start - create a new one each time to avoid leaking -+ if (blender != Blender.empty()) { -+ return NoiseChunk.forChunk(this, noiseColumnSampler, columnSampler, chunkGeneratorSettings, fluidLevelSampler, blender); -+ } -+ // Paper end - if (this.noiseChunk == null) { - this.noiseChunk = NoiseChunk.forChunk(this, noiseColumnSampler, columnSampler, chunkGeneratorSettings, fluidLevelSampler, blender); - } diff --git a/patches/server/0825-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch b/patches/server/0824-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch similarity index 96% rename from patches/server/0825-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch rename to patches/server/0824-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch index cf5879843..782f72a30 100644 --- a/patches/server/0825-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch +++ b/patches/server/0824-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch @@ -8,10 +8,10 @@ This ensures at least a valid version of the chunk exists on disk, even if outdated diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index 950efcc80455f73ec8ca4e991fcf9a5b2b7fa22e..012909055f4def2330e2fa839a98ff8bb41ea604 100644 +index 8ff8855c5267379b3a5f5d8baa4a275ffee2c4bf..6704ae5c2ee01f8b319f4d425fe08c16d7b1b212 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -@@ -1020,6 +1020,24 @@ public class RegionFile implements AutoCloseable { +@@ -1019,6 +1019,24 @@ public class RegionFile implements AutoCloseable { this.pos = chunkcoordintpair; } diff --git a/patches/server/0826-Fix-tripwire-state-inconsistency.patch b/patches/server/0825-Fix-tripwire-state-inconsistency.patch similarity index 100% rename from patches/server/0826-Fix-tripwire-state-inconsistency.patch rename to patches/server/0825-Fix-tripwire-state-inconsistency.patch diff --git a/patches/server/0827-Fix-fluid-logging-on-Block-breakNaturally.patch b/patches/server/0826-Fix-fluid-logging-on-Block-breakNaturally.patch similarity index 86% rename from patches/server/0827-Fix-fluid-logging-on-Block-breakNaturally.patch rename to patches/server/0826-Fix-fluid-logging-on-Block-breakNaturally.patch index aba52937b..3d1428bea 100644 --- a/patches/server/0827-Fix-fluid-logging-on-Block-breakNaturally.patch +++ b/patches/server/0826-Fix-fluid-logging-on-Block-breakNaturally.patch @@ -7,10 +7,10 @@ Leaves fluid if the block broken was fluid-logged which is what happens if a player breaks a fluid-logged block diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index bf7d216d9307a96005dcca64696af72a84a68716..5ea2fdbd2c762e0e632093fc07294327eb061ada 100644 +index 88c8817a85546ff92424b1164abcd74a15ff0917..c18edb2c0680a336f11fab30d1d985192dc1393e 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -502,6 +502,7 @@ public class CraftBlock implements Block { +@@ -508,6 +508,7 @@ public class CraftBlock implements Block { net.minecraft.world.level.block.state.BlockState iblockdata = this.getNMS(); net.minecraft.world.level.block.Block block = iblockdata.getBlock(); net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); @@ -18,7 +18,7 @@ index bf7d216d9307a96005dcca64696af72a84a68716..5ea2fdbd2c762e0e632093fc07294327 boolean result = false; // Modelled off EntityHuman#hasBlock -@@ -512,7 +513,7 @@ public class CraftBlock implements Block { +@@ -518,7 +519,7 @@ public class CraftBlock implements Block { } // SPIGOT-6778: Directly call setBlock instead of setTypeAndData, so that the tile entiy is not removed and custom remove logic is run. diff --git a/patches/server/0828-Forward-CraftEntity-in-teleport-command.patch b/patches/server/0827-Forward-CraftEntity-in-teleport-command.patch similarity index 88% rename from patches/server/0828-Forward-CraftEntity-in-teleport-command.patch rename to patches/server/0827-Forward-CraftEntity-in-teleport-command.patch index ddaf52e32..cc8671d0c 100644 --- a/patches/server/0828-Forward-CraftEntity-in-teleport-command.patch +++ b/patches/server/0827-Forward-CraftEntity-in-teleport-command.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Forward CraftEntity in teleport command diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index fe6f2ec41c521c8f1ac17aa3af8bb7f7375e5a02..9b5bd68f328306e26eced7d3112b2c01301b543b 100644 +index 9b1b038922be3bb29a6f0644d0642ca0c6feb4b5..a2cc34d6a81b7278eacbf980ccf7f275377ee2a8 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3168,6 +3168,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3203,6 +3203,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public void restoreFrom(Entity original) { @@ -22,7 +22,7 @@ index fe6f2ec41c521c8f1ac17aa3af8bb7f7375e5a02..9b5bd68f328306e26eced7d3112b2c01 CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag()); nbttagcompound.remove("Dimension"); -@@ -3249,10 +3256,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3284,10 +3291,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i if (worldserver.getTypeKey() == LevelStem.END) { // CraftBukkit ServerLevel.makeObsidianPlatform(worldserver, this); // CraftBukkit } diff --git a/patches/server/0829-Improve-scoreboard-entries.patch b/patches/server/0828-Improve-scoreboard-entries.patch similarity index 100% rename from patches/server/0829-Improve-scoreboard-entries.patch rename to patches/server/0828-Improve-scoreboard-entries.patch diff --git a/patches/server/0830-Entity-powdered-snow-API.patch b/patches/server/0829-Entity-powdered-snow-API.patch similarity index 100% rename from patches/server/0830-Entity-powdered-snow-API.patch rename to patches/server/0829-Entity-powdered-snow-API.patch diff --git a/patches/server/0832-Add-API-for-item-entity-health.patch b/patches/server/0830-Add-API-for-item-entity-health.patch similarity index 100% rename from patches/server/0832-Add-API-for-item-entity-health.patch rename to patches/server/0830-Add-API-for-item-entity-health.patch diff --git a/patches/server/0833-Configurable-max-block-light-for-monster-spawning.patch b/patches/server/0831-Configurable-max-block-light-for-monster-spawning.patch similarity index 100% rename from patches/server/0833-Configurable-max-block-light-for-monster-spawning.patch rename to patches/server/0831-Configurable-max-block-light-for-monster-spawning.patch diff --git a/patches/server/0834-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch b/patches/server/0832-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch similarity index 94% rename from patches/server/0834-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch rename to patches/server/0832-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch index 8db19c209..8ed1ba062 100644 --- a/patches/server/0834-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch +++ b/patches/server/0832-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch @@ -27,10 +27,10 @@ Co-authored-by: Zach Brown Co-authored-by: Madeline Miller diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -index ed70d63db8b674d987ad468a5bb27fd7567bcdc7..c9c18cf84e4ee5c253bbc64a4b41e91f9f4c4bc7 100644 +index 322b3119682fbab5e790ce9255e96a519f03143d..2e5803035a46f890e8bfc59908c0040f9a960703 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -@@ -146,15 +146,15 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -145,15 +145,15 @@ public class PistonBaseBlock extends DirectionalBlock { } // CraftBukkit start @@ -55,7 +55,7 @@ index ed70d63db8b674d987ad468a5bb27fd7567bcdc7..c9c18cf84e4ee5c253bbc64a4b41e91f // PAIL: checkME - what happened to setTypeAndData? // CraftBukkit end world.blockEvent(pos, this, b0, enumdirection.get3DDataValue()); -@@ -236,6 +236,13 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -235,6 +235,13 @@ public class PistonBaseBlock extends DirectionalBlock { BlockState iblockdata1 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT); @@ -69,7 +69,7 @@ index ed70d63db8b674d987ad468a5bb27fd7567bcdc7..c9c18cf84e4ee5c253bbc64a4b41e91f world.setBlock(pos, iblockdata1, 20); world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata1, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); // Paper - diff on change world.blockUpdated(pos, iblockdata1.getBlock()); -@@ -262,6 +269,13 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -261,6 +268,13 @@ public class PistonBaseBlock extends DirectionalBlock { if (type == 1 && !iblockdata2.isAir() && PistonBaseBlock.isPushable(iblockdata2, world, blockposition1, enumdirection.getOpposite(), false, enumdirection) && (iblockdata2.getPistonPushReaction() == PushReaction.NORMAL || iblockdata2.is(Blocks.PISTON) || iblockdata2.is(Blocks.STICKY_PISTON))) { this.moveBlocks(world, pos, enumdirection, false); } else { diff --git a/patches/server/0835-Load-effect-amplifiers-greater-than-127-correctly.patch b/patches/server/0833-Load-effect-amplifiers-greater-than-127-correctly.patch similarity index 91% rename from patches/server/0835-Load-effect-amplifiers-greater-than-127-correctly.patch rename to patches/server/0833-Load-effect-amplifiers-greater-than-127-correctly.patch index f09e0d4b9..83f5b4740 100644 --- a/patches/server/0835-Load-effect-amplifiers-greater-than-127-correctly.patch +++ b/patches/server/0833-Load-effect-amplifiers-greater-than-127-correctly.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Load effect amplifiers greater than 127 correctly MOJIRA: MC-118857 diff --git a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java -index 1493cff2087080a53210349e9d13e81594c24a04..0dadea0c9559d99c7de04dbda68b3e743c9eeecb 100644 +index fefc8a1b5dbdc02f9f3e31055840170b9a6274b9..b84610d00f710c656d9eaf85b80e796f8be4bca3 100644 --- a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java +++ b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java @@ -235,7 +235,7 @@ public class MobEffectInstance implements Comparable { diff --git a/patches/server/0836-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch b/patches/server/0834-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch similarity index 100% rename from patches/server/0836-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch rename to patches/server/0834-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch diff --git a/patches/server/0837-Fix-bees-aging-inside-hives.patch b/patches/server/0835-Fix-bees-aging-inside-hives.patch similarity index 90% rename from patches/server/0837-Fix-bees-aging-inside-hives.patch rename to patches/server/0835-Fix-bees-aging-inside-hives.patch index f1e629576..c9303da67 100644 --- a/patches/server/0837-Fix-bees-aging-inside-hives.patch +++ b/patches/server/0835-Fix-bees-aging-inside-hives.patch @@ -7,10 +7,10 @@ Fixes bees incorrectly being aged up due to upstream's resetting the ticks inside hive on a failed release diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java -index e5e65bb68a92fffbf765eb140fe1e1ec77059c49..b05ac56823feaf062b1418c9e6dbe4268225f00f 100644 +index 19127ec5d89235ea9af549810b24783e0af85a3d..483dc52c793d9f90a35b1d091dd8ce71115e4640 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java -@@ -324,7 +324,7 @@ public class BeehiveBlockEntity extends BlockEntity { +@@ -325,7 +325,7 @@ public class BeehiveBlockEntity extends BlockEntity { for (Iterator iterator = bees.iterator(); iterator.hasNext(); ++tileentitybeehive_hivebee.ticksInHive) { tileentitybeehive_hivebee = (BeehiveBlockEntity.BeeData) iterator.next(); @@ -19,7 +19,7 @@ index e5e65bb68a92fffbf765eb140fe1e1ec77059c49..b05ac56823feaf062b1418c9e6dbe426 BeehiveBlockEntity.BeeReleaseStatus tileentitybeehive_releasestatus = tileentitybeehive_hivebee.entityData.getBoolean("HasNectar") ? BeehiveBlockEntity.BeeReleaseStatus.HONEY_DELIVERED : BeehiveBlockEntity.BeeReleaseStatus.BEE_RELEASED; if (BeehiveBlockEntity.releaseOccupant(world, pos, state, tileentitybeehive_hivebee, (List) null, tileentitybeehive_releasestatus, flowerPos)) { -@@ -332,10 +332,11 @@ public class BeehiveBlockEntity extends BlockEntity { +@@ -333,10 +333,11 @@ public class BeehiveBlockEntity extends BlockEntity { iterator.remove(); // CraftBukkit start } else { @@ -32,7 +32,7 @@ index e5e65bb68a92fffbf765eb140fe1e1ec77059c49..b05ac56823feaf062b1418c9e6dbe426 } if (flag) { -@@ -424,12 +425,14 @@ public class BeehiveBlockEntity extends BlockEntity { +@@ -425,12 +426,14 @@ public class BeehiveBlockEntity extends BlockEntity { final CompoundTag entityData; int ticksInHive; diff --git a/patches/server/0838-Bucketable-API.patch b/patches/server/0836-Bucketable-API.patch similarity index 100% rename from patches/server/0838-Bucketable-API.patch rename to patches/server/0836-Bucketable-API.patch diff --git a/patches/server/0839-Check-player-world-in-endPortalSoundRadius.patch b/patches/server/0837-Check-player-world-in-endPortalSoundRadius.patch similarity index 94% rename from patches/server/0839-Check-player-world-in-endPortalSoundRadius.patch rename to patches/server/0837-Check-player-world-in-endPortalSoundRadius.patch index 2cad4659f..a632d3d59 100644 --- a/patches/server/0839-Check-player-world-in-endPortalSoundRadius.patch +++ b/patches/server/0837-Check-player-world-in-endPortalSoundRadius.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Check player world in endPortalSoundRadius Fixes Spigot's endPortalSoundRadius not checking player worlds diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java -index 7ccfe737fdf7f07b731ea0ff82e897564350705c..46ca1a11930c57813fbcbab7de7dd2fd47241f64 100644 +index beb3713937470d7c5d8cadce3f3a823ca48d3726..d9c20eca27382e89ddb13f1c8e84348242ca6ceb 100644 --- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java +++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java @@ -66,7 +66,7 @@ public class EnderEyeItem extends Item { diff --git a/patches/server/0841-Validate-usernames.patch b/patches/server/0838-Validate-usernames.patch similarity index 88% rename from patches/server/0841-Validate-usernames.patch rename to patches/server/0838-Validate-usernames.patch index 2b31764c5..dec1576cd 100644 --- a/patches/server/0841-Validate-usernames.patch +++ b/patches/server/0838-Validate-usernames.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Validate usernames diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index d5aa95846e7f52108a03e3731023527281b21d73..1d3cc8836d2ccbec4a8660f86501be35c76e8b0b 100644 +index 609f7ff543353ede53dc46dafc5a2fd0b0622cd8..32f258997face08c20d787b5a9534cb8f3ae4906 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -493,6 +493,12 @@ public class PaperConfig { @@ -22,10 +22,10 @@ index d5aa95846e7f52108a03e3731023527281b21d73..1d3cc8836d2ccbec4a8660f86501be35 public static int maxPlayerAutoSavePerTick = 10; private static void playerAutoSaveRate() { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 33a29890435d6065a2cc4f8e8bf8209c01d5d114..bb70d2b4d284727aa5dc88dd99534d09c2e38657 100644 +index f5c1dff1d571e89f960f11400edbcbbea0620575..7065aa4522431d08018fec8e591ba7c255398140 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -65,6 +65,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -61,6 +61,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener private ServerPlayer delayedAcceptPlayer; public String hostname = ""; // CraftBukkit - add field private int velocityLoginMessageId = -1; // Paper - Velocity support @@ -33,7 +33,7 @@ index 33a29890435d6065a2cc4f8e8bf8209c01d5d114..bb70d2b4d284727aa5dc88dd99534d09 public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection) { this.state = ServerLoginPacketListenerImpl.State.HELLO; -@@ -230,10 +231,38 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -226,11 +227,39 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener // Paper end } @@ -61,6 +61,7 @@ index 33a29890435d6065a2cc4f8e8bf8209c01d5d114..bb70d2b4d284727aa5dc88dd99534d09 public void handleHello(ServerboundHelloPacket packet) { Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]); this.gameProfile = packet.getGameProfile(); + Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(this.gameProfile.getName()), "Invalid characters in username", new Object[0]); + // Paper start - validate usernames + if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() && com.destroystokyo.paper.PaperConfig.performUsernameValidation) { + if (!this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && !validateUsername(this.gameProfile.getName())) { @@ -73,7 +74,7 @@ index 33a29890435d6065a2cc4f8e8bf8209c01d5d114..bb70d2b4d284727aa5dc88dd99534d09 this.state = ServerLoginPacketListenerImpl.State.KEY; this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.nonce)); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index fe9810c3b908339ca050ed832c2e67d62cc97b0b..cd08f9b16c065be8f0eacaeba51d3e72d332daf9 100644 +index 639670e7570beec3dba24b348bc3da0ce0231393..0766abd7334bc76b57fd509c8890701704aa217c 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -707,7 +707,7 @@ public abstract class PlayerList { diff --git a/patches/server/0842-Fix-saving-configs-with-more-long-comments.patch b/patches/server/0839-Fix-saving-configs-with-more-long-comments.patch similarity index 100% rename from patches/server/0842-Fix-saving-configs-with-more-long-comments.patch rename to patches/server/0839-Fix-saving-configs-with-more-long-comments.patch diff --git a/patches/server/0843-Make-water-animal-spawn-height-configurable.patch b/patches/server/0840-Make-water-animal-spawn-height-configurable.patch similarity index 87% rename from patches/server/0843-Make-water-animal-spawn-height-configurable.patch rename to patches/server/0840-Make-water-animal-spawn-height-configurable.patch index d3e1a5e31..70d7bcd1a 100644 --- a/patches/server/0843-Make-water-animal-spawn-height-configurable.patch +++ b/patches/server/0840-Make-water-animal-spawn-height-configurable.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Make water animal spawn height configurable diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 5a5db15493cd9b83815c36487c2f38cb8ac76f3a..cd5a7bac92a1e733d69340f09bc35906138a6ce3 100644 +index c9eefc9455e3db248216a38cd6120cdfa27c1eab..bcac771024f406e2b60739162671a5d5bdbb39cd 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -385,6 +385,24 @@ public class PaperWorldConfig { @@ -34,7 +34,7 @@ index 5a5db15493cd9b83815c36487c2f38cb8ac76f3a..cd5a7bac92a1e733d69340f09bc35906 private void containerUpdateTickRate() { containerUpdateTickRate = getInt("container-update-tick-rate", 1); diff --git a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java -index 6963cf94909a74522706c984d063faeba0e76112..c3bba52a5c7a618fd9731045268fa9ccebff14f4 100644 +index 69f7e034cab1bfd7ca5dffc660b6decd739adf35..c039b896ee85543c26a8ab76640080f539deaa4c 100644 --- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java +++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java @@ -79,6 +79,10 @@ public abstract class WaterAnimal extends PathfinderMob { @@ -45,6 +45,6 @@ index 6963cf94909a74522706c984d063faeba0e76112..c3bba52a5c7a618fd9731045268fa9cc + i = world.getMinecraftWorld().paperConfig.waterAnimalMaxSpawnHeight != null ? world.getMinecraftWorld().paperConfig.waterAnimalMaxSpawnHeight : i; + j = world.getMinecraftWorld().paperConfig.waterAnimalMinSpawnHeight != null ? world.getMinecraftWorld().paperConfig.waterAnimalMinSpawnHeight : j; + // Paper end - return world.getFluidState(pos.below()).is(FluidTags.WATER) && world.getBlockState(pos.above()).is(Blocks.WATER) && pos.getY() >= j && pos.getY() <= i; + return pos.getY() >= j && pos.getY() <= i && world.getFluidState(pos.below()).is(FluidTags.WATER) && world.getBlockState(pos.above()).is(Blocks.WATER); } } diff --git a/patches/server/0844-Expose-vanilla-BiomeProvider-from-WorldInfo.patch b/patches/server/0841-Expose-vanilla-BiomeProvider-from-WorldInfo.patch similarity index 88% rename from patches/server/0844-Expose-vanilla-BiomeProvider-from-WorldInfo.patch rename to patches/server/0841-Expose-vanilla-BiomeProvider-from-WorldInfo.patch index 56badd182..c9881d72d 100644 --- a/patches/server/0844-Expose-vanilla-BiomeProvider-from-WorldInfo.patch +++ b/patches/server/0841-Expose-vanilla-BiomeProvider-from-WorldInfo.patch @@ -5,36 +5,36 @@ Subject: [PATCH] Expose vanilla BiomeProvider from WorldInfo diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d8ec6871cf25175a1da3db004651d4a2ae07b5eb..eab93e1e3712c0a01cac187bf5944818c813d665 100644 +index cdbee0c0d0f6154dc6396be87eeea1db67ad5dbf..7fcc1342245470158da4cc35112649210eacddee 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -654,7 +654,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) { if (world.getDifficulty() != Difficulty.PEACEFUL) { -- if (Objects.equals(world.getBiomeName(pos), Optional.of(Biomes.SWAMP)) && pos.getY() > 50 && pos.getY() < 70 && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) { +- if (world.getBiome(pos).is(Biomes.SWAMP) && pos.getY() > 50 && pos.getY() < 70 && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) { + // Paper start - Replace rules for Height in Swamp Biome + final double maxHeightSwamp = world.getMinecraftWorld().paperConfig.slimeMaxSpawnHeightInSwamp; + final double minHeightSwamp = world.getMinecraftWorld().paperConfig.slimeMinSpawnHeightInSwamp; -+ if (Objects.equals(world.getBiomeName(pos), Optional.of(Biomes.SWAMP)) && pos.getY() > minHeightSwamp && pos.getY() < maxHeightSwamp && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) { ++ if (world.getBiome(pos).is(Biomes.SWAMP) && pos.getY() > minHeightSwamp && pos.getY() < maxHeightSwamp && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) { + // Paper end return checkMobSpawnRules(type, world, spawnReason, pos, random); } -@@ -338,7 +342,10 @@ public class Slime extends Mob implements Enemy { +@@ -336,7 +340,10 @@ public class Slime extends Mob implements Enemy { ChunkPos chunkcoordintpair = new ChunkPos(pos); boolean flag = world.getMinecraftWorld().paperConfig.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper diff --git a/patches/server/0847-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch b/patches/server/0847-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch new file mode 100644 index 000000000..a834180d5 --- /dev/null +++ b/patches/server/0847-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MCMDEV +Date: Fri, 24 Sep 2021 17:59:21 +0200 +Subject: [PATCH] Added getHostname to AsyncPlayerPreLoginEvent + + +diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +index 7065aa4522431d08018fec8e591ba7c255398140..befcb501b4b1b6330bf3cd53e00e30b01efade6f 100644 +--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +@@ -395,7 +395,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener + + // Paper start + com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(ServerLoginPacketListenerImpl.this.gameProfile); +- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile); // Paper - add rawAddress ++ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile, ServerLoginPacketListenerImpl.this.hostname); // Paper - add rawAddress & hostname + server.getPluginManager().callEvent(asyncEvent); + profile = asyncEvent.getPlayerProfile(); + profile.complete(true); // Paper - setPlayerProfileAPI diff --git a/patches/server/0852-Fix-xp-reward-for-baby-zombies.patch b/patches/server/0848-Fix-xp-reward-for-baby-zombies.patch similarity index 88% rename from patches/server/0852-Fix-xp-reward-for-baby-zombies.patch rename to patches/server/0848-Fix-xp-reward-for-baby-zombies.patch index 9f811a6cf..0c5733a37 100644 --- a/patches/server/0852-Fix-xp-reward-for-baby-zombies.patch +++ b/patches/server/0848-Fix-xp-reward-for-baby-zombies.patch @@ -9,7 +9,7 @@ so this resets it after each call to Zombie#getExperienceReward diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index e72e9b748b3f3e34baddf01366c703efba50c67c..35f0203d260c11b729c30e6241316fda4b70bfd7 100644 +index da378373db05f7cf5e655bc76cb58945347d1f32..1954e1b179539be725c291cdda16fb17c8bcea47 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java @@ -172,11 +172,16 @@ public class Zombie extends Monster { @@ -18,7 +18,7 @@ index e72e9b748b3f3e34baddf01366c703efba50c67c..35f0203d260c11b729c30e6241316fda protected int getExperienceReward(Player player) { + final int previousReward = this.xpReward; // Paper - store previous value to reset after calculating XP reward if (this.isBaby()) { - this.xpReward = (int) ((float) this.xpReward * 2.5F); + this.xpReward = (int) ((double) this.xpReward * 2.5D); } - return super.getExperienceReward(player); diff --git a/patches/server/0853-Kick-on-main-for-illegal-chars.patch b/patches/server/0849-Kick-on-main-for-illegal-chars.patch similarity index 87% rename from patches/server/0853-Kick-on-main-for-illegal-chars.patch rename to patches/server/0849-Kick-on-main-for-illegal-chars.patch index 2f56acd7d..317104c97 100644 --- a/patches/server/0853-Kick-on-main-for-illegal-chars.patch +++ b/patches/server/0849-Kick-on-main-for-illegal-chars.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Kick on main for illegal chars diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0c87166beb89dd220e2f7aed1c47a331297eef0d..d945a22e2bb992f3cbba3c9ed0f660b6a385a1b0 100644 +index 99ffca8a6c23ccd588695ddaed4f673d52e3aad4..299e25ee472083f7ab8452932f180b5a6650e9a0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2069,7 +2069,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2077,7 +2077,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { diff --git a/patches/server/0850-Fix-int-overflow-in-chunk-range-check.patch b/patches/server/0850-Fix-int-overflow-in-chunk-range-check.patch deleted file mode 100644 index f997da5ac..000000000 --- a/patches/server/0850-Fix-int-overflow-in-chunk-range-check.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Tue, 11 Jan 2022 19:31:46 +0100 -Subject: [PATCH] Fix int overflow in chunk range check - - -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 79dbffe899dd7e31af648302c557e2993f170623..6a035b173cf0d288b2912f568078fede45d138f2 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -622,9 +622,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - public static boolean isChunkInRange(int x1, int z1, int x2, int z2, int distance) { - int j1 = Math.max(0, Math.abs(x1 - x2) - 1); - int k1 = Math.max(0, Math.abs(z1 - z2) - 1); -- int l1 = Math.max(0, Math.max(j1, k1) - 1); -- int i2 = Math.min(j1, k1); -- int j2 = i2 * i2 + l1 * l1; -+ // Paper start - fix integer overflow -+ long l1 = Math.max(0, Math.max(j1, k1) - 1); -+ long i2 = Math.min(j1, k1); -+ long j2 = i2 * i2 + l1 * l1; -+ // Paper end - int k2 = distance - 1; - int l2 = k2 * k2; - diff --git a/patches/server/0854-Multi-Block-Change-API-Implementation.patch b/patches/server/0850-Multi-Block-Change-API-Implementation.patch similarity index 100% rename from patches/server/0854-Multi-Block-Change-API-Implementation.patch rename to patches/server/0850-Multi-Block-Change-API-Implementation.patch diff --git a/patches/server/0855-Fix-NotePlayEvent.patch b/patches/server/0851-Fix-NotePlayEvent.patch similarity index 100% rename from patches/server/0855-Fix-NotePlayEvent.patch rename to patches/server/0851-Fix-NotePlayEvent.patch diff --git a/patches/server/0856-Freeze-Tick-Lock-API.patch b/patches/server/0852-Freeze-Tick-Lock-API.patch similarity index 87% rename from patches/server/0856-Freeze-Tick-Lock-API.patch rename to patches/server/0852-Freeze-Tick-Lock-API.patch index 71987cc46..1508c0306 100644 --- a/patches/server/0856-Freeze-Tick-Lock-API.patch +++ b/patches/server/0852-Freeze-Tick-Lock-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Freeze Tick Lock API diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9b5bd68f328306e26eced7d3112b2c01301b543b..9ca080e2745686fc2e39485965ec54c5de0bae6e 100644 +index a2cc34d6a81b7278eacbf980ccf7f275377ee2a8..3393816f563b3af95914da2bbd338e542b7c8ec0 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -332,6 +332,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -335,6 +335,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i private org.bukkit.util.Vector origin; @javax.annotation.Nullable private UUID originWorld; @@ -16,7 +16,7 @@ index 9b5bd68f328306e26eced7d3112b2c01301b543b..9ca080e2745686fc2e39485965ec54c5 public void setOrigin(@javax.annotation.Nonnull Location location) { this.origin = location.toVector(); -@@ -758,7 +759,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -762,7 +763,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i this.setRemainingFireTicks(this.remainingFireTicks - 1); } @@ -25,7 +25,7 @@ index 9b5bd68f328306e26eced7d3112b2c01301b543b..9ca080e2745686fc2e39485965ec54c5 this.setTicksFrozen(0); this.level.levelEvent((Player) null, 1009, this.blockPosition, 1); } -@@ -2158,6 +2159,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2163,6 +2164,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i if (fromNetherPortal) { nbt.putBoolean("Paper.FromNetherPortal", true); } @@ -35,7 +35,7 @@ index 9b5bd68f328306e26eced7d3112b2c01301b543b..9ca080e2745686fc2e39485965ec54c5 // Paper end return nbt; } catch (Throwable throwable) { -@@ -2326,6 +2330,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2331,6 +2335,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i if (spawnReason == null) { spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; } @@ -46,10 +46,10 @@ index 9b5bd68f328306e26eced7d3112b2c01301b543b..9ca080e2745686fc2e39485965ec54c5 } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index a7f302a9d22e0475ec295ca69ba17770d668ae30..9822d163a9e4d6ac8240c18a7082e911788d0948 100644 +index a1c43c61ab3a618f864bfefb9e481386d82621e8..fdd76d1a1636f30f519c434b41061d826c4a8261 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3308,7 +3308,7 @@ public abstract class LivingEntity extends Entity { +@@ -3311,7 +3311,7 @@ public abstract class LivingEntity extends Entity { boolean flag1 = this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES); int i; diff --git a/patches/server/0857-Dolphin-API.patch b/patches/server/0853-Dolphin-API.patch similarity index 100% rename from patches/server/0857-Dolphin-API.patch rename to patches/server/0853-Dolphin-API.patch diff --git a/patches/server/0859-More-PotionEffectType-API.patch b/patches/server/0854-More-PotionEffectType-API.patch similarity index 100% rename from patches/server/0859-More-PotionEffectType-API.patch rename to patches/server/0854-More-PotionEffectType-API.patch diff --git a/patches/server/0860-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch b/patches/server/0855-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch similarity index 92% rename from patches/server/0860-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch rename to patches/server/0855-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch index 7380887e9..3b79f9947 100644 --- a/patches/server/0860-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch +++ b/patches/server/0855-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use a CHM for StructureTemplate.Pallete cache fixes a CME due to this collection being shared across threads diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -index ef8dd3fa4f7ac8f85ae508999264850659bf9606..ac80779956ac2f8aa83166d3d2282352ebe1901d 100644 +index 129ebb095c2280376a59b54920e5ff90cf1f465a..c5827e4d870a0bba483649d54cae23072eab2b18 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java @@ -831,7 +831,7 @@ public class StructureTemplate { diff --git a/patches/server/0861-API-for-creating-command-sender-which-forwards-feedb.patch b/patches/server/0856-API-for-creating-command-sender-which-forwards-feedb.patch similarity index 97% rename from patches/server/0861-API-for-creating-command-sender-which-forwards-feedb.patch rename to patches/server/0856-API-for-creating-command-sender-which-forwards-feedb.patch index 853a37cb4..898e20bdf 100644 --- a/patches/server/0861-API-for-creating-command-sender-which-forwards-feedb.patch +++ b/patches/server/0856-API-for-creating-command-sender-which-forwards-feedb.patch @@ -123,10 +123,10 @@ index 0000000000000000000000000000000000000000..f7c86155ce0cfd9b4bf8a2b79d77a656 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 51c325be202ed141eea3e24b44dd7ff38b206d20..b3db64bbb4e06e5a04a632a5b8f2939de227527c 100644 +index d996661dbe9eea5ac2a3505a95f8630f3c81065d..2ebacb84f70c63c304cb709e11fe265a0dfd48db 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1984,6 +1984,13 @@ public final class CraftServer implements Server { +@@ -1976,6 +1976,13 @@ public final class CraftServer implements Server { return console.console; } diff --git a/patches/server/0862-Implement-regenerateChunk.patch b/patches/server/0857-Implement-regenerateChunk.patch similarity index 96% rename from patches/server/0862-Implement-regenerateChunk.patch rename to patches/server/0857-Implement-regenerateChunk.patch index d3cdef66a..c7840812c 100644 --- a/patches/server/0862-Implement-regenerateChunk.patch +++ b/patches/server/0857-Implement-regenerateChunk.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Implement regenerateChunk Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d113ec9b4d371f6468f59b1d85ebdf5adb8e3971..23bd74836e8396720747540829c7b8e27cfb00bd 100644 +index d9e883a936bc4b6bb12a4c28f2174994bc3ec710..72df27de006121fe21d1cc4c5f50dbc4a23fc505 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -129,6 +129,7 @@ import org.bukkit.util.Vector; +@@ -132,6 +132,7 @@ import org.bukkit.util.Vector; public class CraftWorld extends CraftRegionAccessor implements World { public static final int CUSTOM_DIMENSION_OFFSET = 10; private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); @@ -17,7 +17,7 @@ index d113ec9b4d371f6468f59b1d85ebdf5adb8e3971..23bd74836e8396720747540829c7b8e2 private final ServerLevel world; private WorldBorder worldBorder; -@@ -438,27 +439,61 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -441,27 +442,61 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean regenerateChunk(int x, int z) { org.spigotmc.AsyncCatcher.catchOp("chunk regenerate"); // Spigot diff --git a/patches/server/0863-Log-exceptions-thrown-during-chat-processing.patch b/patches/server/0858-Log-exceptions-thrown-during-chat-processing.patch similarity index 100% rename from patches/server/0863-Log-exceptions-thrown-during-chat-processing.patch rename to patches/server/0858-Log-exceptions-thrown-during-chat-processing.patch diff --git a/patches/server/0865-Fix-cancelled-powdered-snow-bucket-placement.patch b/patches/server/0859-Fix-cancelled-powdered-snow-bucket-placement.patch similarity index 93% rename from patches/server/0865-Fix-cancelled-powdered-snow-bucket-placement.patch rename to patches/server/0859-Fix-cancelled-powdered-snow-bucket-placement.patch index f121404e9..9a95fdb1d 100644 --- a/patches/server/0865-Fix-cancelled-powdered-snow-bucket-placement.patch +++ b/patches/server/0859-Fix-cancelled-powdered-snow-bucket-placement.patch @@ -20,10 +20,10 @@ index 893d5bf448ddbccb30db0ee751c7f4a4e83634b9..8f3b9b8784f0d7b137a1ad87655ee8ba } return InteractionResult.FAIL; diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 66f808cabcf6a9a6584849b285f1c60133adc7b4..8bd12326e591213f0a093b96a5af3f04e19dc980 100644 +index a61a309bb921deba8b8022bc4e9fd04c2f8eba63..dc4639f905fb71435daf29c61f64621a3e2cc533 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -315,7 +315,7 @@ public final class ItemStack { +@@ -325,7 +325,7 @@ public final class ItemStack { int oldCount = this.getCount(); ServerLevel world = (ServerLevel) itemactioncontext.getLevel(); @@ -32,7 +32,7 @@ index 66f808cabcf6a9a6584849b285f1c60133adc7b4..8bd12326e591213f0a093b96a5af3f04 world.captureBlockStates = true; // special case bonemeal if (this.getItem() == Items.BONE_MEAL) { -@@ -369,7 +369,7 @@ public final class ItemStack { +@@ -379,7 +379,7 @@ public final class ItemStack { world.capturedBlockStates.clear(); if (blocks.size() > 1) { placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockMultiPlaceEvent(world, entityhuman, enumhand, blocks, blockposition.getX(), blockposition.getY(), blockposition.getZ()); diff --git a/patches/server/0866-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch b/patches/server/0860-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch similarity index 86% rename from patches/server/0866-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch rename to patches/server/0860-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch index c48de1cd8..ac26ffed5 100644 --- a/patches/server/0866-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch +++ b/patches/server/0860-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add missing Validate calls to CraftServer#getSpawnLimit Copies appropriate checks from CraftWorld#getSpawnLimit diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index ff5c06e261945bbd7730662cdb79167f160c661e..f0629cac377b29246e990a01d60601270cbd77bd 100644 +index 2ebacb84f70c63c304cb709e11fe265a0dfd48db..640cfb7cf792e2e61417cc93627b43db8dc9bcc9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2153,6 +2153,8 @@ public final class CraftServer implements Server { +@@ -2145,6 +2145,8 @@ public final class CraftServer implements Server { @Override public int getSpawnLimit(SpawnCategory spawnCategory) { // Paper start diff --git a/patches/server/0861-Add-GameEvent-tags.patch b/patches/server/0861-Add-GameEvent-tags.patch new file mode 100644 index 000000000..7ee9115b3 --- /dev/null +++ b/patches/server/0861-Add-GameEvent-tags.patch @@ -0,0 +1,81 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 3 Jan 2021 20:03:35 -0800 +Subject: [PATCH] Add GameEvent tags + + +diff --git a/src/main/java/io/papermc/paper/CraftGameEventTag.java b/src/main/java/io/papermc/paper/CraftGameEventTag.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d5d3c66afb408026513ac436eb1f4fdd381847bf +--- /dev/null ++++ b/src/main/java/io/papermc/paper/CraftGameEventTag.java +@@ -0,0 +1,30 @@ ++package io.papermc.paper; ++ ++import net.minecraft.core.Registry; ++import net.minecraft.resources.ResourceKey; ++import net.minecraft.tags.TagKey; ++import org.bukkit.GameEvent; ++import org.bukkit.craftbukkit.tag.CraftTag; ++import org.bukkit.craftbukkit.util.CraftNamespacedKey; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.Objects; ++import java.util.Set; ++import java.util.stream.Collectors; ++ ++public class CraftGameEventTag extends CraftTag { ++ ++ public CraftGameEventTag(net.minecraft.core.Registry registry, TagKey tag) { ++ super(registry, tag); ++ } ++ ++ @Override ++ public boolean isTagged(@NotNull GameEvent item) { ++ return registry.getHolderOrThrow(ResourceKey.create(Registry.GAME_EVENT_REGISTRY, CraftNamespacedKey.toMinecraft(item.getKey()))).is(tag); ++ } ++ ++ @Override ++ public @NotNull Set getValues() { ++ return getHandle().stream().map((nms) -> Objects.requireNonNull(GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(Registry.GAME_EVENT.getKey(nms.value()))), nms + " is not a recognized game event")).collect(Collectors.toUnmodifiableSet()); ++ } ++} +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 640cfb7cf792e2e61417cc93627b43db8dc9bcc9..b858ac57ff2b802a8eeec731cfd932ee266bff17 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -97,6 +97,7 @@ import net.minecraft.world.level.biome.BiomeSource; + import net.minecraft.world.level.block.Block; + import net.minecraft.world.level.dimension.DimensionType; + import net.minecraft.world.level.dimension.LevelStem; ++import net.minecraft.world.level.gameevent.GameEvent; + import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator; + import net.minecraft.world.level.levelgen.PatrolSpawner; + import net.minecraft.world.level.levelgen.PhantomSpawner; +@@ -2553,6 +2554,12 @@ public final class CraftServer implements Server { + Preconditions.checkArgument(clazz == org.bukkit.entity.EntityType.class, "Entity type namespace must have entity type"); + + return (org.bukkit.Tag) new CraftEntityTag(Registry.ENTITY_TYPE, TagKey.create(Registry.ENTITY_TYPE_REGISTRY, key)); ++ // Paper start ++ case org.bukkit.Tag.REGISTRY_GAME_EVENTS: ++ Preconditions.checkArgument(clazz == org.bukkit.GameEvent.class, "Game Event namespace must have GameEvent type"); ++ ++ return (org.bukkit.Tag) new io.papermc.paper.CraftGameEventTag(Registry.GAME_EVENT, TagKey.create(Registry.GAME_EVENT_REGISTRY, key)); ++ // Paper end + default: + throw new IllegalArgumentException(); + } +@@ -2582,6 +2589,13 @@ public final class CraftServer implements Server { + + Registry> entityTags = Registry.ENTITY_TYPE; + return entityTags.getTags().map(pair -> (org.bukkit.Tag) new CraftEntityTag(entityTags, pair.getFirst())).collect(ImmutableList.toImmutableList()); ++ // Paper start ++ case org.bukkit.Tag.REGISTRY_GAME_EVENTS: ++ Preconditions.checkArgument(clazz == org.bukkit.GameEvent.class); ++ ++ Registry gameEvents = Registry.GAME_EVENT; ++ return gameEvents.getTags().map(pair -> (org.bukkit.Tag) new io.papermc.paper.CraftGameEventTag(gameEvents, pair.getFirst())).collect(ImmutableList.toImmutableList()); ++ // Paper end + default: + throw new IllegalArgumentException(); + } diff --git a/patches/server/0868-Replace-player-chunk-loader-system.patch b/patches/server/0862-Replace-player-chunk-loader-system.patch similarity index 93% rename from patches/server/0868-Replace-player-chunk-loader-system.patch rename to patches/server/0862-Replace-player-chunk-loader-system.patch index da0839491..e6238d216 100644 --- a/patches/server/0868-Replace-player-chunk-loader-system.patch +++ b/patches/server/0862-Replace-player-chunk-loader-system.patch @@ -84,10 +84,10 @@ index 5e3b7fb2e0b7608610555cd23e7ad25a05883181..1cb0aae3e0c619a715766e0fa604dfd9 })); diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 66501c3b0eb92d946ef77bbd3f36ebcc0d3023af..153f07bac06093b43a1f5b0f8e1a46ffbe6407e5 100644 +index 19f93d3bbac34ca40000965ce515e17c2ffe2603..ba8323c62212c8daa10b17af61759ac68856d19c 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -650,4 +650,33 @@ public class PaperConfig { +@@ -645,4 +645,33 @@ public class PaperConfig { private static void timeCommandAffectsAllWorlds() { timeCommandAffectsAllWorlds = getBoolean("settings.time-command-affects-all-worlds", timeCommandAffectsAllWorlds); } @@ -1236,10 +1236,10 @@ index 0000000000000000000000000000000000000000..9ad84dc6f0463dbbbdd53723edcc2a3e + } +} diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 81dde0efc1a06420c0791520b9e40b24dd1f0318..7b8f9cf06833860d0fc02399822e6aea214883ed 100644 +index 42400b6f0b693dd0ec4a2303a82bd131753a24ba..9bbf990212ee55a267d0eb1e863618c50fa706da 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -95,6 +95,28 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -105,6 +105,28 @@ public class Connection extends SimpleChannelInboundHandler> { public boolean queueImmunity = false; public ConnectionProtocol protocol; // Paper end @@ -1268,7 +1268,7 @@ index 81dde0efc1a06420c0791520b9e40b24dd1f0318..7b8f9cf06833860d0fc02399822e6aea // Paper start - allow controlled flushing volatile boolean canFlush = true; -@@ -466,6 +488,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -478,6 +500,7 @@ public class Connection extends SimpleChannelInboundHandler> { return false; } private boolean processQueue() { @@ -1276,7 +1276,7 @@ index 81dde0efc1a06420c0791520b9e40b24dd1f0318..7b8f9cf06833860d0fc02399822e6aea if (this.queue.isEmpty()) return true; // Paper start - make only one flush call per sendPacketQueue() call final boolean needsFlush = this.canFlush; -@@ -497,6 +520,12 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -509,6 +532,12 @@ public class Connection extends SimpleChannelInboundHandler> { } } return true; @@ -1304,10 +1304,10 @@ index b61abf227a04b4565c2525e5f469db30c3a545a5..7bddc7517356cc74104dcc5c7c55522a worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange); worldData.addProperty("visible-chunk-count", visibleChunks.size()); diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 9c4e4ab16441555d7940863b6736a03ee4af545c..1501759a44bd17a623a852b887b660cbd2780627 100644 +index 36b6e7295cf7484675c8c2b9624c1f6fea7aed1d..38db3905f47fefb5c958fa24aef2313eae68753c 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -73,6 +73,17 @@ public class ChunkHolder { +@@ -76,6 +76,17 @@ public class ChunkHolder { public ServerLevel getWorld() { return chunkMap.level; } // Paper boolean isUpdateQueued = false; // Paper private final ChunkMap chunkMap; // Paper @@ -1325,7 +1325,7 @@ index 9c4e4ab16441555d7940863b6736a03ee4af545c..1501759a44bd17a623a852b887b660cb // Paper start - optimise anyPlayerCloseEnoughForSpawning // cached here to avoid a map lookup -@@ -257,7 +268,7 @@ public class ChunkHolder { +@@ -261,7 +272,7 @@ public class ChunkHolder { public void blockChanged(BlockPos pos) { if (!pos.isInsideBuildHeightAndWorldBoundsHorizontal(levelHeightAccessor)) return; // Paper - SPIGOT-6086 for all invalid locations; avoid acquiring locks @@ -1334,16 +1334,21 @@ index 9c4e4ab16441555d7940863b6736a03ee4af545c..1501759a44bd17a623a852b887b660cb if (chunk != null) { int i = this.levelHeightAccessor.getSectionIndex(pos.getY()); -@@ -273,7 +284,7 @@ public class ChunkHolder { +@@ -277,11 +288,11 @@ public class ChunkHolder { } public void sectionLightChanged(LightLayer lightType, int y) { -- LevelChunk chunk = this.getTickingChunk(); -+ LevelChunk chunk = this.getSendingChunk(); // Paper - no-tick view distance +- LevelChunk chunk = this.getFullChunk(); ++ ChunkAccess chunk = this.getAvailableChunkNow(); // Paper - no-tick view distance if (chunk != null) { chunk.setUnsaved(true); -@@ -375,9 +386,28 @@ public class ChunkHolder { +- LevelChunk chunk1 = this.getTickingChunk(); ++ LevelChunk chunk1 = this.getSendingChunk(); // Paper - no-tick view distance + + if (chunk1 != null) { + int j = this.lightEngine.getMinLightSection(); +@@ -383,9 +394,28 @@ public class ChunkHolder { } public void broadcast(Packet packet, boolean onlyOnWatchDistanceEdge) { @@ -1376,10 +1381,10 @@ index 9c4e4ab16441555d7940863b6736a03ee4af545c..1501759a44bd17a623a852b887b660cb public CompletableFuture> getOrScheduleFuture(ChunkStatus targetStatus, ChunkMap chunkStorage) { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fdf9e923a8 100644 +index a0075aed85fc51cc48e01ecf2b187b04078fb488..becb3fb122ead85875958aa20de34b7f0ad7e371 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -213,6 +213,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -217,6 +217,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap; // this map is absent from updateMaps since it's controlled at the start of the chunkproviderserver tick public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerChunkTickRangeMap; // Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning @@ -1387,7 +1392,7 @@ index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fd // Paper start - use distance map to optimise tracker public static boolean isLegacyTrackingEntity(Entity entity) { return entity.isLegacyTrackingEntity; -@@ -232,6 +233,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -236,6 +237,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // Paper end - use distance map to optimise tracker void addPlayerToDistanceMaps(ServerPlayer player) { @@ -1395,7 +1400,7 @@ index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fd int chunkX = MCUtil.getChunkCoordinate(player.getX()); int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); // Paper start - use distance map to optimise entity tracker -@@ -239,7 +241,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -243,7 +245,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider com.destroystokyo.paper.util.misc.PlayerAreaMap trackMap = this.playerEntityTrackerTrackMaps[i]; int trackRange = this.entityTrackerTrackRanges[i]; @@ -1404,7 +1409,7 @@ index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fd } // Paper end - use distance map to optimise entity tracker // Note: players need to be explicitly added to distance maps before they can be updated -@@ -269,6 +271,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -273,6 +275,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.playerMobDistanceMap.remove(player); } // Paper end - per player mob spawning @@ -1412,7 +1417,7 @@ index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fd } void updateMaps(ServerPlayer player) { -@@ -280,7 +283,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -284,7 +287,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider com.destroystokyo.paper.util.misc.PlayerAreaMap trackMap = this.playerEntityTrackerTrackMaps[i]; int trackRange = this.entityTrackerTrackRanges[i]; @@ -1421,7 +1426,7 @@ index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fd } // Paper end - use distance map to optimise entity tracker this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning -@@ -290,6 +293,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -294,6 +297,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.playerMobDistanceMap.update(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance()); } // Paper end - per player mob spawning @@ -1429,7 +1434,7 @@ index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fd } // Paper end // Paper start -@@ -1396,11 +1400,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1436,11 +1440,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider completablefuture1.thenAcceptAsync((either) -> { either.ifLeft((chunk) -> { this.tickingGenerated.getAndIncrement(); @@ -1442,7 +1447,7 @@ index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fd }); }, (runnable) -> { this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable)); -@@ -1557,33 +1557,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1609,33 +1609,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider int k = this.viewDistance; this.viewDistance = j; @@ -1485,7 +1490,7 @@ index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fd if (chunk != null) { this.playerLoadedChunk(player, packet, chunk); -@@ -1614,7 +1605,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1666,7 +1657,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider void dumpChunks(Writer writer) throws IOException { CsvOutput csvwriter = CsvOutput.builder().addColumn("x").addColumn("z").addColumn("level").addColumn("in_memory").addColumn("status").addColumn("full_status").addColumn("accessible_ready").addColumn("ticking_ready").addColumn("entity_ticking_ready").addColumn("ticket").addColumn("spawning").addColumn("block_entity_count").addColumn("ticking_ticket").addColumn("ticking_level").addColumn("block_ticks").addColumn("fluid_ticks").build(writer); @@ -1494,7 +1499,7 @@ index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fd ObjectBidirectionalIterator objectbidirectionaliterator = this.updatingChunks.getVisibleMap().clone().long2ObjectEntrySet().fastIterator(); // Paper while (objectbidirectionaliterator.hasNext()) { -@@ -1630,7 +1621,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1682,7 +1673,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // CraftBukkit - decompile error csvwriter.writeRow(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(ChunkAccess::getStatus).orElse(null), optional1.map(LevelChunk::getFullStatus).orElse(null), ChunkMap.printFuture(playerchunk.getFullChunkFuture()), ChunkMap.printFuture(playerchunk.getTickingChunkFuture()), ChunkMap.printFuture(playerchunk.getEntityTickingChunkFuture()), this.distanceManager.getTicketDebugString(i), this.anyPlayerCloseEnoughForSpawning(chunkcoordintpair), optional1.map((chunk) -> { return chunk.getBlockEntities().size(); @@ -1503,7 +1508,7 @@ index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fd return chunk.getBlockTicks().count(); }).orElse(0), optional1.map((chunk) -> { return chunk.getFluidTicks().count(); -@@ -1847,15 +1838,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1899,15 +1890,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.removePlayerFromDistanceMaps(player); // Paper - distance maps } @@ -1520,7 +1525,7 @@ index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fd } -@@ -1863,7 +1846,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1915,7 +1898,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider SectionPos sectionposition = SectionPos.of((Entity) player); player.setLastSectionPos(sectionposition); @@ -1529,7 +1534,7 @@ index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fd return sectionposition; } -@@ -1908,65 +1891,40 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1960,65 +1943,40 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider int k1; int l1; @@ -1617,7 +1622,7 @@ index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fd } public void addEntity(Entity entity) { -@@ -2335,7 +2293,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -2387,7 +2345,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider double vec3d_dx = player.getX() - this.entity.getX(); double vec3d_dz = player.getZ() - this.entity.getZ(); // Paper end - remove allocation of Vec3D here @@ -1627,10 +1632,10 @@ index 6a035b173cf0d288b2912f568078fede45d138f2..afef3ea6d1ae5f145261eaae3da720fd double d2 = d0 * d0; boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player); diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index 7c66e4ed02c80521196b4ca797477dd9573752d8..fd379155a67794288f7cdae3250767bc3615d421 100644 +index 005d75c93387a8c34a9ff7413ba09cb1ae788a74..1c8020435ab8eb5fec68dc5bf473650f2658bdac 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -49,8 +49,8 @@ public abstract class DistanceManager { +@@ -50,8 +50,8 @@ public abstract class DistanceManager { public final Long2ObjectOpenHashMap>> tickets = new Long2ObjectOpenHashMap(); private final DistanceManager.ChunkTicketTracker ticketTracker = new DistanceManager.ChunkTicketTracker(); public static final int MOB_SPAWN_RANGE = 8; // private final ChunkMapDistance.b f = new ChunkMapDistance.b(8); // Paper - no longer used @@ -1641,7 +1646,7 @@ index 7c66e4ed02c80521196b4ca797477dd9573752d8..fd379155a67794288f7cdae3250767bc // Paper start use a queue, but still keep unique requirement public final java.util.Queue pendingChunkUpdates = new java.util.ArrayDeque() { @Override -@@ -91,7 +91,7 @@ public abstract class DistanceManager { +@@ -92,7 +92,7 @@ public abstract class DistanceManager { java.util.function.Predicate> removeIf = (ticket) -> { final boolean ret = ticket.timedOut(ticketCounter); if (ret) { @@ -1650,7 +1655,7 @@ index 7c66e4ed02c80521196b4ca797477dd9573752d8..fd379155a67794288f7cdae3250767bc } return ret; }; -@@ -111,7 +111,7 @@ public abstract class DistanceManager { +@@ -112,7 +112,7 @@ public abstract class DistanceManager { if (ticket.timedOut(this.ticketTickCounter)) { iterator.remove(); flag = true; @@ -1659,7 +1664,7 @@ index 7c66e4ed02c80521196b4ca797477dd9573752d8..fd379155a67794288f7cdae3250767bc } } -@@ -141,9 +141,9 @@ public abstract class DistanceManager { +@@ -142,9 +142,9 @@ public abstract class DistanceManager { public boolean runAllUpdates(ChunkMap chunkStorage) { //this.f.a(); // Paper - no longer used @@ -1671,25 +1676,25 @@ index 7c66e4ed02c80521196b4ca797477dd9573752d8..fd379155a67794288f7cdae3250767bc int i = Integer.MAX_VALUE - this.ticketTracker.runDistanceUpdates(Integer.MAX_VALUE); boolean flag = i != 0; -@@ -282,7 +282,7 @@ public abstract class DistanceManager { - long j = pos.toLong(); +@@ -277,7 +277,7 @@ public abstract class DistanceManager { + long j = chunkcoordintpair.toLong(); - this.addTicket(j, ticket); + boolean added = this.addTicket(j, ticket); // CraftBukkit - this.tickingTicketsTracker.addTicket(j, ticket); + //this.tickingTicketsTracker.addTicket(j, ticket); // Paper - no longer used + return added; // CraftBukkit } - public void removeRegionTicket(TicketType type, ChunkPos pos, int radius, T argument) { -@@ -290,7 +290,7 @@ public abstract class DistanceManager { - long j = pos.toLong(); +@@ -292,7 +292,7 @@ public abstract class DistanceManager { + long j = chunkcoordintpair.toLong(); - this.removeTicket(j, ticket); + boolean removed = this.removeTicket(j, ticket); // CraftBukkit - this.tickingTicketsTracker.removeTicket(j, ticket); + //this.tickingTicketsTracker.removeTicket(j, ticket); // Paper - no longer used + return removed; // CraftBukkit } - private SortedArraySet> getTickets(long position) { -@@ -411,10 +411,10 @@ public abstract class DistanceManager { +@@ -414,10 +414,10 @@ public abstract class DistanceManager { if (forced) { this.addTicket(i, ticket); @@ -1702,7 +1707,7 @@ index 7c66e4ed02c80521196b4ca797477dd9573752d8..fd379155a67794288f7cdae3250767bc } } -@@ -427,8 +427,8 @@ public abstract class DistanceManager { +@@ -430,8 +430,8 @@ public abstract class DistanceManager { return new ObjectOpenHashSet(); })).add(player); //this.f.update(i, 0, true); // Paper - no longer used @@ -1713,7 +1718,7 @@ index 7c66e4ed02c80521196b4ca797477dd9573752d8..fd379155a67794288f7cdae3250767bc } public void removePlayer(SectionPos pos, ServerPlayer player) { -@@ -441,8 +441,8 @@ public abstract class DistanceManager { +@@ -444,8 +444,8 @@ public abstract class DistanceManager { if (objectset == null || objectset.isEmpty()) { // Paper this.playersPerChunk.remove(i); //this.f.update(i, Integer.MAX_VALUE, false); // Paper - no longer used @@ -1724,7 +1729,7 @@ index 7c66e4ed02c80521196b4ca797477dd9573752d8..fd379155a67794288f7cdae3250767bc } } -@@ -452,11 +452,17 @@ public abstract class DistanceManager { +@@ -455,11 +455,17 @@ public abstract class DistanceManager { } public boolean inEntityTickingRange(long chunkPos) { @@ -1744,7 +1749,7 @@ index 7c66e4ed02c80521196b4ca797477dd9573752d8..fd379155a67794288f7cdae3250767bc } protected String getTicketDebugString(long pos) { -@@ -466,20 +472,16 @@ public abstract class DistanceManager { +@@ -469,20 +475,16 @@ public abstract class DistanceManager { } protected void updatePlayerTickets(int viewDistance) { @@ -1768,7 +1773,7 @@ index 7c66e4ed02c80521196b4ca797477dd9573752d8..fd379155a67794288f7cdae3250767bc } // Paper end -@@ -536,10 +538,7 @@ public abstract class DistanceManager { +@@ -539,10 +541,7 @@ public abstract class DistanceManager { } @@ -1778,9 +1783,9 @@ index 7c66e4ed02c80521196b4ca797477dd9573752d8..fd379155a67794288f7cdae3250767bc - } + // Paper - replace player chunk loader - // CraftBukkit start - public void removeAllTicketsFor(TicketType ticketType, int ticketLevel, T ticketIdentifier) { -@@ -606,6 +605,7 @@ public abstract class DistanceManager { + public void removeTicketsOnClosing() { + ImmutableSet> immutableset = ImmutableSet.of(TicketType.UNKNOWN, TicketType.POST_TELEPORT, TicketType.LIGHT); +@@ -643,6 +642,7 @@ public abstract class DistanceManager { } } @@ -1788,17 +1793,17 @@ index 7c66e4ed02c80521196b4ca797477dd9573752d8..fd379155a67794288f7cdae3250767bc private class FixedPlayerDistanceChunkTracker extends ChunkTracker { protected final Long2ByteMap chunks = new Long2ByteOpenHashMap(); -@@ -779,4 +779,5 @@ public abstract class DistanceManager { +@@ -816,4 +816,5 @@ public abstract class DistanceManager { return distance <= this.viewDistance - 2; } } + */ // Paper - replace old loader system } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 98be0ea366732695f76bc5b1a78e0a36060515bd..e20fc528b85a8278bffab32845daac2208836748 100644 +index ef5321f230f66383e3760bf97e7eca1be3a5b02e..96cdb8746b404e7080f7f53da14d49e596dddc75 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -855,17 +855,10 @@ public class ServerChunkCache extends ChunkSource { +@@ -851,17 +851,10 @@ public class ServerChunkCache extends ChunkSource { // Paper end public boolean isPositionTicking(long pos) { @@ -1820,31 +1825,31 @@ index 98be0ea366732695f76bc5b1a78e0a36060515bd..e20fc528b85a8278bffab32845daac22 } public void save(boolean flush) { -@@ -921,6 +914,7 @@ public class ServerChunkCache extends ChunkSource { - this.level.timings.doChunkMap.stopTiming(); // Spigot +@@ -918,6 +911,7 @@ public class ServerChunkCache extends ChunkSource { this.level.getProfiler().popPush("chunks"); - this.level.timings.chunks.startTiming(); // Paper - timings -+ this.chunkMap.playerChunkManager.tick(); // Paper - this is mostly is to account for view distance changes - this.tickChunks(); - this.level.timings.chunks.stopTiming(); // Paper - timings - this.level.timings.doChunkUnload.startTiming(); // Spigot -@@ -1032,13 +1026,13 @@ public class ServerChunkCache extends ChunkSource { + if (tickChunks) { + this.level.timings.chunks.startTiming(); // Paper - timings ++ this.chunkMap.playerChunkManager.tick(); // Paper - this is mostly is to account for view distance changes + this.tickChunks(); + this.level.timings.chunks.stopTiming(); // Paper - timings + } +@@ -1031,13 +1025,13 @@ public class ServerChunkCache extends ChunkSource { // Paper end - optimise chunk tick iteration ChunkPos chunkcoordintpair = chunk1.getPos(); -- if (this.level.isPositionEntityTicking(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, false)) { // Paper - optimise anyPlayerCloseEnoughForSpawning -+ if ((true || this.level.isPositionEntityTicking(chunkcoordintpair)) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, false)) { // Paper - optimise anyPlayerCloseEnoughForSpawning // Paper - replace player chunk loader system +- if (this.level.isNaturalSpawningAllowed(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, false)) { // Paper - optimise anyPlayerCloseEnoughForSpawning ++ if ((true || this.level.isNaturalSpawningAllowed(chunkcoordintpair)) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, false)) { // Paper - optimise anyPlayerCloseEnoughForSpawning // Paper - replace player chunk loader system chunk1.incrementInhabitedTime(j); if (flag2 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(holder, chunkcoordintpair, true)) { // Spigot // Paper - optimise anyPlayerCloseEnoughForSpawning & optimise chunk tick iteration NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1); } - if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { -+ if ((true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong()))) { // Paper - replace player chunk loader system ++ if (true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { // Paper - replace player chunk loader system this.level.tickChunk(chunk1, k); if ((chunksTicked++ & 1) == 0) net.minecraft.server.MinecraftServer.getServer().executeMidTickTasks(); // Paper } -@@ -1261,6 +1255,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -1262,6 +1256,7 @@ public class ServerChunkCache extends ChunkSource { public boolean pollTask() { try { boolean execChunkTask = com.destroystokyo.paper.io.chunk.ChunkTaskManager.pollChunkWaitQueue() || ServerChunkCache.this.level.asyncChunkTaskManager.pollNextChunkTask(); // Paper @@ -1853,10 +1858,10 @@ index 98be0ea366732695f76bc5b1a78e0a36060515bd..e20fc528b85a8278bffab32845daac22 return true; } else { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 24b0912f3a99c19103f2a07e6f6ba66e23afe3bc..835a17cd4ec487271ba28232280dd0fbf2687c4b 100644 +index 4df54aa0828e79960469576cf1adaf002f32d8d3..19e0648c47733dc1973d6ff2ccba2ba6a25f48de 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -655,7 +655,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -658,7 +658,7 @@ public class ServerLevel extends Level implements WorldGenLevel { gameprofilerfiller.push("checkDespawn"); entity.checkDespawn(); gameprofilerfiller.pop(); @@ -1865,7 +1870,7 @@ index 24b0912f3a99c19103f2a07e6f6ba66e23afe3bc..835a17cd4ec487271ba28232280dd0fb Entity entity1 = entity.getVehicle(); if (entity1 != null) { -@@ -686,7 +686,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -689,7 +689,10 @@ public class ServerLevel extends Level implements WorldGenLevel { @Override public boolean shouldTickBlocksAt(long chunkPos) { @@ -1877,7 +1882,7 @@ index 24b0912f3a99c19103f2a07e6f6ba66e23afe3bc..835a17cd4ec487271ba28232280dd0fb } protected void tickTime() { -@@ -2369,7 +2372,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2370,7 +2373,7 @@ public class ServerLevel extends Level implements WorldGenLevel { private boolean isPositionTickingWithEntitiesLoaded(long chunkPos) { // Paper start - optimize is ticking ready type functions ChunkHolder chunkHolder = this.chunkSource.chunkMap.getVisibleChunkIfPresent(chunkPos); @@ -1887,35 +1892,33 @@ index 24b0912f3a99c19103f2a07e6f6ba66e23afe3bc..835a17cd4ec487271ba28232280dd0fb } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 7b23535a680d2a8534dcb8dd87770f66fb982c13..470dbed47830e2f580c090bc762a7be5cf389ce5 100644 +index b4d20c06a19e021317cff64a9789f0579b5f921d..e74c13e7aaa144fcd07036de70e80bebf0be698a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -168,7 +168,7 @@ import org.bukkit.inventory.MainHand; - - public class ServerPlayer extends Player { +@@ -2436,5 +2436,5 @@ public class ServerPlayer extends Player { + } + // CraftBukkit end - public final int getViewDistance() { return this.getLevel().getChunkSource().chunkMap.viewDistance - 1; } // Paper - placeholder + public final int getViewDistance() { throw new UnsupportedOperationException("Use PlayerChunkLoader"); } // Paper - placeholder - - private static final Logger LOGGER = LogManager.getLogger(); - public long lastSave = MinecraftServer.currentTick; // Paper + } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index cd08f9b16c065be8f0eacaeba51d3e72d332daf9..7a0c1ba40156df69bbbf36d96bed0950130d2351 100644 +index 0766abd7334bc76b57fd509c8890701704aa217c..d14b079ae53628c9bf9a7c261f0b195c7351c2e6 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -271,7 +271,7 @@ public abstract class PlayerList { boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO); // Spigot - view distance -- playerconnection.send(new ClientboundLoginPacket(player.getId(), worlddata.isHardcore(), player.gameMode.getGameModeForPlayer(), player.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.registryHolder, worldserver1.dimensionType(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), worldserver1.spigotConfig.viewDistance, worldserver1.spigotConfig.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat())); -+ playerconnection.send(new ClientboundLoginPacket(player.getId(), worlddata.isHardcore(), player.gameMode.getGameModeForPlayer(), player.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.registryHolder, worldserver1.dimensionType(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetSendDistance(), worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetTickViewDistance(), flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat())); // Paper - replace old player chunk management +- playerconnection.send(new ClientboundLoginPacket(player.getId(), worlddata.isHardcore(), player.gameMode.getGameModeForPlayer(), player.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.registryHolder, worldserver1.dimensionTypeRegistration(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), worldserver1.spigotConfig.viewDistance, worldserver1.spigotConfig.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat())); ++ playerconnection.send(new ClientboundLoginPacket(player.getId(), worlddata.isHardcore(), player.gameMode.getGameModeForPlayer(), player.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.registryHolder, worldserver1.dimensionTypeRegistration(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetSendDistance(), worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetTickViewDistance(), flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat())); // Paper - replace old player chunk management player.getBukkitEntity().sendSupportedChannels(); // CraftBukkit playerconnection.send(new ClientboundCustomPayloadPacket(ClientboundCustomPayloadPacket.BRAND, (new FriendlyByteBuf(Unpooled.buffer())).writeUtf(this.getServer().getServerModName()))); playerconnection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); @@ -942,8 +942,8 @@ public abstract class PlayerList { // CraftBukkit start LevelData worlddata = worldserver1.getLevelData(); - entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionType(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag)); + entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionTypeRegistration(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag)); - entityplayer1.connection.send(new ClientboundSetChunkCacheRadiusPacket(worldserver1.spigotConfig.viewDistance)); // Spigot - entityplayer1.connection.send(new ClientboundSetSimulationDistancePacket(worldserver1.spigotConfig.simulationDistance)); // Spigot + entityplayer1.connection.send(new ClientboundSetChunkCacheRadiusPacket(worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetSendDistance())); // Spigot // Paper - replace old player chunk management @@ -1942,10 +1945,10 @@ index cd08f9b16c065be8f0eacaeba51d3e72d332daf9..7a0c1ba40156df69bbbf36d96bed0950 while (iterator.hasNext()) { diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -index e17a3afa41fd628d2c4a3637ae19418e258a99b8..b74cdaecb361851b0662002c8ec8f196ab1275bd 100644 +index 7eebecf836d21fc4ee901d23d7061db64486c0d5..1eb76c456790b81b657090377dd5ea547898f9a5 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -647,7 +647,7 @@ public class EnderDragon extends Mob implements Enemy { +@@ -644,7 +644,7 @@ public class EnderDragon extends Mob implements Enemy { // this.world.b(1028, this.getChunkCoordinates(), 0); //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API for (net.minecraft.server.level.ServerPlayer player : (List) ((ServerLevel)level).players()) { @@ -1955,10 +1958,10 @@ index e17a3afa41fd628d2c4a3637ae19418e258a99b8..b74cdaecb361851b0662002c8ec8f196 double deltaZ = this.getZ() - player.getZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -index ede0ced64d74d71547d1b8bb6853c5aacc1b486a..c0ee9915c971482e765d91b4f85d65c3a1f526eb 100644 +index d347ab0a638a972ea53a982f29af40423919870c..563a028018421cbafdeff398175a32d6830134af 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -279,7 +279,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob +@@ -278,7 +278,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob // this.world.globalLevelEvent(1023, new BlockPosition(this), 0); //int viewDistance = ((ServerLevel) this.level).getCraftServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API for (ServerPlayer player : (List)this.level.players()) { // Paper @@ -1968,7 +1971,7 @@ index ede0ced64d74d71547d1b8bb6853c5aacc1b486a..c0ee9915c971482e765d91b4f85d65c3 double deltaZ = this.getZ() - player.getZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java -index 46ca1a11930c57813fbcbab7de7dd2fd47241f64..2429bdc5fc5150dcadbedf6c33810889c2444f54 100644 +index d9c20eca27382e89ddb13f1c8e84348242ca6ceb..c624a2cb0f4c9d7e12387ece574c1f9f74528b0c 100644 --- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java +++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java @@ -60,9 +60,10 @@ public class EnderEyeItem extends Item { @@ -1984,10 +1987,10 @@ index 46ca1a11930c57813fbcbab7de7dd2fd47241f64..2429bdc5fc5150dcadbedf6c33810889 double deltaZ = soundPos.getZ() - player.getZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index a0fb656be28a73c4d605eab0f7db05d205ebdc96..11e146241a01ab9ec206b9d3f39aebf5c201a16e 100644 +index 03824f73ecbac8ef6da586feb82f851557f82b6a..160c0f37aa3aaf7598f852acf9bd444f79444c97 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -655,6 +655,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -612,6 +612,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && (this.isClientSide || chunk == null || (chunk.getFullStatus() != null && chunk.getFullStatus().isOrAfter(ChunkHolder.FullChunkStatus.TICKING)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i); @@ -2000,7 +2003,7 @@ index a0fb656be28a73c4d605eab0f7db05d205ebdc96..11e146241a01ab9ec206b9d3f39aebf5 if ((i & 1) != 0) { 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 55c0e9655ded14e25b0f284ad0c1f99eb5d0b192..b47c4c9e9b82030cd82d72fe90d7c8bf558d6b28 100644 +index a141071966428315484480831a58f02a2b0bc025..d4ce71d98c5071cd3567c772a0853ca86550bad5 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -191,6 +191,43 @@ public class LevelChunk extends ChunkAccess { @@ -2079,10 +2082,10 @@ index 55c0e9655ded14e25b0f284ad0c1f99eb5d0b192..b47c4c9e9b82030cd82d72fe90d7c8bf @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 23bd74836e8396720747540829c7b8e27cfb00bd..2c3ce2065812de227c34506edddb439da9a07ba1 100644 +index 72df27de006121fe21d1cc4c5f50dbc4a23fc505..f9f7a8ee1a9cd4709924ee403a487bcce9bd0ffb 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2215,37 +2215,55 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2218,37 +2218,55 @@ public class CraftWorld extends CraftRegionAccessor implements World { // Spigot start @Override public int getViewDistance() { diff --git a/patches/server/0869-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch b/patches/server/0863-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch similarity index 87% rename from patches/server/0869-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch rename to patches/server/0863-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch index 051913ad4..cf02a182c 100644 --- a/patches/server/0869-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch +++ b/patches/server/0863-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch @@ -9,10 +9,10 @@ This might result in chunks loading far slower in the nether, for example. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index eab93e1e3712c0a01cac187bf5944818c813d665..1674deebbeab0995ed7acacf8052e1daf4d2a7bc 100644 +index 7fcc1342245470158da4cc35112649210eacddee..e065c834033af7bc06065f34515ba7d045f345f7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1392,6 +1392,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop -Date: Tue, 14 Dec 2021 12:43:03 +0800 -Subject: [PATCH] Optimize Util#sequence - -Original method allocates O(n^2) memory on n-size list. - -diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 9c111d479bbcc101886c12950c97f10941125ae7..34e571b702684673b89103176838dc246ff9b24d 100644 ---- a/src/main/java/net/minecraft/Util.java -+++ b/src/main/java/net/minecraft/Util.java -@@ -390,22 +390,18 @@ public class Util { - return (Strategy) Util.IdentityStrategy.INSTANCE; // Paper - decompile fix - } - -+ private static final CompletableFuture[] EMPTY_FUTURE = new CompletableFuture[0]; // Paper - public static CompletableFuture> sequence(List> futures) { -- return futures.stream().reduce(CompletableFuture.completedFuture(Lists.newArrayList()), (completableFuture, completableFuture2) -> { -- return completableFuture2.thenCombine(completableFuture, (object, list) -> { -- List list2 = Lists.newArrayListWithCapacity(list.size() + 1); -- list2.addAll(list); -- list2.add(object); -- return list2; -- }); -- }, (completableFuture, completableFuture2) -> { -- return completableFuture.thenCombine(completableFuture2, (list, list2) -> { -- List list3 = Lists.newArrayListWithCapacity(list.size() + list2.size()); -- list3.addAll(list); -- list3.addAll(list2); -- return list3; -+ // Paper start - optimize -+ return CompletableFuture.allOf(futures.toArray(EMPTY_FUTURE)) -+ .thenApply(v -> { -+ List list = Lists.newArrayListWithCapacity(futures.size()); -+ for (CompletableFuture future : futures) { -+ list.add(future.join()); -+ } -+ return list; - }); -- }); -+ // Paper end - } - - public static CompletableFuture> sequenceFailFast(List> futures) { diff --git a/patches/server/0870-Replace-ticket-level-propagator.patch b/patches/server/0864-Replace-ticket-level-propagator.patch similarity index 94% rename from patches/server/0870-Replace-ticket-level-propagator.patch rename to patches/server/0864-Replace-ticket-level-propagator.patch index e6620b98c..648070373 100644 --- a/patches/server/0870-Replace-ticket-level-propagator.patch +++ b/patches/server/0864-Replace-ticket-level-propagator.patch @@ -15,18 +15,18 @@ will be more effective, since more time will be allocated to actually processing chunk tasks vs the ticket level updates. diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index fd379155a67794288f7cdae3250767bc3615d421..d278e5b8b3386044e0fbc13add369794fd6f9cd7 100644 +index 1c8020435ab8eb5fec68dc5bf473650f2658bdac..0a0162003830da767a9d49ac62938e8b30d895fd 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -37,6 +37,7 @@ import net.minecraft.world.level.chunk.LevelChunk; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -38,6 +38,7 @@ import net.minecraft.world.level.chunk.ChunkStatus; + import net.minecraft.world.level.chunk.LevelChunk; + import org.slf4j.Logger; +import it.unimi.dsi.fastutil.longs.Long2IntLinkedOpenHashMap; // Paper public abstract class DistanceManager { - static final Logger LOGGER = LogManager.getLogger(); -@@ -47,7 +48,7 @@ public abstract class DistanceManager { + static final Logger LOGGER = LogUtils.getLogger(); +@@ -48,7 +49,7 @@ public abstract class DistanceManager { private static final int BLOCK_TICKING_LEVEL_THRESHOLD = 33; final Long2ObjectMap> playersPerChunk = new Long2ObjectOpenHashMap(); public final Long2ObjectOpenHashMap>> tickets = new Long2ObjectOpenHashMap(); @@ -35,7 +35,7 @@ index fd379155a67794288f7cdae3250767bc3615d421..d278e5b8b3386044e0fbc13add369794 public static final int MOB_SPAWN_RANGE = 8; // private final ChunkMapDistance.b f = new ChunkMapDistance.b(8); // Paper - no longer used //private final TickingTracker tickingTicketsTracker = new TickingTracker(); // Paper - no longer used //private final DistanceManager.PlayerTicketTracker playerTicketManager = new DistanceManager.PlayerTicketTracker(33); // Paper - no longer used -@@ -82,6 +83,46 @@ public abstract class DistanceManager { +@@ -83,6 +84,46 @@ public abstract class DistanceManager { this.chunkMap = chunkMap; // Paper } @@ -82,7 +82,7 @@ index fd379155a67794288f7cdae3250767bc3615d421..d278e5b8b3386044e0fbc13add369794 protected void purgeStaleTickets() { ++this.ticketTickCounter; ObjectIterator objectiterator = this.tickets.long2ObjectEntrySet().fastIterator(); -@@ -116,7 +157,7 @@ public abstract class DistanceManager { +@@ -117,7 +158,7 @@ public abstract class DistanceManager { } if (flag) { @@ -91,7 +91,7 @@ index fd379155a67794288f7cdae3250767bc3615d421..d278e5b8b3386044e0fbc13add369794 } if (((SortedArraySet) entry.getValue()).isEmpty()) { -@@ -139,61 +180,94 @@ public abstract class DistanceManager { +@@ -140,61 +181,94 @@ public abstract class DistanceManager { @Nullable protected abstract ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k); @@ -220,7 +220,7 @@ index fd379155a67794288f7cdae3250767bc3615d421..d278e5b8b3386044e0fbc13add369794 } boolean pollingPendingChunkUpdates = false; // Paper - Chunk priority -@@ -205,7 +279,7 @@ public abstract class DistanceManager { +@@ -206,7 +280,7 @@ public abstract class DistanceManager { ticket1.setCreatedTick(this.ticketTickCounter); if (ticket.getTicketLevel() < j) { @@ -229,7 +229,7 @@ index fd379155a67794288f7cdae3250767bc3615d421..d278e5b8b3386044e0fbc13add369794 } return ticket == ticket1; // CraftBukkit -@@ -249,7 +323,7 @@ public abstract class DistanceManager { +@@ -250,7 +324,7 @@ public abstract class DistanceManager { // Paper start - Chunk priority int newLevel = getTicketLevelAt(arraysetsorted); if (newLevel > oldLevel) { @@ -238,7 +238,7 @@ index fd379155a67794288f7cdae3250767bc3615d421..d278e5b8b3386044e0fbc13add369794 } // Paper end return removed; // CraftBukkit -@@ -549,7 +623,7 @@ public abstract class DistanceManager { +@@ -586,7 +660,7 @@ public abstract class DistanceManager { SortedArraySet> tickets = entry.getValue(); if (tickets.remove(target)) { // copied from removeTicket diff --git a/patches/server/0871-Furnace-RecipesUsed-API.patch b/patches/server/0865-Furnace-RecipesUsed-API.patch similarity index 100% rename from patches/server/0871-Furnace-RecipesUsed-API.patch rename to patches/server/0865-Furnace-RecipesUsed-API.patch diff --git a/patches/server/0872-Configurable-sculk-sensor-listener-range.patch b/patches/server/0866-Configurable-sculk-sensor-listener-range.patch similarity index 100% rename from patches/server/0872-Configurable-sculk-sensor-listener-range.patch rename to patches/server/0866-Configurable-sculk-sensor-listener-range.patch diff --git a/patches/server/0867-Add-GameEvent-tags.patch b/patches/server/0867-Add-GameEvent-tags.patch deleted file mode 100644 index a94785b68..000000000 --- a/patches/server/0867-Add-GameEvent-tags.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 3 Jan 2021 20:03:35 -0800 -Subject: [PATCH] Add GameEvent tags - - -diff --git a/src/main/java/io/papermc/paper/CraftGameEventTag.java b/src/main/java/io/papermc/paper/CraftGameEventTag.java -new file mode 100644 -index 0000000000000000000000000000000000000000..b9614196c360d357ae7e4fcaad5256a12e7cc7cd ---- /dev/null -+++ b/src/main/java/io/papermc/paper/CraftGameEventTag.java -@@ -0,0 +1,31 @@ -+package io.papermc.paper; -+ -+import net.minecraft.core.Registry; -+import net.minecraft.resources.ResourceLocation; -+import net.minecraft.tags.TagCollection; -+import org.bukkit.GameEvent; -+import org.bukkit.craftbukkit.tag.CraftTag; -+import org.bukkit.craftbukkit.util.CraftNamespacedKey; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.Collections; -+import java.util.Objects; -+import java.util.Set; -+import java.util.stream.Collectors; -+ -+public class CraftGameEventTag extends CraftTag { -+ -+ public CraftGameEventTag(TagCollection registry, ResourceLocation tag) { -+ super(registry, tag); -+ } -+ -+ @Override -+ public boolean isTagged(@NotNull GameEvent item) { -+ return this.getHandle().contains(Registry.GAME_EVENT.get(CraftNamespacedKey.toMinecraft(item.getKey()))); -+ } -+ -+ @Override -+ public @NotNull Set getValues() { -+ return this.getHandle().getValues().stream().map(ge -> Objects.requireNonNull(GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(Registry.GAME_EVENT.getKey(ge))), ge + " is not a recognized game event")).collect(Collectors.toUnmodifiableSet()); -+ } -+} -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f0629cac377b29246e990a01d60601270cbd77bd..dbbae437123163c60c3f60a48043967a8adbd124 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2561,6 +2561,12 @@ public final class CraftServer implements Server { - Preconditions.checkArgument(clazz == org.bukkit.entity.EntityType.class, "Entity type namespace must have entity type"); - - return (org.bukkit.Tag) new CraftEntityTag(EntityTypeTags.getAllTags(), key); -+ // Paper start -+ case org.bukkit.Tag.REGISTRY_GAME_EVENTS: -+ Preconditions.checkArgument(clazz == org.bukkit.GameEvent.class, "Game Event namespace must have GameEvent type"); -+ -+ return (org.bukkit.Tag) new io.papermc.paper.CraftGameEventTag(net.minecraft.tags.GameEventTags.getAllTags(), key); -+ // Paper end - default: - throw new IllegalArgumentException(); - } -@@ -2590,6 +2596,13 @@ public final class CraftServer implements Server { - - TagCollection> entityTags = EntityTypeTags.getAllTags(); - return entityTags.getAllTags().keySet().stream().map(key -> (org.bukkit.Tag) new CraftEntityTag(entityTags, key)).collect(ImmutableList.toImmutableList()); -+ // Paper start -+ case org.bukkit.Tag.REGISTRY_GAME_EVENTS: -+ Preconditions.checkArgument(clazz == org.bukkit.GameEvent.class); -+ -+ TagCollection gameEvents = net.minecraft.tags.GameEventTags.getAllTags(); -+ return gameEvents.getAllTags().keySet().stream().map(key -> (org.bukkit.Tag) new io.papermc.paper.CraftGameEventTag(gameEvents, key)).toList(); -+ // Paper end - default: - throw new IllegalArgumentException(); - } diff --git a/patches/server/0873-Add-missing-block-data-mins-and-maxes.patch b/patches/server/0867-Add-missing-block-data-mins-and-maxes.patch similarity index 100% rename from patches/server/0873-Add-missing-block-data-mins-and-maxes.patch rename to patches/server/0867-Add-missing-block-data-mins-and-maxes.patch diff --git a/patches/server/0874-Option-to-have-default-CustomSpawners-in-custom-worl.patch b/patches/server/0868-Option-to-have-default-CustomSpawners-in-custom-worl.patch similarity index 77% rename from patches/server/0874-Option-to-have-default-CustomSpawners-in-custom-worl.patch rename to patches/server/0868-Option-to-have-default-CustomSpawners-in-custom-worl.patch index ef1fc582d..aa895b4c6 100644 --- a/patches/server/0874-Option-to-have-default-CustomSpawners-in-custom-worl.patch +++ b/patches/server/0868-Option-to-have-default-CustomSpawners-in-custom-worl.patch @@ -10,10 +10,10 @@ just looking at the LevelStem key, look at the DimensionType key which is one level below that. Defaults to off to keep vanilla behavior. diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 153f07bac06093b43a1f5b0f8e1a46ffbe6407e5..a7ebf6d9f79ce50a90c3c903563e00a10607f9f2 100644 +index ba8323c62212c8daa10b17af61759ac68856d19c..736b6f4db48f3b300b1aaa825e8bd7cadf135e5a 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -679,4 +679,9 @@ public class PaperConfig { +@@ -674,4 +674,9 @@ public class PaperConfig { } globalMaxConcurrentChunkLoads = getDouble("settings.chunk-loading.global-max-concurrent-loads", 500.0); } @@ -24,22 +24,22 @@ index 153f07bac06093b43a1f5b0f8e1a46ffbe6407e5..a7ebf6d9f79ce50a90c3c903563e00a1 + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 1674deebbeab0995ed7acacf8052e1daf4d2a7bc..8014b8a20dfc1f348510eaad6ff42200c9ba4baa 100644 +index e065c834033af7bc06065f34515ba7d045f345f7..6010b9cf3337768e3b1cfbe65dc07fb8e6dc900b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -689,7 +689,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop spawners; -+ if (com.destroystokyo.paper.PaperConfig.useDimensionTypeForCustomSpawners && this.registryHolder.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY).getResourceKey(dimensionmanager).orElseThrow() == DimensionType.OVERWORLD_LOCATION) { ++ if (com.destroystokyo.paper.PaperConfig.useDimensionTypeForCustomSpawners && this.registryHolder.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY).getResourceKey(holder.value()).orElseThrow() == DimensionType.OVERWORLD_LOCATION) { + spawners = list; + } else { + spawners = Collections.emptyList(); + } -+ world = new ServerLevel(this, this.executor, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, spawners, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider); ++ world = new ServerLevel(this, this.executor, worldSession, iworlddataserver, worldKey, holder, worldloadlistener, chunkgenerator, flag, j, spawners, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider); + // Paper end } diff --git a/patches/server/0875-Put-world-into-worldlist-before-initing-the-world.patch b/patches/server/0869-Put-world-into-worldlist-before-initing-the-world.patch similarity index 85% rename from patches/server/0875-Put-world-into-worldlist-before-initing-the-world.patch rename to patches/server/0869-Put-world-into-worldlist-before-initing-the-world.patch index 1b789b4c3..a2992d3ac 100644 --- a/patches/server/0875-Put-world-into-worldlist-before-initing-the-world.patch +++ b/patches/server/0869-Put-world-into-worldlist-before-initing-the-world.patch @@ -7,10 +7,10 @@ Some parts of legacy conversion will need the overworld to get the legacy structure data storage diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 8014b8a20dfc1f348510eaad6ff42200c9ba4baa..6d1d83bc17403346cc9d3143666b927ef55fb9df 100644 +index 6010b9cf3337768e3b1cfbe65dc07fb8e6dc900b..3bfc08e309a06b418d5e271747e25b29cbaa97e3 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -701,9 +701,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop LevelStem in StructureCheck from CB Need to use the right for injectDatafixingContext diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 835a17cd4ec487271ba28232280dd0fbf2687c4b..768017ba650f1bd96e3db0aad8fda939e2ea7add 100644 +index 19e0648c47733dc1973d6ff2ccba2ba6a25f48de..8e87aca16879d7dd1dc0bd17d3215fca40b547cd 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -532,7 +532,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -535,7 +535,7 @@ public class ServerLevel extends Level implements WorldGenLevel { long l = minecraftserver.getWorldData().worldGenSettings().seed(); @@ -19,21 +19,21 @@ index 835a17cd4ec487271ba28232280dd0fbf2687c4b..768017ba650f1bd96e3db0aad8fda939 if (this.dimensionType().createDragonFight()) { this.dragonFight = new EndDragonFight(this, this.serverLevelData.worldGenSettings().seed(), this.serverLevelData.endDragonFightData()); // CraftBukkit diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java -index 22d3fd0b1951e72ac0315bfc6ab39531f0b2d075..07379c20433a990a74df2c752f69457c76527cf4 100644 +index ad7177615c7feedc416b543f635c4cd2f88814d0..84f04c91ca9b8dfbb8c2d3685d710cca7171d859 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java -@@ -47,7 +47,7 @@ public class StructureCheck { - private final RegistryAccess registryAccess; +@@ -45,7 +45,7 @@ public class StructureCheck { private final Registry biomes; + private final Registry> structureConfigs; private final StructureManager structureManager; - private final ResourceKey dimension; + private final ResourceKey dimension; // Paper - fix missing CB diff private final ChunkGenerator chunkGenerator; private final LevelHeightAccessor heightAccessor; private final BiomeSource biomeSource; -@@ -56,7 +56,7 @@ public class StructureCheck { - private final Long2ObjectMap>> loadedChunks = new Long2ObjectOpenHashMap<>(); - private final Map, Long2BooleanMap> featureChecks = new HashMap<>(); +@@ -54,7 +54,7 @@ public class StructureCheck { + private final Long2ObjectMap>> loadedChunks = new Long2ObjectOpenHashMap<>(); + private final Map, Long2BooleanMap> featureChecks = new HashMap<>(); - public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureManager structureManager, ResourceKey worldKey, ChunkGenerator chunkGenerator, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { + public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureManager structureManager, ResourceKey worldKey, ChunkGenerator chunkGenerator, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { // Paper - fix missing CB diff diff --git a/work/BuildData b/work/BuildData index 059e48d0b..641cb0c93 160000 --- a/work/BuildData +++ b/work/BuildData @@ -1 +1 @@ -Subproject commit 059e48d0b4666138c4a8330ee38310d74824a848 +Subproject commit 641cb0c939c7c2a3c4b42f2fd7bca7c8b34254ae diff --git a/work/Bukkit b/work/Bukkit index 6fac07ebf..d8a3c3b55 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 6fac07ebfb9c836546d4fe10772a32cfb8357149 +Subproject commit d8a3c3b55674a931391e2905cad4d54acfd15d11 diff --git a/work/CraftBukkit b/work/CraftBukkit index 1e87776ac..05a38da19 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 1e87776acbb1f1c63fd9a5917b44eb2e7f1283a2 +Subproject commit 05a38da190704cb8df90401c45fc39d087cdc031 diff --git a/work/Spigot b/work/Spigot index 699290cdc..fb0dd5f51 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 699290cdcc3d7721a3031b395d8693a9a11d8f6d +Subproject commit fb0dd5f518e866748a20ee2c753edc3c6b9392d2