diff --git a/patches/unapplied/server/0435-Fix-missing-chunks-due-to-integer-overflow.patch b/patches/removed/1.19/0435-Fix-missing-chunks-due-to-integer-overflow.patch similarity index 95% rename from patches/unapplied/server/0435-Fix-missing-chunks-due-to-integer-overflow.patch rename to patches/removed/1.19/0435-Fix-missing-chunks-due-to-integer-overflow.patch index b1be3e839..fdc884fe3 100644 --- a/patches/unapplied/server/0435-Fix-missing-chunks-due-to-integer-overflow.patch +++ b/patches/removed/1.19/0435-Fix-missing-chunks-due-to-integer-overflow.patch @@ -3,6 +3,8 @@ From: David Slovikosky Date: Tue, 9 Jun 2020 00:10:03 -0700 Subject: [PATCH] Fix missing chunks due to integer overflow +1.19: Either no longer needed or has to take a very different form -MM + This patch fixes a bug in the WorldChunkManagerTheEnd class where the distance from 0,0 squared overflows the maximum size of an integer. The overflow leads to hard chunk borders around 370,000 blocks from 0,0. After this cutoff there diff --git a/patches/unapplied/server/0425-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/removed/1.19/Reduce-allocation-of-Vec3D-by-entity-tracker.patch similarity index 59% rename from patches/unapplied/server/0425-Reduce-allocation-of-Vec3D-by-entity-tracker.patch rename to patches/removed/1.19/Reduce-allocation-of-Vec3D-by-entity-tracker.patch index ad01a0241..4147c0bd1 100644 --- a/patches/unapplied/server/0425-Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/patches/removed/1.19/Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -1,29 +1,8 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Mon, 27 Apr 2020 00:04:16 -0700 -Subject: [PATCH] Reduce allocation of Vec3D by entity tracker +1.19: the position vectors aren't the same for all entities here. Can maybe just handle them differently +I think only Paintings are different +Part of this patch was merged, see the same name -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index f4b14d77d5c256852677bd9bc6dbda2bbe5367e3..38efde791c99dd22de71183676d0301a1d5a14e0 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1886,9 +1886,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) { -- Vec3 vec3d = player.position().subtract(this.entity.position()); // MC-155077, SPIGOT-5113 -+ // Paper start - remove allocation of Vec3D here -+ //Vec3 vec3d = player.position().subtract(this.entity.position()); // MC-155077, SPIGOT-5113 -+ double vec3d_dx = player.getX() - this.entity.getX(); -+ double vec3d_dz = player.getZ() - this.entity.getZ(); -+ // Paper end - remove allocation of Vec3D here - double d0 = (double) Math.min(this.getEffectiveRange(), (ChunkMap.this.viewDistance - 1) * 16); -- double d1 = vec3d.x * vec3d.x + vec3d.z * vec3d.z; -+ double d1 = vec3d_dx * vec3d_dx + vec3d_dz * vec3d_dz; // Paper - double d2 = d0 * d0; - 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 5e3f489964489e0facc93a823a1cb84b4c8abce7..1a4350b40d15edba998e3dee5f16cde4e9f50759 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -45,7 +24,7 @@ index 5e3f489964489e0facc93a823a1cb84b4c8abce7..1a4350b40d15edba998e3dee5f16cde4 boolean flag3 = Math.abs(i - this.yRotp) >= 1 || Math.abs(j - this.xRotp) >= 1; @@ -161,9 +165,11 @@ public class ServerEntity { // CraftBukkit end - + if (this.tickCount > 0 || this.entity instanceof AbstractArrow) { - long k = ClientboundMoveEntityPacket.entityToPacket(vec3d.x); - long l = ClientboundMoveEntityPacket.entityToPacket(vec3d.y); @@ -56,5 +35,5 @@ index 5e3f489964489e0facc93a823a1cb84b4c8abce7..1a4350b40d15edba998e3dee5f16cde4 + long i1 = ClientboundMoveEntityPacket.entityToPacket(vec3d_dz); + // Paper end - remove allocation of Vec3D here boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L; - + if (!flag4 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.isOnGround()) { diff --git a/patches/unapplied/server/0408-Expose-game-version.patch b/patches/server/0405-Expose-game-version.patch similarity index 82% rename from patches/unapplied/server/0408-Expose-game-version.patch rename to patches/server/0405-Expose-game-version.patch index 1b9b250d2..61ac89532 100644 --- a/patches/unapplied/server/0408-Expose-game-version.patch +++ b/patches/server/0405-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 9e2adc414d43f0c91f222be5f082e74d9db173aa..271f4ab919788bfad7ce750b1dafc742debed674 100644 +index 14baaf2d679ccceeecb32958cd2ad0ef54beaf4b..d0c73d201d4bc5052efea6049988798a0c52f07e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -573,6 +573,13 @@ public final class CraftServer implements Server { +@@ -568,6 +568,13 @@ public final class CraftServer implements Server { return this.bukkitVersion; } diff --git a/patches/unapplied/server/0409-Optimize-Voxel-Shape-Merging.patch b/patches/server/0406-Optimize-Voxel-Shape-Merging.patch similarity index 100% rename from patches/unapplied/server/0409-Optimize-Voxel-Shape-Merging.patch rename to patches/server/0406-Optimize-Voxel-Shape-Merging.patch diff --git a/patches/unapplied/server/0410-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch b/patches/server/0407-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch similarity index 93% rename from patches/unapplied/server/0410-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch rename to patches/server/0407-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch index 735b87527..7f53e3110 100644 --- a/patches/unapplied/server/0410-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch +++ b/patches/server/0407-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch @@ -17,7 +17,7 @@ keeping long lived large direct buffers in cache. Set system properly at server startup if not set already to help protect from this. diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 7a5e7e8a680ead5128fbf5829bc47704715b94bd..fbe68bd4739d9a0e7d9bc4c3d5ba8ecfd2d13954 100644 +index 5e79ad04aed13462d1d187a71801aeb2628495e8..344d93f1d7f25a3f26064469e78dd698af66dc0d 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -28,6 +28,7 @@ public class Main { diff --git a/patches/unapplied/server/0411-misc-debugging-dumps.patch b/patches/server/0408-misc-debugging-dumps.patch similarity index 82% rename from patches/unapplied/server/0411-misc-debugging-dumps.patch rename to patches/server/0408-misc-debugging-dumps.patch index e6ae3f6f5..9cc0be25e 100644 --- a/patches/unapplied/server/0411-misc-debugging-dumps.patch +++ b/patches/server/0408-misc-debugging-dumps.patch @@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..2d5494d2813b773e60ddba6790b750a9 + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 4ed65f1371013fb91fe60a0e1501e222a6e9c508..abb640370da876a18a3eba952b19cfa9d0f73743 100644 +index 08ada4f1818f3dc8aeee417df11948a48b66bcfd..096cbbeb42ea195f51e0d430aab2e989ea1aa065 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -915,6 +915,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop set, boolean flag) { diff --git a/patches/unapplied/server/0413-Deobfuscate-stacktraces-in-log-messages-crash-report.patch b/patches/server/0410-Deobfuscate-stacktraces-in-log-messages-crash-report.patch similarity index 97% rename from patches/unapplied/server/0413-Deobfuscate-stacktraces-in-log-messages-crash-report.patch rename to patches/server/0410-Deobfuscate-stacktraces-in-log-messages-crash-report.patch index 5ea4209a8..a423c555a 100644 --- a/patches/unapplied/server/0413-Deobfuscate-stacktraces-in-log-messages-crash-report.patch +++ b/patches/server/0410-Deobfuscate-stacktraces-in-log-messages-crash-report.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Deobfuscate stacktraces in log messages, crash reports, and diff --git a/build.gradle.kts b/build.gradle.kts -index 5a609a297ccfa66859b04eb907595741b8ec2160..398bedaba0a006bcd8ad562486ecd583d9d129ef 100644 +index 7dd1c9449a1e6a9197e2915399feabf63f490b0a..9bd09c4465f5fe1cd68b63da293f506da4b17a72 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,6 @@ @@ -23,8 +23,8 @@ index 5a609a297ccfa66859b04eb907595741b8ec2160..398bedaba0a006bcd8ad562486ecd583 + annotationProcessor("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - Needed to generate meta for our Log4j plugins // Paper end implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper - implementation("org.ow2.asm:asm:9.2") -@@ -31,6 +34,8 @@ dependencies { + implementation("org.ow2.asm:asm:9.3") +@@ -32,6 +35,8 @@ dependencies { runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.2") runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.2") @@ -33,7 +33,7 @@ index 5a609a297ccfa66859b04eb907595741b8ec2160..398bedaba0a006bcd8ad562486ecd583 testImplementation("junit:junit:4.13.2") testImplementation("org.hamcrest:hamcrest-library:1.3") } -@@ -89,6 +94,45 @@ tasks.shadowJar { +@@ -90,6 +95,45 @@ tasks.shadowJar { } } @@ -518,7 +518,7 @@ index 3941e14d1c3e6e688e28904948039c8b2200de5f..a4fda4a3bae9ce600e778b44cd3ef432 } } diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index a0d3d9e344f530b713167d0663634c40eefce5b5..c469688c2b55b1c93435a2ac6e8e4494ab7e5229 100644 +index 97166c362a5468e3f7e2fcfd5e318dc519bfbf6c..ed4587248fada36c4c206be1fa36fef42fc969e2 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -66,13 +66,13 @@ public class Connection extends SimpleChannelInboundHandler> { @@ -539,10 +539,10 @@ index a0d3d9e344f530b713167d0663634c40eefce5b5..c469688c2b55b1c93435a2ac6e8e4494 private final PacketFlow receiving; private final Queue queue = Queues.newConcurrentLinkedQueue(); diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java -index 5165170e3289fe3939497c56a71eae9fdaa4bcfa..8a0ced3f9b9099913ade4b71181aff6cafbc4ee6 100644 +index 72932b13d71f71896f07810c8850eb45749ae2e6..5c92aa1cc1a7e7fd0b7a06ae9b21e734fab71c74 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java -@@ -27,7 +27,7 @@ public class ServerboundChatPacket implements Packet { +@@ -41,7 +41,7 @@ public class ServerboundChatPacket implements Packet { // Spigot Start private static final java.util.concurrent.ExecutorService executors = java.util.concurrent.Executors.newCachedThreadPool( @@ -552,10 +552,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 d0d058287fc1e87e944e99d4fc2cbd38eafb82b3..cec0082718c2a729044d6f19d74b8e4425816725 100644 +index 7d381cc2c514045aad2bf65fd166b8ad1c8a9c97..ce700e9c74ad961703d95245febf95d060a7df8d 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -215,6 +215,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -208,6 +208,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface } com.destroystokyo.paper.PaperConfig.registerCommands(); com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now @@ -564,10 +564,10 @@ index d0d058287fc1e87e944e99d4fc2cbd38eafb82b3..cec0082718c2a729044d6f19d74b8e44 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 7c820a8f9ae85eb6941dce0e6296775fb331d720..888e863b6d605bf587d0c071795a43d2157afa4d 100644 +index 78808e6239070121d36b6c377202d76e8fb3fa32..72fbc58f7d003b7af3c35e5fc504010307c7086b 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 { +@@ -53,10 +53,10 @@ public class ServerConnectionListener { private static final Logger LOGGER = LogUtils.getLogger(); public static final LazyLoadedValue SERVER_EVENT_GROUP = new LazyLoadedValue<>(() -> { diff --git a/patches/unapplied/server/0414-Implement-Mob-Goal-API.patch b/patches/server/0411-Implement-Mob-Goal-API.patch similarity index 99% rename from patches/unapplied/server/0414-Implement-Mob-Goal-API.patch rename to patches/server/0411-Implement-Mob-Goal-API.patch index b13bb87a4..3e80ae536 100644 --- a/patches/unapplied/server/0414-Implement-Mob-Goal-API.patch +++ b/patches/server/0411-Implement-Mob-Goal-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement Mob Goal API diff --git a/build.gradle.kts b/build.gradle.kts -index 398bedaba0a006bcd8ad562486ecd583d9d129ef..6b46f9c94dc051579ca5b51755caad19505e874a 100644 +index 9bd09c4465f5fe1cd68b63da293f506da4b17a72..31659bb0a78dc00f29a057915fcbb0283b6081e0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -36,6 +36,7 @@ dependencies { +@@ -37,6 +37,7 @@ dependencies { implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation @@ -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 0ea163f4443bc07727675e3c05b9e1d68c52f78a..44c5938edda0aeab0b65f1179ef7dad6356462da 100644 +index 4639c2015de9b7300f6bfb58a598100b339f2fa6..6b3597ed1ed20863658cc5ef363ded2c734c25aa 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2670,5 +2670,11 @@ public final class CraftServer implements Server { +@@ -2653,5 +2653,11 @@ public final class CraftServer implements Server { public boolean isStopping() { return net.minecraft.server.MinecraftServer.getServer().hasStopped(); } diff --git a/patches/unapplied/server/0415-Add-villager-reputation-API.patch b/patches/server/0412-Add-villager-reputation-API.patch similarity index 98% rename from patches/unapplied/server/0415-Add-villager-reputation-API.patch rename to patches/server/0412-Add-villager-reputation-API.patch index 1a1361c92..4c3878033 100644 --- a/patches/unapplied/server/0415-Add-villager-reputation-API.patch +++ b/patches/server/0412-Add-villager-reputation-API.patch @@ -20,7 +20,7 @@ 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 701b9c67c01f2aa4823e2aa71db388d5c3292dc4..e98951ac056910340c498d866715e174d461f723 100644 +index 7a7c92f1a026116958ad24312df358a703834369..0de65462956fa734b6405614e047161696e596fb 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 @@ -27,7 +27,7 @@ import net.minecraft.util.VisibleForDebug; diff --git a/patches/unapplied/server/0416-Option-for-maximum-exp-value-when-merging-orbs.patch b/patches/server/0413-Option-for-maximum-exp-value-when-merging-orbs.patch similarity index 100% rename from patches/unapplied/server/0416-Option-for-maximum-exp-value-when-merging-orbs.patch rename to patches/server/0413-Option-for-maximum-exp-value-when-merging-orbs.patch diff --git a/patches/unapplied/server/0417-ExperienceOrbMergeEvent.patch b/patches/server/0414-ExperienceOrbMergeEvent.patch similarity index 100% rename from patches/unapplied/server/0417-ExperienceOrbMergeEvent.patch rename to patches/server/0414-ExperienceOrbMergeEvent.patch diff --git a/patches/unapplied/server/0418-Fix-PotionEffect-ignores-icon-flag.patch b/patches/server/0415-Fix-PotionEffect-ignores-icon-flag.patch similarity index 100% rename from patches/unapplied/server/0418-Fix-PotionEffect-ignores-icon-flag.patch rename to patches/server/0415-Fix-PotionEffect-ignores-icon-flag.patch diff --git a/patches/unapplied/server/0419-Optimize-brigadier-child-sorting-performance.patch b/patches/server/0416-Optimize-brigadier-child-sorting-performance.patch similarity index 100% rename from patches/unapplied/server/0419-Optimize-brigadier-child-sorting-performance.patch rename to patches/server/0416-Optimize-brigadier-child-sorting-performance.patch diff --git a/patches/unapplied/server/0420-Potential-bed-API.patch b/patches/server/0417-Potential-bed-API.patch similarity index 100% rename from patches/unapplied/server/0420-Potential-bed-API.patch rename to patches/server/0417-Potential-bed-API.patch diff --git a/patches/unapplied/server/0421-Wait-for-Async-Tasks-during-shutdown.patch b/patches/server/0418-Wait-for-Async-Tasks-during-shutdown.patch similarity index 89% rename from patches/unapplied/server/0421-Wait-for-Async-Tasks-during-shutdown.patch rename to patches/server/0418-Wait-for-Async-Tasks-during-shutdown.patch index 91fbc0044..fa0397c9b 100644 --- a/patches/unapplied/server/0421-Wait-for-Async-Tasks-during-shutdown.patch +++ b/patches/server/0418-Wait-for-Async-Tasks-during-shutdown.patch @@ -10,10 +10,10 @@ 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 abb640370da876a18a3eba952b19cfa9d0f73743..12c1cee3b3055b44d0ca3196eb37e51879fce67b 100644 +index 096cbbeb42ea195f51e0d430aab2e989ea1aa065..9905dba12c6b3f584a6fab94517592b6d2c042f0 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -950,6 +950,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0.0F; f -= 0.22500001F) { BlockPos blockposition = new BlockPos(d4, d5, d6); BlockState iblockdata = this.level.getBlockState(blockposition); @@ -44,7 +44,7 @@ index fc1b86828c8a38950f7a26735d8f5d125ee3e914..0d6f33319521101bd10352d597b5e3e0 FluidState fluid = iblockdata.getFluidState(); // Paper if (!this.level.isInWorldBounds(blockposition)) { -@@ -351,7 +352,7 @@ public class Explosion { +@@ -350,7 +351,7 @@ public class Explosion { BlockState iblockdata = this.level.getBlockState(blockposition); Block block = iblockdata.getBlock(); @@ -54,10 +54,10 @@ index fc1b86828c8a38950f7a26735d8f5d125ee3e914..0d6f33319521101bd10352d597b5e3e0 this.level.getProfiler().push("explosion_blocks"); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index e4c2bd0131a54495fbd1930ad046225118e33186..4095b3ebacb8a55744fa99fea7e08d31e42d8b47 100644 +index 6f04f79832b52fc898ec2b13af03bc28d4e0bbc1..b1cd5781620514533cf0f4d3c518ad461f98f23b 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -414,6 +414,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -425,6 +425,10 @@ 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) { @@ -69,10 +69,10 @@ index e4c2bd0131a54495fbd1930ad046225118e33186..4095b3ebacb8a55744fa99fea7e08d31 if (blockstate == null) { blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags); 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 59a8d1984f3bcc94048a4ce3e530d21cc3f39d7f..17c369b49272ac72119708b507e6fa119343706e 100644 +index 0422e389e5b9577417d09490a15584ed5b885209..24556481bf72dae526eb0f13826d693d6516bfb4 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -90,6 +90,19 @@ public class Block extends BlockBehaviour implements ItemLike { +@@ -92,6 +92,19 @@ public class Block extends BlockBehaviour implements ItemLike { protected final StateDefinition stateDefinition; private BlockState defaultBlockState; // Paper start @@ -93,10 +93,10 @@ index 59a8d1984f3bcc94048a4ce3e530d21cc3f39d7f..17c369b49272ac72119708b507e6fa11 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 8f4b3bf0eba548a35b59232491c68d635e21123f..edb599da2431fa32f6e656dd3de8f4a6f5e2ed4f 100644 +index 76720517cd2d82065eb8430cf854b536295341db..272279244f558c8ea298b35605c0421c037aad48 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 -@@ -198,6 +198,12 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -199,6 +199,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 8f4b3bf0eba548a35b59232491c68d635e21123f..edb599da2431fa32f6e656dd3de8f4a6 if (!world.isClientSide) { boolean flag = this.getNeighborSignal(world, pos, enumdirection); -@@ -230,7 +236,7 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -231,7 +237,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 8f4b3bf0eba548a35b59232491c68d635e21123f..edb599da2431fa32f6e656dd3de8f4a6 world.blockUpdated(pos, iblockdata1.getBlock()); iblockdata1.updateNeighbourShapes(world, pos, 2); if (this.isSticky) { -@@ -259,7 +265,14 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -260,7 +266,14 @@ public class PistonBaseBlock extends DirectionalBlock { } } } else { @@ -135,10 +135,10 @@ index 8f4b3bf0eba548a35b59232491c68d635e21123f..edb599da2431fa32f6e656dd3de8f4a6 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 a5b7fbd940bf180b76017442ee7224761741fe52..fdb9a60ce9e1f8e3caabe1733e32e34146d4ddf3 100644 +index 942dae5116840a2e8a992f0830574ab2a315bdf1..0ff34d2c569fbeae95509abed343b1e2f593378a 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 -@@ -225,7 +225,7 @@ public abstract class BlockBehaviour { +@@ -222,7 +222,7 @@ public abstract class BlockBehaviour { /** @deprecated */ @Deprecated public boolean canBeReplaced(BlockState state, BlockPlaceContext context) { @@ -147,20 +147,20 @@ index a5b7fbd940bf180b76017442ee7224761741fe52..fdb9a60ce9e1f8e3caabe1733e32e341 } /** @deprecated */ -@@ -707,7 +707,11 @@ public abstract class BlockBehaviour { - public Block getBlock() { - return (Block) this.owner; +@@ -726,6 +726,12 @@ public abstract class BlockBehaviour { + return ((Block) this.owner).builtInRegistryHolder(); } -- + + // Paper start + public final boolean isDestroyable() { + return getBlock().isDestroyable(); + } + // Paper end ++ public Material getMaterial() { return this.material; } -@@ -805,7 +809,7 @@ public abstract class BlockBehaviour { +@@ -823,7 +829,7 @@ public abstract class BlockBehaviour { } public PushReaction getPistonPushReaction() { @@ -170,7 +170,7 @@ index a5b7fbd940bf180b76017442ee7224761741fe52..fdb9a60ce9e1f8e3caabe1733e32e341 public boolean isSolidRender(BlockGetter world, BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java -index 05150fbade1d5a9b3b6de8ad1f5e825f34d1037e..ed79058696eb26a89b9d4116821840dbad9ea449 100644 +index 8672545ba07205ef362442e1342f2ee5281f62cb..504f5d98d4a3d6b5bbd0998b495196aa6b39f47a 100644 --- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java +++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java @@ -210,6 +210,13 @@ public class PortalForcer { diff --git a/patches/unapplied/server/0424-Reduce-MutableInt-allocations-from-light-engine.patch b/patches/server/0421-Reduce-MutableInt-allocations-from-light-engine.patch similarity index 100% rename from patches/unapplied/server/0424-Reduce-MutableInt-allocations-from-light-engine.patch rename to patches/server/0421-Reduce-MutableInt-allocations-from-light-engine.patch diff --git a/patches/server/0422-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/server/0422-Reduce-allocation-of-Vec3D-by-entity-tracker.patch new file mode 100644 index 000000000..6f9054670 --- /dev/null +++ b/patches/server/0422-Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Mon, 27 Apr 2020 00:04:16 -0700 +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 16cce0feeca7d6f9f67100a07b824930adabcc72..926e4a8ea6e5afc6ad683761a5d8c4006cdec5ee 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +@@ -1929,9 +1929,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) { +- Vec3 vec3d = player.position().subtract(this.entity.position()); ++ // Paper start - remove allocation of Vec3D here ++ // Vec3 vec3d = player.position().subtract(this.entity.position()); ++ double vec3d_dx = player.getX() - this.entity.getX(); ++ double vec3d_dz = player.getZ() - this.entity.getZ(); ++ // Paper end - remove allocation of Vec3D here + double d0 = (double) Math.min(this.getEffectiveRange(), (ChunkMap.this.viewDistance - 1) * 16); +- double d1 = vec3d.x * vec3d.x + vec3d.z * vec3d.z; ++ double d1 = vec3d_dx * vec3d_dx + vec3d_dz * vec3d_dz; // Paper + double d2 = d0 * d0; + boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player); + diff --git a/patches/unapplied/server/0426-Ensure-safe-gateway-teleport.patch b/patches/server/0423-Ensure-safe-gateway-teleport.patch similarity index 93% rename from patches/unapplied/server/0426-Ensure-safe-gateway-teleport.patch rename to patches/server/0423-Ensure-safe-gateway-teleport.patch index 527175e57..6d352f74a 100644 --- a/patches/unapplied/server/0426-Ensure-safe-gateway-teleport.patch +++ b/patches/server/0423-Ensure-safe-gateway-teleport.patch @@ -5,7 +5,7 @@ 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 4e47b641a2aae8e82890cda1bdb209803472b1d4..4e435a16a16c703a2978f4dc82606b8710742670 100644 +index befd35b0edf4a76b119f711f8536369a02abc1ba..56d68b87287f0bb2c79ce0bed02fa333b85c4287 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 @@ -105,7 +105,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { diff --git a/patches/unapplied/server/0427-Add-option-for-console-having-all-permissions.patch b/patches/server/0424-Add-option-for-console-having-all-permissions.patch similarity index 95% rename from patches/unapplied/server/0427-Add-option-for-console-having-all-permissions.patch rename to patches/server/0424-Add-option-for-console-having-all-permissions.patch index aabebdbc1..27b6101ba 100644 --- a/patches/unapplied/server/0427-Add-option-for-console-having-all-permissions.patch +++ b/patches/server/0424-Add-option-for-console-having-all-permissions.patch @@ -39,10 +39,10 @@ index 324e6d1a4fadd3e557e4ba05f04e6a5891cc54df..db77cdee224d14ec91e8d530dd65da51 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java -index 07f7effaa46afdd8766e3e6bfd8cb923e55f68cf..54e358ffb9c89469a7cd0df6493caf6162a37a21 100644 +index a6612cc0ea87aeb8e87521ff7b5fe58c7b06b9ef..b9df8c90df16f2ed462a655fff3f36c37ecbbd31 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java -@@ -46,4 +46,16 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme +@@ -45,4 +45,16 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme public void setOp(boolean value) { throw new UnsupportedOperationException("Cannot change operator status of remote controller."); } diff --git a/patches/unapplied/server/0428-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch b/patches/server/0425-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch similarity index 95% rename from patches/unapplied/server/0428-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch rename to patches/server/0425-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch index f94c4f158..0157e2703 100644 --- a/patches/unapplied/server/0428-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch +++ b/patches/server/0425-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch @@ -6,7 +6,7 @@ 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 8356a0e816324ce67df14151bdc186e60d8a223c..1324d48ff7540c4fe9148b3c6d4952ebbfb3fc22 100644 +index 6e7d09cd48048957a14835b857ac708aafe8f664..4e8a79f2d3b6f52c6284bc9b0ce2423dc43a154f 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -76,6 +76,23 @@ public class ChunkHolder { @@ -42,10 +42,10 @@ index 8356a0e816324ce67df14151bdc186e60d8a223c..1324d48ff7540c4fe9148b3c6d4952eb // 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 38efde791c99dd22de71183676d0301a1d5a14e0..63e264c862053874585b0f6aad2f89389c2dadcb 100644 +index 926e4a8ea6e5afc6ad683761a5d8c4006cdec5ee..464a00542756437d8c3dccc1a85ae51cfdb588d2 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -181,11 +181,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -185,11 +185,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 38efde791c99dd22de71183676d0301a1d5a14e0..63e264c862053874585b0f6aad2f8938 // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.add(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance()); -@@ -195,6 +207,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -199,6 +211,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider void removePlayerFromDistanceMaps(ServerPlayer player) { @@ -80,7 +80,7 @@ index 38efde791c99dd22de71183676d0301a1d5a14e0..63e264c862053874585b0f6aad2f8938 // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.remove(player); -@@ -206,6 +222,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -210,6 +226,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 38efde791c99dd22de71183676d0301a1d5a14e0..63e264c862053874585b0f6aad2f8938 // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.update(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance()); -@@ -286,6 +303,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -298,6 +315,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 38efde791c99dd22de71183676d0301a1d5a14e0..63e264c862053874585b0f6aad2f8938 } protected ChunkGenerator generator() { -@@ -537,6 +586,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -553,6 +602,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 38efde791c99dd22de71183676d0301a1d5a14e0..63e264c862053874585b0f6aad2f8938 } else { holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this); // Paper start -@@ -632,6 +682,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -648,6 +698,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ChunkHolder playerchunk = (ChunkHolder) this.updatingChunkMap.remove(j); if (playerchunk != null) { @@ -143,7 +143,7 @@ index 38efde791c99dd22de71183676d0301a1d5a14e0..63e264c862053874585b0f6aad2f8938 this.pendingUnloads.put(j, playerchunk); this.modified = true; ++i; -@@ -1370,43 +1421,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1413,43 +1464,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return this.anyPlayerCloseEnoughForSpawning(pos, false); } @@ -286,10 +286,10 @@ index 4a9d0fca55b71f817defcb4286154c0a47bede03..62118348d6fb00f063507debb488e1ff 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 cf5a5d98420c3849621bfdfae7bda7d5cb4b2dc9..846e6f41fdb6413b10f908c6b3f5c199a9f5ef38 100644 +index 55b8f9dc3ad2b282e83c912ad8bf46b31cbd3765..d247f8997e5afc4c6449495da0b302a4814df495 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -872,6 +872,37 @@ public class ServerChunkCache extends ChunkSource { +@@ -873,6 +873,37 @@ public class ServerChunkCache extends ChunkSource { if (flag) { this.chunkMap.tick(); } else { @@ -327,7 +327,7 @@ index cf5a5d98420c3849621bfdfae7bda7d5cb4b2dc9..846e6f41fdb6413b10f908c6b3f5c199 LevelData worlddata = this.level.getLevelData(); ProfilerFiller gameprofilerfiller = this.level.getProfiler(); -@@ -915,15 +946,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -916,15 +947,7 @@ public class ServerChunkCache extends ChunkSource { boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit Collections.shuffle(list); @@ -344,7 +344,7 @@ index cf5a5d98420c3849621bfdfae7bda7d5cb4b2dc9..846e6f41fdb6413b10f908c6b3f5c199 Iterator iterator1 = list.iterator(); while (iterator1.hasNext()) { -@@ -931,9 +954,9 @@ public class ServerChunkCache extends ChunkSource { +@@ -932,9 +955,9 @@ public class ServerChunkCache extends ChunkSource { LevelChunk chunk1 = chunkproviderserver_a.chunk; ChunkPos chunkcoordintpair = chunk1.getPos(); @@ -357,14 +357,14 @@ index cf5a5d98420c3849621bfdfae7bda7d5cb4b2dc9..846e6f41fdb6413b10f908c6b3f5c199 } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index f8913f10e3e24c4da7c251bc4bc0ab0820807f57..90a844229e4a3ef5193cffc2c742b4c5a305a91c 100644 +index 1e32ac21998cf7b7987815850fd022a5f282c5e0..c62db939791f6c80f612b14db0f8b98f334a96b6 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 { +@@ -260,6 +260,7 @@ public class ServerPlayer extends Player { // CraftBukkit end public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper + public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper - public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) { + public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, @Nullable ProfilePublicKey publicKey) { diff --git a/patches/unapplied/server/0429-Use-distance-map-to-optimise-entity-tracker.patch b/patches/server/0426-Use-distance-map-to-optimise-entity-tracker.patch similarity index 95% rename from patches/unapplied/server/0429-Use-distance-map-to-optimise-entity-tracker.patch rename to patches/server/0426-Use-distance-map-to-optimise-entity-tracker.patch index 77bae1fcb..2ed5e129a 100644 --- a/patches/unapplied/server/0429-Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/server/0426-Use-distance-map-to-optimise-entity-tracker.patch @@ -6,7 +6,7 @@ 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 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761ebe89a38d8 100644 +index 464a00542756437d8c3dccc1a85ae51cfdb588d2..95dbf60604d86666a359c0d861ef3eb8313e6184 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -70,6 +70,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; @@ -17,7 +17,7 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb import net.minecraft.server.level.progress.ChunkProgressListener; import net.minecraft.server.network.ServerPlayerConnection; import net.minecraft.util.CsvOutput; -@@ -192,10 +193,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -196,10 +197,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 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb // 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 -@@ -207,6 +233,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -211,6 +237,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider void removePlayerFromDistanceMaps(ServerPlayer player) { @@ -65,7 +65,7 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb // Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning this.playerMobSpawnMap.remove(player); this.playerChunkTickRangeMap.remove(player); -@@ -222,6 +253,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -226,6 +257,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 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { -@@ -303,6 +342,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -315,6 +354,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 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb // 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, -@@ -1544,17 +1622,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1587,17 +1665,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public void move(ServerPlayer player) { @@ -145,7 +145,7 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb int i = SectionPos.blockToSectionCoord(player.getBlockX()); int j = SectionPos.blockToSectionCoord(player.getBlockZ()); -@@ -1681,7 +1749,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1724,7 +1792,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 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb if (entity instanceof ServerPlayer) { ServerPlayer entityplayer = (ServerPlayer) entity; -@@ -1725,7 +1793,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1768,7 +1836,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.tracker = null; // Paper - We're no longer tracked } @@ -192,7 +192,7 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb List list = Lists.newArrayList(); List list1 = this.level.players(); ObjectIterator objectiterator = this.entityMap.values().iterator(); -@@ -1801,23 +1899,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1844,23 +1942,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos()); List list = Lists.newArrayList(); List list1 = Lists.newArrayList(); @@ -236,8 +236,8 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb Iterator iterator; Entity entity1; -@@ -1893,6 +1999,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - this.lastSectionPos = SectionPos.of(entity); +@@ -1936,6 +2042,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + this.lastSectionPos = SectionPos.of((EntityAccess) entity); } + // Paper start - use distance map to optimise tracker @@ -280,10 +280,10 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb 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 f69bc9d81750feb108119347f984de6bca24ae44..14b3f14d2489bdbeb89886a115db2ba78cb97ad7 100644 +index 1413acf7029fd690fbdb50c80037d040ef24e24f..bbd94142c3519bc8a6602a31699a7132119e395c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -54,6 +54,7 @@ import net.minecraft.network.syncher.EntityDataSerializers; +@@ -56,6 +56,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 f69bc9d81750feb108119347f984de6bca24ae44..14b3f14d2489bdbeb89886a115db2ba7 import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; -@@ -362,6 +363,39 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -383,6 +384,39 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } // Paper end diff --git a/patches/unapplied/server/0430-Optimize-ServerLevels-chunk-level-checking-methods.patch b/patches/server/0427-Optimize-ServerLevels-chunk-level-checking-methods.patch similarity index 89% rename from patches/unapplied/server/0430-Optimize-ServerLevels-chunk-level-checking-methods.patch rename to patches/server/0427-Optimize-ServerLevels-chunk-level-checking-methods.patch index 4a79e8342..cbfb61cb1 100644 --- a/patches/unapplied/server/0430-Optimize-ServerLevels-chunk-level-checking-methods.patch +++ b/patches/server/0427-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 5009ad1a758e192eaf6ca59baab26d2ba58a6c66..894186d25863a437e49ef0c10b2f2dab34af7ed0 100644 +index 8808b8b5b3fa03a1a0c4d843867f1e26d966ab85..e5f7ed6e70231c447f3983ae181e23acc6f69de6 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2169,19 +2169,22 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2247,19 +2247,22 @@ public class ServerLevel extends Level implements WorldGenLevel { } private boolean isPositionTickingWithEntitiesLoaded(long chunkPos) { @@ -39,10 +39,10 @@ index 5009ad1a758e192eaf6ca59baab26d2ba58a6c66..894186d25863a437e49ef0c10b2f2dab private final class EntityCallbacks implements LevelCallback { diff --git a/src/main/java/net/minecraft/world/level/ChunkPos.java b/src/main/java/net/minecraft/world/level/ChunkPos.java -index 4335132883e959f0c9649d5640b703a291d8a7aa..22d95316eac3731c66dd7dde960e4d71a6b565e2 100644 +index 2d41f619577b41d6420159668bbab70fb6c762eb..ed0b136e99def41d4377f2004477826b3546a145 100644 --- a/src/main/java/net/minecraft/world/level/ChunkPos.java +++ b/src/main/java/net/minecraft/world/level/ChunkPos.java -@@ -50,7 +50,7 @@ public class ChunkPos { +@@ -60,7 +60,7 @@ public class ChunkPos { } public static long asLong(BlockPos pos) { @@ -52,7 +52,7 @@ index 4335132883e959f0c9649d5640b703a291d8a7aa..22d95316eac3731c66dd7dde960e4d71 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 1407f30d467fa78bc207a91da0e6395c0a9ba83d..2110cb437807f99994838b57653caefe2f01a9c5 100644 +index e55ec74ac0363def04c2d7bf1b2a9d873388ea70..823489437dad68f52213f25d84d84ac64f7cc208 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 diff --git a/patches/unapplied/server/0431-Delay-Chunk-Unloads-based-on-Player-Movement.patch b/patches/server/0428-Delay-Chunk-Unloads-based-on-Player-Movement.patch similarity index 100% rename from patches/unapplied/server/0431-Delay-Chunk-Unloads-based-on-Player-Movement.patch rename to patches/server/0428-Delay-Chunk-Unloads-based-on-Player-Movement.patch diff --git a/patches/unapplied/server/0432-Fix-villager-trading-demand-MC-163962.patch b/patches/server/0429-Fix-villager-trading-demand-MC-163962.patch similarity index 90% rename from patches/unapplied/server/0432-Fix-villager-trading-demand-MC-163962.patch rename to patches/server/0429-Fix-villager-trading-demand-MC-163962.patch index 085098328..fb5e33085 100644 --- a/patches/unapplied/server/0432-Fix-villager-trading-demand-MC-163962.patch +++ b/patches/server/0429-Fix-villager-trading-demand-MC-163962.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix villager trading demand - MC-163962 Prevent demand from going negative and tending to negative infinity diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java -index 510730fecc8a88dd0588689512863bd30ac248c7..f3cf16ce1e1d6c8f76ca5823f532925253ae64aa 100644 +index 987e65332058f364fcef0a29c97b206b14ad6457..8b46e494ecd0cce5ab0b2bf8e50cf50dc7e2a7e5 100644 --- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java +++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java @@ -113,7 +113,7 @@ public class MerchantOffer { diff --git a/patches/unapplied/server/0433-Maps-shouldn-t-load-chunks.patch b/patches/server/0430-Maps-shouldn-t-load-chunks.patch similarity index 91% rename from patches/unapplied/server/0433-Maps-shouldn-t-load-chunks.patch rename to patches/server/0430-Maps-shouldn-t-load-chunks.patch index d3c9edb4f..3ab19f357 100644 --- a/patches/unapplied/server/0433-Maps-shouldn-t-load-chunks.patch +++ b/patches/server/0430-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 f3c0d48f1f6bc6a1a20d4b25d943b01c8736bb36..d15d87208d21173912cf489b55b1c5d226ea998b 100644 +index 339dfd9fdffbc1c49b9112ba43ef6f05d85bdf86..44bfc5560a1b43925aabfd8137495e169da32fa2 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java -@@ -130,9 +130,9 @@ public class MapItem extends ComplexItem { +@@ -131,9 +131,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/unapplied/server/0434-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch b/patches/server/0431-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch similarity index 55% rename from patches/unapplied/server/0434-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch rename to patches/server/0431-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch index 3c0b925e5..9ed5e37d3 100644 --- a/patches/unapplied/server/0434-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch +++ b/patches/server/0431-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch @@ -6,10 +6,10 @@ 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 d15d87208d21173912cf489b55b1c5d226ea998b..6f86f00d33cd50a2b67409c2f0f5400c869b802a 100644 +index 44bfc5560a1b43925aabfd8137495e169da32fa2..d407cf849a31a7a77fda07aa687ebb254f43d6ab 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java -@@ -251,14 +251,13 @@ public class MapItem extends ComplexItem { +@@ -252,14 +252,13 @@ public class MapItem extends ComplexItem { boolean[] aboolean = new boolean[16384]; int l = j / i - 64; int i1 = k / i - 64; @@ -20,8 +20,8 @@ index d15d87208d21173912cf489b55b1c5d226ea998b..6f86f00d33cd50a2b67409c2f0f5400c 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 +- Holder holder = world.getBiome(blockposition_mutableblockposition.set((l + k1) * i, 0, (i1 + j1) * i)); ++ Holder holder = 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; + aboolean[j1 * 128 + k1] = holder.is(BiomeTags.WATER_ON_MAP_OUTLINES); } diff --git a/patches/unapplied/server/0436-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch b/patches/server/0432-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch similarity index 100% rename from patches/unapplied/server/0436-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch rename to patches/server/0432-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch diff --git a/patches/unapplied/server/0437-Fix-piston-physics-inconsistency-MC-188840.patch b/patches/server/0433-Fix-piston-physics-inconsistency-MC-188840.patch similarity index 97% rename from patches/unapplied/server/0437-Fix-piston-physics-inconsistency-MC-188840.patch rename to patches/server/0433-Fix-piston-physics-inconsistency-MC-188840.patch index dfecb91ef..b67d05ab0 100644 --- a/patches/unapplied/server/0437-Fix-piston-physics-inconsistency-MC-188840.patch +++ b/patches/server/0433-Fix-piston-physics-inconsistency-MC-188840.patch @@ -49,10 +49,10 @@ index 62a0f6772bacfb8ad90c15493e0d48e29b70fac1..c639557108ad9c59ccdd0b543b5507fb + } 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 edb599da2431fa32f6e656dd3de8f4a6f5e2ed4f..f4f49cc4109d4ae72c0a50f7acbd181d05bf415a 100644 +index 272279244f558c8ea298b35605c0421c037aad48..053bb85355c1b0fd93477187f4cedc582c6a480b 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 -@@ -409,14 +409,26 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -411,14 +411,26 @@ public class PistonBaseBlock extends DirectionalBlock { } for (k = list.size() - 1; k >= 0; --k) { diff --git a/patches/unapplied/server/0438-Fix-sand-duping.patch b/patches/server/0434-Fix-sand-duping.patch similarity index 100% rename from patches/unapplied/server/0438-Fix-sand-duping.patch rename to patches/server/0434-Fix-sand-duping.patch diff --git a/patches/unapplied/server/0439-Prevent-position-desync-in-playerconnection-causing-.patch b/patches/server/0435-Prevent-position-desync-in-playerconnection-causing-.patch similarity index 91% rename from patches/unapplied/server/0439-Prevent-position-desync-in-playerconnection-causing-.patch rename to patches/server/0435-Prevent-position-desync-in-playerconnection-causing-.patch index bcab36c33..c33609367 100644 --- a/patches/unapplied/server/0439-Prevent-position-desync-in-playerconnection-causing-.patch +++ b/patches/server/0435-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 9f80408a7cf39f1f8b58c688b91de4731208e93d..61d5b5001979751da986fd8a634a58094c172946 100644 +index d5b7a909a26135abce682c062cedd9b2de0239d0..0693356f47cfbc4c3ff2573bf2ce4f28d41f5fd7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1342,6 +1342,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1372,6 +1372,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/unapplied/server/0440-Inventory-getHolder-method-without-block-snapshot.patch b/patches/server/0436-Inventory-getHolder-method-without-block-snapshot.patch similarity index 100% rename from patches/unapplied/server/0440-Inventory-getHolder-method-without-block-snapshot.patch rename to patches/server/0436-Inventory-getHolder-method-without-block-snapshot.patch diff --git a/patches/unapplied/server/0441-Improve-Arrow-API.patch b/patches/server/0437-Improve-Arrow-API.patch similarity index 100% rename from patches/unapplied/server/0441-Improve-Arrow-API.patch rename to patches/server/0437-Improve-Arrow-API.patch diff --git a/patches/unapplied/server/0442-Add-and-implement-PlayerRecipeBookClickEvent.patch b/patches/server/0438-Add-and-implement-PlayerRecipeBookClickEvent.patch similarity index 92% rename from patches/unapplied/server/0442-Add-and-implement-PlayerRecipeBookClickEvent.patch rename to patches/server/0438-Add-and-implement-PlayerRecipeBookClickEvent.patch index 7663aac0e..5a0b2ceec 100644 --- a/patches/unapplied/server/0442-Add-and-implement-PlayerRecipeBookClickEvent.patch +++ b/patches/server/0438-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 61d5b5001979751da986fd8a634a58094c172946..5069017665f98a8b3900220b01ca4b99bc8d2f93 100644 +index 0693356f47cfbc4c3ff2573bf2ce4f28d41f5fd7..90ce47c8ac50da05b3082402d56b295fc3293532 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2805,9 +2805,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2996,9 +2996,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/unapplied/server/0443-Hide-sync-chunk-writes-behind-flag.patch b/patches/server/0439-Hide-sync-chunk-writes-behind-flag.patch similarity index 89% rename from patches/unapplied/server/0443-Hide-sync-chunk-writes-behind-flag.patch rename to patches/server/0439-Hide-sync-chunk-writes-behind-flag.patch index cb0833f0d..299fc6e59 100644 --- a/patches/unapplied/server/0443-Hide-sync-chunk-writes-behind-flag.patch +++ b/patches/server/0439-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 a7938420f6840b9d3880fb895aaf709ebd844312..ebfaa8d5de5b905bd2dd7778728b8c9939d01252 100644 +index cc92e2c5e6b62c6a67d0a6534b078e3a6029daf5..26345494ce190b5cd2ab58dd7d4b046796767b20 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -@@ -111,7 +111,7 @@ public class DedicatedServerProperties extends Settings { return Mth.clamp(integer, (int) 1, 29999984); }, 29999984); diff --git a/patches/unapplied/server/0444-Add-permission-for-command-blocks.patch b/patches/server/0440-Add-permission-for-command-blocks.patch similarity index 85% rename from patches/unapplied/server/0444-Add-permission-for-command-blocks.patch rename to patches/server/0440-Add-permission-for-command-blocks.patch index feaf0be33..c31d0ab3b 100644 --- a/patches/unapplied/server/0444-Add-permission-for-command-blocks.patch +++ b/patches/server/0440-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 d4f57fde2f02071dfde08cb2a5c8359984056aef..176e5bbac94cf39805dcacfcae3a3daa98b793b7 100644 +index 312768054e02847bbc7d2ec7fa6198dad52b86d2..32a6b4d8e6c8f9c05cc7ca811c2188aa554f9e3e 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -403,7 +403,7 @@ public class ServerPlayerGameMode { +@@ -396,7 +396,7 @@ public class ServerPlayerGameMode { BlockEntity tileentity = this.level.getBlockEntity(pos); Block block = iblockdata.getBlock(); @@ -18,32 +18,32 @@ index d4f57fde2f02071dfde08cb2a5c8359984056aef..176e5bbac94cf39805dcacfcae3a3daa 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 5069017665f98a8b3900220b01ca4b99bc8d2f93..b03b8bb8e3f19de772d41bc5a9bda3192273df07 100644 +index 90ce47c8ac50da05b3082402d56b295fc3293532..44b44548c33f5128fbf09ac36c6bab428b8a8c97 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -796,7 +796,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -828,7 +828,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); + this.player.sendSystemMessage(Component.translatable("advMode.notEnabled")); - } else if (!this.player.canUseGameMasterBlocks()) { + } else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission - this.player.sendMessage(new TranslatableComponent("advMode.notAllowed"), Util.NIL_UUID); + this.player.sendSystemMessage(Component.translatable("advMode.notAllowed")); } else { BaseCommandBlock commandblocklistenerabstract = null; -@@ -863,7 +863,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -895,7 +895,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); + this.player.sendSystemMessage(Component.translatable("advMode.notEnabled")); - } else if (!this.player.canUseGameMasterBlocks()) { + } else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission - this.player.sendMessage(new TranslatableComponent("advMode.notAllowed"), Util.NIL_UUID); + this.player.sendSystemMessage(Component.translatable("advMode.notAllowed")); } else { BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level); diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java -index 5b125aa77e769983a0aee7c5f6eb6a8a146fead0..fca57e5d1e25db6367c53ad04e49508ebf2223e7 100644 +index da504702bc9423774b35dff792d2dbe7fc270fe3..c0195f73cd2c8721e882c681eaead65471710081 100644 --- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java +++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java -@@ -199,7 +199,7 @@ public abstract class BaseCommandBlock implements CommandSource { +@@ -198,7 +198,7 @@ public abstract class BaseCommandBlock implements CommandSource { } public InteractionResult usedBy(Player player) { @@ -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 25a297968388f85108d7b9de96fdc7d368034e4d..1a48c5ea1f2f755abfa85469e26f37ea5f02d6da 100644 +index 061a56e3828767cd6576d5a9edde5f3498e609d0..2e7c03b00bc941b86df6a7f1b2b188c9f0aede22 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/unapplied/server/0445-Ensure-Entity-AABB-s-are-never-invalid.patch b/patches/server/0441-Ensure-Entity-AABB-s-are-never-invalid.patch similarity index 84% rename from patches/unapplied/server/0445-Ensure-Entity-AABB-s-are-never-invalid.patch rename to patches/server/0441-Ensure-Entity-AABB-s-are-never-invalid.patch index 7ee204a54..51afbf141 100644 --- a/patches/unapplied/server/0445-Ensure-Entity-AABB-s-are-never-invalid.patch +++ b/patches/server/0441-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 14b3f14d2489bdbeb89886a115db2ba78cb97ad7..5d51296954dc9e1c3c9576d7afb5287c76ab3afe 100644 +index bbd94142c3519bc8a6602a31699a7132119e395c..36fa5864edb6da34ba005487fd62255421d6190f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -599,8 +599,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -621,8 +621,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } public void setPos(double x, double y, double z) { @@ -19,7 +19,7 @@ index 14b3f14d2489bdbeb89886a115db2ba78cb97ad7..5d51296954dc9e1c3c9576d7afb5287c } protected AABB makeBoundingBox() { -@@ -3783,6 +3783,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3834,6 +3834,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } public final void setPosRaw(double x, double y, double z) { @@ -31,8 +31,8 @@ index 14b3f14d2489bdbeb89886a115db2ba78cb97ad7..5d51296954dc9e1c3c9576d7afb5287c 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); -@@ -3805,6 +3810,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { - } +@@ -3851,6 +3856,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + this.levelCallback.onMove(); } + // Paper start - never allow AABB to become desynced from position diff --git a/patches/unapplied/server/0446-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/0442-Fix-Per-World-Difficulty-Remembering-Difficulty.patch similarity index 80% rename from patches/unapplied/server/0446-Fix-Per-World-Difficulty-Remembering-Difficulty.patch rename to patches/server/0442-Fix-Per-World-Difficulty-Remembering-Difficulty.patch index 3ff88ec22..feaae1830 100644 --- a/patches/unapplied/server/0446-Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/patches/server/0442-Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -8,10 +8,10 @@ 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 12c1cee3b3055b44d0ca3196eb37e51879fce67b..f85ee370c89b59ad58f182da2ff6d0d11c6e3a8b 100644 +index 9905dba12c6b3f584a6fab94517592b6d2c042f0..06e7ca13f24838bdb2305e1c12b1aeac9152612f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -820,7 +820,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop