diff options
author | Jake Potrebic <[email protected]> | 2024-04-06 18:52:05 -0700 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2024-04-10 14:04:47 -0700 |
commit | c1166f5d0d73723d8e7bad1a158a96a21835c5c2 (patch) | |
tree | 7af29e745260ce62664bfd2be7aaaf28c06eed60 /patches/server | |
parent | 5436d44bf2509ff89129f8790ee4643f09c72871 (diff) | |
download | Paper-c1166f5d0d73723d8e7bad1a158a96a21835c5c2.tar.gz Paper-c1166f5d0d73723d8e7bad1a158a96a21835c5c2.zip |
Update patches to handle vineflower decompiler
Diffstat (limited to 'patches/server')
364 files changed, 1875 insertions, 1838 deletions
diff --git a/patches/server/0002-Remap-fixes.patch b/patches/server/0002-Remap-fixes.patch index 3f9503543f..20de85514e 100644 --- a/patches/server/0002-Remap-fixes.patch +++ b/patches/server/0002-Remap-fixes.patch @@ -5,10 +5,10 @@ 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 ad3035da44c6af2fa7cc53926f33526a43740313..e89fa618fa20e3e843d8de81629e6dc551777823 100644 +index 14dc0f93a1904bd78853ff861c855115f8de0462..cd2a345e5e33b4a8858bcf64bda1aa99aef2f059 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -278,9 +278,11 @@ public class BlockPos extends Vec3i { +@@ -292,9 +292,11 @@ public class BlockPos extends Vec3i { public static Iterable<BlockPos> withinManhattan(BlockPos center, int rangeX, int rangeY, int rangeZ) { int i = rangeX + rangeY + rangeZ; @@ -23,7 +23,7 @@ index ad3035da44c6af2fa7cc53926f33526a43740313..e89fa618fa20e3e843d8de81629e6dc5 return () -> { return new AbstractIterator<BlockPos>() { private final BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos(); -@@ -295,7 +297,7 @@ public class BlockPos extends Vec3i { +@@ -309,7 +311,7 @@ public class BlockPos extends Vec3i { protected BlockPos computeNext() { if (this.zMirror) { this.zMirror = false; @@ -32,7 +32,7 @@ index ad3035da44c6af2fa7cc53926f33526a43740313..e89fa618fa20e3e843d8de81629e6dc5 return this.cursor; } else { BlockPos blockPos; -@@ -321,7 +323,7 @@ public class BlockPos extends Vec3i { +@@ -335,7 +337,7 @@ public class BlockPos extends Vec3i { int k = this.currentDepth - Math.abs(i) - Math.abs(j); if (k <= rangeZ) { this.zMirror = k != 0; diff --git a/patches/server/0003-Build-system-changes.patch b/patches/server/0003-Build-system-changes.patch index d9c9c0db74..8f489a8989 100644 --- a/patches/server/0003-Build-system-changes.patch +++ b/patches/server/0003-Build-system-changes.patch @@ -9,7 +9,7 @@ public net.minecraft.server.packs.VanillaPackResourcesBuilder safeGetPath(Ljava/ Co-authored-by: Jake Potrebic <[email protected]> diff --git a/build.gradle.kts b/build.gradle.kts -index 74849d7b20e3c3831a6a6c3715a6e875d6ff8a48..ff9e7b4c4354d4475559213cdaa01728601859fa 100644 +index 4e0b810bd0a9991d10e13920f47f0b6d0a56f6aa..50d9182a4845564cd62b026700a7d0517c25e74d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,9 +9,7 @@ plugins { @@ -66,10 +66,10 @@ index 74849d7b20e3c3831a6a6c3715a6e875d6ff8a48..ff9e7b4c4354d4475559213cdaa01728 + jvmArgs("-DPaper.pushPaperAssetsRoot=true") } diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java -index 68e3d54c79924d72b22eb3bc142ff47aa1700895..d3300e43523429fdd0e61c5aa9aed2e6bc78e07e 100644 +index 6b6bf94b7826aad8e10200495772f68a9b4a0b48..980ba384d15c69030d033426290678e569af23b4 100644 --- a/src/main/java/net/minecraft/resources/ResourceLocation.java +++ b/src/main/java/net/minecraft/resources/ResourceLocation.java -@@ -26,6 +26,7 @@ public class ResourceLocation implements Comparable<ResourceLocation> { +@@ -28,6 +28,7 @@ public class ResourceLocation implements Comparable<ResourceLocation> { public static final char NAMESPACE_SEPARATOR = ':'; public static final String DEFAULT_NAMESPACE = "minecraft"; public static final String REALMS_NAMESPACE = "realms"; @@ -78,10 +78,10 @@ index 68e3d54c79924d72b22eb3bc142ff47aa1700895..d3300e43523429fdd0e61c5aa9aed2e6 private final String path; diff --git a/src/main/java/net/minecraft/server/packs/VanillaPackResourcesBuilder.java b/src/main/java/net/minecraft/server/packs/VanillaPackResourcesBuilder.java -index 1b65823e6c2070761dd08ce801268e95dad13065..978dd399430ae98d54fc4805800aa0214d4034e3 100644 +index e3e28f21f6eee539ca960946067b2d31626899fa..6dd89ad3e7354b1403b873b5c55a41f0b04c956a 100644 --- a/src/main/java/net/minecraft/server/packs/VanillaPackResourcesBuilder.java +++ b/src/main/java/net/minecraft/server/packs/VanillaPackResourcesBuilder.java -@@ -141,6 +141,15 @@ public class VanillaPackResourcesBuilder { +@@ -140,6 +140,15 @@ public class VanillaPackResourcesBuilder { public VanillaPackResourcesBuilder applyDevelopmentConfig() { developmentConfig.accept(this); @@ -98,18 +98,18 @@ index 1b65823e6c2070761dd08ce801268e95dad13065..978dd399430ae98d54fc4805800aa021 } diff --git a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java -index a2a8bce29ec5540de89095574dfdc0ca9b17bbd3..d92cd89373f8373c367ce422328b9836de09096d 100644 +index f2d24c3dd0a958bfd038ba7e3cafb72b53ea20dd..d0d65a59d75b56e4fc8c29068ac56e13df2b2aea 100644 --- a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java +++ b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java -@@ -32,7 +32,7 @@ public class ServerPacksSource extends BuiltInPackSource { - - @VisibleForTesting +@@ -38,7 +38,7 @@ public class ServerPacksSource extends BuiltInPackSource { public static VanillaPackResources createVanillaPackSource() { -- return (new VanillaPackResourcesBuilder()).setMetadata(BUILT_IN_METADATA).exposeNamespace("minecraft").applyDevelopmentConfig().pushJarResources().build(); -+ return (new VanillaPackResourcesBuilder()).setMetadata(BUILT_IN_METADATA).exposeNamespace("minecraft", ResourceLocation.PAPER_NAMESPACE).applyDevelopmentConfig().pushJarResources().build(); // Paper - } - - @Override + return new VanillaPackResourcesBuilder() + .setMetadata(BUILT_IN_METADATA) +- .exposeNamespace("minecraft") ++ .exposeNamespace("minecraft", ResourceLocation.PAPER_NAMESPACE) // Paper + .applyDevelopmentConfig() + .pushJarResources() + .build(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java index 2930f37c663a1824a2d38df8e4b679aa6adbd870..67d347741db1c5a9a6568ee084388a59e35b16ea 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/patches/server/0004-Test-changes.patch b/patches/server/0004-Test-changes.patch index b13f9277b7..9bb625b711 100644 --- a/patches/server/0004-Test-changes.patch +++ b/patches/server/0004-Test-changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Test changes diff --git a/build.gradle.kts b/build.gradle.kts -index ff9e7b4c4354d4475559213cdaa01728601859fa..5304f5de52a76eee876ac8f0b2834a93b28d57aa 100644 +index 50d9182a4845564cd62b026700a7d0517c25e74d..69155f6badcd79b3479654363ca1f1d8a138a7ad 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,6 +23,7 @@ dependencies { diff --git a/patches/server/0005-Paper-config-files.patch b/patches/server/0005-Paper-config-files.patch index 21f0044039..0a7181c4de 100644 --- a/patches/server/0005-Paper-config-files.patch +++ b/patches/server/0005-Paper-config-files.patch @@ -15,7 +15,7 @@ public net.minecraft.server.dedicated.DedicatedServerProperties reload(Lnet/mine public net.minecraft.world.level.NaturalSpawner SPAWNING_CATEGORIES diff --git a/build.gradle.kts b/build.gradle.kts -index beb50d67ea2c1933a115766627b2adabd2032929..b8970d0064b9b64e1c50ab373818c38611fd9f5e 100644 +index 69155f6badcd79b3479654363ca1f1d8a138a7ad..8332781de54d73cb5803828e98882a731daed81f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,6 +11,7 @@ dependencies { @@ -4867,17 +4867,19 @@ index 42da710d18063aed6fd450fe31277d7daf0542c1..62e096c9cc05c387ca2413a490f44c6c private void readScoreboard(DimensionDataStorage persistentStateManager) { diff --git a/src/main/java/net/minecraft/server/Services.java b/src/main/java/net/minecraft/server/Services.java -index 1d611538d339345df065cd9c0c582d02e1fb0cc7..d200619b4aa820e273c26f2f6133589c727f8a0e 100644 +index dfbb04800d6f1dcbb909fcdfeb1ebf1a5efa6a48..5928e5f1934b8e247ba516595018ed5c633d3b5d 100644 --- a/src/main/java/net/minecraft/server/Services.java +++ b/src/main/java/net/minecraft/server/Services.java -@@ -10,14 +10,30 @@ import javax.annotation.Nullable; +@@ -10,16 +10,32 @@ import javax.annotation.Nullable; import net.minecraft.server.players.GameProfileCache; import net.minecraft.util.SignatureValidator; --public record Services(MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache) { -+// Paper start - add paper configuration files -+public record Services(MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache, @javax.annotation.Nullable io.papermc.paper.configuration.PaperConfigurations paperConfigurations) { + + public record Services( +- MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache ++ MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache, @javax.annotation.Nullable io.papermc.paper.configuration.PaperConfigurations paperConfigurations // Paper - add paper configuration files + ) { ++ // Paper start - add paper configuration files + public Services(MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache) { + this(sessionService, servicesKeySet, profileRepository, profileCache, null); + } @@ -4985,7 +4987,7 @@ index 680a308c466c0056d4213e61f69cf13ee3ff5c61..cd39509d383c47319b71797e5d1df41c world.serverLevelData.setDifficulty(config.difficulty); world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 96210dd54e8ff6dc0375a8d03bf14fec1b26aaeb..19725db76dc3a12356993aed7edba507b52fe4d7 100644 +index 67d347741db1c5a9a6568ee084388a59e35b16ea..cc6d96c5015b4e5614e8091dc9113e82e9babc25 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -141,6 +141,19 @@ public class Main { diff --git a/patches/server/0006-MC-Dev-fixes.patch b/patches/server/0006-MC-Dev-fixes.patch index 271ad7735f..dac30cbd81 100644 --- a/patches/server/0006-MC-Dev-fixes.patch +++ b/patches/server/0006-MC-Dev-fixes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] MC Dev fixes diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index e89fa618fa20e3e843d8de81629e6dc551777823..2bb5e51f71cbf66819d198505aa4a5ecffd246c6 100644 +index cd2a345e5e33b4a8858bcf64bda1aa99aef2f059..44853c711442e0360e5631ae1c5d1d5a6edd2526 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -383,12 +383,12 @@ public class BlockPos extends Vec3i { +@@ -411,12 +411,12 @@ public class BlockPos extends Vec3i { if (this.index == l) { return this.endOfData(); } else { @@ -20,90 +20,36 @@ index e89fa618fa20e3e843d8de81629e6dc551777823..2bb5e51f71cbf66819d198505aa4a5ec + int u = this.index / i; // Paper - decomp fix + int offsetY = u % j; // Paper - decomp fix + int offsetZ = u / j; // Paper - decomp fix - ++this.index; + this.index++; - return this.cursor.set(startX + i, startY + k, startZ + l); + return this.cursor.set(startX + offsetX, startY + offsetY, startZ + offsetZ); // Paper - decomp fix } } }; -diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -index ac523135cfdfbac507774c8f86d731de881b0442..ca70cd2e76c94f7a284c9af47c64252855f070a4 100644 ---- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -+++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -@@ -333,7 +333,7 @@ public class BuiltInRegistries { - LOADERS.put(resourceLocation, () -> { - return initializer.run(registry); - }); -- WRITABLE_REGISTRY.register(key, registry, lifecycle); -+ WRITABLE_REGISTRY.register((ResourceKey) key, registry, lifecycle); // Paper - decompile fix - return registry; - } - diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java -index bfac303dc0c11a0e741b29f3700823c69e55c798..ac1aa37329bd4d411964ea34ea8147f6db945b9a 100644 +index 81c74fc4ebdab7d2b11f2aebef997dc71ae39c97..fca5251008f21c0f3eee9390eca9b9fa2fef1151 100644 --- a/src/main/java/net/minecraft/network/ConnectionProtocol.java +++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java -@@ -220,7 +220,7 @@ public enum ConnectionProtocol { - PLAY("play", protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet<ClientGamePacketListener>()).withBundlePacket(ClientboundBundlePacket.class, ClientboundBundlePacket::new).addPacket(ClientboundAddEntityPacket.class, ClientboundAddEntityPacket::new).addPacket(ClientboundAddExperienceOrbPacket.class, ClientboundAddExperienceOrbPacket::new).addPacket(ClientboundAnimatePacket.class, ClientboundAnimatePacket::new).addPacket(ClientboundAwardStatsPacket.class, ClientboundAwardStatsPacket::new).addPacket(ClientboundBlockChangedAckPacket.class, ClientboundBlockChangedAckPacket::new).addPacket(ClientboundBlockDestructionPacket.class, ClientboundBlockDestructionPacket::new).addPacket(ClientboundBlockEntityDataPacket.class, ClientboundBlockEntityDataPacket::new).addPacket(ClientboundBlockEventPacket.class, ClientboundBlockEventPacket::new).addPacket(ClientboundBlockUpdatePacket.class, ClientboundBlockUpdatePacket::new).addPacket(ClientboundBossEventPacket.class, ClientboundBossEventPacket::new).addPacket(ClientboundChangeDifficultyPacket.class, ClientboundChangeDifficultyPacket::new).addPacket(ClientboundChunkBatchFinishedPacket.class, ClientboundChunkBatchFinishedPacket::new).addPacket(ClientboundChunkBatchStartPacket.class, ClientboundChunkBatchStartPacket::new).addPacket(ClientboundChunksBiomesPacket.class, ClientboundChunksBiomesPacket::new).addPacket(ClientboundClearTitlesPacket.class, ClientboundClearTitlesPacket::new).addPacket(ClientboundCommandSuggestionsPacket.class, ClientboundCommandSuggestionsPacket::new).addPacket(ClientboundCommandsPacket.class, ClientboundCommandsPacket::new).addPacket(ClientboundContainerClosePacket.class, ClientboundContainerClosePacket::new).addPacket(ClientboundContainerSetContentPacket.class, ClientboundContainerSetContentPacket::new).addPacket(ClientboundContainerSetDataPacket.class, ClientboundContainerSetDataPacket::new).addPacket(ClientboundContainerSetSlotPacket.class, ClientboundContainerSetSlotPacket::new).addPacket(ClientboundCooldownPacket.class, ClientboundCooldownPacket::new).addPacket(ClientboundCustomChatCompletionsPacket.class, ClientboundCustomChatCompletionsPacket::new).addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new).addPacket(ClientboundDamageEventPacket.class, ClientboundDamageEventPacket::new).addPacket(ClientboundDeleteChatPacket.class, ClientboundDeleteChatPacket::new).addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new).addPacket(ClientboundDisguisedChatPacket.class, ClientboundDisguisedChatPacket::new).addPacket(ClientboundEntityEventPacket.class, ClientboundEntityEventPacket::new).addPacket(ClientboundExplodePacket.class, ClientboundExplodePacket::new).addPacket(ClientboundForgetLevelChunkPacket.class, ClientboundForgetLevelChunkPacket::new).addPacket(ClientboundGameEventPacket.class, ClientboundGameEventPacket::new).addPacket(ClientboundHorseScreenOpenPacket.class, ClientboundHorseScreenOpenPacket::new).addPacket(ClientboundHurtAnimationPacket.class, ClientboundHurtAnimationPacket::new).addPacket(ClientboundInitializeBorderPacket.class, ClientboundInitializeBorderPacket::new).addPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new).addPacket(ClientboundLevelChunkWithLightPacket.class, ClientboundLevelChunkWithLightPacket::new).addPacket(ClientboundLevelEventPacket.class, ClientboundLevelEventPacket::new).addPacket(ClientboundLevelParticlesPacket.class, ClientboundLevelParticlesPacket::new).addPacket(ClientboundLightUpdatePacket.class, ClientboundLightUpdatePacket::new).addPacket(ClientboundLoginPacket.class, ClientboundLoginPacket::new).addPacket(ClientboundMapItemDataPacket.class, ClientboundMapItemDataPacket::new).addPacket(ClientboundMerchantOffersPacket.class, ClientboundMerchantOffersPacket::new).addPacket(ClientboundMoveEntityPacket.Pos.class, ClientboundMoveEntityPacket.Pos::read).addPacket(ClientboundMoveEntityPacket.PosRot.class, ClientboundMoveEntityPacket.PosRot::read).addPacket(ClientboundMoveEntityPacket.Rot.class, ClientboundMoveEntityPacket.Rot::read).addPacket(ClientboundMoveVehiclePacket.class, ClientboundMoveVehiclePacket::new).addPacket(ClientboundOpenBookPacket.class, ClientboundOpenBookPacket::new).addPacket(ClientboundOpenScreenPacket.class, ClientboundOpenScreenPacket::new).addPacket(ClientboundOpenSignEditorPacket.class, ClientboundOpenSignEditorPacket::new).addPacket(ClientboundPingPacket.class, ClientboundPingPacket::new).addPacket(ClientboundPongResponsePacket.class, ClientboundPongResponsePacket::new).addPacket(ClientboundPlaceGhostRecipePacket.class, ClientboundPlaceGhostRecipePacket::new).addPacket(ClientboundPlayerAbilitiesPacket.class, ClientboundPlayerAbilitiesPacket::new).addPacket(ClientboundPlayerChatPacket.class, ClientboundPlayerChatPacket::new).addPacket(ClientboundPlayerCombatEndPacket.class, ClientboundPlayerCombatEndPacket::new).addPacket(ClientboundPlayerCombatEnterPacket.class, ClientboundPlayerCombatEnterPacket::new).addPacket(ClientboundPlayerCombatKillPacket.class, ClientboundPlayerCombatKillPacket::new).addPacket(ClientboundPlayerInfoRemovePacket.class, ClientboundPlayerInfoRemovePacket::new).addPacket(ClientboundPlayerInfoUpdatePacket.class, ClientboundPlayerInfoUpdatePacket::new).addPacket(ClientboundPlayerLookAtPacket.class, ClientboundPlayerLookAtPacket::new).addPacket(ClientboundPlayerPositionPacket.class, ClientboundPlayerPositionPacket::new).addPacket(ClientboundRecipePacket.class, ClientboundRecipePacket::new).addPacket(ClientboundRemoveEntitiesPacket.class, ClientboundRemoveEntitiesPacket::new).addPacket(ClientboundRemoveMobEffectPacket.class, ClientboundRemoveMobEffectPacket::new).addPacket(ClientboundResetScorePacket.class, ClientboundResetScorePacket::new).addPacket(ClientboundResourcePackPopPacket.class, ClientboundResourcePackPopPacket::new).addPacket(ClientboundResourcePackPushPacket.class, ClientboundResourcePackPushPacket::new).addPacket(ClientboundRespawnPacket.class, ClientboundRespawnPacket::new).addPacket(ClientboundRotateHeadPacket.class, ClientboundRotateHeadPacket::new).addPacket(ClientboundSectionBlocksUpdatePacket.class, ClientboundSectionBlocksUpdatePacket::new).addPacket(ClientboundSelectAdvancementsTabPacket.class, ClientboundSelectAdvancementsTabPacket::new).addPacket(ClientboundServerDataPacket.class, ClientboundServerDataPacket::new).addPacket(ClientboundSetActionBarTextPacket.class, ClientboundSetActionBarTextPacket::new).addPacket(ClientboundSetBorderCenterPacket.class, ClientboundSetBorderCenterPacket::new).addPacket(ClientboundSetBorderLerpSizePacket.class, ClientboundSetBorderLerpSizePacket::new).addPacket(ClientboundSetBorderSizePacket.class, ClientboundSetBorderSizePacket::new).addPacket(ClientboundSetBorderWarningDelayPacket.class, ClientboundSetBorderWarningDelayPacket::new).addPacket(ClientboundSetBorderWarningDistancePacket.class, ClientboundSetBorderWarningDistancePacket::new).addPacket(ClientboundSetCameraPacket.class, ClientboundSetCameraPacket::new).addPacket(ClientboundSetCarriedItemPacket.class, ClientboundSetCarriedItemPacket::new).addPacket(ClientboundSetChunkCacheCenterPacket.class, ClientboundSetChunkCacheCenterPacket::new).addPacket(ClientboundSetChunkCacheRadiusPacket.class, ClientboundSetChunkCacheRadiusPacket::new).addPacket(ClientboundSetDefaultSpawnPositionPacket.class, ClientboundSetDefaultSpawnPositionPacket::new).addPacket(ClientboundSetDisplayObjectivePacket.class, ClientboundSetDisplayObjectivePacket::new).addPacket(ClientboundSetEntityDataPacket.class, ClientboundSetEntityDataPacket::new).addPacket(ClientboundSetEntityLinkPacket.class, ClientboundSetEntityLinkPacket::new).addPacket(ClientboundSetEntityMotionPacket.class, ClientboundSetEntityMotionPacket::new).addPacket(ClientboundSetEquipmentPacket.class, ClientboundSetEquipmentPacket::new).addPacket(ClientboundSetExperiencePacket.class, ClientboundSetExperiencePacket::new).addPacket(ClientboundSetHealthPacket.class, ClientboundSetHealthPacket::new).addPacket(ClientboundSetObjectivePacket.class, ClientboundSetObjectivePacket::new).addPacket(ClientboundSetPassengersPacket.class, ClientboundSetPassengersPacket::new).addPacket(ClientboundSetPlayerTeamPacket.class, ClientboundSetPlayerTeamPacket::new).addPacket(ClientboundSetScorePacket.class, ClientboundSetScorePacket::new).addPacket(ClientboundSetSimulationDistancePacket.class, ClientboundSetSimulationDistancePacket::new).addPacket(ClientboundSetSubtitleTextPacket.class, ClientboundSetSubtitleTextPacket::new).addPacket(ClientboundSetTimePacket.class, ClientboundSetTimePacket::new).addPacket(ClientboundSetTitleTextPacket.class, ClientboundSetTitleTextPacket::new).addPacket(ClientboundSetTitlesAnimationPacket.class, ClientboundSetTitlesAnimationPacket::new).addPacket(ClientboundSoundEntityPacket.class, ClientboundSoundEntityPacket::new).addPacket(ClientboundSoundPacket.class, ClientboundSoundPacket::new).addPacket(ClientboundStartConfigurationPacket.class, ClientboundStartConfigurationPacket::new).addPacket(ClientboundStopSoundPacket.class, ClientboundStopSoundPacket::new).addPacket(ClientboundSystemChatPacket.class, ClientboundSystemChatPacket::new).addPacket(ClientboundTabListPacket.class, ClientboundTabListPacket::new).addPacket(ClientboundTagQueryPacket.class, ClientboundTagQueryPacket::new).addPacket(ClientboundTakeItemEntityPacket.class, ClientboundTakeItemEntityPacket::new).addPacket(ClientboundTeleportEntityPacket.class, ClientboundTeleportEntityPacket::new).addPacket(ClientboundTickingStatePacket.class, ClientboundTickingStatePacket::new).addPacket(ClientboundTickingStepPacket.class, ClientboundTickingStepPacket::new).addPacket(ClientboundUpdateAdvancementsPacket.class, ClientboundUpdateAdvancementsPacket::new).addPacket(ClientboundUpdateAttributesPacket.class, ClientboundUpdateAttributesPacket::new).addPacket(ClientboundUpdateMobEffectPacket.class, ClientboundUpdateMobEffectPacket::new).addPacket(ClientboundUpdateRecipesPacket.class, ClientboundUpdateRecipesPacket::new).addPacket(ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet<ServerGamePacketListener>()).addPacket(ServerboundAcceptTeleportationPacket.class, ServerboundAcceptTeleportationPacket::new).addPacket(ServerboundBlockEntityTagQuery.class, ServerboundBlockEntityTagQuery::new).addPacket(ServerboundChangeDifficultyPacket.class, ServerboundChangeDifficultyPacket::new).addPacket(ServerboundChatAckPacket.class, ServerboundChatAckPacket::new).addPacket(ServerboundChatCommandPacket.class, ServerboundChatCommandPacket::new).addPacket(ServerboundChatPacket.class, ServerboundChatPacket::new).addPacket(ServerboundChatSessionUpdatePacket.class, ServerboundChatSessionUpdatePacket::new).addPacket(ServerboundChunkBatchReceivedPacket.class, ServerboundChunkBatchReceivedPacket::new).addPacket(ServerboundClientCommandPacket.class, ServerboundClientCommandPacket::new).addPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new).addPacket(ServerboundCommandSuggestionPacket.class, ServerboundCommandSuggestionPacket::new).addPacket(ServerboundConfigurationAcknowledgedPacket.class, ServerboundConfigurationAcknowledgedPacket::new).addPacket(ServerboundContainerButtonClickPacket.class, ServerboundContainerButtonClickPacket::new).addPacket(ServerboundContainerClickPacket.class, ServerboundContainerClickPacket::new).addPacket(ServerboundContainerClosePacket.class, ServerboundContainerClosePacket::new).addPacket(ServerboundContainerSlotStateChangedPacket.class, ServerboundContainerSlotStateChangedPacket::new).addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new).addPacket(ServerboundEditBookPacket.class, ServerboundEditBookPacket::new).addPacket(ServerboundEntityTagQuery.class, ServerboundEntityTagQuery::new).addPacket(ServerboundInteractPacket.class, ServerboundInteractPacket::new).addPacket(ServerboundJigsawGeneratePacket.class, ServerboundJigsawGeneratePacket::new).addPacket(ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new).addPacket(ServerboundLockDifficultyPacket.class, ServerboundLockDifficultyPacket::new).addPacket(ServerboundMovePlayerPacket.Pos.class, ServerboundMovePlayerPacket.Pos::read).addPacket(ServerboundMovePlayerPacket.PosRot.class, ServerboundMovePlayerPacket.PosRot::read).addPacket(ServerboundMovePlayerPacket.Rot.class, ServerboundMovePlayerPacket.Rot::read).addPacket(ServerboundMovePlayerPacket.StatusOnly.class, ServerboundMovePlayerPacket.StatusOnly::read).addPacket(ServerboundMoveVehiclePacket.class, ServerboundMoveVehiclePacket::new).addPacket(ServerboundPaddleBoatPacket.class, ServerboundPaddleBoatPacket::new).addPacket(ServerboundPickItemPacket.class, ServerboundPickItemPacket::new).addPacket(ServerboundPingRequestPacket.class, ServerboundPingRequestPacket::new).addPacket(ServerboundPlaceRecipePacket.class, ServerboundPlaceRecipePacket::new).addPacket(ServerboundPlayerAbilitiesPacket.class, ServerboundPlayerAbilitiesPacket::new).addPacket(ServerboundPlayerActionPacket.class, ServerboundPlayerActionPacket::new).addPacket(ServerboundPlayerCommandPacket.class, ServerboundPlayerCommandPacket::new).addPacket(ServerboundPlayerInputPacket.class, ServerboundPlayerInputPacket::new).addPacket(ServerboundPongPacket.class, ServerboundPongPacket::new).addPacket(ServerboundRecipeBookChangeSettingsPacket.class, ServerboundRecipeBookChangeSettingsPacket::new).addPacket(ServerboundRecipeBookSeenRecipePacket.class, ServerboundRecipeBookSeenRecipePacket::new).addPacket(ServerboundRenameItemPacket.class, ServerboundRenameItemPacket::new).addPacket(ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new).addPacket(ServerboundSeenAdvancementsPacket.class, ServerboundSeenAdvancementsPacket::new).addPacket(ServerboundSelectTradePacket.class, ServerboundSelectTradePacket::new).addPacket(ServerboundSetBeaconPacket.class, ServerboundSetBeaconPacket::new).addPacket(ServerboundSetCarriedItemPacket.class, ServerboundSetCarriedItemPacket::new).addPacket(ServerboundSetCommandBlockPacket.class, ServerboundSetCommandBlockPacket::new).addPacket(ServerboundSetCommandMinecartPacket.class, ServerboundSetCommandMinecartPacket::new).addPacket(ServerboundSetCreativeModeSlotPacket.class, ServerboundSetCreativeModeSlotPacket::new).addPacket(ServerboundSetJigsawBlockPacket.class, ServerboundSetJigsawBlockPacket::new).addPacket(ServerboundSetStructureBlockPacket.class, ServerboundSetStructureBlockPacket::new).addPacket(ServerboundSignUpdatePacket.class, ServerboundSignUpdatePacket::new).addPacket(ServerboundSwingPacket.class, ServerboundSwingPacket::new).addPacket(ServerboundTeleportToEntityPacket.class, ServerboundTeleportToEntityPacket::new).addPacket(ServerboundUseItemOnPacket.class, ServerboundUseItemOnPacket::new).addPacket(ServerboundUseItemPacket.class, ServerboundUseItemPacket::new))), - STATUS("status", protocol().addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet<ServerStatusPacketListener>()).addPacket(ServerboundStatusRequestPacket.class, ServerboundStatusRequestPacket::new).addPacket(ServerboundPingRequestPacket.class, ServerboundPingRequestPacket::new)).addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet<ClientStatusPacketListener>()).addPacket(ClientboundStatusResponsePacket.class, ClientboundStatusResponsePacket::new).addPacket(ClientboundPongResponsePacket.class, ClientboundPongResponsePacket::new))), - LOGIN("login", protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet<ClientLoginPacketListener>()).addPacket(ClientboundLoginDisconnectPacket.class, ClientboundLoginDisconnectPacket::new).addPacket(ClientboundHelloPacket.class, ClientboundHelloPacket::new).addPacket(ClientboundGameProfilePacket.class, ClientboundGameProfilePacket::new).addPacket(ClientboundLoginCompressionPacket.class, ClientboundLoginCompressionPacket::new).addPacket(ClientboundCustomQueryPacket.class, ClientboundCustomQueryPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet<ServerLoginPacketListener>()).addPacket(ServerboundHelloPacket.class, ServerboundHelloPacket::new).addPacket(ServerboundKeyPacket.class, ServerboundKeyPacket::new).addPacket(ServerboundCustomQueryAnswerPacket.class, ServerboundCustomQueryAnswerPacket::read).addPacket(ServerboundLoginAcknowledgedPacket.class, ServerboundLoginAcknowledgedPacket::new))), -- CONFIGURATION("configuration", protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet<ClientCommonPacketListener>()).addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new).addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new).addPacket(ClientboundFinishConfigurationPacket.class, ClientboundFinishConfigurationPacket::new).addPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new).addPacket(ClientboundPingPacket.class, ClientboundPingPacket::new).addPacket(ClientboundRegistryDataPacket.class, ClientboundRegistryDataPacket::new).addPacket(ClientboundResourcePackPopPacket.class, ClientboundResourcePackPopPacket::new).addPacket(ClientboundResourcePackPushPacket.class, ClientboundResourcePackPushPacket::new).addPacket(ClientboundUpdateEnabledFeaturesPacket.class, ClientboundUpdateEnabledFeaturesPacket::new).addPacket(ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet<ServerCommonPacketListener>()).addPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new).addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new).addPacket(ServerboundFinishConfigurationPacket.class, ServerboundFinishConfigurationPacket::new).addPacket(ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new).addPacket(ServerboundPongPacket.class, ServerboundPongPacket::new).addPacket(ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new))); -+ CONFIGURATION("configuration", protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet<net.minecraft.network.protocol.configuration.ClientConfigurationPacketListener>()).addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new).addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new).addPacket(ClientboundFinishConfigurationPacket.class, ClientboundFinishConfigurationPacket::new).addPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new).addPacket(ClientboundPingPacket.class, ClientboundPingPacket::new).addPacket(ClientboundRegistryDataPacket.class, ClientboundRegistryDataPacket::new).addPacket(ClientboundResourcePackPopPacket.class, ClientboundResourcePackPopPacket::new).addPacket(ClientboundResourcePackPushPacket.class, ClientboundResourcePackPushPacket::new).addPacket(ClientboundUpdateEnabledFeaturesPacket.class, ClientboundUpdateEnabledFeaturesPacket::new).addPacket(ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet<net.minecraft.network.protocol.configuration.ServerConfigurationPacketListener>()).addPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new).addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new).addPacket(ServerboundFinishConfigurationPacket.class, ServerboundFinishConfigurationPacket::new).addPacket(ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new).addPacket(ServerboundPongPacket.class, ServerboundPongPacket::new).addPacket(ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new))); // Paper - decompile fix - - public static final int NOT_REGISTERED = -1; - private final String id; -diff --git a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java -index 60228c3778e53ca5c513cd265e5e08d151573a4f..49138ccda0f378b13c7f425be765876eb4026b06 100644 ---- a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java -+++ b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java -@@ -86,7 +86,7 @@ public class ComponentSerialization { - for(MapDecoder<? extends T> mapDecoder : this.codecs) { - DataResult<? extends T> dataResult = mapDecoder.decode(dynamicOps, mapLike); - if (dataResult.result().isPresent()) { -- return dataResult; -+ return (DataResult<T>) dataResult; // Paper - decomp fix - } - } - -@@ -96,7 +96,7 @@ public class ComponentSerialization { - } - - public <S> RecordBuilder<S> encode(T object, DynamicOps<S> dynamicOps, RecordBuilder<S> recordBuilder) { -- MapEncoder<T> mapEncoder = this.encoderGetter.apply(object); -+ MapEncoder<T> mapEncoder = (MapEncoder<T>) this.encoderGetter.apply(object); // Paper - decomp fix - return mapEncoder.encode(object, dynamicOps, recordBuilder); - } - -diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java -index 13c8051da164bed579fbda44af059a36b8f00a0e..b6506e881ef337bfd2a7a0644296b48b7300a0f6 100644 ---- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java -+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java -@@ -129,9 +129,8 @@ public class ComponentUtils { - ComponentContents string = text.getContents(); - if (string instanceof TranslatableContents) { - TranslatableContents translatableContents = (TranslatableContents)string; -- String string = translatableContents.getKey(); - String string2 = translatableContents.getFallback(); -- return string2 != null || Language.getInstance().has(string); -+ return string2 != null || Language.getInstance().has(translatableContents.getKey()); // Paper - decompile fix - } - } - -diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java -index 279df2598c54e5b035c2945c59812baf1f97356b..e1bddbbdbeea79115d0f987065c34e0f7f04d377 100644 ---- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java -+++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java -@@ -92,7 +92,7 @@ public class RegistryDataLoader { - return new RegistryOps.RegistryInfoLookup() { - @Override - public <T> Optional<RegistryOps.RegistryInfo<T>> lookup(ResourceKey<? extends Registry<? extends T>> registryRef) { -- return Optional.ofNullable(map.get(registryRef)); -+ return Optional.ofNullable((RegistryOps.RegistryInfo<T>) map.get(registryRef)); // Paper - decompile fix - } - }; - } +@@ -451,7 +451,7 @@ public enum ConnectionProtocol { + protocol() + .addFlow( + PacketFlow.CLIENTBOUND, +- new ConnectionProtocol.PacketSet<ClientCommonPacketListener>() ++ new ConnectionProtocol.PacketSet<net.minecraft.network.protocol.configuration.ClientConfigurationPacketListener>() // Paper - decompile fix + .addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new) + .addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new) + .addPacket(ClientboundFinishConfigurationPacket.class, ClientboundFinishConfigurationPacket::new) +@@ -465,7 +465,7 @@ public enum ConnectionProtocol { + ) + .addFlow( + PacketFlow.SERVERBOUND, +- new ConnectionProtocol.PacketSet<ServerCommonPacketListener>() ++ new ConnectionProtocol.PacketSet<net.minecraft.network.protocol.configuration.ServerConfigurationPacketListener>() // Paper - decompile fix + .addPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new) + .addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new) + .addPacket(ServerboundFinishConfigurationPacket.class, ServerboundFinishConfigurationPacket::new) diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 15bdddae68db770690ddfcb19c7ecdbedbfa8cb7..650bf3483414751fbda7bff584af55df49cef22d 100644 +index 62e096c9cc05c387ca2413a490f44c6c66a5c41e..9c23ad38f935b2f31c0e0998e685978434202900 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1863,7 +1863,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -115,21 +61,8 @@ index 15bdddae68db770690ddfcb19c7ecdbedbfa8cb7..650bf3483414751fbda7bff584af55df }, this).thenCompose((immutablelist) -> { 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 2f66abf62d303342f5fe614fb3e35e7844497ffc..b346fa94b23d81da7da073f71dd12e672e0f079c 100644 ---- a/src/main/java/net/minecraft/server/level/Ticket.java -+++ b/src/main/java/net/minecraft/server/level/Ticket.java -@@ -21,7 +21,7 @@ public final class Ticket<T> implements Comparable<Ticket<?>> { - return i; - } else { - int j = Integer.compare(System.identityHashCode(this.type), System.identityHashCode(ticket.type)); -- return j != 0 ? j : this.type.getComparator().compare(this.key, ticket.key); -+ return j != 0 ? j : this.type.getComparator().compare(this.key, (T)ticket.key); // Paper - decompile fix - } - } - diff --git a/src/main/java/net/minecraft/util/SortedArraySet.java b/src/main/java/net/minecraft/util/SortedArraySet.java -index 2dc801061025888192c3bf2c4c38b928c16a0165..ca788f0dcec4a117b410fe8348969e056b138b1e 100644 +index 661a6274a800ca9b91bdb809d026972d23c3b263..ea72dcb064a35bc6245bc5c94d592efedd8faf41 100644 --- a/src/main/java/net/minecraft/util/SortedArraySet.java +++ b/src/main/java/net/minecraft/util/SortedArraySet.java @@ -28,7 +28,7 @@ public class SortedArraySet<T> extends AbstractSet<T> { @@ -141,32 +74,6 @@ index 2dc801061025888192c3bf2c4c38b928c16a0165..ca788f0dcec4a117b410fe8348969e05 } public static <T> SortedArraySet<T> create(Comparator<T> comparator) { -diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -index e1b9e25f1f8352bf6825a5827b6b354ef7a93203..90e4e0ec0c7b0ece23c4b53f5f12b1f24e1c18ad 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -@@ -101,7 +101,7 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> { - - @Override - public Brain<Frog> getBrain() { -- return super.getBrain(); -+ return (Brain<Frog>) super.getBrain(); // Paper - decompile fix - } - - @Override -diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 9799f693dc08cdfc2974959fc792ba86c5c51ceb..7bcd5498c734873b74bee503992ec4806ae61df7 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -125,7 +125,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { - - @Override - public Brain<Hoglin> getBrain() { -- return super.getBrain(); -+ return (Brain<Hoglin>) super.getBrain(); // Paper - decompile fix - } - - @Override 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 04adc10f24f96804a5cb14e884224bb672360464..4259181bab2dc4f2d0409b56fdf81d966003376d 100644 --- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java @@ -180,42 +87,3 @@ index 04adc10f24f96804a5cb14e884224bb672360464..4259181bab2dc4f2d0409b56fdf81d96 })); this.byName = Maps.newHashMap(builder.build()); // CraftBukkit RecipeManager.LOGGER.info("Loaded {} recipes", map1.size()); -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 9fbe8ef3fea77ecbbc8689cc6472d0d5f30b7166..b8fb6d1d85e07f5165bfaf7d80807e069b595851 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -57,7 +57,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer - } - - private static <T, C extends PalettedContainerRO<T>> Codec<C> codec(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy provider, T defaultValue, PalettedContainerRO.Unpacker<T, C> reader) { -- return RecordCodecBuilder.<PalettedContainerRO.PackedData>create((instance) -> { -+ return RecordCodecBuilder.<PalettedContainerRO.PackedData<T>>create((instance) -> { // Paper - decompile fix - return instance.group(entryCodec.mapResult(ExtraCodecs.orElsePartial(defaultValue)).listOf().fieldOf("palette").forGetter(PalettedContainerRO.PackedData::paletteEntries), Codec.LONG_STREAM.optionalFieldOf("data").forGetter(PalettedContainerRO.PackedData::storage)).apply(instance, PalettedContainerRO.PackedData::new); - }).comapFlatMap((serialized) -> { - return reader.read(idList, provider, serialized); -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 6b91771a4bf559881a4f3e6c98500e09b33d16e0..21a2800db22f287b9c6a8290326fdf3b94ae94b1 100644 ---- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java -+++ b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java -@@ -19,7 +19,7 @@ public class EntityLookup<T extends EntityAccess> { - public <U extends T> void getEntities(EntityTypeTest<T, U> filter, AbortableIterationConsumer<U> consumer) { - for(T entityAccess : this.byId.values()) { - U entityAccess2 = (U)((EntityAccess)filter.tryCast(entityAccess)); -- if (entityAccess2 != null && consumer.accept((T)entityAccess2).shouldAbort()) { -+ if (entityAccess2 != null && consumer.accept(entityAccess2).shouldAbort()) { // Paper - decompile fix - return; - } - } -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 69a19dbf58cde41680d086e78b9a12ffee602dbf..5dcb7f9cab097990148f5a7c4ccbe1556afdd514 100644 ---- a/src/main/java/net/minecraft/world/level/entity/EntitySection.java -+++ b/src/main/java/net/minecraft/world/level/entity/EntitySection.java -@@ -44,7 +44,7 @@ public class EntitySection<T extends EntityAccess> { - } else { - for(T entityAccess : collection) { - U entityAccess2 = (U)((EntityAccess)type.tryCast(entityAccess)); -- if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(box) && consumer.accept((T)entityAccess2).shouldAbort()) { -+ if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(box) && consumer.accept(entityAccess2).shouldAbort()) { // Paper - decompile fix - return AbortableIterationConsumer.Continuation.ABORT; - } - } diff --git a/patches/server/0008-CB-fixes.patch b/patches/server/0008-CB-fixes.patch index 98d20522e6..98a115c15e 100644 --- a/patches/server/0008-CB-fixes.patch +++ b/patches/server/0008-CB-fixes.patch @@ -52,10 +52,10 @@ index b2f37e3caf305f7f2c19c59848717bf73bd2ef5d..87c8460324ff2d2a14e1404fcfa3adb2 @Override 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 161ad6ab1443b2ce33a2d7d91d189c855db0453b..15a9736a870055d639d03063c7cf67fd769fff36 100644 +index 8fa222759b8ada1674a7d3ae1c0cdf91bfd7f915..da919ad85ce06572f8e7e4c121a2c222f975c7f5 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 -@@ -43,7 +43,7 @@ public class StructureCheck { +@@ -42,7 +42,7 @@ public class StructureCheck { private final Registry<Biome> biomes; private final Registry<Structure> structureConfigs; private final StructureTemplateManager structureTemplateManager; @@ -64,15 +64,15 @@ index 161ad6ab1443b2ce33a2d7d91d189c855db0453b..15a9736a870055d639d03063c7cf67fd private final ChunkGenerator chunkGenerator; private final RandomState randomState; private final LevelHeightAccessor heightAccessor; -@@ -53,7 +53,7 @@ public class StructureCheck { - private final Long2ObjectMap<Object2IntMap<Structure>> loadedChunks = new Long2ObjectOpenHashMap<>(); - private final Map<Structure, Long2BooleanMap> featureChecks = new HashMap<>(); - -- public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureTemplateManager structureTemplateManager, ResourceKey<Level> worldKey, ChunkGenerator chunkGenerator, RandomState noiseConfig, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { -+ public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureTemplateManager structureTemplateManager, ResourceKey<net.minecraft.world.level.dimension.LevelStem> worldKey, ChunkGenerator chunkGenerator, RandomState noiseConfig, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { // Paper - fix missing CB diff - this.storageAccess = chunkIoWorker; - this.registryAccess = registryManager; - this.structureTemplateManager = structureTemplateManager; +@@ -56,7 +56,7 @@ public class StructureCheck { + ChunkScanAccess chunkIoWorker, + RegistryAccess registryManager, + StructureTemplateManager structureTemplateManager, +- ResourceKey<Level> worldKey, ++ ResourceKey<net.minecraft.world.level.dimension.LevelStem> worldKey, // Paper - fix missing CB diff + ChunkGenerator chunkGenerator, + RandomState noiseConfig, + LevelHeightAccessor world, diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java index 809fdf2da78293391aa5c60c04f4ad652b152eec..955b0abd4019fc45df84719eee6bf413e59d941a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java @@ -107,7 +107,7 @@ index cd39509d383c47319b71797e5d1df41c2b8c7ab6..2cc1871c81056acd0582184bb684e672 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 19725db76dc3a12356993aed7edba507b52fe4d7..c2e1376bb06442297bda806ed8dc92f10cbbdd9a 100644 +index cc6d96c5015b4e5614e8091dc9113e82e9babc25..6f9196120177104c6e689ff1d39a06f91d04b0c8 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -122,6 +122,7 @@ public class Main { diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch index 8cb6342c33..74d7ea2349 100644 --- a/patches/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -5937,10 +5937,10 @@ index 0000000000000000000000000000000000000000..d603887f4d0464f4463172fd79bcd529 + } +} diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index d3afd54f546ae81f1c6d1a3ca9ee4e8e5c786ae4..114f4017c4133042178c57d424f10079163835dd 100644 +index 21c2bd6795d044ef6898de57d0734dd453769587..9a12feebbae4a9fdfd24214c2ffa61e717d6e358 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -125,7 +125,7 @@ public class Util { +@@ -127,7 +127,7 @@ public class Util { } public static long getNanos() { @@ -5950,10 +5950,10 @@ index d3afd54f546ae81f1c6d1a3ca9ee4e8e5c786ae4..114f4017c4133042178c57d424f10079 public static long getEpochMillis() { diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java -index c77fc9b93f3213655b2cc89f4afdec893f1cd22d..c77a6bb6885ffaaa4d9e1aa9d4770d5e847a590b 100644 +index 4f520046c5b650a780896a565efe959bc0bd21ae..8a8dd896328ec3f392f3c5ef7c94633922e45ee3 100644 --- a/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java -@@ -164,7 +164,7 @@ public class CompoundTag implements Tag { +@@ -163,7 +163,7 @@ public class CompoundTag implements Tag { return "TAG_Compound"; } }; @@ -5962,7 +5962,7 @@ index c77fc9b93f3213655b2cc89f4afdec893f1cd22d..c77a6bb6885ffaaa4d9e1aa9d4770d5e protected CompoundTag(Map<String, Tag> entries) { this.tags = entries; -@@ -240,6 +240,10 @@ public class CompoundTag implements Tag { +@@ -239,6 +239,10 @@ public class CompoundTag implements Tag { this.tags.put(key, NbtUtils.createUUID(value)); } @@ -5997,7 +5997,7 @@ index e7a124403f2b07c96caaaf97d1c9023f9ec2f9d9..5b267514504497de3faa7ffa490a1792 this.receiving = side; } diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index 427959874b7f167184785a582163029ad4a66df2..344c5af75c4a66bb27f3f422937c6c427c15ed25 100644 +index 522c62ff1114fa8bff41f7177f1192ab4472a6ed..d0e159f54da70bf0bd834738ced5d4b414a36142 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java @@ -46,7 +46,7 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { @@ -6959,7 +6959,7 @@ index 30fc222c384938fb4fdd4c6715295aeea57094bc..9ea829aafa7a874a784d02da889576c8 public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { // IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // 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 e89125da8e53cbfaa9ec5c6e56de2f7e8466c99f..a721e9cd0958d7fceed1aba8ae55fefed4e6a887 100644 +index b758a86c3d4744674faf25a6aea53c15a62ce234..c57b91c2385d118590bc419e7e6ed586d5d87422 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -259,6 +259,8 @@ public class ServerPlayer extends Player { @@ -7036,12 +7036,12 @@ index 93e0de052ea54cc1dee1ebc017fefb634eb42f8d..2e8e786407869b53cb4d7e4ec8f91fe0 GameProfileCache usercache = this.server.getProfileCache(); String s; diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -index 337e0a7b3c14e1b1a28744920e0dc0a69e0c5a87..f5829ae484d93b547a5437b85a9621346384a11b 100644 +index 9eba8e87e34abb23c0a32cb7ffbaaf272616418a..03e8707258e9b73cf12a4750270ab7573bb1c812 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<R extends Runnable> implements Profiler +@@ -77,6 +77,13 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler + runnable.run(); } - } + // Paper start + public void scheduleOnMain(Runnable r0) { @@ -7070,7 +7070,7 @@ index cdefbfb7a578d5f90b24f24dbc9a0fe627b91474..17e489c4650ba421a993c863426f1a20 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 cb0d7779a2eeadca49a99ab31217b27f5fd49e4c..864da662a81b653cd94e2270be262e912e351e21 100644 +index 36cedbf1b17a40cf15bc7207c263173d4571b466..cdac785c54e150c0886046b8d50657c0ca958438 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -259,6 +259,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -7107,7 +7107,7 @@ index 21fa43e0c3fabf74919f7e41d074ab1f7c061967..5e9cf929674888b3a143a0691dc6936b return this.getWalkTargetValue(pos, this.level()); } diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java -index 86b65d66d895a4f02da002448739c122796feb4d..036d79baf372f4900681fee366bcd91c99474e5f 100644 +index f73604d762efbac400d40f536ec1782fca584efa..4701bf9ee203f2f15b0b68e84bbfa2c489b66631 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Monster.java +++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java @@ -27,6 +27,7 @@ import net.minecraft.world.level.ServerLevelAccessor; @@ -7185,7 +7185,7 @@ index 1c71d2c1b16bdba1e14a8230787e4cb4ad530163..d6d8bbc98fc71997cb52521d59ebb59d FluidState getFluidState(BlockPos pos); diff --git a/src/main/java/net/minecraft/world/level/ChunkPos.java b/src/main/java/net/minecraft/world/level/ChunkPos.java -index 43bb3f5a617f4a6d719b02023a71edcb12aa9d05..2f47004a34f28a58965b1c47e78fb07ae15770cb 100644 +index 4cea6b4cad66d26a0fc66d06fa73af1eaf01b146..54cd046587c2f9dd26204bfa4eb65b8ad52b2d5e 100644 --- a/src/main/java/net/minecraft/world/level/ChunkPos.java +++ b/src/main/java/net/minecraft/world/level/ChunkPos.java @@ -20,6 +20,7 @@ public class ChunkPos { @@ -7350,7 +7350,7 @@ index bd9ea2bd012cdcf07ac322b3e0360c6c336ab1f9..bede1a64e4f04aa8e87ddb44f2cc4a1a 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 e6aabec35f4e27623d1fbbfb285cc78531137014..cc0d20e9f851268fe8403ac516f426ec1d008150 100644 +index daa1e9bf39666233dd80eeee0ffd76e168376889..ced67cf88c91c5270a0060a7307f36739237cbb2 100644 --- a/src/main/java/net/minecraft/world/level/LevelReader.java +++ b/src/main/java/net/minecraft/world/level/LevelReader.java @@ -26,6 +26,9 @@ public interface LevelReader extends BlockAndTintGetter, CollisionGetter, Signal @@ -7360,11 +7360,11 @@ index e6aabec35f4e27623d1fbbfb285cc78531137014..cc0d20e9f851268fe8403ac516f426ec + @Nullable ChunkAccess getChunkIfLoadedImmediately(int x, int z); // Paper - ifLoaded api (we need this since current impl blocks if the chunk is loading) + @Nullable default ChunkAccess getChunkIfLoadedImmediately(BlockPos pos) { return this.getChunkIfLoadedImmediately(pos.getX() >> 4, pos.getZ() >> 4);} + - /** @deprecated */ @Deprecated boolean hasChunk(int chunkX, int chunkZ); + diff --git a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java -index 249b3ed33672a9a9529bd14de978722b62019314..0f1025495237aebe30132ace0832aa5718d6f9bb 100644 +index 11364675963d9ef3b69b784ffa4bcd21ec35c530..bc6ea19689a4200a2a0759bed1445ef26c494e9e 100644 --- a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java +++ b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java @@ -9,6 +9,7 @@ import net.minecraft.core.Holder; @@ -7375,7 +7375,7 @@ index 249b3ed33672a9a9529bd14de978722b62019314..0f1025495237aebe30132ace0832aa57 import net.minecraft.world.entity.Entity; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biomes; -@@ -70,7 +71,7 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { +@@ -69,7 +70,7 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { private ChunkAccess getChunk(int chunkX, int chunkZ) { int i = chunkX - this.centerX; int j = chunkZ - this.centerZ; @@ -7384,7 +7384,7 @@ index 249b3ed33672a9a9529bd14de978722b62019314..0f1025495237aebe30132ace0832aa57 ChunkAccess chunkAccess = this.chunks[i][j]; return (ChunkAccess)(chunkAccess != null ? chunkAccess : new EmptyLevelChunk(this.level, new ChunkPos(chunkX, chunkZ), this.plains.get())); } else { -@@ -78,6 +79,30 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { +@@ -77,6 +78,30 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { } } @@ -7713,10 +7713,10 @@ index d59392c322936ce89b759ac9787c8f4f0b228af6..2d6daf76a56574c9727b404feb4f8634 private short tickingFluidCount; public final PalettedContainer<BlockState> 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 51a0ddcee9a9cb1040fda643a6442d2e2e15b8a0..38ec21faaa16df5485a81a581506700a5ab0a440 100644 +index af83a60623092073881c9d4c0c39d907c31c070c..aee460cd2cfed3134870b5c02bf4ecb5738a5aa0 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -72,6 +72,18 @@ public class ProtoChunk extends ChunkAccess { +@@ -81,6 +81,18 @@ public class ProtoChunk extends ChunkAccess { return new ChunkAccess.TicksToSave(this.blockTicks, this.fluidTicks); } diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index f1810399dd..9d49f67c14 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -2096,7 +2096,7 @@ index 0000000000000000000000000000000000000000..c0701d4f93a4d77a8177d2dd8d5076f9 + } +} diff --git a/src/main/java/net/minecraft/ChatFormatting.java b/src/main/java/net/minecraft/ChatFormatting.java -index e7980c88d036c617420e80bda8e1972723f97b52..efbc104acc62c5af8acf35b15f1be0d9f11113c9 100644 +index 75f33ca3425800f63d7b51a0b303aae72e6ef8f8..20baece1b9e1e3fef7236c6643af96c64b7981fd 100644 --- a/src/main/java/net/minecraft/ChatFormatting.java +++ b/src/main/java/net/minecraft/ChatFormatting.java @@ -113,6 +113,18 @@ public enum ChatFormatting implements StringRepresentable { @@ -2131,19 +2131,19 @@ index db93483cfee13ca4303d7452ecbb47507dc5f89e..f6938c35ac6f6116084d3e7ec9cdc918 public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) { this(output, pos, rot, world, level, name, displayName, server, entity, false, CommandResultCallback.EMPTY, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(server)); diff --git a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java -index 979ea69678319338c543185ba026ad0699a388d6..a3e8b2baec7ac8a61f6cbed7095f84273be385e7 100644 +index 7511445f48d9f13106b5d45b5d5bae9172fccfe4..43a47a6d8e5043ef743c5c2d8fb802d8ba3cb8ec 100644 --- a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java +++ b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java -@@ -51,17 +51,21 @@ public class MessageArgument implements SignedArgument<MessageArgument.Message> +@@ -50,17 +50,21 @@ public class MessageArgument implements SignedArgument<MessageArgument.Message> private static void resolveSignedMessage(Consumer<PlayerChatMessage> callback, CommandSourceStack source, PlayerChatMessage message) { MinecraftServer minecraftServer = source.getServer(); CompletableFuture<FilteredText> completableFuture = filterPlainText(source, message); - Component component = minecraftServer.getChatDecorator().decorate(source.getPlayer(), message.decoratedContent()); -- source.getChatMessageChainer().append(completableFuture, (filtered) -> { +- source.getChatMessageChainer().append(completableFuture, filtered -> { - PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(component).filter(filtered.mask()); + // Paper start - support asynchronous chat decoration + CompletableFuture<ChatDecorator.Result> componentFuture = minecraftServer.getChatDecorator().decorate(source.getPlayer(), source, message.decoratedContent()); -+ source.getChatMessageChainer().append(CompletableFuture.allOf(completableFuture, componentFuture), (filtered) -> { ++ source.getChatMessageChainer().append(CompletableFuture.allOf(completableFuture, componentFuture), filtered -> { + PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(componentFuture.join().component()).filter(completableFuture.join().mask()); + // Paper end - support asynchronous chat decoration callback.accept(playerChatMessage2); @@ -2225,7 +2225,7 @@ index 9373502ede6c8a881af67db005cf12fd9313f37f..53f033d2d887909f5f905c00122d1b09 public <T extends Enum<T>> T readEnum(Class<T> enumClass) { diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index 344c5af75c4a66bb27f3f422937c6c427c15ed25..7070d093c80033b61a9c8495bc56153d986b6b03 100644 +index d0e159f54da70bf0bd834738ced5d4b414a36142..0d80fcee1831af59b06c4d00dc713bd4dad947fc 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java @@ -35,6 +35,7 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { @@ -2316,10 +2316,10 @@ index 887b9fd625aa23c4ec828a175d63695f915232d3..8e4a4b15152c2f83444fa8017bec06bb + // Paper end - adventure; support async chat decoration events } diff --git a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java -index 49138ccda0f378b13c7f425be765876eb4026b06..30568c1be4d412bfae5bd07d45b823861ec39ab3 100644 +index c39b04c7e83fba45b5220678b4d94bf96f4c16dc..f51130399642a5e4a004b0661e33cf850ff18b4b 100644 --- a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java +++ b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java -@@ -55,12 +55,58 @@ public class ComponentSerialization { +@@ -58,7 +58,25 @@ public class ComponentSerialization { return ExtraCodecs.orCompressed(mapCodec3, mapCodec2); } @@ -2342,11 +2342,13 @@ index 49138ccda0f378b13c7f425be765876eb4026b06..30568c1be4d412bfae5bd07d45b82386 + + private static Codec<Component> createCodec(Codec<Component> selfCodec, @javax.annotation.Nullable java.util.Locale locale) { + // Paper end - adventure; create separate codec for each locale - ComponentContents.Type<?>[] types = new ComponentContents.Type[]{PlainTextContents.TYPE, TranslatableContents.TYPE, KeybindContents.TYPE, ScoreContents.TYPE, SelectorContents.TYPE, NbtContents.TYPE}; - MapCodec<ComponentContents> mapCodec = createLegacyComponentMatcher(types, ComponentContents.Type::codec, ComponentContents::type, "type"); - Codec<Component> codec = RecordCodecBuilder.create((instance) -> { - return instance.group(mapCodec.forGetter(Component::getContents), ExtraCodecs.strictOptionalField(ExtraCodecs.nonEmptyList(selfCodec.listOf()), "extra", List.of()).forGetter(Component::getSiblings), Style.Serializer.MAP_CODEC.forGetter(Component::getStyle)).apply(instance, MutableComponent::new); - }); + ComponentContents.Type<?>[] types = new ComponentContents.Type[]{ + PlainTextContents.TYPE, TranslatableContents.TYPE, KeybindContents.TYPE, ScoreContents.TYPE, SelectorContents.TYPE, NbtContents.TYPE + }; +@@ -73,6 +91,34 @@ public class ComponentSerialization { + .apply(instance, MutableComponent::new); + } + ); + // Paper start - adventure; create separate codec for each locale + final Codec<Component> origCodec = codec; + codec = new Codec<>() { @@ -2375,11 +2377,11 @@ index 49138ccda0f378b13c7f425be765876eb4026b06..30568c1be4d412bfae5bd07d45b82386 + } + }; + // Paper end - adventure; create separate codec for each locale - return Codec.either(Codec.either(Codec.STRING, ExtraCodecs.nonEmptyList(selfCodec.listOf())), codec).xmap((either) -> { - return either.map((either2) -> { + return Codec.either(Codec.either(Codec.STRING, ExtraCodecs.nonEmptyList(selfCodec.listOf())), codec).xmap(either -> { + return either.map(either2 -> { return either2.map(Component::literal, ComponentSerialization::createFromList); diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java -index b6506e881ef337bfd2a7a0644296b48b7300a0f6..57206594f305961a33542e1f8079c75bfa7c535f 100644 +index 103885e8d5458bc06c8bfe0f42c1d35b5716b541..d51c9210bb3267c03cc10920178f7c53e1413c94 100644 --- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java +++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java @@ -41,6 +41,11 @@ public class ComponentUtils { @@ -2393,12 +2395,12 @@ index b6506e881ef337bfd2a7a0644296b48b7300a0f6..57206594f305961a33542e1f8079c75b + // Paper end - adventure; pass actual vanilla component MutableComponent mutableComponent = text.getContents().resolve(source, sender, depth + 1); - for(Component component : text.getSiblings()) { + for (Component component : text.getSiblings()) { diff --git a/src/main/java/net/minecraft/network/chat/MessageSignature.java b/src/main/java/net/minecraft/network/chat/MessageSignature.java -index df9997873c4bbec184379ec14dca1bf4566eb89d..a3e2d03ffe9392cc69e850c5db7d71889a0a27ea 100644 +index 739ef5fb6f4fa37382153ba6a308ca3b451e6b05..7c3154af5d7732037c0ee965f6f8b89424461abd 100644 --- a/src/main/java/net/minecraft/network/chat/MessageSignature.java +++ b/src/main/java/net/minecraft/network/chat/MessageSignature.java -@@ -13,11 +13,12 @@ import net.minecraft.util.SignatureUpdater; +@@ -13,6 +13,7 @@ import net.minecraft.util.SignatureUpdater; import net.minecraft.util.SignatureValidator; public record MessageSignature(byte[] bytes) { @@ -2406,14 +2408,8 @@ index df9997873c4bbec184379ec14dca1bf4566eb89d..a3e2d03ffe9392cc69e850c5db7d7188 public static final Codec<MessageSignature> CODEC = ExtraCodecs.BASE64_STRING.xmap(MessageSignature::new, MessageSignature::bytes); public static final int BYTES = 256; - public MessageSignature { -- Preconditions.checkState(bs.length == 256, "Invalid message signature size"); -+ Preconditions.checkState(bytes.length == 256, "Invalid message signature size"); // Paper - decompile fix - } - - public static MessageSignature read(FriendlyByteBuf buf) { diff --git a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java -index f8773f2982e6cd40661d138a7c32f219cda9225c..74cf1c043beef03cfd5adf481414a5ee78bef2a6 100644 +index e2def0ca552343143e495736d533b3334686fd62..c87b708c368713a23a10ad97704575ee4df27891 100644 --- a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java +++ b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java @@ -7,6 +7,12 @@ public interface OutgoingChatMessage { @@ -2427,10 +2423,10 @@ index f8773f2982e6cd40661d138a7c32f219cda9225c..74cf1c043beef03cfd5adf481414a5ee + // Paper end + static OutgoingChatMessage create(PlayerChatMessage message) { - return (OutgoingChatMessage)(message.isSystem() ? new OutgoingChatMessage.Disguised(message.decoratedContent()) : new OutgoingChatMessage.Player(message)); - } -@@ -14,7 +20,12 @@ public interface OutgoingChatMessage { - public static record Disguised(Component content) implements OutgoingChatMessage { + return (OutgoingChatMessage)(message.isSystem() + ? new OutgoingChatMessage.Disguised(message.decoratedContent()) +@@ -16,7 +22,12 @@ public interface OutgoingChatMessage { + public static record Disguised(@Override Component content) implements OutgoingChatMessage { @Override public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params) { - sender.connection.sendDisguisedChatMessage(this.content, params); @@ -2443,7 +2439,7 @@ index f8773f2982e6cd40661d138a7c32f219cda9225c..74cf1c043beef03cfd5adf481414a5ee } } -@@ -26,7 +37,13 @@ public interface OutgoingChatMessage { +@@ -28,7 +39,13 @@ public interface OutgoingChatMessage { @Override public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params) { @@ -2458,16 +2454,17 @@ index f8773f2982e6cd40661d138a7c32f219cda9225c..74cf1c043beef03cfd5adf481414a5ee sender.connection.sendPlayerChatMessage(playerChatMessage, params); } diff --git a/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java b/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java -index 901c1aba1653ed70f4af931835ceb12a357aff55..00560ea19c29fd0e16cbe11ab0b07f12a2ff0cb6 100644 +index 2f3e750c148e3c0c2c0c9e72572ec5021fbab2c9..843126bc73c449615ab81309d22db224a6f484ac 100644 --- a/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java +++ b/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java -@@ -14,7 +14,53 @@ import net.minecraft.Util; - import net.minecraft.util.SignatureUpdater; +@@ -15,8 +15,54 @@ import net.minecraft.util.SignatureUpdater; import net.minecraft.util.SignatureValidator; --public record PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask) { -+// Paper start - adventure; support signed messages -+public record PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask, @Nullable net.minecraft.network.chat.ChatDecorator.Result result) { + public record PlayerChatMessage( +- SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask ++ SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask, @Nullable net.minecraft.network.chat.ChatDecorator.Result result // Paper - adventure; support signed messages + ) { ++ // Paper start - adventure; support signed messages + public PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask) { + this(link, signature, signedBody, unsignedContent, filterMask, null); + } @@ -2513,10 +2510,10 @@ index 901c1aba1653ed70f4af931835ceb12a357aff55..00560ea19c29fd0e16cbe11ab0b07f12 + return new AdventureView(); + } + // Paper end - adventure; support signed messages - public static final MapCodec<PlayerChatMessage> MAP_CODEC = RecordCodecBuilder.mapCodec((instance) -> { - return instance.group(SignedMessageLink.CODEC.fieldOf("link").forGetter(PlayerChatMessage::link), MessageSignature.CODEC.optionalFieldOf("signature").forGetter((message) -> { - return Optional.ofNullable(message.signature); -@@ -39,7 +85,7 @@ public record PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignatu + public static final MapCodec<PlayerChatMessage> MAP_CODEC = RecordCodecBuilder.mapCodec( + instance -> { + return instance.group( +@@ -50,7 +96,7 @@ public record PlayerChatMessage( } public PlayerChatMessage withUnsignedContent(Component unsignedContent) { @@ -2764,7 +2761,7 @@ index 4035faedd9f5f72f262822a9f050178d99be06e4..4c18491a627e66297627abbded1af48b public boolean logIPs() { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index a721e9cd0958d7fceed1aba8ae55fefed4e6a887..27a1450696a633578cd44567f240cbc1a4c578ac 100644 +index c57b91c2385d118590bc419e7e6ed586d5d87422..7bad19b7e17bbdac3e8502b6a7e246070ba67e8c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -162,6 +162,7 @@ import net.minecraft.world.damagesource.CombatTracker; @@ -3247,7 +3244,7 @@ index 2e8e786407869b53cb4d7e4ec8f91fe0a3ad8e1a..5e00df1cd2b8a6691b2f9490b1f4c3ed } diff --git a/src/main/java/net/minecraft/world/BossEvent.java b/src/main/java/net/minecraft/world/BossEvent.java -index 4c62df5a3781ec9df4a5c5f1b528649e6e8a62d1..affd1b8c7589ba59330dc0b6fc803cce4ee57397 100644 +index 80029e66d7f78aea9327edebd001d3b88b147128..42891df5db9465005d438cc4b65da2dee63d81f2 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 { @@ -4056,7 +4053,7 @@ index 9c1063d92a49c71f4458bf1634bcf9d79302ecca..f24b4732db849893fd870b4b6a49f1c4 @Override public String getTranslationKey() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 7126d8cdeea5eb23176af6a97a99b33961749d71..e78a378f0de48cde3702774970e6cda241b8ddda 100644 +index f5a5496e21e29c6ae9f497f5939823078ac8c1c0..0f51f05f334d262b3435cebce47c3b9f08936398 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -67,6 +67,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0012-Paper-Metrics.patch b/patches/server/0012-Paper-Metrics.patch index 56286148ba..3d7bf9785a 100644 --- a/patches/server/0012-Paper-Metrics.patch +++ b/patches/server/0012-Paper-Metrics.patch @@ -698,7 +698,7 @@ index 0000000000000000000000000000000000000000..6aaed8e8bf8c721fc834da5c76ac72a4 + } +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index faab5e8c952a2af6a286043617cded4e6ca5c3c6..813fd87df0dfed8fe46389db8333d1d9f409fbe4 100644 +index 8499eb5128d3269925ffb2c61d8532e9da47be4a..4917aa64505870a0521bc09ce4d4d3e37c03eaae 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -188,6 +188,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -710,7 +710,7 @@ index faab5e8c952a2af6a286043617cded4e6ca5c3c6..813fd87df0dfed8fe46389db8333d1d9 this.setPvpAllowed(dedicatedserverproperties.pvp); this.setFlightAllowed(dedicatedserverproperties.allowFlight); diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 1d066ce7dcf5f548c2a34d308d4422ab4fd02e5a..0fca20580d81c461e903c8cbd1cf090f5d5083c6 100644 +index e6e070db9a6ee78e65dbff6f18cb5c8784202b9f..bd4c744c597201267418b07b9bcb522805c485eb 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -83,6 +83,7 @@ public class SpigotConfig diff --git a/patches/server/0013-Paper-Plugins.patch b/patches/server/0013-Paper-Plugins.patch index f4d48c7f53..114f21034c 100644 --- a/patches/server/0013-Paper-Plugins.patch +++ b/patches/server/0013-Paper-Plugins.patch @@ -7117,10 +7117,10 @@ index f7114d5b8f2f93f62883e24da29afaf9f74ee1a6..8bf0630c0e06950cd99b7ae9898137f7 return foundFrame.orElse(null); diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -index ca70cd2e76c94f7a284c9af47c64252855f070a4..b366389fd1aed47e04884e9e495df83ec7398ca3 100644 +index a40bad65312fc65def43ba6d93ee97e97dcbad72..b85d4e8da923232ba2963a969a83b9e8936cb43f 100644 --- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java +++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -@@ -338,7 +338,13 @@ public class BuiltInRegistries { +@@ -370,7 +370,13 @@ public class BuiltInRegistries { } public static void bootStrap() { diff --git a/patches/server/0014-Timings-v2.patch b/patches/server/0014-Timings-v2.patch index 184f493236..23cfa84192 100644 --- a/patches/server/0014-Timings-v2.patch +++ b/patches/server/0014-Timings-v2.patch @@ -1393,7 +1393,7 @@ index c4bc491eed487c0a7e30538b0fb46fde91cd7b31..382b55167dede435b034866bd394455f } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 864da662a81b653cd94e2270be262e912e351e21..da755e478d2ab1444c92afd0d916589b2e6f4df4 100644 +index cdac785c54e150c0886046b8d50657c0ca958438..13e8502640abad928282e4b1596f2ad97b4db765 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -142,7 +142,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; diff --git a/patches/server/0016-Further-improve-server-tick-loop.patch b/patches/server/0016-Further-improve-server-tick-loop.patch index 5c66e16921..53f246d057 100644 --- a/patches/server/0016-Further-improve-server-tick-loop.patch +++ b/patches/server/0016-Further-improve-server-tick-loop.patch @@ -12,7 +12,7 @@ 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 a6a8b5079ceaad90a79a09cab5c38a6fde6d33ee..f32aa4e03ae02d1449101c4aa89c8e0c0fa26ba5 100644 +index 3365d2ec8426888c16873a311226fa69840fa2f0..dd93d4957459556a102b9bf712dd80cb69810cb7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -283,7 +283,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0017-Add-command-line-option-to-load-extra-plugin-jars-no.patch b/patches/server/0017-Add-command-line-option-to-load-extra-plugin-jars-no.patch index 98abdd4851..aa17ed15b2 100644 --- a/patches/server/0017-Add-command-line-option-to-load-extra-plugin-jars-no.patch +++ b/patches/server/0017-Add-command-line-option-to-load-extra-plugin-jars-no.patch @@ -47,7 +47,7 @@ index 5a720c0a751e7a83976727d01cc5bc6282702255..48c40f12649735f14204c516eace6905 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 5158d536de16c93358d1b335b0fcfbe0d6ce848e..c312c450055965d63db0ccdee8aa8e34e7051d0b 100644 +index c513d932e0c455401bbe53d13779df0e4bda16ec..7f8d45856763fa155272898ee83212f8c808fb40 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -160,6 +160,12 @@ public class Main { diff --git a/patches/server/0022-Allow-nerfed-mobs-to-jump.patch b/patches/server/0022-Allow-nerfed-mobs-to-jump.patch index 4840e50748..598cc77be4 100644 --- a/patches/server/0022-Allow-nerfed-mobs-to-jump.patch +++ b/patches/server/0022-Allow-nerfed-mobs-to-jump.patch @@ -34,7 +34,7 @@ index 8892a6344b3a96a3d412528b80ce7bcf1ab30003..8395130fcc148ed1500342ead78b20a1 this.sensing.tick(); this.level().getProfiler().pop(); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java -index 01950951ea06e43bedeeede489a112e577617829..60a62781fcfe4c598c308a7ce2b0dcf72c0895ae 100644 +index 5fbb5d2bf8945a361babfe50f5f92fa46b9e8b5f..7eb0e0486203d9ad6ce89d17a4da96a7563088a4 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java @@ -9,6 +9,7 @@ public class FloatGoal extends Goal { diff --git a/patches/server/0024-Allow-for-toggling-of-spawn-chunks.patch b/patches/server/0024-Allow-for-toggling-of-spawn-chunks.patch index 84bcfe5318..092af27d5c 100644 --- a/patches/server/0024-Allow-for-toggling-of-spawn-chunks.patch +++ b/patches/server/0024-Allow-for-toggling-of-spawn-chunks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow for toggling of spawn chunks diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index aa22d4024cdd0ecb1c0442ecdeae00822597362e..9cfc60863caeaa1fd0df153889cadd88fef9e111 100644 +index d02cc220c8bd59a1289f34fd9fb70a00b0fbc07a..953ff52b6e6397a8f81b0935fc2fb8cfadf5cf40 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -264,6 +264,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0026-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/0026-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index fc9a21d7a5..9eab4cd8f4 100644 --- a/patches/server/0026-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/patches/server/0026-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/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index f32aa4e03ae02d1449101c4aa89c8e0c0fa26ba5..c6ce55d48fc71ea097a4a279fcd0dd1d4086be9b 100644 +index dd93d4957459556a102b9bf712dd80cb69810cb7..b951659a8fae8929123be985d02e08f28bd1e49e 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1615,7 +1615,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -32,7 +32,7 @@ index 48c40f12649735f14204c516eace6905b2ac0019..56a63adc3c0c919594c3f2646d4cf5b8 private final String bukkitVersion = Versioning.getBukkitVersion(); private final Logger logger = Logger.getLogger("Minecraft"); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index cf0390e8ccb8e4845e3a14fa71b2547996b69baf..6c1e3254c9a20ba58c7285d4cf6a01489862100d 100644 +index 7f8d45856763fa155272898ee83212f8c808fb40..bdff750f44cabdbc7e329a0feaa77709e2103635 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -241,12 +241,25 @@ public class Main { diff --git a/patches/server/0029-Player-affects-spawning-API.patch b/patches/server/0029-Player-affects-spawning-API.patch index 75e68bbdc9..ddf77c972b 100644 --- a/patches/server/0029-Player-affects-spawning-API.patch +++ b/patches/server/0029-Player-affects-spawning-API.patch @@ -98,10 +98,10 @@ index d156f7e3430685947d2b4c30aa867e8002ca70ad..e888cf862662ae6baa6d0de8188aa74a public void clientTick(Level world, BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index b6a3c75b84d9f768afee33aa0f226207b307c1c0..07e7851ca27ea0f8166be52b086a6504c0deea09 100644 +index d4fb3c62825927a2c7c71a18e0f678ef7f4dec22..72b3913d00d6f2ec01a716444debe065c48174f6 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -70,6 +70,11 @@ public interface EntityGetter { +@@ -74,6 +74,11 @@ public interface EntityGetter { } } @@ -112,8 +112,8 @@ index b6a3c75b84d9f768afee33aa0f226207b307c1c0..07e7851ca27ea0f8166be52b086a6504 + // Paper end - Affects Spawning API @Nullable default Player getNearestPlayer(double x, double y, double z, double maxDistance, @Nullable Predicate<Entity> targetPredicate) { - double d = -1.0D; -@@ -99,6 +104,20 @@ public interface EntityGetter { + double d = -1.0; +@@ -103,6 +108,20 @@ public interface EntityGetter { return this.getNearestPlayer(x, y, z, maxDistance, predicate); } @@ -132,7 +132,7 @@ index b6a3c75b84d9f768afee33aa0f226207b307c1c0..07e7851ca27ea0f8166be52b086a6504 + // Paper end - Affects Spawning API + default boolean hasNearbyAlivePlayer(double x, double y, double z, double range) { - for(Player player : this.players()) { + for (Player player : this.players()) { if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index d53e15a3a70de8e2a405d3a39ff51a3551e82dbc..a592ee955a823309f1936a607823ff93822cd369 100644 diff --git a/patches/server/0034-Configurable-top-of-nether-void-damage.patch b/patches/server/0034-Configurable-top-of-nether-void-damage.patch index e1dc631598..7885dcabd1 100644 --- a/patches/server/0034-Configurable-top-of-nether-void-damage.patch +++ b/patches/server/0034-Configurable-top-of-nether-void-damage.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Configurable top of nether void damage Co-authored-by: Jake Potrebic <[email protected]> diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c21c4d6df21bc9741f087ac4a328aad04b1cda38..60d94e4d8f69fb7ab8a94a926d18d38fe1c1d6c7 100644 +index 6f687387d8f817646dacf0e0373d50db8ee80dd5..c582d2f447384ca3b46c3b8159b7114d7efef52c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -683,7 +683,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0037-Configurable-end-credits.patch b/patches/server/0037-Configurable-end-credits.patch index d1085599d1..6c261dacae 100644 --- a/patches/server/0037-Configurable-end-credits.patch +++ b/patches/server/0037-Configurable-end-credits.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable end credits diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 27a1450696a633578cd44567f240cbc1a4c578ac..3bb3312da2b91616d9d3bb4cb79259ee9e3479bd 100644 +index 7bad19b7e17bbdac3e8502b6a7e246070ba67e8c..68a376743e531dfe06bf6bd7b5be3e7d8e3154d8 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1030,6 +1030,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0039-Optimize-explosions.patch b/patches/server/0039-Optimize-explosions.patch index 9434cb4e98..2befa1204f 100644 --- a/patches/server/0039-Optimize-explosions.patch +++ b/patches/server/0039-Optimize-explosions.patch @@ -10,7 +10,7 @@ This patch adds a per-tick cache that is used for storing and retrieving an entity's exposure during an explosion. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c6ce55d48fc71ea097a4a279fcd0dd1d4086be9b..cc2775d94f3b6ebd7f97e14e324bf292d5874de4 100644 +index b951659a8fae8929123be985d02e08f28bd1e49e..001592ec2ec34a744713d4d6c95a00955889facd 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1489,6 +1489,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -120,7 +120,7 @@ index b600abae1c17e1196ff2b171e054db95cca5c9ff..df17b8cddd7f8bd3f13641c99ad0d25e + // 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 dfe8eea789a6dd5476da0c194236dba3868a2cb7..7ead83d46e7bb3ee3586acf695b08f197f61f04a 100644 +index eb6bf467c92cb04c9f1ffcde0b5df64e9a160d59..673141ab586057b2d05b3921cc4d42b4f5e049ab 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -170,6 +170,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0041-Disable-thunder.patch b/patches/server/0041-Disable-thunder.patch index 812330feaa..b28e50b059 100644 --- a/patches/server/0041-Disable-thunder.patch +++ b/patches/server/0041-Disable-thunder.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Disable thunder diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 1315822ce37e5011880b24afb4fbe18cd1dfe80f..ae4f429ccacc01e3f970fadf01570ec7da454721 100644 +index 4c0e12d9f36c78eeae4dcb2f58d41503d3a046e4..31b4d6e0473cf7cad7d4994f5a989a5d7bd9a531 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -609,7 +609,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0042-Disable-ice-and-snow.patch b/patches/server/0042-Disable-ice-and-snow.patch index b67a99ca11..10f0de5a2c 100644 --- a/patches/server/0042-Disable-ice-and-snow.patch +++ b/patches/server/0042-Disable-ice-and-snow.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Disable ice and snow diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index ae4f429ccacc01e3f970fadf01570ec7da454721..c9113f7e0d9e1b9861f667c40e2702c6bb1d4e53 100644 +index 31b4d6e0473cf7cad7d4994f5a989a5d7bd9a531..5a20dc552423717f91178068dc5f8a30be13ea54 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -639,11 +639,13 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0044-Implement-PlayerLocaleChangeEvent.patch b/patches/server/0044-Implement-PlayerLocaleChangeEvent.patch index fa3a977c10..dd5347f29c 100644 --- a/patches/server/0044-Implement-PlayerLocaleChangeEvent.patch +++ b/patches/server/0044-Implement-PlayerLocaleChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement PlayerLocaleChangeEvent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 3bb3312da2b91616d9d3bb4cb79259ee9e3479bd..f21174c1d50158330b9a48dba8409919a2229927 100644 +index 68a376743e531dfe06bf6bd7b5be3e7d8e3154d8..e3e96008d69926c831e5f42b28e1e70160a3c5bd 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -222,7 +222,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0046-Configurable-container-update-tick-rate.patch b/patches/server/0046-Configurable-container-update-tick-rate.patch index 7a2ea2cb51..f3cc5d8814 100644 --- a/patches/server/0046-Configurable-container-update-tick-rate.patch +++ b/patches/server/0046-Configurable-container-update-tick-rate.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable container update tick rate diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index f21174c1d50158330b9a48dba8409919a2229927..429f3ed00c0c6d7c89138aa9a4b770e3e68b7ed7 100644 +index e3e96008d69926c831e5f42b28e1e70160a3c5bd..50264a1da70f120f9adf1619dd72d834ba14e499 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -247,6 +247,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0051-Improve-Player-chat-API-handling.patch b/patches/server/0051-Improve-Player-chat-API-handling.patch index 80ec033d04..c0ca302a0b 100644 --- a/patches/server/0051-Improve-Player-chat-API-handling.patch +++ b/patches/server/0051-Improve-Player-chat-API-handling.patch @@ -17,7 +17,7 @@ Co-authored-by: Jake Potrebic <[email protected]> Co-authored-by: SoSeDiK <[email protected]> diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 01c70d149b306030c775427f744c4dfab19411cf..dedd0aa332412eec5f976959b67da5405d980ded 100644 +index 4be0935a36bd7b2e0d83e30b6edc43a6429dac22..37cba1e693490e42908f45dc68e60ac3afebbb49 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1930,7 +1930,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0054-Be-a-bit-more-informative-in-maxHealth-exception.patch b/patches/server/0054-Be-a-bit-more-informative-in-maxHealth-exception.patch index aadcfbc397..619d3c8665 100644 --- a/patches/server/0054-Be-a-bit-more-informative-in-maxHealth-exception.patch +++ b/patches/server/0054-Be-a-bit-more-informative-in-maxHealth-exception.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Be a bit more informative in maxHealth exception diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index bcab4757869428e20c67907684e02b64d2958e88..a73a5a8291ddd954f2c7b73a4895933e715c5d68 100644 +index 68c2825c2d43b3c949cc4b08035b0f5d277f34f2..844a97b0eb396835ec72b4d14c9362a2ea2a8709 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -102,7 +102,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0056-Add-configurable-portal-search-radius.patch b/patches/server/0056-Add-configurable-portal-search-radius.patch index 7bba890fae..df6cdd9f85 100644 --- a/patches/server/0056-Add-configurable-portal-search-radius.patch +++ b/patches/server/0056-Add-configurable-portal-search-radius.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add configurable portal search radius diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 60d94e4d8f69fb7ab8a94a926d18d38fe1c1d6c7..71c4b75901ca55e3e08fd59f0e906a0cc5334b89 100644 +index c582d2f447384ca3b46c3b8159b7114d7efef52c..8444518356f32486ee4064446f8c1396276ad015 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3192,7 +3192,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0057-Add-velocity-warnings.patch b/patches/server/0057-Add-velocity-warnings.patch index 8439175a6d..ad776ec3f5 100644 --- a/patches/server/0057-Add-velocity-warnings.patch +++ b/patches/server/0057-Add-velocity-warnings.patch @@ -17,7 +17,7 @@ index 6135e8c0669886260afacdaa7405bf55597b17a6..2b2d0c8ed68eb86812877026a0bb5c4a 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 6871fe86c9cda00d0187f3df827772200eca1bcc..4a875d038f1ab7f2bdc5f290a6ad71e4b61c6822 100644 +index 85d77772b003e56382f8c3b55fc11a9ae1ec535f..1be5c322abcec8ec32b84dec02d386e53cb5e16a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -129,10 +129,40 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0060-Disable-Scoreboards-for-non-players-by-default.patch b/patches/server/0060-Disable-Scoreboards-for-non-players-by-default.patch index b0ec269133..fae95eea55 100644 --- a/patches/server/0060-Disable-Scoreboards-for-non-players-by-default.patch +++ b/patches/server/0060-Disable-Scoreboards-for-non-players-by-default.patch @@ -11,7 +11,7 @@ So avoid looking up scoreboards and short circuit to the "not on a team" logic which is most likely to be true. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 71c4b75901ca55e3e08fd59f0e906a0cc5334b89..4dc659760272a13fc8c0f05c543bed634784af6c 100644 +index 8444518356f32486ee4064446f8c1396276ad015..9fb52c98455d547bdde6d56689528e78a5ddfed5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2820,6 +2820,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -23,7 +23,7 @@ index 71c4b75901ca55e3e08fd59f0e906a0cc5334b89..4dc659760272a13fc8c0f05c543bed63 } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 5ae9f9a4cb903909cb26a612a847d12515c52d91..7f85da14097ad559e5a8f82474f7a71a078b3e77 100644 +index 13e8502640abad928282e4b1596f2ad97b4db765..99e91dd930bb33a006b2be3ad678df5861eb8eeb 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -841,6 +841,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0069-Add-World-Util-Methods.patch b/patches/server/0069-Add-World-Util-Methods.patch index 527a47153c..80106855ae 100644 --- a/patches/server/0069-Add-World-Util-Methods.patch +++ b/patches/server/0069-Add-World-Util-Methods.patch @@ -6,7 +6,7 @@ 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/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index eb2b4ba79488c3d43421c39852c36c4387372f38..c3138a2ff6446fb72d9eb1bd31f851d7df6b94f2 100644 +index b91df88036d3ec2579883a9c65a7b80d4c0be81b..2ad3c16bf36972ff55269612f02cdb4f558f35b7 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -347,6 +347,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0070-Custom-replacement-for-eaten-items.patch b/patches/server/0070-Custom-replacement-for-eaten-items.patch index dc47f3b1f3..fe631ab089 100644 --- a/patches/server/0070-Custom-replacement-for-eaten-items.patch +++ b/patches/server/0070-Custom-replacement-for-eaten-items.patch @@ -5,7 +5,7 @@ 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 7f85da14097ad559e5a8f82474f7a71a078b3e77..2356ceb62216086e7ac19e994803d5f6a0f89f83 100644 +index 99e91dd930bb33a006b2be3ad678df5861eb8eeb..13438b60bb3891e40bf0b5e942e0b2ba744121f9 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3719,10 +3719,11 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch b/patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch index cc09649ab9..5e32ddcea2 100644 --- a/patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch +++ b/patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch @@ -5,7 +5,7 @@ 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 2356ceb62216086e7ac19e994803d5f6a0f89f83..ba79c3153a2679d6a0d9ed3d1a25a999f7e78950 100644 +index 13438b60bb3891e40bf0b5e942e0b2ba744121f9..8447a47e1c493001ea9f54392e02f14da14cb25d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -802,7 +802,13 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0072-Use-a-Shared-Random-for-Entities.patch b/patches/server/0072-Use-a-Shared-Random-for-Entities.patch index 072a1ee29a..cec2d61d7d 100644 --- a/patches/server/0072-Use-a-Shared-Random-for-Entities.patch +++ b/patches/server/0072-Use-a-Shared-Random-for-Entities.patch @@ -6,7 +6,7 @@ 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 4dc659760272a13fc8c0f05c543bed634784af6c..93dc90cc4e90d9db4712efff80f811d7c9d55caa 100644 +index 9fb52c98455d547bdde6d56689528e78a5ddfed5..52220795bf8a73c63837b4e07b1abf99c0344322 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -166,6 +166,79 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -99,7 +99,7 @@ index 4dc659760272a13fc8c0f05c543bed634784af6c..93dc90cc4e90d9db4712efff80f811d7 this.fluidHeight = new Object2DoubleArrayMap(2); 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 891d8b4c8cb73d5e310970066831ab3e2af14e91..4f32597c7af34d599f6658fe4962d41624e60419 100644 +index d404cd4c805442004d9a5f259a9e0907758ad915..36506dc4b99f9de19a23a99c1bccdcb4e7102e72 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Squid.java +++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java @@ -44,7 +44,7 @@ public class Squid extends WaterAnimal { diff --git a/patches/server/0073-Configurable-spawn-chances-for-skeleton-horses.patch b/patches/server/0073-Configurable-spawn-chances-for-skeleton-horses.patch index 604e850fb3..e950cd8144 100644 --- a/patches/server/0073-Configurable-spawn-chances-for-skeleton-horses.patch +++ b/patches/server/0073-Configurable-spawn-chances-for-skeleton-horses.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable spawn chances for skeleton horses diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index c9113f7e0d9e1b9861f667c40e2702c6bb1d4e53..a127acc6c44bfd078e06c74b408d62df6e85d1fe 100644 +index 5a20dc552423717f91178068dc5f8a30be13ea54..ea4eacf66651798185e1c445979a465e173571d0 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -614,7 +614,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0075-Entity-AddTo-RemoveFrom-World-Events.patch b/patches/server/0075-Entity-AddTo-RemoveFrom-World-Events.patch index 953744dca3..5c270f17c5 100644 --- a/patches/server/0075-Entity-AddTo-RemoveFrom-World-Events.patch +++ b/patches/server/0075-Entity-AddTo-RemoveFrom-World-Events.patch @@ -5,7 +5,7 @@ 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 5975cc2fa72609ea5f3e6f99155d6e5bc321a321..0da9a1f428e2fa412de08296e1bafaea0ddd05d0 100644 +index 1c3b12692094c1eaa086ebb2f060b22aaf9d9b39..211f785adf6b8bfc6b974da7898cb2f4359626c9 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2161,6 +2161,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0077-EntityPathfindEvent.patch b/patches/server/0077-EntityPathfindEvent.patch index c262d243bd..2fcac51f76 100644 --- a/patches/server/0077-EntityPathfindEvent.patch +++ b/patches/server/0077-EntityPathfindEvent.patch @@ -6,7 +6,7 @@ Subject: [PATCH] EntityPathfindEvent Fires when an Entity decides to start moving to a location. diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java -index 3db41017c6690d4519564496edd8e7365b2f5a22..e35c38feb62c3345d82636081decc09db9f061ab 100644 +index d3a279a1a14f99aee8dd516552e5c60de92b4969..a3e0c5af4cc9323c02e88e768cbda9e46854aea1 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java @@ -40,7 +40,7 @@ public class FlyingPathNavigation extends PathNavigation { @@ -19,7 +19,7 @@ index 3db41017c6690d4519564496edd8e7365b2f5a22..e35c38feb62c3345d82636081decc09d @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java -index 12564909abff7da4e5a4bb3d004a7ede2ffda12d..47de460ff5435ea6712c800c77093126908d0fce 100644 +index bd38ff5615bbf33b374283e3d461981b30035bb8..74ae984ac41bcdd2cc45f1bec461cdc5f69977c6 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java @@ -41,7 +41,7 @@ public class GroundPathNavigation extends PathNavigation { @@ -28,10 +28,10 @@ index 12564909abff7da4e5a4bb3d004a7ede2ffda12d..47de460ff5435ea6712c800c77093126 @Override - public Path createPath(BlockPos target, int distance) { + public Path createPath(BlockPos target, @javax.annotation.Nullable Entity entity, int distance) { // Paper - EntityPathfindEvent - LevelChunk levelChunk = this.level.getChunkSource().getChunkNow(SectionPos.blockToSectionCoord(target.getX()), SectionPos.blockToSectionCoord(target.getZ())); - if (levelChunk == null) { - return null; -@@ -52,7 +52,7 @@ public class GroundPathNavigation extends PathNavigation { + LevelChunk levelChunk = this.level + .getChunkSource() + .getChunkNow(SectionPos.blockToSectionCoord(target.getX()), SectionPos.blockToSectionCoord(target.getZ())); +@@ -56,7 +56,7 @@ public class GroundPathNavigation extends PathNavigation { } if (blockPos.getY() > this.level.getMinBuildHeight()) { @@ -39,16 +39,18 @@ index 12564909abff7da4e5a4bb3d004a7ede2ffda12d..47de460ff5435ea6712c800c77093126 + return super.createPath(blockPos.above(), entity, distance); // Paper - EntityPathfindEvent } - while(blockPos.getY() < this.level.getMaxBuildHeight() && levelChunk.getBlockState(blockPos).isAir()) { -@@ -63,20 +63,20 @@ public class GroundPathNavigation extends PathNavigation { + while (blockPos.getY() < this.level.getMaxBuildHeight() && levelChunk.getBlockState(blockPos).isAir()) { +@@ -67,7 +67,7 @@ public class GroundPathNavigation extends PathNavigation { } if (!levelChunk.getBlockState(target).isSolid()) { - return super.createPath(target, distance); + return super.createPath(target, entity, distance); // Paper - EntityPathfindEvent } else { - BlockPos blockPos2; - for(blockPos2 = target.above(); blockPos2.getY() < this.level.getMaxBuildHeight() && levelChunk.getBlockState(blockPos2).isSolid(); blockPos2 = blockPos2.above()) { + BlockPos blockPos2 = target.above(); + +@@ -75,14 +75,14 @@ public class GroundPathNavigation extends PathNavigation { + blockPos2 = blockPos2.above(); } - return super.createPath(blockPos2, distance); @@ -65,10 +67,10 @@ index 12564909abff7da4e5a4bb3d004a7ede2ffda12d..47de460ff5435ea6712c800c77093126 private int getSurfaceY() { 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 fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..85b3da93b6dd8e1a40d884db0721f30b9b237c69 100644 +index c3e1fa25b03c24c9127441d62142a96e5f81f18c..fa5088945adc5e41e34cc2dc21a1762d106254c8 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 -@@ -110,7 +110,13 @@ public abstract class PathNavigation { +@@ -109,7 +109,13 @@ public abstract class PathNavigation { @Nullable public Path createPath(BlockPos target, int distance) { @@ -83,7 +85,7 @@ index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..85b3da93b6dd8e1a40d884db0721f30b } @Nullable -@@ -120,7 +126,7 @@ public abstract class PathNavigation { +@@ -119,7 +125,7 @@ public abstract class PathNavigation { @Nullable public Path createPath(Entity entity, int distance) { @@ -92,7 +94,7 @@ index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..85b3da93b6dd8e1a40d884db0721f30b } @Nullable -@@ -130,6 +136,17 @@ public abstract class PathNavigation { +@@ -129,6 +135,17 @@ public abstract class PathNavigation { @Nullable protected Path createPath(Set<BlockPos> positions, int range, boolean useHeadPos, int distance, float followRange) { @@ -110,7 +112,7 @@ index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..85b3da93b6dd8e1a40d884db0721f30b if (positions.isEmpty()) { return null; } else if (this.mob.getY() < (double)this.level.getMinBuildHeight()) { -@@ -139,6 +156,23 @@ public abstract class PathNavigation { +@@ -138,6 +155,23 @@ public abstract class PathNavigation { } else if (this.path != null && !this.path.isDone() && positions.contains(this.targetPos)) { return this.path; } else { @@ -135,7 +137,7 @@ index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..85b3da93b6dd8e1a40d884db0721f30b BlockPos blockPos = useHeadPos ? this.mob.blockPosition().above() : this.mob.blockPosition(); int i = (int)(followRange + (float)range); diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java -index e9b49c72aa73dfcef6c136d9ed7bb5044fe8405d..185550dce31b3b31a1d1dfcebb29147131bfad66 100644 +index 1a1bc30b425858d82dbfb84b4a94d7793cab7125..5bbfa43d1e97970f035fcb101c3252c01ffead0d 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java @@ -16,9 +16,9 @@ public class WallClimberNavigation extends GroundPathNavigation { diff --git a/patches/server/0079-Do-not-load-chunks-for-Pathfinding.patch b/patches/server/0079-Do-not-load-chunks-for-Pathfinding.patch index 3dfd3d8f38..9ccd7b1587 100644 --- a/patches/server/0079-Do-not-load-chunks-for-Pathfinding.patch +++ b/patches/server/0079-Do-not-load-chunks-for-Pathfinding.patch @@ -5,11 +5,11 @@ 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 cd6778fa1d4261caf846ae71702621d2ec6b98c1..dbb6a7d950b1a6f58a845b4d399ead6eb6d4fe14 100644 +index c68d227e758f11a3146fc382014ce96651cd7acf..5ff66dd2ff2e3027ee7f7b62d5398c965195d8ed 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -465,7 +465,12 @@ public class WalkNodeEvaluator extends NodeEvaluator { - for(int n = -1; n <= 1; ++n) { +@@ -473,7 +473,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); - BlockState blockState = world.getBlockState(pos); @@ -22,7 +22,7 @@ index cd6778fa1d4261caf846ae71702621d2ec6b98c1..dbb6a7d950b1a6f58a845b4d399ead6e if (blockState.is(Blocks.CACTUS) || blockState.is(Blocks.SWEET_BERRY_BUSH)) { return BlockPathTypes.DANGER_OTHER; } -@@ -481,6 +486,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { +@@ -489,6 +494,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { if (blockState.is(Blocks.WITHER_ROSE) || blockState.is(Blocks.POINTED_DRIPSTONE)) { return BlockPathTypes.DAMAGE_CAUTIOUS; } @@ -30,7 +30,7 @@ index cd6778fa1d4261caf846ae71702621d2ec6b98c1..dbb6a7d950b1a6f58a845b4d399ead6e } } } -@@ -490,7 +496,8 @@ public class WalkNodeEvaluator extends NodeEvaluator { +@@ -498,7 +504,8 @@ public class WalkNodeEvaluator extends NodeEvaluator { } protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) { diff --git a/patches/server/0080-Add-PlayerUseUnknownEntityEvent.patch b/patches/server/0080-Add-PlayerUseUnknownEntityEvent.patch index 6b9696541f..f97fec7cb8 100644 --- a/patches/server/0080-Add-PlayerUseUnknownEntityEvent.patch +++ b/patches/server/0080-Add-PlayerUseUnknownEntityEvent.patch @@ -9,7 +9,7 @@ virtual entities/entities that are not actually known to the server. Co-authored-by: Nassim Jahnke <[email protected]> diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java -index 644a0fdea6576647539b96528717dbaeab498d93..221e64a66ff12a8de5c75992fc26a54a03b317e7 100644 +index e4149e3108a163d2e33f78e45c852ded5a4833cc..893a0f362c4683db73d165405ea9b3913608ea1c 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java @@ -169,4 +169,14 @@ public class ServerboundInteractPacket implements Packet<ServerGamePacketListene diff --git a/patches/server/0082-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/patches/server/0082-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index 34040f336e..5156c9a9c6 100644 --- a/patches/server/0082-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/patches/server/0082-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 0da9a1f428e2fa412de08296e1bafaea0ddd05d0..ddab865f4237b91020f3c5f9726d93f8dbf0eda6 100644 +index 211f785adf6b8bfc6b974da7898cb2f4359626c9..c9c711398cf90fc1990a0145196fa05894f9ffff 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1384,6 +1384,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0083-Optimize-DataBits.patch b/patches/server/0083-Optimize-DataBits.patch index 26c1e4f903..e11675c807 100644 --- a/patches/server/0083-Optimize-DataBits.patch +++ b/patches/server/0083-Optimize-DataBits.patch @@ -11,10 +11,10 @@ After: http://i.imgur.com/nJ46crB.png Optimize redundant converting of static fields into an unsigned long each call by precomputing it in ctor diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java -index f677cc252d5510a2365e73dc42bd266e56115e83..acd820b19aff4e093536cc47002a899498b3fd6b 100644 +index dea4f322f750a0a09407fdb48d5d6e809dfe8ed4..236ce41328758cb173a239133073944adb484dd1 100644 --- a/src/main/java/net/minecraft/util/SimpleBitStorage.java +++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java -@@ -11,8 +11,8 @@ public class SimpleBitStorage implements BitStorage { +@@ -204,8 +204,8 @@ public class SimpleBitStorage implements BitStorage { private final long mask; private final int size; private final int valuesPerLong; @@ -25,7 +25,7 @@ index f677cc252d5510a2365e73dc42bd266e56115e83..acd820b19aff4e093536cc47002a8994 private final int divideShift; public SimpleBitStorage(int elementBits, int size, int[] data) { -@@ -56,8 +56,8 @@ public class SimpleBitStorage implements BitStorage { +@@ -248,8 +248,8 @@ public class SimpleBitStorage implements BitStorage { this.mask = (1L << elementBits) - 1L; this.valuesPerLong = (char)(64 / elementBits); int i = 3 * (this.valuesPerLong - 1); @@ -36,7 +36,7 @@ index f677cc252d5510a2365e73dc42bd266e56115e83..acd820b19aff4e093536cc47002a8994 this.divideShift = MAGIC[i + 2]; int j = (size + this.valuesPerLong - 1) / this.valuesPerLong; if (data != null) { -@@ -73,15 +73,15 @@ public class SimpleBitStorage implements BitStorage { +@@ -264,15 +264,15 @@ public class SimpleBitStorage implements BitStorage { } private int cellIndex(int index) { @@ -58,7 +58,7 @@ index f677cc252d5510a2365e73dc42bd266e56115e83..acd820b19aff4e093536cc47002a8994 int i = this.cellIndex(index); long l = this.data[i]; int j = (index - i * this.valuesPerLong) * this.bits; -@@ -91,9 +91,9 @@ public class SimpleBitStorage implements BitStorage { +@@ -282,9 +282,9 @@ public class SimpleBitStorage implements BitStorage { } @Override @@ -71,7 +71,7 @@ index f677cc252d5510a2365e73dc42bd266e56115e83..acd820b19aff4e093536cc47002a8994 int i = this.cellIndex(index); long l = this.data[i]; int j = (index - i * this.valuesPerLong) * this.bits; -@@ -101,8 +101,8 @@ public class SimpleBitStorage implements BitStorage { +@@ -292,8 +292,8 @@ public class SimpleBitStorage implements BitStorage { } @Override @@ -83,7 +83,7 @@ index f677cc252d5510a2365e73dc42bd266e56115e83..acd820b19aff4e093536cc47002a8994 long l = this.data[i]; int j = (index - i * this.valuesPerLong) * this.bits; diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java -index 0710c72441c832a93275f3f9bd9dd7643dc0f229..b7a3f15dc1ed9e9322a86921052984c7cbd3262a 100644 +index 8dd5a5899e9b5d8b3f1a6064dd7c1580313da69e..50040c497a819cd1229042ab3cb057d34a32cacc 100644 --- a/src/main/java/net/minecraft/util/ZeroBitStorage.java +++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java @@ -13,21 +13,21 @@ public class ZeroBitStorage implements BitStorage { diff --git a/patches/server/0085-Configurable-Player-Collision.patch b/patches/server/0085-Configurable-Player-Collision.patch index 2404b35354..e1dc5880fe 100644 --- a/patches/server/0085-Configurable-Player-Collision.patch +++ b/patches/server/0085-Configurable-Player-Collision.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable Player Collision diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java -index 3d2a689d11bfa230bab61a2a65c6051328f6b78d..cf31771648549ab6d7e4e38b30409ca48a976bea 100644 +index d60acdd2e2949461270a767569c3b105c9001024..e9d03ebfbd02a46b0ba274be107e099cc24b59e3 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java -@@ -193,7 +193,7 @@ public class ClientboundSetPlayerTeamPacket implements Packet<ClientGamePacketLi +@@ -200,7 +200,7 @@ public class ClientboundSetPlayerTeamPacket implements Packet<ClientGamePacketLi buf.writeComponent(this.displayName); buf.writeByte(this.options); buf.writeUtf(this.nametagVisibility); @@ -18,7 +18,7 @@ index 3d2a689d11bfa230bab61a2a65c6051328f6b78d..cf31771648549ab6d7e4e38b30409ca4 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 a4df17bf15ac8e427039428f947df4f08c746de6..866ff31a6057eda7612cfa48c0028fb988deed64 100644 +index 72ddebd40c2b29e0c6e069d62ed206c29ad5fa6b..677ce578af9da4b512bad47fe54625305e99c7e4 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -622,6 +622,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0087-Configurable-RCON-IP-address.patch b/patches/server/0087-Configurable-RCON-IP-address.patch index f1088bf865..8db10da972 100644 --- a/patches/server/0087-Configurable-RCON-IP-address.patch +++ b/patches/server/0087-Configurable-RCON-IP-address.patch @@ -33,10 +33,10 @@ index d64ac84d4c5ef3dd3054a601deee128d3069686b..90fe26a546eeebf90ccf7f899103346c // 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 cb61eaf8447c8340c4b4e1079c0a6aecd41a6116..3bf60f640aa9fa4cabd2b3e5d3931e8467b9df24 100644 +index 40d7b7d42506ea12ca348296f07ac090ccd67b73..cabaa1ea22b0ed66a45f6c0c2c051764ad65f37e 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 { +@@ -59,7 +59,7 @@ public class RconThread extends GenericThread { @Nullable public static RconThread create(ServerInterface server) { DedicatedServerProperties dedicatedServerProperties = server.getProperties(); diff --git a/patches/server/0088-EntityRegainHealthEvent-isFastRegen-API.patch b/patches/server/0088-EntityRegainHealthEvent-isFastRegen-API.patch index 6027fb24b2..332064a55a 100644 --- a/patches/server/0088-EntityRegainHealthEvent-isFastRegen-API.patch +++ b/patches/server/0088-EntityRegainHealthEvent-isFastRegen-API.patch @@ -6,7 +6,7 @@ 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 ba79c3153a2679d6a0d9ed3d1a25a999f7e78950..5ba65d647903077b39d9475ef28bfa0c400edd7a 100644 +index 8447a47e1c493001ea9f54392e02f14da14cb25d..eec88cb65aae7986e53cba336f6e0bf5ff3011b3 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1331,10 +1331,16 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0089-Add-ability-to-configure-frosted_ice-properties.patch b/patches/server/0089-Add-ability-to-configure-frosted_ice-properties.patch index 239b963ea6..ba6d745387 100644 --- a/patches/server/0089-Add-ability-to-configure-frosted_ice-properties.patch +++ b/patches/server/0089-Add-ability-to-configure-frosted_ice-properties.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add ability to configure frosted_ice properties diff --git a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java -index 5c8f0751def701359b388eabeb14d1dc83438c5a..f3ec0f8b8faca6aa073e76af2477f78ac3034518 100644 +index cabe67a97f3f9058d5671cb5a1a94ff4e9ef199b..1b61e5139d3183de8f9a375e8ef24d302861727d 100644 --- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java @@ -40,6 +40,7 @@ public class FrostedIceBlock extends IceBlock { @@ -13,10 +13,10 @@ index 5c8f0751def701359b388eabeb14d1dc83438c5a..f3ec0f8b8faca6aa073e76af2477f78a @Override public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + if (!world.paperConfig().environment.frostedIce.enabled) return; // Paper - Frosted ice options - if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(world, pos, 4)) && world.getMaxLocalRawBrightness(pos) > 11 - state.getValue(AGE) - state.getLightBlock(world, pos) && this.slightlyMelt(state, world, pos)) { - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - -@@ -47,12 +48,12 @@ public class FrostedIceBlock extends IceBlock { + if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(world, pos, 4)) + && world.getMaxLocalRawBrightness(pos) > 11 - state.getValue(AGE) - state.getLightBlock(world, pos) + && this.slightlyMelt(state, world, pos)) { +@@ -49,11 +50,11 @@ public class FrostedIceBlock extends IceBlock { mutableBlockPos.setWithOffset(pos, direction); BlockState blockState = world.getBlockState(mutableBlockPos); if (blockState.is(this) && !this.slightlyMelt(blockState, world, mutableBlockPos)) { @@ -24,7 +24,6 @@ index 5c8f0751def701359b388eabeb14d1dc83438c5a..f3ec0f8b8faca6aa073e76af2477f78a + world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig().environment.frostedIce.delay.min, world.paperConfig().environment.frostedIce.delay.max)); // Paper - Frosted ice options } } - } else { - world.scheduleTick(pos, this, Mth.nextInt(random, 20, 40)); + world.scheduleTick(pos, this, Mth.nextInt(random, world.paperConfig().environment.frostedIce.delay.min, world.paperConfig().environment.frostedIce.delay.max)); // Paper - Frosted ice options diff --git a/patches/server/0091-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch b/patches/server/0091-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch index ca99379663..5ec276607a 100644 --- a/patches/server/0091-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch +++ b/patches/server/0091-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Don't save empty scoreboard teams to scoreboard.dat diff --git a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java -index 28e631be85fb06245e152e1f5e0bae16b7358cfd..6c3ed29e13ea78ceb1c9bb11ce0d9938bb8b4c62 100644 +index 9341349fb16256701450e452270fb85ef213e4d6..df7d9aa45d09e5aaee8c94d48bab99279335fff4 100644 --- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java +++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java -@@ -148,6 +148,7 @@ public class ScoreboardSaveData extends SavedData { +@@ -144,6 +144,7 @@ public class ScoreboardSaveData extends SavedData { ListTag listTag = new ListTag(); - for(PlayerTeam playerTeam : this.scoreboard.getPlayerTeams()) { + for (PlayerTeam playerTeam : this.scoreboard.getPlayerTeams()) { + if (!io.papermc.paper.configuration.GlobalConfiguration.get().scoreboards.saveEmptyScoreboardTeams && playerTeam.getPlayers().isEmpty()) continue; // Paper - Don't save empty scoreboard teams to scoreboard.dat CompoundTag compoundTag = new CompoundTag(); compoundTag.putString("Name", playerTeam.getName()); diff --git a/patches/server/0092-LootTable-API-and-replenishable-lootables.patch b/patches/server/0092-LootTable-API-and-replenishable-lootables.patch index d3cd902aae..f17c37b15c 100644 --- a/patches/server/0092-LootTable-API-and-replenishable-lootables.patch +++ b/patches/server/0092-LootTable-API-and-replenishable-lootables.patch @@ -504,7 +504,7 @@ index 0000000000000000000000000000000000000000..9cfa5d36a6991067a3866e0d437749fa + } +} diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 93dc90cc4e90d9db4712efff80f811d7c9d55caa..3112eace3d9d3d7b21dfc267993cb9d84819dc11 100644 +index 52220795bf8a73c63837b4e07b1abf99c0344322..a6a97dca29c900278885b5ab1741229fcfaf7b36 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -239,6 +239,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -596,34 +596,32 @@ index 0e68f692bb9b397cffd7352e7340465b5e3719f4..58af87b8faf4f8d6bdb111c49a429466 public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>(); private int maxStack = MAX_STACK; diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java -index e0fbacd574e0c83c2e1d164ded8e9ccf4af30480..7529751afa2932fd16bc4591189b0358268a7b14 100644 +index 23551b97bdd865c30d7402cff0e221cfe4b1d9d4..f4ad1eea5bced6997edbc3a5ed1360b12b70f68f 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java -@@ -59,10 +59,9 @@ public interface ContainerEntity extends Container, MenuProvider { +@@ -59,9 +59,8 @@ public interface ContainerEntity extends Container, MenuProvider { if (this.getLootTableSeed() != 0L) { nbt.putLong("LootTableSeed", this.getLootTableSeed()); } - } else { - ContainerHelper.saveAllItems(nbt, this.getItemStacks()); } - + ContainerHelper.saveAllItems(nbt, this.getItemStacks()); // Paper - always save the items, table may still remain } default void readChestVehicleSaveData(CompoundTag nbt) { -@@ -70,10 +69,9 @@ public interface ContainerEntity extends Container, MenuProvider { +@@ -69,9 +68,8 @@ public interface ContainerEntity extends Container, MenuProvider { if (nbt.contains("LootTable", 8)) { this.setLootTable(new ResourceLocation(nbt.getString("LootTable"))); this.setLootTableSeed(nbt.getLong("LootTableSeed")); - } else { - ContainerHelper.loadAllItems(nbt, this.getItemStacks()); } - + ContainerHelper.loadAllItems(nbt, this.getItemStacks()); // Paper - always load the items, table may still remain } default void chestVehicleDestroyed(DamageSource source, Level world, Entity vehicle) { -@@ -96,13 +94,13 @@ public interface ContainerEntity extends Container, MenuProvider { +@@ -93,13 +91,13 @@ public interface ContainerEntity extends Container, MenuProvider { default void unpackChestVehicleLootTable(@Nullable Player player) { MinecraftServer minecraftServer = this.level().getServer(); @@ -634,14 +632,14 @@ index e0fbacd574e0c83c2e1d164ded8e9ccf4af30480..7529751afa2932fd16bc4591189b0358 CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer)player, this.getLootTable()); } -- this.setLootTable((ResourceLocation)null); +- this.setLootTable(null); + this.getLootableData().processRefill(player); // Paper - LootParams.Builder builder = (new LootParams.Builder((ServerLevel)this.level())).withParameter(LootContextParams.ORIGIN, this.position()); + LootParams.Builder builder = new LootParams.Builder((ServerLevel)this.level()).withParameter(LootContextParams.ORIGIN, this.position()); if (player != null) { builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player); -@@ -176,4 +174,13 @@ public interface ContainerEntity extends Container, MenuProvider { +@@ -171,4 +169,13 @@ public interface ContainerEntity extends Container, MenuProvider { default boolean isChestVehicleStillValid(Player player) { - return !this.isRemoved() && this.position().closerThan(player.position(), 8.0D); + return !this.isRemoved() && this.position().closerThan(player.position(), 8.0); } + // Paper start + default Entity getEntity() { @@ -654,7 +652,7 @@ index e0fbacd574e0c83c2e1d164ded8e9ccf4af30480..7529751afa2932fd16bc4591189b0358 + // Paper end } diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java -index aa4181e59f88be04a3605352fa5ceb3e04149dd3..e4e827a57c2913c719282cc0d5da33586607677b 100644 +index 1c3763d892e4e2df23ccf7a9fdb126e59b36ab65..f33c4633094002a3dd0c54353b62f7b358628be3 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java @@ -17,6 +17,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc @@ -717,7 +715,7 @@ index aa4181e59f88be04a3605352fa5ceb3e04149dd3..e4e827a57c2913c719282cc0d5da3358 + @Override public boolean isEmpty() { - this.unpackLootTable((Player)null); + this.unpackLootTable(null); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBrushableBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBrushableBlock.java index 86076a9d2a3b1044c96518cbaeee66d60a8a22c6..c268513bc5719d80e1c3d73de53b85ec7f852fa9 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBrushableBlock.java diff --git a/patches/server/0094-Async-GameProfileCache-saving.patch b/patches/server/0094-Async-GameProfileCache-saving.patch index 702f554313..24ad3a2b3a 100644 --- a/patches/server/0094-Async-GameProfileCache-saving.patch +++ b/patches/server/0094-Async-GameProfileCache-saving.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Async GameProfileCache saving diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2c500fed04982c502b3e6fb1687b38bfaaa37f69..fcaa31ccd6f6e6affaccf76403dbab26e6932571 100644 +index 20ee0fd8f5a808436fae60b64fc3e8966146ba71..b9c006bef0491c401ae3a447a3f67742a75cb74f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -980,7 +980,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0096-Faster-redstone-torch-rapid-clock-removal.patch b/patches/server/0096-Faster-redstone-torch-rapid-clock-removal.patch index 8bb76d9c3c..09e88a303b 100644 --- a/patches/server/0096-Faster-redstone-torch-rapid-clock-removal.patch +++ b/patches/server/0096-Faster-redstone-torch-rapid-clock-removal.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Faster redstone torch rapid clock removal Only resize the the redstone torch list once, since resizing arrays / lists is costly diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 61056b2873a58bf8d0f70e39022ded4b1fcbc5a5..f11e00b3a7164e8af6e33a9a09328539df5405fc 100644 +index 424377f062c6443460a9814feb8b90e7bef71c6a..0137f61a572800ea7bb013185835a1ad4cd0462c 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -171,6 +171,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0097-Add-server-name-parameter.patch b/patches/server/0097-Add-server-name-parameter.patch index 19c35fe6e6..6dfa8a2767 100644 --- a/patches/server/0097-Add-server-name-parameter.patch +++ b/patches/server/0097-Add-server-name-parameter.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add server-name parameter diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 9f4c5a6f22719ae30d88ca02a1db4a3f39957943..4fb377d967d13ed920ea1246e84b3b94cda25be6 100644 +index bdff750f44cabdbc7e329a0feaa77709e2103635..db36453ff46afded45268b3701488e23305aa2eb 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -167,6 +167,14 @@ public class Main { diff --git a/patches/server/0102-Optimise-BlockState-s-hashCode-equals.patch b/patches/server/0102-Optimise-BlockState-s-hashCode-equals.patch index b303f4e71f..313921f28d 100644 --- a/patches/server/0102-Optimise-BlockState-s-hashCode-equals.patch +++ b/patches/server/0102-Optimise-BlockState-s-hashCode-equals.patch @@ -9,7 +9,7 @@ object identity checks safely. Use a simpler optimized hashcode diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java -index 3084343b724098de9791bb74ffb037a499c0c430..8da64429eaf083578c672cd34f52dd42389ff396 100644 +index ee2f1bff22fed14cda434173dc6286e4d4520822..b63116b333b6e06494091a82588acfb639bddb71 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java @@ -30,8 +30,7 @@ public class BooleanProperty extends Property<Boolean> { @@ -23,10 +23,10 @@ index 3084343b724098de9791bb74ffb037a499c0c430..8da64429eaf083578c672cd34f52dd42 return true; } else { diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java -index 647e295c7761b95db6da28f6fd043ec963f27872..0a7a6c0e7635d0ada101074d4229df7edc6dd31b 100644 +index bc7890e8ccfb133992605b06b37114424ccb093d..cd7efe4a09e114ab68a90365a6f5363a5c4c17a2 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java -@@ -45,8 +45,7 @@ public class EnumProperty<T extends Enum<T> & StringRepresentable> extends Prope +@@ -44,8 +44,7 @@ public class EnumProperty<T extends Enum<T> & StringRepresentable> extends Prope return value.getSerializedName(); } @@ -37,7 +37,7 @@ index 647e295c7761b95db6da28f6fd043ec963f27872..0a7a6c0e7635d0ada101074d4229df7e return true; } else { diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java -index d6c1b1817ba79a652c4094f003a7d899d4939971..cbe6e4579cc55a427dd8f8fe403478faf6d35b8f 100644 +index 3c590d400032d8266de63aae301fedbd83d37a1d..3a850321a4bcc68058483b5fd53e829c425a68af 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java @@ -35,8 +35,7 @@ public class IntegerProperty extends Property<Integer> { @@ -51,21 +51,14 @@ index d6c1b1817ba79a652c4094f003a7d899d4939971..cbe6e4579cc55a427dd8f8fe403478fa return true; } else { diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java -index d1f2e29623b15fdb99ba082fd757a54fd4713761..08c2e4ba9147fbea41e0fce26ad20586832a525b 100644 +index ce06c1702e9ff2e966d94a0d622264e16ded493c..bad6c58b0adc1ca630d3e943a86a2bc66dd94c9f 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java -@@ -70,14 +70,7 @@ public abstract class Property<T extends Comparable<T>> { +@@ -70,7 +70,7 @@ public abstract class Property<T extends Comparable<T>> { @Override public boolean equals(Object object) { -- if (this == object) { -- return true; -- } else if (!(object instanceof Property)) { -- return false; -- } else { -- Property<?> property = (Property)object; -- return this.clazz.equals(property.clazz) && this.name.equals(property.name); -- } +- return this == object || object instanceof Property<?> property && this.clazz.equals(property.clazz) && this.name.equals(property.name); + return this == object; // Paper - Perf: Optimize hashCode/equals } diff --git a/patches/server/0103-Configurable-packet-in-spam-threshold.patch b/patches/server/0103-Configurable-packet-in-spam-threshold.patch index 73f1819cfc..45836f3841 100644 --- a/patches/server/0103-Configurable-packet-in-spam-threshold.patch +++ b/patches/server/0103-Configurable-packet-in-spam-threshold.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable packet in spam threshold diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c1c1abd45cae5f1fe010e73199e4b228f919c6a6..f9581c2f53e7a73b942505be8f00ffc3ac1774a9 100644 +index 801e1727bd291f647c91e2c325810ead070f3752..b5471f86e4c9b5167ac96eb7a114cde0f6a35a9e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1529,13 +1529,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0104-Configurable-flying-kick-messages.patch b/patches/server/0104-Configurable-flying-kick-messages.patch index 055290f358..e0b03a6592 100644 --- a/patches/server/0104-Configurable-flying-kick-messages.patch +++ b/patches/server/0104-Configurable-flying-kick-messages.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable flying kick messages diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f9581c2f53e7a73b942505be8f00ffc3ac1774a9..6fec49a0833300ff0e4ef0f22d21480dfac9a2c7 100644 +index b5471f86e4c9b5167ac96eb7a114cde0f6a35a9e..69e525776d57b2fe80d8bb9e94e981e553f329a3 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -338,7 +338,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0111-Prevent-Pathfinding-out-of-World-Border.patch b/patches/server/0111-Prevent-Pathfinding-out-of-World-Border.patch index f473b6a56e..6c97c14e17 100644 --- a/patches/server/0111-Prevent-Pathfinding-out-of-World-Border.patch +++ b/patches/server/0111-Prevent-Pathfinding-out-of-World-Border.patch @@ -13,10 +13,10 @@ by adding code to all overrides in: to return BLOCKED if it is outside the world border. 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 85b3da93b6dd8e1a40d884db0721f30b9b237c69..c3b406e6302ae0ac1ef56253ab614ca201a7a1c8 100644 +index fa5088945adc5e41e34cc2dc21a1762d106254c8..25a9f1fd69fbafab5129740e26e9741e35885ce0 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 -@@ -159,7 +159,7 @@ public abstract class PathNavigation { +@@ -158,7 +158,7 @@ public abstract class PathNavigation { // Paper start - EntityPathfindEvent boolean copiedSet = false; for (BlockPos possibleTarget : positions) { diff --git a/patches/server/0112-Optimize-Level.hasChunkAt-BlockPosition-Z.patch b/patches/server/0112-Optimize-Level.hasChunkAt-BlockPosition-Z.patch index 16a0ca9ffb..5a64d1f8f3 100644 --- a/patches/server/0112-Optimize-Level.hasChunkAt-BlockPosition-Z.patch +++ b/patches/server/0112-Optimize-Level.hasChunkAt-BlockPosition-Z.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimize Level.hasChunkAt(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 610ce2574a61fcee00f5224b554b285079a75698..e4a2afc20efcfd7a6107dc56217ae8451dd5a7d6 100644 +index 1ecde4f1dff5bfa67c526a699061f1952da59fae..926e4f9760e07ab66405132de2e96306211e5b9c 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -348,6 +348,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0114-Configurable-Cartographer-Treasure-Maps.patch b/patches/server/0114-Configurable-Cartographer-Treasure-Maps.patch index 61fc245ddd..8470a74ac8 100644 --- a/patches/server/0114-Configurable-Cartographer-Treasure-Maps.patch +++ b/patches/server/0114-Configurable-Cartographer-Treasure-Maps.patch @@ -9,10 +9,10 @@ Also allow turning off treasure maps all together as they can eat up Map ID's which are limited in quantity. 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 43fb44b8cd164b0815335a32f04879b301a54728..318b7c7cb2a88e8d4dc4456154431fe7bfe2e0dc 100644 +index 20fbbf57a9bc17803ff68f317a723f8fe1c46ff3..f8f7711545a8c51e3a81dc59d782b15e3a0ef4a1 100644 --- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java -@@ -451,7 +451,8 @@ public class VillagerTrades { +@@ -1644,7 +1644,8 @@ public class VillagerTrades { return null; } else { ServerLevel serverLevel = (ServerLevel)entity.level(); @@ -23,14 +23,13 @@ index 43fb44b8cd164b0815335a32f04879b301a54728..318b7c7cb2a88e8d4dc4456154431fe7 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 dcc6da6641e78cd80bd148ba644475811a1fbf4d..76b6544e75e52f931bed5bd9b25eda41957beaf7 100644 +index 6adb72926d7bbc73d80b91dadbdb895a22bd0efd..4a6c4d943c60b8da1cd89a4cadfcb6fef8e4e7c9 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 -@@ -75,7 +75,16 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { +@@ -90,8 +90,17 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { Vec3 vec3 = context.getParamOrNull(LootContextParams.ORIGIN); if (vec3 != null) { ServerLevel serverLevel = context.getLevel(); -- BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, BlockPos.containing(vec3), this.searchRadius, this.skipKnownStructures); + // Paper start - Configurable cartographer treasure maps + if (!serverLevel.paperConfig().environment.treasureMaps.enabled) { + /* @@ -39,8 +38,10 @@ index dcc6da6641e78cd80bd148ba644475811a1fbf4d..76b6544e75e52f931bed5bd9b25eda41 + */ + return stack; + } -+ BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, BlockPos.containing(vec3), this.searchRadius, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredLootTable.or(!this.skipKnownStructures)); + // Paper end - Configurable cartographer treasure maps + BlockPos blockPos = serverLevel.findNearestMapStructure( +- this.destination, BlockPos.containing(vec3), this.searchRadius, this.skipKnownStructures ++ this.destination, BlockPos.containing(vec3), this.searchRadius, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredLootTable.or(!this.skipKnownStructures) // Paper - Configurable cartographer treasure maps + ); if (blockPos != null) { ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), this.zoom, true, true); - MapItem.renderBiomePreviewMap(serverLevel, itemStack); diff --git a/patches/server/0117-Properly-fix-item-duplication-bug.patch b/patches/server/0117-Properly-fix-item-duplication-bug.patch index 47c56686b2..0d3f7e5666 100644 --- a/patches/server/0117-Properly-fix-item-duplication-bug.patch +++ b/patches/server/0117-Properly-fix-item-duplication-bug.patch @@ -6,7 +6,7 @@ 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 429f3ed00c0c6d7c89138aa9a4b770e3e68b7ed7..f1f090b7d9ac21f6430756ddb02b734f7dda0c7c 100644 +index 50264a1da70f120f9adf1619dd72d834ba14e499..54f343a1979794781757b221514f70aa0f7a5dec 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2451,7 +2451,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0118-Firework-API-s.patch b/patches/server/0118-Firework-API-s.patch index a137c1c66f..c562b87811 100644 --- a/patches/server/0118-Firework-API-s.patch +++ b/patches/server/0118-Firework-API-s.patch @@ -7,14 +7,14 @@ Subject: [PATCH] Firework API's public net.minecraft.world.entity.projectile.FireworkRocketEntity attachedToEntity 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 9d637e005205a32fa5406ba47de7cd2b22ead9cf..5b3b59057b962438c6f4fc8a1507342865b3bc11 100644 +index 9d637e005205a32fa5406ba47de7cd2b22ead9cf..813c4a52c8ddd70e252125ebfd3654346c71f13c 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java @@ -40,6 +40,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { public int lifetime; @Nullable public LivingEntity attachedToEntity; -+ public java.util.UUID spawningEntity; // Paper ++ @Nullable public java.util.UUID spawningEntity; // Paper public FireworkRocketEntity(EntityType<? extends FireworkRocketEntity> type, Level world) { super(type, world); @@ -56,18 +56,18 @@ index ac7371882d15746e9353865635d0bb716f890c53..ba570f1c9654e1004e068a1efe2118f3 object = CrossbowItem.getArrow(world, shooter, crossbow, projectile); if (creative || simulated != 0.0F) { diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -index 5cafb6f0b507127665393741b372286da098d603..7c627d27300247db9122ab2081049345ef306073 100644 +index b342d23692ffd38b6eec66838162e9012f29ac09..3749cfca8f007973d1a2206d8f2ba15283a550e1 100644 --- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java +++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -@@ -46,6 +46,7 @@ public class FireworkRocketItem extends Item { - Vec3 vec3 = context.getClickLocation(); - Direction direction = context.getClickedFace(); - FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(level, context.getPlayer(), vec3.x + (double)direction.getStepX() * 0.15D, vec3.y + (double)direction.getStepY() * 0.15D, vec3.z + (double)direction.getStepZ() * 0.15D, itemStack); +@@ -53,6 +53,7 @@ public class FireworkRocketItem extends Item { + vec3.z + (double)direction.getStepZ() * 0.15, + itemStack + ); + fireworkRocketEntity.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID(); // Paper level.addFreshEntity(fireworkRocketEntity); itemStack.shrink(1); } -@@ -59,6 +60,7 @@ public class FireworkRocketItem extends Item { +@@ -66,6 +67,7 @@ public class FireworkRocketItem extends Item { ItemStack itemStack = user.getItemInHand(hand); if (!world.isClientSide) { FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(world, itemStack, user); diff --git a/patches/server/0122-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/0122-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index 0294d6985b..698992e2b7 100644 --- a/patches/server/0122-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/patches/server/0122-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -127,7 +127,7 @@ index 7ce46bd254e0f14b1bbafe37e0eb97a468a07083..00b46fd0b4a718756f8b21f203fd5679 @Override diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 5ba65d647903077b39d9475ef28bfa0c400edd7a..2c3439d12e40003032904ebdb480fa95dd2a9682 100644 +index eec88cb65aae7986e53cba336f6e0bf5ff3011b3..a49d20bab5c49721fb41e2429c7fb721ef3c2f98 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1795,7 +1795,8 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0123-Cap-Entity-Collisions.patch b/patches/server/0123-Cap-Entity-Collisions.patch index 7faa5f0876..a84c864799 100644 --- a/patches/server/0123-Cap-Entity-Collisions.patch +++ b/patches/server/0123-Cap-Entity-Collisions.patch @@ -12,7 +12,7 @@ just as it does in Vanilla, but entity pushing logic will be capped. You can set this to 0 to disable collisions. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3112eace3d9d3d7b21dfc267993cb9d84819dc11..c261971ab482abfa5a1ca51abd189eff16421534 100644 +index a6a97dca29c900278885b5ab1741229fcfaf7b36..6d31ced629fabef4de2ef9a26586cea0cffa155c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -394,6 +394,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -24,7 +24,7 @@ index 3112eace3d9d3d7b21dfc267993cb9d84819dc11..c261971ab482abfa5a1ca51abd189eff @javax.annotation.Nullable private org.bukkit.util.Vector origin; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 2c3439d12e40003032904ebdb480fa95dd2a9682..ded2c573533699133309d9ed5250e6a0ce97cc54 100644 +index a49d20bab5c49721fb41e2429c7fb721ef3c2f98..589fba7264d8041e6f766779fe8e3d5071398fed 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3369,10 +3369,12 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0125-Properly-handle-async-calls-to-restart-the-server.patch b/patches/server/0125-Properly-handle-async-calls-to-restart-the-server.patch index 0bacd60877..09c60eff3e 100644 --- a/patches/server/0125-Properly-handle-async-calls-to-restart-the-server.patch +++ b/patches/server/0125-Properly-handle-async-calls-to-restart-the-server.patch @@ -30,7 +30,7 @@ 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 fcaa31ccd6f6e6affaccf76403dbab26e6932571..1d8e17f4b862e71cc5ef8c5eabfb80dc427aec51 100644 +index b9c006bef0491c401ae3a447a3f67742a75cb74f..48513e585ce02c301983adbe1224e95ff7f9a345 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -236,6 +236,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0128-Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/0128-Use-TerminalConsoleAppender-for-console-improvements.patch index 8e2b8a4474..b6f20d9015 100644 --- a/patches/server/0128-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/0128-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -25,7 +25,7 @@ Other changes: Co-Authored-By: Emilia Kond <[email protected]> diff --git a/build.gradle.kts b/build.gradle.kts -index 1219b12750edb855df0962d14d7f3c1859d78b2e..511dfff4870c197b6f69169cc0504ef05988bb9c 100644 +index 8332781de54d73cb5803828e98882a731daed81f..cadb6a2cae98a8df97c392bfbd5a1440bccd16f4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,9 +6,30 @@ plugins { @@ -413,7 +413,7 @@ index 827579f59d34b61912a67b40624f0f41524185fd..f7d937c6a11e24afe767411428210f3c @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 adae906894144a1684a0dab15226649fd4bf6354..1bd54fbadc9b1b5207325c78298cc72f61455ac7 100644 +index db36453ff46afded45268b3701488e23305aa2eb..e5df5469f20ccffcbe9cd227df6f5c60e82206bf 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -13,7 +13,6 @@ import java.util.logging.Logger; diff --git a/patches/server/0133-Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/0133-Do-not-submit-profile-lookups-to-worldgen-threads.patch index 144dfef087..5e3192ef74 100644 --- a/patches/server/0133-Do-not-submit-profile-lookups-to-worldgen-threads.patch +++ b/patches/server/0133-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 114f4017c4133042178c57d424f10079163835dd..aa52b271bd556a29f774fde375b713d0d187521b 100644 +index 9a12feebbae4a9fdfd24214c2ffa61e717d6e358..1f1422a000eb9a0fb819f26d42b3f39ed683a8da 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -89,6 +89,22 @@ public class Util { +@@ -91,6 +91,22 @@ public class Util { private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main"); private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false); private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true); diff --git a/patches/server/0144-Fix-this-stupid-bullshit.patch b/patches/server/0144-Fix-this-stupid-bullshit.patch index f71529aaed..67c72e7d54 100644 --- a/patches/server/0144-Fix-this-stupid-bullshit.patch +++ b/patches/server/0144-Fix-this-stupid-bullshit.patch @@ -31,7 +31,7 @@ index 8ff786c366332588a2df053438f23cc9fb7e2b84..c887d34171f89c731d76c4ca92c70be2 Bootstrap.isBootstrapped = true; Instant instant = Instant.now(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 1bd54fbadc9b1b5207325c78298cc72f61455ac7..a7a376e91fca80dd96f5a3e8910eba9772c67bfe 100644 +index e5df5469f20ccffcbe9cd227df6f5c60e82206bf..d8a7287849407c4756d4ebe4b55c358970320ce3 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -258,10 +258,12 @@ public class Main { diff --git a/patches/server/0149-Handle-plugin-prefixes-using-Log4J-configuration.patch b/patches/server/0149-Handle-plugin-prefixes-using-Log4J-configuration.patch index 8dc571bba3..42bd840658 100644 --- a/patches/server/0149-Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/patches/server/0149-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 7a3c96318f95fcd6cf6fd94415958382d1193ec6..38ded67b38bb5dc7c59eb610b81ac33d88d25dac 100644 +index cadb6a2cae98a8df97c392bfbd5a1440bccd16f4..ca6e0c77acbcf3b32eb8b5c0f86701f52dfeea0c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,7 +25,7 @@ dependencies { diff --git a/patches/server/0151-Add-PlayerJumpEvent.patch b/patches/server/0151-Add-PlayerJumpEvent.patch index e24d0d58ee..cbd161bc48 100644 --- a/patches/server/0151-Add-PlayerJumpEvent.patch +++ b/patches/server/0151-Add-PlayerJumpEvent.patch @@ -5,7 +5,7 @@ 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 12cfc3ed36d6eebd477dfd9058b2852e0a0d98eb..3c4431123c39256fdf704111d350c1005e4d9ef9 100644 +index 00870f788b40fc0943ef54da1e84c6e357640a32..fa8db93541dc62dc61bccc53c1aaeb3666d80ee1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1218,7 +1218,34 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0156-Add-PlayerArmorChangeEvent.patch b/patches/server/0156-Add-PlayerArmorChangeEvent.patch index b880ce1c49..e93b77f565 100644 --- a/patches/server/0156-Add-PlayerArmorChangeEvent.patch +++ b/patches/server/0156-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 ded2c573533699133309d9ed5250e6a0ce97cc54..bbf3286cb69f931be528726e45784eec9f8e0af3 100644 +index 589fba7264d8041e6f766779fe8e3d5071398fed..96805bc64fd3593373ba9eecf29bd13d33d9e053 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3068,6 +3068,13 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0160-API-to-get-a-BlockState-without-a-snapshot.patch b/patches/server/0160-API-to-get-a-BlockState-without-a-snapshot.patch index 423d453874..5b11c72288 100644 --- a/patches/server/0160-API-to-get-a-BlockState-without-a-snapshot.patch +++ b/patches/server/0160-API-to-get-a-BlockState-without-a-snapshot.patch @@ -69,7 +69,7 @@ index a1c1a101aa424e74309f6f4c0a53a6a8db5df441..013298c424025cd88f15d61e50d196f7 public Biome getBiome() { return this.getWorld().getBiome(this.getX(), this.getY(), this.getZ()); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 22af1b41eec06d660dbe47c463014bcdd96fc5b6..f046f507a095e0cb8f839b9b4b06add3a671486b 100644 +index fa490e01d1358762eda7f41db532024fc4c7605a..e7fd9ebd47af277d6dbced0f17e954722c202776 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -17,15 +17,26 @@ public class CraftBlockEntityState<T extends BlockEntity> extends CraftBlockStat diff --git a/patches/server/0161-AsyncTabCompleteEvent.patch b/patches/server/0161-AsyncTabCompleteEvent.patch index 665a68f81e..621c5319a5 100644 --- a/patches/server/0161-AsyncTabCompleteEvent.patch +++ b/patches/server/0161-AsyncTabCompleteEvent.patch @@ -16,7 +16,7 @@ Also adds isCommand and getLocation to the sync TabCompleteEvent Co-authored-by: Aikar <[email protected]> diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3c4431123c39256fdf704111d350c1005e4d9ef9..f60d754cb617df3c5ab8654eba66016c1cc04617 100644 +index fa8db93541dc62dc61bccc53c1aaeb3666d80ee1..5d4730b9ced378c1e77d7734f2f8aba6d09a19d0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -688,21 +688,58 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0164-PlayerNaturallySpawnCreaturesEvent.patch b/patches/server/0164-PlayerNaturallySpawnCreaturesEvent.patch index 86df19fb45..b535464839 100644 --- a/patches/server/0164-PlayerNaturallySpawnCreaturesEvent.patch +++ b/patches/server/0164-PlayerNaturallySpawnCreaturesEvent.patch @@ -9,7 +9,7 @@ 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 7245b93a4935aece23567fda0474104686485395..de328a93abcf23d3ff265557a7d8bad5be56287c 100644 +index 97bb0fc7e890273f2f975f137ec1194a1a83fde7..2a0e81a3ec0774ad98e2d74ac7672c167e28f38e 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1203,7 +1203,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -60,7 +60,7 @@ index e0ae7274da59ff043cd423d282ed8db0382561d4..369e4bf5ff52cb774f1acaf760b8bd27 boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit Iterator iterator1 = list.iterator(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index f1f090b7d9ac21f6430756ddb02b734f7dda0c7c..19cd69fc911bb9b95257b1fdc19645bbdfe05de3 100644 +index 54f343a1979794781757b221514f70aa0f7a5dec..98d229fb8f342775482f2ed199265bda3f043a96 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -265,6 +265,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0174-Implement-extended-PaperServerListPingEvent.patch b/patches/server/0174-Implement-extended-PaperServerListPingEvent.patch index 2c073bc562..919b4393df 100644 --- a/patches/server/0174-Implement-extended-PaperServerListPingEvent.patch +++ b/patches/server/0174-Implement-extended-PaperServerListPingEvent.patch @@ -181,7 +181,7 @@ index 0000000000000000000000000000000000000000..6b0bdc266109cdfb874f08bf74323603 + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6587cd9ea257d0f6f1308ea8ca4d0245178b2870..0f3589ae1c5577c612b93289fc42cdb977486b6b 100644 +index 22b9d4bebee30877225b08b46cec6084b12a9c5a..09bd8a6576647c612e9d7f807780b1e20478a534 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -3,6 +3,9 @@ package net.minecraft.server; diff --git a/patches/server/0181-Flag-to-disable-the-channel-limit.patch b/patches/server/0181-Flag-to-disable-the-channel-limit.patch index 4c3389e676..11af2999d9 100644 --- a/patches/server/0181-Flag-to-disable-the-channel-limit.patch +++ b/patches/server/0181-Flag-to-disable-the-channel-limit.patch @@ -9,7 +9,7 @@ e.g. servers which allow and support the usage of mod packs. provide an optional flag to disable this check, at your own risk. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index f33aee99de2007701bd593917a63e05c7fa5e349..a77c15a9c351c9cd5e8b4832016ec6de30483ed6 100644 +index ac42d245f14c9b0565f64689b4646d84791b6a86..dbf67a52ae2e18589952b2d019b5258324ff3edc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -196,6 +196,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0186-Block-Enderpearl-Travel-Exploit.patch b/patches/server/0186-Block-Enderpearl-Travel-Exploit.patch index ffdce6c524..969fd2b959 100644 --- a/patches/server/0186-Block-Enderpearl-Travel-Exploit.patch +++ b/patches/server/0186-Block-Enderpearl-Travel-Exploit.patch @@ -16,7 +16,7 @@ public net.minecraft.world.entity.projectile.Projectile cachedOwner public net.minecraft.world.entity.projectile.Projectile ownerUUID diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 5f0885c13116ad070dc076cca5a527b2a616c541..6cadfd678f1b2323a763ffd9220de7394620328b 100644 +index 76246fdacf70309918ce413f494bdb4d8683241d..d2266bc75f2c1b0b02405eea0711a7b53d1a9e7a 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2114,6 +2114,12 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0196-Fix-CraftEntity-hashCode.patch b/patches/server/0196-Fix-CraftEntity-hashCode.patch index 9ff8123f58..1622a61ea9 100644 --- a/patches/server/0196-Fix-CraftEntity-hashCode.patch +++ b/patches/server/0196-Fix-CraftEntity-hashCode.patch @@ -21,7 +21,7 @@ check is essentially the same as this.getHandle() == other.getHandle() However, replaced it too to make it clearer of intent. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index d715dcc9155ad9938bd4fbe0cde43079f614f203..34e4dd733a2e9ccc3c7f1b228825428100e583e9 100644 +index 4808c62d3d951b201061659c91d1001e4b9b49ef..6fddbcec673564ac531a852f631f6acc460accbd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -500,14 +500,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0197-Configurable-LootPool-luck-formula.patch b/patches/server/0197-Configurable-LootPool-luck-formula.patch index 6df631b746..929037b4c9 100644 --- a/patches/server/0197-Configurable-LootPool-luck-formula.patch +++ b/patches/server/0197-Configurable-LootPool-luck-formula.patch @@ -36,10 +36,10 @@ This change will result in some major changes to fishing formulas. I would love to see this change in Vanilla, so Mojang please pull :) diff --git a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java -index 6d5a2806345ff86e143e16ecedc2f1e8d80f5b85..0cf437dd75b97b9ba39f5134ae2ae5f33b94f653 100644 +index 128b1a1c11258c648b7734d5f41fbec8e2f1bd55..f385344f866e21ebdd7b0463822aa5dd7b82dfc4 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java -@@ -122,9 +122,35 @@ public abstract class LootPoolSingletonContainer extends LootPoolEntryContainer +@@ -128,9 +128,35 @@ public abstract class LootPoolSingletonContainer extends LootPoolEntryContainer protected abstract class EntryBase implements LootPoolEntry { @Override public int getWeight(float luck) { diff --git a/patches/server/0199-Make-shield-blocking-delay-configurable.patch b/patches/server/0199-Make-shield-blocking-delay-configurable.patch index ae7ebd4f8e..cd4b92ec72 100644 --- a/patches/server/0199-Make-shield-blocking-delay-configurable.patch +++ b/patches/server/0199-Make-shield-blocking-delay-configurable.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Make shield blocking delay configurable diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 4af3e59b9ad84aaf1a5dd8f1373b781233ba07d6..7810739098ee52efafbbd5355d4d16dadcb5ac35 100644 +index 96805bc64fd3593373ba9eecf29bd13d33d9e053..e3dfef027fb7f6aedd3e3411af6457671b5507a7 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3828,12 +3828,24 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0202-Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch b/patches/server/0202-Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch index d9acc8f055..c009e429ef 100644 --- a/patches/server/0202-Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch +++ b/patches/server/0202-Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch @@ -9,7 +9,7 @@ Co-authored-by: aerulion <[email protected]> This event is called when an entity receives knockback by another entity. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index fe314015f8cbc44e29a8ec73ecca4eeadd1da39f..d2d1a3e3c8accbdfeecafa86f9cc9f16007c3930 100644 +index 0cc82ffdcebbdd92fa953e7c52a20911f46a503c..165cc45e2ae99e606533e5e5294e431ed5e3a2dd 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1868,9 +1868,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -39,7 +39,7 @@ index fe314015f8cbc44e29a8ec73ecca4eeadd1da39f..d2d1a3e3c8accbdfeecafa86f9cc9f16 protected void markHurt() { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 21bef887193c777ec1e311b3bf5c0213180ea4ca..83a56061ce23d3d6f7d8ad3201ce325106f8a4d0 100644 +index e3dfef027fb7f6aedd3e3411af6457671b5507a7..88af8a11dfc3b645c5a2b5fb629a73fc1e2b2f80 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1569,7 +1569,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -85,26 +85,26 @@ index 21bef887193c777ec1e311b3bf5c0213180ea4ca..83a56061ce23d3d6f7d8ad3201ce3251 } } diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java b/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java -index e319a46a21a94314c5d496820b1ac4879dcf56b9..fcc0a7789c79b956f097bc6d34e0c37e0b90a2db 100644 +index 312398b7f1281144a0529a743d2a09376d575ff5..f832000cb023ce873f4437b6f6db19a65916af4a 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java -@@ -77,7 +77,7 @@ public class RamTarget extends Behavior<Goat> { +@@ -83,7 +83,7 @@ public class RamTarget extends Behavior<Goat> { float f = 0.25F * (float)(i - j); float g = Mth.clamp(entity.getSpeed() * 1.65F, 0.2F, 3.0F) + f; float h = livingEntity.isDamageSourceBlocked(world.damageSources().mobAttack(entity)) ? 0.5F : 1.0F; - livingEntity.knockback((double)(h * g) * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z()); + livingEntity.knockback((double)(h * g) * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z(), entity, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent this.finishRam(world, entity); - world.playSound((Player)null, entity, this.getImpactSound.apply(entity), SoundSource.NEUTRAL, 1.0F, 1.0F); + world.playSound(null, entity, this.getImpactSound.apply(entity), SoundSource.NEUTRAL, 1.0F, 1.0F); } else if (this.hasRammedHornBreakingBlock(world, entity)) { diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java b/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java -index 29cfd065f246bbd3d3c2a5bbd32c3f4813a02951..771d798fa3b367043129f41101c65f13f0b466fa 100644 +index be7031dad5c30fefcdaccb9721e216374b2f26a8..e4626e981fbe6c7c9e17441429a8e3dd33d3e664 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java -@@ -68,7 +68,7 @@ public class SonicBoom extends Behavior<Warden> { +@@ -81,7 +81,7 @@ public class SonicBoom extends Behavior<Warden> { target.hurt(world.damageSources().sonicBoom(entity), 10.0F); - double d = 0.5D * (1.0D - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); - double e = 2.5D * (1.0D - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); + double d = 0.5 * (1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); + double e = 2.5 * (1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); - target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e); + target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e, entity); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent }); @@ -166,13 +166,13 @@ index 041f1650b853138e4286fe83a08d79d276054ce7..aba20a4352d8983b01ab5d329187588f @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java -index 81003ce3f05c6be6f52a92b86a4721235f4ce12a..cae7e3e85c3b911f50f8a06badf695c3df2847e5 100644 +index 38c27b4aa37e8b046e3eccdde3f527eb555da6f8..05dee42941a842bf4bba9480a2c04a142541ac29 100644 --- a/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java +++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java @@ -40,7 +40,7 @@ public interface HoglinBase { double j = f * (double)(attacker.level().random.nextFloat() * 0.5F + 0.2F); - Vec3 vec3 = (new Vec3(g, 0.0D, h)).normalize().scale(j).yRot(i); - double k = f * (double)attacker.level().random.nextFloat() * 0.5D; + Vec3 vec3 = new Vec3(g, 0.0, h).normalize().scale(j).yRot(i); + double k = f * (double)attacker.level().random.nextFloat() * 0.5; - target.push(vec3.x, k, vec3.z); + target.push(vec3.x, k, vec3.z, attacker); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent target.hurtMarked = true; diff --git a/patches/server/0206-Add-config-to-disable-ender-dragon-legacy-check.patch b/patches/server/0206-Add-config-to-disable-ender-dragon-legacy-check.patch index 8a9728d94f..9b0dd03eba 100644 --- a/patches/server/0206-Add-config-to-disable-ender-dragon-legacy-check.patch +++ b/patches/server/0206-Add-config-to-disable-ender-dragon-legacy-check.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add config to disable ender dragon legacy check 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 38c2aed0785b3b5bcceba572a1a6f5fb0224964d..cad7a1b28c9d7a3e67dbf0865cbf232ebd39a8d9 100644 +index 141df4dba676fd0a714d5d48d385ee71084a7990..1c716cf65d77e54ba8f90c8cf736e20c64f5df2e 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 @@ -106,6 +106,10 @@ public class EndDragonFight { diff --git a/patches/server/0208-InventoryCloseEvent-Reason-API.patch b/patches/server/0208-InventoryCloseEvent-Reason-API.patch index 91a388c934..aa589afd1b 100644 --- a/patches/server/0208-InventoryCloseEvent-Reason-API.patch +++ b/patches/server/0208-InventoryCloseEvent-Reason-API.patch @@ -29,7 +29,7 @@ index 256b9c6cbf52c252f8174d0aa74e1270fb092ae9..113dce44ce086272fe7f20a2007efade } // 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 19cd69fc911bb9b95257b1fdc19645bbdfe05de3..38a3b264ba72631c27203a178ac0bbdd36e10a10 100644 +index 98d229fb8f342775482f2ed199265bda3f043a96..0b039c43bd3bd46f31477fc75585038270242de2 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -648,7 +648,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0211-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch b/patches/server/0211-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch index 50b3a6608f..d999d8b2ce 100644 --- a/patches/server/0211-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch +++ b/patches/server/0211-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Use AsyncAppender to keep logging IO off main thread diff --git a/build.gradle.kts b/build.gradle.kts -index 38ded67b38bb5dc7c59eb610b81ac33d88d25dac..30edfbf16e7bed29b3261b51d9e4f3124beef026 100644 +index ca6e0c77acbcf3b32eb8b5c0f86701f52dfeea0c..470c55412e7a4f09235947adc72944b903d6543d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -36,6 +36,7 @@ dependencies { diff --git a/patches/server/0212-add-more-information-to-Entity.toString.patch b/patches/server/0212-add-more-information-to-Entity.toString.patch index 9b1f740570..beef9001e2 100644 --- a/patches/server/0212-add-more-information-to-Entity.toString.patch +++ b/patches/server/0212-add-more-information-to-Entity.toString.patch @@ -6,7 +6,7 @@ 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 17a8c7e42b31513a4586cd2d40b2d58911814f75..b718e5a1dd49dc855a1161106b53a1d6615e8b69 100644 +index 165cc45e2ae99e606533e5e5294e431ed5e3a2dd..36f0a43cc301840406eab260b162295fe760f8bb 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3166,7 +3166,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0213-EnderDragon-Events.patch b/patches/server/0213-EnderDragon-Events.patch index c2dbb91e76..5f404a5e08 100644 --- a/patches/server/0213-EnderDragon-Events.patch +++ b/patches/server/0213-EnderDragon-Events.patch @@ -23,10 +23,10 @@ index 3eaf64a6f66c6a844e30967e6b87432e559a59e7..5c5c71db73a2bfebbb33cebd6325a0f4 } diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java -index f54576f6450e24f574bfe7f4b8e2ad5d8c9f1ba3..561e9525c37952c6b2fb52811b3767eb1044773b 100644 +index 02f407757a37c9dc8b3f4a899ac3b04719d8ceed..c5269c3117901b8521720d1b32689d7f600f20a3 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java -@@ -74,7 +74,9 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance { +@@ -78,7 +78,9 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance { DragonFireball dragonFireball = new DragonFireball(this.dragon.level(), this.dragon, r, s, t); dragonFireball.moveTo(o, p, q, 0.0F, 0.0F); @@ -35,7 +35,7 @@ index f54576f6450e24f574bfe7f4b8e2ad5d8c9f1ba3..561e9525c37952c6b2fb52811b3767eb + else dragonFireball.discard(null); // Paper - EnderDragon Events this.fireballCharge = 0; if (this.currentPath != null) { - while(!this.currentPath.isDone()) { + while (!this.currentPath.isDone()) { diff --git a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java index a425659d89165610fdb1afa3095bf4ac867646ae..58723ea75f7db9bf3889b99139669b14a284a3a1 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java diff --git a/patches/server/0214-PlayerElytraBoostEvent.patch b/patches/server/0214-PlayerElytraBoostEvent.patch index 902f983c36..b9afdb2bf1 100644 --- a/patches/server/0214-PlayerElytraBoostEvent.patch +++ b/patches/server/0214-PlayerElytraBoostEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerElytraBoostEvent diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -index 7c627d27300247db9122ab2081049345ef306073..6e6c9477b70b0e1ab36bca9fa91806a283ebedd1 100644 +index 3749cfca8f007973d1a2206d8f2ba15283a550e1..eb655eb01e4841ca163666f21dae00f0632a11e5 100644 --- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java +++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -@@ -61,12 +61,19 @@ public class FireworkRocketItem extends Item { +@@ -68,12 +68,19 @@ public class FireworkRocketItem extends Item { if (!world.isClientSide) { FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(world, itemStack, user); fireworkRocketEntity.spawningEntity = user.getUUID(); // Paper diff --git a/patches/server/0215-PlayerLaunchProjectileEvent.patch b/patches/server/0215-PlayerLaunchProjectileEvent.patch index 5d9bed5608..6e2265c0d2 100644 --- a/patches/server/0215-PlayerLaunchProjectileEvent.patch +++ b/patches/server/0215-PlayerLaunchProjectileEvent.patch @@ -88,15 +88,24 @@ index c7d4745aed77b23562cde7c68b8870fa239428d4..8c8cf8705107c95d9a4eab28b5845ae1 return InteractionResultHolder.sidedSuccess(itemstack, world.isClientSide()); } diff --git a/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java b/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java -index 72dfb7b652f515bf9df201d524a851ab56706544..39fe6734c8dcd34c563e33e717937bbd91882e1e 100644 +index fe03ef2e400b246f7f3a9333506f22b63ae28690..ad147f392e7ef151d971d462431ab67d378cc920 100644 --- a/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java +++ b/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java -@@ -22,18 +22,37 @@ public class ExperienceBottleItem extends Item { +@@ -22,27 +22,46 @@ public class ExperienceBottleItem extends Item { @Override public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) { ItemStack itemStack = user.getItemInHand(hand); -- world.playSound((Player)null, user.getX(), user.getY(), user.getZ(), SoundEvents.EXPERIENCE_BOTTLE_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); -+ // world.playSound((Player)null, user.getX(), user.getY(), user.getZ(), SoundEvents.EXPERIENCE_BOTTLE_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); // Paper - PlayerLaunchProjectileEvent; moved down +- world.playSound( +- null, +- user.getX(), +- user.getY(), +- user.getZ(), +- SoundEvents.EXPERIENCE_BOTTLE_THROW, +- SoundSource.NEUTRAL, +- 0.5F, +- 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F) +- ); ++ // Paper - PlayerLaunchProjectileEvent; moved down if (!world.isClientSide) { ThrownExperienceBottle thrownExperienceBottle = new ThrownExperienceBottle(world, user); thrownExperienceBottle.setItem(itemStack); @@ -111,7 +120,16 @@ index 72dfb7b652f515bf9df201d524a851ab56706544..39fe6734c8dcd34c563e33e717937bbd + ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory(); + } + -+ world.playSound((Player) null, user.getX(), user.getY(), user.getZ(), SoundEvents.EXPERIENCE_BOTTLE_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (net.minecraft.world.entity.Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F)); ++ world.playSound( ++ null, ++ user.getX(), ++ user.getY(), ++ user.getZ(), ++ SoundEvents.EXPERIENCE_BOTTLE_THROW, ++ SoundSource.NEUTRAL, ++ 0.5F, ++ 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F) ++ ); + user.awardStat(Stats.ITEM_USED.get(this)); + } else { + if (user instanceof net.minecraft.server.level.ServerPlayer) { @@ -132,12 +150,12 @@ index 72dfb7b652f515bf9df201d524a851ab56706544..39fe6734c8dcd34c563e33e717937bbd return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide()); } diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -index 6e6c9477b70b0e1ab36bca9fa91806a283ebedd1..0821c06a4c66edc8fcee09fc192335a588d2944b 100644 +index eb655eb01e4841ca163666f21dae00f0632a11e5..8a82b8bec014b70d672cfaae84510ed84fd2ea97 100644 --- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java +++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -@@ -47,8 +47,12 @@ public class FireworkRocketItem extends Item { - Direction direction = context.getClickedFace(); - FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(level, context.getPlayer(), vec3.x + (double)direction.getStepX() * 0.15D, vec3.y + (double)direction.getStepY() * 0.15D, vec3.z + (double)direction.getStepZ() * 0.15D, itemStack); +@@ -54,8 +54,12 @@ public class FireworkRocketItem extends Item { + itemStack + ); fireworkRocketEntity.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID(); // Paper - level.addFreshEntity(fireworkRocketEntity); - itemStack.shrink(1); @@ -151,18 +169,26 @@ index 6e6c9477b70b0e1ab36bca9fa91806a283ebedd1..0821c06a4c66edc8fcee09fc192335a5 return InteractionResult.sidedSuccess(level.isClientSide); diff --git a/src/main/java/net/minecraft/world/item/LingeringPotionItem.java b/src/main/java/net/minecraft/world/item/LingeringPotionItem.java -index 04370590e6c8051ad17f937576b4cd88f6afb5d9..8526251e45899499bc4d9b6254fa1b190a3843d8 100644 +index a822d82b577be20b5c8aa9ba1a4a0d6e4a493354..fec53407acc9bb95ae91e02a44ebc0e8d51355cf 100644 --- a/src/main/java/net/minecraft/world/item/LingeringPotionItem.java +++ b/src/main/java/net/minecraft/world/item/LingeringPotionItem.java -@@ -23,7 +23,12 @@ public class LingeringPotionItem extends ThrowablePotionItem { +@@ -23,6 +23,10 @@ public class LingeringPotionItem extends ThrowablePotionItem { @Override public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) { + // Paper start - PlayerLaunchProjectileEvent + InteractionResultHolder<ItemStack> wrapper = super.use(world, user, hand); + if (wrapper.getResult() != net.minecraft.world.InteractionResult.FAIL) { - world.playSound((Player)null, user.getX(), user.getY(), user.getZ(), SoundEvents.LINGERING_POTION_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); ++ // Paper end - PlayerLaunchProjectileEvent + world.playSound( + null, + user.getX(), +@@ -33,6 +37,9 @@ public class LingeringPotionItem extends ThrowablePotionItem { + 0.5F, + 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F) + ); - return super.use(world, user, hand); ++ // Paper start - PlayerLaunchProjectileEvent + } + return wrapper; + // Paper end - PlayerLaunchProjectileEvent @@ -212,18 +238,26 @@ index d60e57e84f7d66e1858ab50ac33777feedf1c54d..bc8186a5bc3a98b35fad570729dd4ba5 return InteractionResultHolder.sidedSuccess(itemstack, world.isClientSide()); } diff --git a/src/main/java/net/minecraft/world/item/SplashPotionItem.java b/src/main/java/net/minecraft/world/item/SplashPotionItem.java -index 317e20052bcac9118e1adeb619bedaacc6fcd690..3bd127780091c6bb9ec17c88f0cf57b0b8f37e11 100644 +index 935c34ba7eb14348becdd3ac0c29766abf7ca614..73bac60b3bf6d20d415a8250d0426251c0c3265b 100644 --- a/src/main/java/net/minecraft/world/item/SplashPotionItem.java +++ b/src/main/java/net/minecraft/world/item/SplashPotionItem.java -@@ -14,7 +14,12 @@ public class SplashPotionItem extends ThrowablePotionItem { +@@ -14,6 +14,10 @@ public class SplashPotionItem extends ThrowablePotionItem { @Override public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) { + // Paper start - PlayerLaunchProjectileEvent + InteractionResultHolder<ItemStack> wrapper = super.use(world, user, hand); + if (wrapper.getResult() != net.minecraft.world.InteractionResult.FAIL) { - world.playSound((Player)null, user.getX(), user.getY(), user.getZ(), SoundEvents.SPLASH_POTION_THROW, SoundSource.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); ++ // Paper end - PlayerLaunchProjectileEvent + world.playSound( + null, + user.getX(), +@@ -24,6 +28,9 @@ public class SplashPotionItem extends ThrowablePotionItem { + 0.5F, + 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F) + ); - return super.use(world, user, hand); ++ // Paper start - PlayerLaunchProjectileEvent + } + return wrapper; + // Paper end - PlayerLaunchProjectileEvent @@ -267,7 +301,7 @@ index 0673f62f25532955f3552b64f122e644d42027e4..f47f793c62a919fb65c081ddb82d597a return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide()); } diff --git a/src/main/java/net/minecraft/world/item/TridentItem.java b/src/main/java/net/minecraft/world/item/TridentItem.java -index 2ccbba4775d7550c5c7277aee9cab9ff7d665693..fa876ddf54780728e7f3ecfe02aa8a16b8ef6f8d 100644 +index f46d0015d707e6708b9e19cc8f20fad5d3bd590b..a792c7b7a6179aa88fc473b27ef0ca13bd91a395 100644 --- a/src/main/java/net/minecraft/world/item/TridentItem.java +++ b/src/main/java/net/minecraft/world/item/TridentItem.java @@ -83,21 +83,26 @@ public class TridentItem extends Item implements Vanishable { diff --git a/patches/server/0216-Improve-BlockPosition-inlining.patch b/patches/server/0216-Improve-BlockPosition-inlining.patch index b9b5c09af2..3e778d1ab7 100644 --- a/patches/server/0216-Improve-BlockPosition-inlining.patch +++ b/patches/server/0216-Improve-BlockPosition-inlining.patch @@ -21,19 +21,16 @@ This is based upon conclusions drawn from inspecting the assenmbly generated byt They had 'callq' (invoke) instead of 'mov' (get from memory) instructions. diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java -index 1b29c6872ebe54351f28c1f1f38b22561ba785ee..5256ff18d992250e04a6180e196c2d5d3f0928ca 100644 +index bc5a8e034ae0cd875689456ed862b46c1343bed9..8908905d76fb8568c9a3c18a54b03d6a93574be8 100644 --- a/src/main/java/net/minecraft/core/Vec3i.java +++ b/src/main/java/net/minecraft/core/Vec3i.java -@@ -38,7 +38,7 @@ public class Vec3i implements Comparable<Vec3i> { +@@ -43,12 +43,12 @@ public class Vec3i implements Comparable<Vec3i> { } @Override - public boolean equals(Object object) { + public final boolean equals(Object object) { // Paper - Perf: Final for inline - if (this == object) { - return true; - } else if (!(object instanceof Vec3i)) { -@@ -56,7 +56,7 @@ public class Vec3i implements Comparable<Vec3i> { + return this == object || object instanceof Vec3i vec3i && this.getX() == vec3i.getX() && this.getY() == vec3i.getY() && this.getZ() == vec3i.getZ(); } @Override @@ -42,7 +39,7 @@ index 1b29c6872ebe54351f28c1f1f38b22561ba785ee..5256ff18d992250e04a6180e196c2d5d return (this.getY() + this.getZ() * 31) * 31 + this.getX(); } -@@ -69,15 +69,15 @@ public class Vec3i implements Comparable<Vec3i> { +@@ -61,15 +61,15 @@ public class Vec3i implements Comparable<Vec3i> { } } diff --git a/patches/server/0220-SkeletonHorse-Additions.patch b/patches/server/0220-SkeletonHorse-Additions.patch index 15761af470..201b108f16 100644 --- a/patches/server/0220-SkeletonHorse-Additions.patch +++ b/patches/server/0220-SkeletonHorse-Additions.patch @@ -32,10 +32,10 @@ index 8f20239f3ef7ebe41fac8ee6e024c36dafec33c4..d00fb16ae3b94dfcb10fd1a7c1671595 this.horse.setTrap(false); diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index 07e7851ca27ea0f8166be52b086a6504c0deea09..e7b6f97d8519a5797903664e5ba2a793e37a4bfc 100644 +index 72b3913d00d6f2ec01a716444debe065c48174f6..c35d5865b77203d0de6467d2793424837704e95a 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -93,6 +93,28 @@ public interface EntityGetter { +@@ -97,6 +97,28 @@ public interface EntityGetter { return player; } diff --git a/patches/server/0225-Break-up-and-make-tab-spam-limits-configurable.patch b/patches/server/0225-Break-up-and-make-tab-spam-limits-configurable.patch index 48a5038a88..eef3036873 100644 --- a/patches/server/0225-Break-up-and-make-tab-spam-limits-configurable.patch +++ b/patches/server/0225-Break-up-and-make-tab-spam-limits-configurable.patch @@ -22,7 +22,7 @@ to take the burden of this into their own hand without having to rely on plugins doing unsafe things. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3d6355f50d04035f62fa9eddee076d0a157c89a6..acf350e18b9e4de77b43a01afe40a72ef040d92e 100644 +index 91cc18da4f0beca4cc4a9e13627b87931262efb6..a2eb93d47f659eb5b978358ee409bbf5f5d4d35a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -256,6 +256,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0228-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch b/patches/server/0228-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch index 8ca9496478..18b6234816 100644 --- a/patches/server/0228-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch +++ b/patches/server/0228-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch @@ -43,7 +43,7 @@ index 113dce44ce086272fe7f20a2007efadee142ff85..0811a2e87192b46c39f54c26ce0e56fc // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit return false; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index b718e5a1dd49dc855a1161106b53a1d6615e8b69..31ff851cc15216fb5855f829f3fc22c1d26ece21 100644 +index 36f0a43cc301840406eab260b162295fe760f8bb..c46ad2013439f043145fb7fc67bbcd80728e3c16 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -242,6 +242,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -55,10 +55,10 @@ index b718e5a1dd49dc855a1161106b53a1d6615e8b69..31ff851cc15216fb5855f829f3fc22c1 if (this.bukkitEntity == null) { this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this); 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 21a2800db22f287b9c6a8290326fdf3b94ae94b1..2e561ac90a8c91ea13cfc18d09f8e0abbcff9385 100644 +index 38df704dca30ef08f4d0831dc1cc48c6d6f71a4d..ed6aea7a38ef6e80c300ff9b012dcdbc390ad2c7 100644 --- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java +++ b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java -@@ -34,6 +34,14 @@ public class EntityLookup<T extends EntityAccess> { +@@ -33,6 +33,14 @@ public class EntityLookup<T extends EntityAccess> { UUID uUID = entity.getUUID(); if (this.byUuid.containsKey(uUID)) { LOGGER.warn("Duplicate entity UUID {}: {}", uUID, entity); diff --git a/patches/server/0229-Add-Early-Warning-Feature-to-WatchDog.patch b/patches/server/0229-Add-Early-Warning-Feature-to-WatchDog.patch index 4fee792554..76d44df2fe 100644 --- a/patches/server/0229-Add-Early-Warning-Feature-to-WatchDog.patch +++ b/patches/server/0229-Add-Early-Warning-Feature-to-WatchDog.patch @@ -9,7 +9,7 @@ thread dumps at an interval until the point of crash. This will help diagnose what was going on in that time before the crash. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0f3589ae1c5577c612b93289fc42cdb977486b6b..0b704d5d39263b66f7846a9c4a116ac4d96383cf 100644 +index 09bd8a6576647c612e9d7f807780b1e20478a534..3e6008d27ed81453f6b4448f0334b8d343f66694 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1092,6 +1092,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0233-Optimize-BlockPosition-helper-methods.patch b/patches/server/0233-Optimize-BlockPosition-helper-methods.patch index ed94eb3b7b..39da5505cc 100644 --- a/patches/server/0233-Optimize-BlockPosition-helper-methods.patch +++ b/patches/server/0233-Optimize-BlockPosition-helper-methods.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize BlockPosition helper methods diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index 2bb5e51f71cbf66819d198505aa4a5ecffd246c6..3b3d81886d50ee6510ff366e11817a578c645089 100644 +index 44853c711442e0360e5631ae1c5d1d5a6edd2526..a965c4295b4db0aa304554d7d6d031dbcd591969 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java @@ -132,67 +132,84 @@ public class BlockPos extends Vec3i { diff --git a/patches/server/0238-Optimize-MappedRegistry.patch b/patches/server/0238-Optimize-MappedRegistry.patch index cb661e87c8..08acc887fa 100644 --- a/patches/server/0238-Optimize-MappedRegistry.patch +++ b/patches/server/0238-Optimize-MappedRegistry.patch @@ -8,15 +8,15 @@ 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 33990e4f9b5e7e3d8080c80f639b81b7f798c859..b2d22bb25499756fe393cf562f8a4eda0649c26d 100644 +index 814049ce20142a6820f30607b9cb6d2d426caa1c..d4bbc2172d95c2767902d8695a68f86af7e8baa7 100644 --- a/src/main/java/net/minecraft/core/MappedRegistry.java +++ b/src/main/java/net/minecraft/core/MappedRegistry.java -@@ -35,13 +35,13 @@ public class MappedRegistry<T> implements WritableRegistry<T> { +@@ -36,13 +36,13 @@ public class MappedRegistry<T> implements WritableRegistry<T> { private static final Logger LOGGER = LogUtils.getLogger(); final ResourceKey<? extends Registry<T>> key; private final ObjectList<Holder.Reference<T>> byId = new ObjectArrayList<>(256); -- private final Reference2IntMap<T> toId = Util.make(new Reference2IntOpenHashMap<>(), (map) -> { -+ private final Reference2IntMap<T> toId = Util.make(new Reference2IntOpenHashMap<>(2048), (map) -> { // Paper - Perf: Use bigger expected size to reduce collisions +- private final Reference2IntMap<T> toId = Util.make(new Reference2IntOpenHashMap<>(), map -> { ++ private final Reference2IntMap<T> toId = Util.make(new Reference2IntOpenHashMap<>(2048), map -> { // Paper - Perf: Use bigger expected size to reduce collisions map.defaultReturnValue(-1); }); - private final Map<ResourceLocation, Holder.Reference<T>> byLocation = new HashMap<>(); diff --git a/patches/server/0243-Add-ray-tracing-methods-to-LivingEntity.patch b/patches/server/0243-Add-ray-tracing-methods-to-LivingEntity.patch index 71ee314ddc..4279bf5ba5 100644 --- a/patches/server/0243-Add-ray-tracing-methods-to-LivingEntity.patch +++ b/patches/server/0243-Add-ray-tracing-methods-to-LivingEntity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add ray tracing methods to LivingEntity diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 83a56061ce23d3d6f7d8ad3201ce325106f8a4d0..e8c4d42b1637752e69ea128fa7d0148bb5ffae06 100644 +index 88af8a11dfc3b645c5a2b5fb629a73fc1e2b2f80..c6c6fb195476e0d37b0007510044928ebe6e4572 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3849,6 +3849,19 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -29,7 +29,7 @@ index 83a56061ce23d3d6f7d8ad3201ce325106f8a4d0..e8c4d42b1637752e69ea128fa7d0148b public int getShieldBlockingDelay() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index be06dda82db09947f60a353b0d5504955738b6b6..eb74778c0bb6fe6b7c09209eb58195e7fedc54ac 100644 +index 0fe087cd6037b4dd694cc3c5c3eac8203ea6d519..8139ea88988e2e3551258b6686873753353ab9f8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -201,6 +201,33 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0244-Expose-attack-cooldown-methods-for-Player.patch b/patches/server/0244-Expose-attack-cooldown-methods-for-Player.patch index 2b4d1222f5..2d2577636a 100644 --- a/patches/server/0244-Expose-attack-cooldown-methods-for-Player.patch +++ b/patches/server/0244-Expose-attack-cooldown-methods-for-Player.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expose attack cooldown methods for Player diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ddf089d73a05792d99a96bb449717d82755f5cd9..27d29187b5471fa9d1588b7e8e35539be8a861a0 100644 +index b4212f5a5b3b1e5476f7598be165ffb1defb5c21..65c56d29e04fd0853a8bfe9f943d27fe71849cc2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2897,6 +2897,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0245-Improve-death-events.patch b/patches/server/0245-Improve-death-events.patch index 50e37c3a69..7fc744eac0 100644 --- a/patches/server/0245-Improve-death-events.patch +++ b/patches/server/0245-Improve-death-events.patch @@ -19,7 +19,7 @@ public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sou public net.minecraft.world.entity.LivingEntity getSoundVolume()F diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 38a3b264ba72631c27203a178ac0bbdd36e10a10..80cedd5221d3c0dc475c631113e8782507067cb0 100644 +index 0b039c43bd3bd46f31477fc75585038270242de2..054057482d191d8e77bf4d179d51e32b5d9ca16e 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -248,6 +248,10 @@ public class ServerPlayer extends Player { @@ -80,7 +80,7 @@ index 38a3b264ba72631c27203a178ac0bbdd36e10a10..80cedd5221d3c0dc475c631113e87825 } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index de01edaa23fb8493faf46c02abcb47989ac9a582..7dbfc8f0e3eb54e86fef6d9bc68e082ae8cd4422 100644 +index c6c6fb195476e0d37b0007510044928ebe6e4572..4b3d1c8452bd759db6fc8d3d9fcf98e2a8d25084 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -260,6 +260,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -319,30 +319,27 @@ index 6376908df89af1eff3a948ca1faef5d4925f0c3b..4ac32078cb074a78a2bb83307013b849 @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java -index bb399f775a5530a01f59332848c8ab9b8eceb2b5..14edfe103e61024b569f33de0b6608f39e749319 100644 +index e9137ea77a44eb8ded24a70f3a2b388d77379fa7..ecf8a1ddf4a98bc3587708975c4045e02ed09b38 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java -@@ -70,11 +70,19 @@ public abstract class AbstractChestedHorse extends AbstractHorse { +@@ -70,9 +70,17 @@ public abstract class AbstractChestedHorse extends AbstractHorse { this.spawnAtLocation(Blocks.CHEST); } -- this.setChest(false); + //this.setCarryingChest(false); // Paper - moved to post death logic - } - - } - ++ } ++ } ++ + // Paper start + protected void postDeathDropItems(org.bukkit.event.entity.EntityDeathEvent event) { + if (this.hasChest() && (event == null || !event.isCancelled())) { -+ this.setChest(false); -+ } -+ } + this.setChest(false); + } + } + // Paper end -+ + @Override public void addAdditionalSaveData(CompoundTag nbt) { - super.addAdditionalSaveData(nbt); diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java index 0634b88a5bbfb549d5ec5931e19f674fb9ca4cbe..11555d1b771f93234098a3bc6a6eaacddeeeb4f6 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java diff --git a/patches/server/0247-Mob-Pathfinding-API.patch b/patches/server/0247-Mob-Pathfinding-API.patch index ec6e875e5d..d48ca68f9b 100644 --- a/patches/server/0247-Mob-Pathfinding-API.patch +++ b/patches/server/0247-Mob-Pathfinding-API.patch @@ -160,7 +160,7 @@ index 0000000000000000000000000000000000000000..064712e7b27a200b29c72076a82f4f56 + } +} diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Path.java b/src/main/java/net/minecraft/world/level/pathfinder/Path.java -index 539dc45c3c7ffc60cf3fb47ae4df65e604e8627b..3049edb5a8b5967e5242a3896b23665888eb3472 100644 +index 339a74782ac4ac5e3cc765c3ee7b8c0c10c9d8c8..3e2b60eaeae6d6ee0d3b06182c6f7cb1eec82b8d 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/Path.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/Path.java @@ -18,6 +18,7 @@ public class Path { diff --git a/patches/server/0249-Prevent-various-interactions-from-causing-chunk-load.patch b/patches/server/0249-Prevent-various-interactions-from-causing-chunk-load.patch index 5fad22ce92..0734fec4fb 100644 --- a/patches/server/0249-Prevent-various-interactions-from-causing-chunk-load.patch +++ b/patches/server/0249-Prevent-various-interactions-from-causing-chunk-load.patch @@ -64,7 +64,7 @@ index 13ba764d51f941c2b0d1d2af88ffd0c1fc3982c0..9637c26a3c381869f0a4dfe9189c0095 Vec3 vec3d1 = new Vec3((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D); BlockHitResult movingobjectpositionblock = world.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.enderman)); diff --git a/src/main/java/net/minecraft/world/item/CompassItem.java b/src/main/java/net/minecraft/world/item/CompassItem.java -index 5d3047a420efe59063e90bfc7b42392127e0ad7d..b3c67c954acf7e518d89d6af65a55d6f22dac059 100644 +index 0f74cdc825c66fac9f085f5d2aa408ba9844b253..a83fc0e62d8f48aaf60d21dca04678e954b6b3c2 100644 --- a/src/main/java/net/minecraft/world/item/CompassItem.java +++ b/src/main/java/net/minecraft/world/item/CompassItem.java @@ -77,7 +77,7 @@ public class CompassItem extends Item implements Vanishable { diff --git a/patches/server/0257-Add-LivingEntity-getTargetEntity.patch b/patches/server/0257-Add-LivingEntity-getTargetEntity.patch index 577dd4e729..796d844555 100644 --- a/patches/server/0257-Add-LivingEntity-getTargetEntity.patch +++ b/patches/server/0257-Add-LivingEntity-getTargetEntity.patch @@ -5,7 +5,7 @@ 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 39ff6dd7ee8e821f5693f6a6e01b713b25d30393..5a1dc8f196b274a822db4aa1fa48cd066f12da94 100644 +index 4b3d1c8452bd759db6fc8d3d9fcf98e2a8d25084..1a328de32b69b69814e11a5b6bc55bfccf408d6b 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -115,6 +115,7 @@ import net.minecraft.world.level.storage.loot.LootTable; @@ -56,7 +56,7 @@ index 39ff6dd7ee8e821f5693f6a6e01b713b25d30393..5a1dc8f196b274a822db4aa1fa48cd06 public int getShieldBlockingDelay() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index eb74778c0bb6fe6b7c09209eb58195e7fedc54ac..c9a487c1b85d46c1ce25147bd8a610a5631cdb5d 100644 +index 8139ea88988e2e3551258b6686873753353ab9f8..5def5bccd8fce86ce015567e65fefae329819c18 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -1,5 +1,6 @@ diff --git a/patches/server/0259-Catch-JsonParseException-in-entity-and-block-entity-.patch b/patches/server/0259-Catch-JsonParseException-in-entity-and-block-entity-.patch index 40b73f5045..99c5fe4d1e 100644 --- a/patches/server/0259-Catch-JsonParseException-in-entity-and-block-entity-.patch +++ b/patches/server/0259-Catch-JsonParseException-in-entity-and-block-entity-.patch @@ -89,15 +89,15 @@ index 25ec3ab534872500a2eb51cd44062e2754c404bb..a1097950766ad31393340b423ea3f98a 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 3a8bdb788b07b0a8cda3d4b872ede52ca9a005c4..65e1381bb2d10bd212463feb602c60f8fdb9ade1 100644 +index 00de0cc29775a219a763431fd4d54b2fa2585477..4d1a895f3749bdcb132de199e81a9d93330c0ee6 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 -@@ -42,7 +42,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable +@@ -41,7 +41,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable public void load(CompoundTag nbt) { super.load(nbt); if (nbt.contains("CustomName", 8)) { - this.name = Component.Serializer.fromJson(nbt.getString("CustomName")); + this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt); // Paper - Catch ParseException } - } + diff --git a/patches/server/0261-Call-player-spectator-target-events-and-improve-impl.patch b/patches/server/0261-Call-player-spectator-target-events-and-improve-impl.patch index 4dccbd3f63..192951a6e9 100644 --- a/patches/server/0261-Call-player-spectator-target-events-and-improve-impl.patch +++ b/patches/server/0261-Call-player-spectator-target-events-and-improve-impl.patch @@ -19,7 +19,7 @@ spectate the target entity. Co-authored-by: Spottedleaf <[email protected]> diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 80cedd5221d3c0dc475c631113e8782507067cb0..3a991a6ef6a8c3150bdc557219424cf13f1dc0cc 100644 +index 054057482d191d8e77bf4d179d51e32b5d9ca16e..19c3eb566552f7994ae5e60dc869c94e08590fbb 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2041,6 +2041,21 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0264-Add-option-to-prevent-players-from-moving-into-unloa.patch b/patches/server/0264-Add-option-to-prevent-players-from-moving-into-unloa.patch index 403e73e6ee..69b3eaf3cf 100644 --- a/patches/server/0264-Add-option-to-prevent-players-from-moving-into-unloa.patch +++ b/patches/server/0264-Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index acf350e18b9e4de77b43a01afe40a72ef040d92e..c827a2b9a64bba61ffdc8ee5ee35460b332a8556 100644 +index a2eb93d47f659eb5b978358ee409bbf5f5d4d35a..0d9251ceb351b7d763420c49b0bf487907c42c55 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -474,9 +474,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0265-Reset-players-airTicks-on-respawn.patch b/patches/server/0265-Reset-players-airTicks-on-respawn.patch index d2e0da64ac..86f7de966c 100644 --- a/patches/server/0265-Reset-players-airTicks-on-respawn.patch +++ b/patches/server/0265-Reset-players-airTicks-on-respawn.patch @@ -5,7 +5,7 @@ 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 3a991a6ef6a8c3150bdc557219424cf13f1dc0cc..0627d51d41d492e07b230e9c398158d656493848 100644 +index 19c3eb566552f7994ae5e60dc869c94e08590fbb..08c936288b5ac8738d7cff9fe95b1256ae32cd28 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2516,6 +2516,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0267-Improve-Server-Thread-Pool-and-Thread-Priorities.patch b/patches/server/0267-Improve-Server-Thread-Pool-and-Thread-Priorities.patch index c37045a97f..e696041e24 100644 --- a/patches/server/0267-Improve-Server-Thread-Pool-and-Thread-Priorities.patch +++ b/patches/server/0267-Improve-Server-Thread-Pool-and-Thread-Priorities.patch @@ -38,10 +38,10 @@ index 0000000000000000000000000000000000000000..b60f59cf5cc8eb84a6055b7861857dec + } +} diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index aa52b271bd556a29f774fde375b713d0d187521b..765e4bc00a0526aab6e263dae7233f63f7f31498 100644 +index 1f1422a000eb9a0fb819f26d42b3f39ed683a8da..1bab7a03d433d3745cf9e244f5501dd3efedf583 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -86,7 +86,7 @@ public class Util { +@@ -88,7 +88,7 @@ public class Util { private static final int DEFAULT_MAX_THREADS = 255; private static final int DEFAULT_SAFE_FILE_OPERATION_RETRIES = 10; private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads"; @@ -50,7 +50,7 @@ index aa52b271bd556a29f774fde375b713d0d187521b..765e4bc00a0526aab6e263dae7233f63 private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false); private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true); // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread -@@ -152,15 +152,27 @@ public class Util { +@@ -154,15 +154,27 @@ public class Util { return FILENAME_DATE_TIME_FORMATTER.format(ZonedDateTime.now()); } @@ -75,7 +75,7 @@ index aa52b271bd556a29f774fde375b713d0d187521b..765e4bc00a0526aab6e263dae7233f63 executorService = MoreExecutors.newDirectExecutorService(); } else { - AtomicInteger atomicInteger = new AtomicInteger(1); -- executorService = new ForkJoinPool(i, (pool) -> { +- executorService = new ForkJoinPool(i, pool -> { - ForkJoinWorkerThread forkJoinWorkerThread = new ForkJoinWorkerThread(pool) { + executorService = new java.util.concurrent.ThreadPoolExecutor(i, i,0L, TimeUnit.MILLISECONDS, new java.util.concurrent.LinkedBlockingQueue<>(), target -> new io.papermc.paper.util.ServerWorkerThread(target, s, priorityModifier)); + } @@ -83,7 +83,7 @@ index aa52b271bd556a29f774fde375b713d0d187521b..765e4bc00a0526aab6e263dae7233f63 @Override protected void onTermination(Throwable throwable) { if (throwable != null) { -@@ -176,6 +188,7 @@ public class Util { +@@ -178,6 +190,7 @@ public class Util { return forkJoinWorkerThread; }, Util::onThreadException, true); } @@ -92,7 +92,7 @@ index aa52b271bd556a29f774fde375b713d0d187521b..765e4bc00a0526aab6e263dae7233f63 return executorService; } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0b704d5d39263b66f7846a9c4a116ac4d96383cf..114f40c63c617f4df9e6c9bf2d50707e289f2f20 100644 +index 3e6008d27ed81453f6b4448f0334b8d343f66694..3ccd1178f0db9301fe87afb8a0d996c0acfc1b16 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -312,6 +312,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0268-Optimize-World-Time-Updates.patch b/patches/server/0268-Optimize-World-Time-Updates.patch index 1587037e1a..853bbaef70 100644 --- a/patches/server/0268-Optimize-World-Time-Updates.patch +++ b/patches/server/0268-Optimize-World-Time-Updates.patch @@ -8,7 +8,7 @@ the updates per world, so that we can re-use the same packet object for every player unless they have per-player time enabled. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 114f40c63c617f4df9e6c9bf2d50707e289f2f20..2950d4b158f7ac2658b84315045a27b89ba27fc3 100644 +index 3ccd1178f0db9301fe87afb8a0d996c0acfc1b16..4cacf5cc0750f017824e9d8737d3c490324b49dd 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1478,12 +1478,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0271-Don-t-allow-digging-into-unloaded-chunks.patch b/patches/server/0271-Don-t-allow-digging-into-unloaded-chunks.patch index 166c217651..4132fd3278 100644 --- a/patches/server/0271-Don-t-allow-digging-into-unloaded-chunks.patch +++ b/patches/server/0271-Don-t-allow-digging-into-unloaded-chunks.patch @@ -59,7 +59,7 @@ index a8d33286832786031ac57e6ce27d5181e1a3d9b1..e8b12b27e5ec74afb940f575e5ce78e5 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 c827a2b9a64bba61ffdc8ee5ee35460b332a8556..f64157a1fc3d629b9ef3c3d7b8fcf8f2cd960fe0 100644 +index 0d9251ceb351b7d763420c49b0bf487907c42c55..358b6b493af3fcc52b274ccc43a18187b505e1f0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1590,6 +1590,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0273-Handle-Large-Packets-disconnecting-client.patch b/patches/server/0273-Handle-Large-Packets-disconnecting-client.patch index f5fce50aca..65d62e20f2 100644 --- a/patches/server/0273-Handle-Large-Packets-disconnecting-client.patch +++ b/patches/server/0273-Handle-Large-Packets-disconnecting-client.patch @@ -34,7 +34,7 @@ index 02b3f5c67b47a098f7fe15ddba0df6cb586a9ae5..157f055df00faf3a7870df8109e84fdb 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 7070d093c80033b61a9c8495bc56153d986b6b03..61f05f34ca33837c643f2915e753ec3935a38314 100644 +index 0d80fcee1831af59b06c4d00dc713bd4dad947fc..061eada043325142d33a0cec02e9e484d14a7fca 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java @@ -41,7 +41,7 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { @@ -46,7 +46,7 @@ index 7070d093c80033b61a9c8495bc56153d986b6b03..61f05f34ca33837c643f2915e753ec39 throw new IllegalArgumentException("Packet too big (is " + k + ", should be less than 8388608): " + packet); } -@@ -54,10 +54,35 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { +@@ -54,9 +54,34 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { throw var13; } finally { @@ -58,7 +58,6 @@ index 7070d093c80033b61a9c8495bc56153d986b6b03..61f05f34ca33837c643f2915e753ec39 + // Paper end - Handle large packets disconnecting client ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet); } - } } } @@ -100,7 +99,7 @@ index 700418bb0c9fbed3f161611881b1e222248ca4eb..cc658a61065d5c0021a4b88fa58b4021 return false; } diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java -index 0e076173033278587df2b5dfbd01cc9005651eb5..dbd8b9b09b82c1b75e8be9dc7416d9f0863c8c87 100644 +index 6206d4d71dfe95b454b22f5b3055623638e145c0..6765175c98d52e5cbc191e88e0d545a05606dfd4 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java @@ -31,6 +31,16 @@ public class ClientboundContainerSetContentPacket implements Packet<ClientGamePa @@ -121,10 +120,10 @@ index 0e076173033278587df2b5dfbd01cc9005651eb5..dbd8b9b09b82c1b75e8be9dc7416d9f0 public void write(FriendlyByteBuf buf) { buf.writeByte(this.containerId); diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java -index 932cca4d957c1fc212b7a514ea23e8dc7ab5b9d9..f47eeb70661661610ef1a96dd9da67785825c126 100644 +index 0c593b7a4e893568db9c1b0b5dfa7ee4984cd8c9..99fe90094f1cabdaea9db89cfc016a98c1ee8c2d 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java -@@ -50,7 +50,7 @@ public class ClientboundLevelChunkPacketData { +@@ -49,7 +49,7 @@ public class ClientboundLevelChunkPacketData { throw new RuntimeException("Can't read heightmap in packet for [" + x + ", " + z + "]"); } else { int i = buf.readVarInt(); diff --git a/patches/server/0274-force-entity-dismount-during-teleportation.patch b/patches/server/0274-force-entity-dismount-during-teleportation.patch index 83d7c13e24..0fb457cc12 100644 --- a/patches/server/0274-force-entity-dismount-during-teleportation.patch +++ b/patches/server/0274-force-entity-dismount-during-teleportation.patch @@ -20,7 +20,7 @@ this is going to be the best soultion all around. Improvements/suggestions welcome! diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 31ff851cc15216fb5855f829f3fc22c1d26ece21..cb453b843ecf82454a8ade369d424d5e7bbda4c4 100644 +index c46ad2013439f043145fb7fc67bbcd80728e3c16..f746829f1e94ee58821e56ec4192269add00395b 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2570,11 +2570,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -72,7 +72,7 @@ index 31ff851cc15216fb5855f829f3fc22c1d26ece21..cb453b843ecf82454a8ade369d424d5e 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 5a1dc8f196b274a822db4aa1fa48cd066f12da94..f619171b3e436d7263d5229f7f9131954a0941f8 100644 +index 1a328de32b69b69814e11a5b6bc55bfccf408d6b..4be7b136dd2b35b0637a1455985ab99bbd3af0a5 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3492,9 +3492,15 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0276-Book-Size-Limits.patch b/patches/server/0276-Book-Size-Limits.patch index bc6794b68a..a25ebb5d5c 100644 --- a/patches/server/0276-Book-Size-Limits.patch +++ b/patches/server/0276-Book-Size-Limits.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Book Size Limits Puts some limits on the size of books. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f64157a1fc3d629b9ef3c3d7b8fcf8f2cd960fe0..aa4178c00391ca00f2ca148a914eacb161b1860e 100644 +index 358b6b493af3fcc52b274ccc43a18187b505e1f0..9084109acfa260110c6ccd3c563b8b6688ea7b74 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1024,6 +1024,45 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0278-Replace-OfflinePlayer-getLastPlayed.patch b/patches/server/0278-Replace-OfflinePlayer-getLastPlayed.patch index d61e26f140..6acfae9a68 100644 --- a/patches/server/0278-Replace-OfflinePlayer-getLastPlayed.patch +++ b/patches/server/0278-Replace-OfflinePlayer-getLastPlayed.patch @@ -16,7 +16,7 @@ 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 0627d51d41d492e07b230e9c398158d656493848..f500440ba1bcd36af3b3bc6470c108ec3f546cc4 100644 +index 08c936288b5ac8738d7cff9fe95b1256ae32cd28..a8de1f58fffe2541478083defc18be949d0c75f1 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -248,6 +248,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0279-Workaround-for-vehicle-tracking-issue-on-disconnect.patch b/patches/server/0279-Workaround-for-vehicle-tracking-issue-on-disconnect.patch index 47dac04a5a..39521fc7b3 100644 --- a/patches/server/0279-Workaround-for-vehicle-tracking-issue-on-disconnect.patch +++ b/patches/server/0279-Workaround-for-vehicle-tracking-issue-on-disconnect.patch @@ -5,7 +5,7 @@ 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 f500440ba1bcd36af3b3bc6470c108ec3f546cc4..390e36f3557040f2ddc2c9158410a535cc178aa3 100644 +index a8de1f58fffe2541478083defc18be949d0c75f1..7433116ee68b92c86d1588296d521e5df49e5ac2 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1705,6 +1705,13 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0280-Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch b/patches/server/0280-Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch index a0f7ab0755..2a804b56e0 100644 --- a/patches/server/0280-Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch +++ b/patches/server/0280-Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch @@ -8,7 +8,7 @@ We just add a check to ensure that the CraftPlayer's handle is a ServerPlayer diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index f309b16670d1814b7c4a1f8464e60af512b86da3..c5ea6d424c8009c8afd791e58a75174291696d05 100644 +index 4a07e7d3df71f3bfc026e1f1c0abfe25999c6b8e..476b7bc14b4d2e7ed30c23b65dbc7aa0c6679b6b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -211,8 +211,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0282-Async-command-map-building.patch b/patches/server/0282-Async-command-map-building.patch index 16d1e494fc..92eb3afb3e 100644 --- a/patches/server/0282-Async-command-map-building.patch +++ b/patches/server/0282-Async-command-map-building.patch @@ -53,7 +53,7 @@ index 15a5059994371da4850adcf726034a715b80efba..af7cb518a32a4d550eae833fdd5bb17f event.getPlayer().getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2950d4b158f7ac2658b84315045a27b89ba27fc3..0edd0181d7379e648155231689f1715076edcd1e 100644 +index 4cacf5cc0750f017824e9d8737d3c490324b49dd..fea2863dc00d9765b86ac4cf925ceaf0fbef7da3 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -916,6 +916,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0283-Brigadier-Mojang-API.patch b/patches/server/0283-Brigadier-Mojang-API.patch index c66a3d0252..40e78368b1 100644 --- a/patches/server/0283-Brigadier-Mojang-API.patch +++ b/patches/server/0283-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 30edfbf16e7bed29b3261b51d9e4f3124beef026..eaaf9a9779f57ee048245899750bf7a1599b716f 100644 +index 470c55412e7a4f09235947adc72944b903d6543d..9cd80bc7f2b47e1044eef2592274e38d1988ff5d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,6 +14,7 @@ val alsoShade: Configuration by configurations.creating @@ -131,7 +131,7 @@ index af7cb518a32a4d550eae833fdd5bb17fd4058717..40ff3090fb17fb0f01a9b52639fb783e if (commandnode2.canUse(source)) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index aa4178c00391ca00f2ca148a914eacb161b1860e..7c5b550845035bf896358b7aad2101ab0b48b3fe 100644 +index 9084109acfa260110c6ccd3c563b8b6688ea7b74..7fc5078b0fff8746daf6d3ee873e4d85df702cf1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -746,7 +746,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0284-Improve-exact-choice-recipe-ingredients.patch b/patches/server/0284-Improve-exact-choice-recipe-ingredients.patch index 7a176c6924..40cf56721d 100644 --- a/patches/server/0284-Improve-exact-choice-recipe-ingredients.patch +++ b/patches/server/0284-Improve-exact-choice-recipe-ingredients.patch @@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..413dfa52760db393ad6a8b5341200ee7 +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.framework.qual.DefaultQualifier; diff --git a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java -index 4303f2b4e55191f8a53170435c6d1263782d1c8d..1534cbb5cb5da61fa7fa41bd503b01994877a01b 100644 +index f7328e583c63b4b74664ea78110f8b71c635ce60..80f032cca3309b709a11898cbc08bce27cbd624d 100644 --- a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java +++ b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java @@ -34,6 +34,7 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ @@ -153,17 +153,17 @@ index 4303f2b4e55191f8a53170435c6d1263782d1c8d..1534cbb5cb5da61fa7fa41bd503b0199 + this.stackedContents.initialize(recipe.value()); // Paper - Improve exact choice recipe ingredients entity.getInventory().fillStackedContents(this.stackedContents); this.menu.fillCraftSlotsStackedContents(this.stackedContents); - if (this.stackedContents.canCraft(recipe.value(), (IntList)null)) { + if (this.stackedContents.canCraft((Recipe<?>)recipe.value(), null)) { @@ -80,7 +81,7 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ int l = k; - for(int m : intList) { + for (int m : intList) { - int n = StackedContents.fromStackingIndex(m).getMaxStackSize(); + int n = StackedContents.maxStackSizeFromStackingIndex(m, this.stackedContents); // Paper - Improve exact choice recipe ingredients if (n < l) { l = n; } -@@ -97,10 +98,21 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ +@@ -96,10 +97,21 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ @Override public void addItemToSlot(Iterator<Integer> inputs, int slot, int amount, int gridX, int gridY) { Slot slot2 = this.menu.getSlot(slot); @@ -181,13 +181,13 @@ index 4303f2b4e55191f8a53170435c6d1263782d1c8d..1534cbb5cb5da61fa7fa41bd503b0199 + } + // Paper end - Improve exact choice recipe ingredients if (!itemStack.isEmpty()) { - for(int i = 0; i < amount; ++i) { + for (int i = 0; i < amount; i++) { - this.moveItemToGrid(slot2, itemStack); + this.moveItemToGrid(slot2, itemStack, isExact); // Paper - Improve exact choice recipe ingredients } } - -@@ -130,8 +142,14 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ + } +@@ -128,8 +140,14 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ return i; } @@ -204,7 +204,7 @@ index 4303f2b4e55191f8a53170435c6d1263782d1c8d..1534cbb5cb5da61fa7fa41bd503b0199 ItemStack itemStack = this.inventory.getItem(i); if (!itemStack.isEmpty()) { diff --git a/src/main/java/net/minecraft/world/entity/player/StackedContents.java b/src/main/java/net/minecraft/world/entity/player/StackedContents.java -index 5cc5f67284ad01c9154876252450552ed37f24bf..9c7b05fec22a8b84c29d7210f1104030a20cc7aa 100644 +index a3a7bfaf5d21a50410017c8d17484ef5a409d68a..33e493874cb8cecd820e80f2c15e6f654bc64b02 100644 --- a/src/main/java/net/minecraft/world/entity/player/StackedContents.java +++ b/src/main/java/net/minecraft/world/entity/player/StackedContents.java @@ -21,8 +21,10 @@ import net.minecraft.world.item.crafting.RecipeHolder; @@ -218,15 +218,15 @@ index 5cc5f67284ad01c9154876252450552ed37f24bf..9c7b05fec22a8b84c29d7210f1104030 if (!stack.isDamaged() && !stack.isEnchanted() && !stack.hasCustomHoverName()) { this.accountStack(stack); } -@@ -37,6 +39,7 @@ public class StackedContents { +@@ -36,6 +38,7 @@ public class StackedContents { if (!stack.isEmpty()) { int i = getStackingIndex(stack); int j = Math.min(maxCount, stack.getCount()); + if (this.extrasMap != null && stack.hasTag() && this.extrasMap.accountStack(stack, j)) return; // Paper - Improve exact choice recipe ingredients; if an exact ingredient, don't include it this.put(i, j); } - -@@ -84,6 +87,23 @@ public class StackedContents { + } +@@ -82,6 +85,23 @@ public class StackedContents { return itemId == 0 ? ItemStack.EMPTY : new ItemStack(Item.byId(itemId)); } @@ -250,34 +250,34 @@ index 5cc5f67284ad01c9154876252450552ed37f24bf..9c7b05fec22a8b84c29d7210f1104030 public void clear() { this.contents.clear(); } -@@ -107,7 +127,7 @@ public class StackedContents { +@@ -105,7 +125,7 @@ public class StackedContents { this.data = new BitSet(this.ingredientCount + this.itemCount + this.ingredientCount + this.ingredientCount * this.itemCount); - for(int i = 0; i < this.ingredients.size(); ++i) { + for (int i = 0; i < this.ingredients.size(); i++) { - IntList intList = this.ingredients.get(i).getStackingIds(); + IntList intList = this.getStackingIds(this.ingredients.get(i)); // Paper - Improve exact choice recipe ingredients - for(int j = 0; j < this.itemCount; ++j) { + for (int j = 0; j < this.itemCount; j++) { if (intList.contains(this.items[j])) { -@@ -171,7 +191,7 @@ public class StackedContents { +@@ -168,7 +188,7 @@ public class StackedContents { IntCollection intCollection = new IntAVLTreeSet(); - for(Ingredient ingredient : this.ingredients) { + for (Ingredient ingredient : this.ingredients) { - intCollection.addAll(ingredient.getStackingIds()); + intCollection.addAll(this.getStackingIds(ingredient)); // Paper - Improve exact choice recipe ingredients } IntIterator intIterator = intCollection.iterator(); -@@ -294,7 +314,7 @@ public class StackedContents { - for(Ingredient ingredient : this.ingredients) { +@@ -297,7 +317,7 @@ public class StackedContents { + for (Ingredient ingredient : this.ingredients) { int j = 0; -- for(int k : ingredient.getStackingIds()) { -+ for(int k : this.getStackingIds(ingredient)) { // Paper - Improve exact choice recipe ingredients +- for (int k : ingredient.getStackingIds()) { ++ for (int k : this.getStackingIds(ingredient)) { // Paper - Improve exact choice recipe ingredients j = Math.max(j, StackedContents.this.contents.get(k)); } -@@ -305,5 +325,17 @@ public class StackedContents { +@@ -308,5 +328,17 @@ public class StackedContents { return i; } @@ -296,7 +296,7 @@ index 5cc5f67284ad01c9154876252450552ed37f24bf..9c7b05fec22a8b84c29d7210f1104030 } } diff --git a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java -index ff48b0de1bdf693e01ea04bc1606c5f80d4c401c..43cff6d2fca55192a0a8d9051a0728327c5dcf4b 100644 +index 7fe2389df3f033da60ec246937f67662355d3715..2a99d6b9c5c0bed7c971303cff82f84303184bca 100644 --- a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java @@ -6,7 +6,7 @@ import net.minecraft.world.Container; @@ -308,7 +308,7 @@ index ff48b0de1bdf693e01ea04bc1606c5f80d4c401c..43cff6d2fca55192a0a8d9051a072832 protected final RecipeType<?> type; protected final CookingBookCategory category; protected final String group; -@@ -23,6 +23,7 @@ public abstract class AbstractCookingRecipe implements Recipe<Container> { +@@ -25,6 +25,7 @@ public abstract class AbstractCookingRecipe implements Recipe<Container> { this.result = result; this.experience = experience; this.cookingTime = cookingTime; diff --git a/patches/server/0287-Entity-getEntitySpawnReason.patch b/patches/server/0287-Entity-getEntitySpawnReason.patch index 1593a0a103..2e712d95da 100644 --- a/patches/server/0287-Entity-getEntitySpawnReason.patch +++ b/patches/server/0287-Entity-getEntitySpawnReason.patch @@ -120,18 +120,18 @@ index cae8c508972d771ad96228ace8a7e6cbc34d5489..3184f73ce799cc5202d2129be736e2fe // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java -index faad948f089575e4988d989790cc1dd13f8a79cd..e143f42e71ac774d49b75e6d85591aa1189ee210 100644 +index c498e2881b22d23f8fbf558cc65f4e5a5ad4085e..ed3c82b96951af247680bde3e4e0951e80c7579e 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java -@@ -186,7 +186,7 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi - } +@@ -187,7 +187,7 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi private boolean trySummonWarden(ServerLevel world) { -- return this.warningLevel < 4 ? false : SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER).isPresent(); -+ return this.warningLevel < 4 ? false : SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL, null).isPresent(); // Paper - Entity#getEntitySpawnReason + return this.warningLevel >= 4 +- && SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER) ++ && SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL, null) // Paper - Entity#getEntitySpawnReason + .isPresent(); } - @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 6fddbcec673564ac531a852f631f6acc460accbd..9ed122efb2b380bb2c1b50fdfe75bf3e679c9c6e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/patches/server/0288-Fire-event-on-GS4-query.patch b/patches/server/0288-Fire-event-on-GS4-query.patch index 70ee09cecb..c43baca1e4 100644 --- a/patches/server/0288-Fire-event-on-GS4-query.patch +++ b/patches/server/0288-Fire-event-on-GS4-query.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fire event on GS4 query diff --git a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java -index 88917d7a179739fc13c59831b15e7ddc711bed1b..1ef089dbf83de35d875c00efdf468c397be56978 100644 +index 7db3cc76543c3e020de799dc844c616e1c027849..41c0eeba9743d7ce141e4e58f96a761948ae33d7 100644 --- a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java +++ b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java @@ -106,13 +106,32 @@ public class QueryThreadGs4 extends GenericThread { @@ -45,7 +45,7 @@ index 88917d7a179739fc13c59831b15e7ddc711bed1b..1ef089dbf83de35d875c00efdf468c39 + networkDataOutputStream.writeString(queryResponse.getHostname()); + // Paper end this.sendTo(networkDataOutputStream.toByteArray(), packet); - LOGGER.debug("Status [{}]", (Object)socketAddress); + LOGGER.debug("Status [{}]", socketAddress); } @@ -147,31 +166,75 @@ public class QueryThreadGs4 extends GenericThread { this.rulesResponse.writeString("splitnum"); @@ -112,13 +112,13 @@ index 88917d7a179739fc13c59831b15e7ddc711bed1b..1ef089dbf83de35d875c00efdf468c39 - this.rulesResponse.writeString(this.worldName); + this.rulesResponse.writeString(queryResponse.getMap()); this.rulesResponse.writeString("numplayers"); -- this.rulesResponse.writeString("" + this.serverInterface.getPlayerCount()); +- this.rulesResponse.writeString(this.serverInterface.getPlayerCount() + ""); + this.rulesResponse.writeString(Integer.toString(queryResponse.getCurrentPlayers())); this.rulesResponse.writeString("maxplayers"); -- this.rulesResponse.writeString("" + this.maxPlayers); +- this.rulesResponse.writeString(this.maxPlayers + ""); + this.rulesResponse.writeString(Integer.toString(queryResponse.getMaxPlayers())); this.rulesResponse.writeString("hostport"); -- this.rulesResponse.writeString("" + this.serverPort); +- this.rulesResponse.writeString(this.serverPort + ""); + this.rulesResponse.writeString(Integer.toString(queryResponse.getPort())); this.rulesResponse.writeString("hostip"); - this.rulesResponse.writeString(this.hostIp); @@ -130,5 +130,5 @@ index 88917d7a179739fc13c59831b15e7ddc711bed1b..1ef089dbf83de35d875c00efdf468c39 - String[] strings = this.serverInterface.getPlayerNames(); + String[] strings = queryResponse.getPlayers().toArray(String[]::new); - for(String string : strings) { + for (String string : strings) { this.rulesResponse.writeString(string); diff --git a/patches/server/0291-Server-Tick-Events.patch b/patches/server/0291-Server-Tick-Events.patch index 51ca906ea2..354c364ca7 100644 --- a/patches/server/0291-Server-Tick-Events.patch +++ b/patches/server/0291-Server-Tick-Events.patch @@ -6,7 +6,7 @@ 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 0edd0181d7379e648155231689f1715076edcd1e..ddbe9061b518711ed4bb2e30a90817293fd7fb7d 100644 +index fea2863dc00d9765b86ac4cf925ceaf0fbef7da3..21baf9139a652f21af81e775c4a0cfd3f2a81923 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1357,6 +1357,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0292-PlayerDeathEvent-getItemsToKeep.patch b/patches/server/0292-PlayerDeathEvent-getItemsToKeep.patch index 1baab7db6d..dfe9c7f417 100644 --- a/patches/server/0292-PlayerDeathEvent-getItemsToKeep.patch +++ b/patches/server/0292-PlayerDeathEvent-getItemsToKeep.patch @@ -11,7 +11,7 @@ Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4 public net.minecraft.world.entity.player.Inventory compartments diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 390e36f3557040f2ddc2c9158410a535cc178aa3..71372fad81d34bb0a4035d3a69d656db3b45d9ce 100644 +index 7433116ee68b92c86d1588296d521e5df49e5ac2..eb9668f94dbc36f3abc7d5c47c9b1b657aa94ced 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -813,6 +813,46 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0297-Fix-sounds-when-item-frames-are-modified-MC-123450.patch b/patches/server/0297-Fix-sounds-when-item-frames-are-modified-MC-123450.patch index a91800e4b3..76b1e55348 100644 --- a/patches/server/0297-Fix-sounds-when-item-frames-are-modified-MC-123450.patch +++ b/patches/server/0297-Fix-sounds-when-item-frames-are-modified-MC-123450.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix sounds when item frames are modified (MC-123450) This also fixes the adding sound playing when the item frame direction is changed. 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 78a3c87b74218a0d5792801c07e3a263c15fcd5b..8289ea080aa297f75cdbc8d591d6efa6a0def0ea 100644 +index f90878e0449f39f66ae3a7036a65c374b36b7dbc..5c507b1160835fd4beb3b2d5b621250540545d4e 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java @@ -326,7 +326,7 @@ public class ItemFrame extends HangingEntity { diff --git a/patches/server/0299-Configurable-Keep-Spawn-Loaded-range-per-world.patch b/patches/server/0299-Configurable-Keep-Spawn-Loaded-range-per-world.patch index 38dda4ebd6..55a4c16b30 100644 --- a/patches/server/0299-Configurable-Keep-Spawn-Loaded-range-per-world.patch +++ b/patches/server/0299-Configurable-Keep-Spawn-Loaded-range-per-world.patch @@ -165,7 +165,7 @@ index 1b565b2809c2d367e21971c5154f35c9763995e6..4792eaa30464f4c4ca7f2d6cf20f734b + void setChunkRadius(int radius); // Paper - Configurable Keep Spawn Loaded range per world } diff --git a/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java b/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java -index 4d2348df25410a0b5364eec066880326d6667dad..3754cda7e7731935893359d84f3ae06157a347c6 100644 +index c9667df492e5681bf933a7f8878b0fdb324afed3..09d0c702132d4cc52ce36712aed11d30efe89f54 100644 --- a/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java +++ b/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java @@ -11,12 +11,19 @@ import org.slf4j.Logger; diff --git a/patches/server/0301-Show-blockstate-location-if-we-failed-to-read-it.patch b/patches/server/0301-Show-blockstate-location-if-we-failed-to-read-it.patch index e2812d19fd..2c9fef1cf5 100644 --- a/patches/server/0301-Show-blockstate-location-if-we-failed-to-read-it.patch +++ b/patches/server/0301-Show-blockstate-location-if-we-failed-to-read-it.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Show blockstate location if we failed to read it diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index f046f507a095e0cb8f839b9b4b06add3a671486b..f1f6d85399db86ce7aee1fccde51d6259b427e7e 100644 +index e7fd9ebd47af277d6dbced0f17e954722c202776..ff3f88f107a4c059688566b69dcdf48bc01210ab 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -25,6 +25,7 @@ public class CraftBlockEntityState<T extends BlockEntity> extends CraftBlockStat diff --git a/patches/server/0304-offset-item-frame-ticking.patch b/patches/server/0304-offset-item-frame-ticking.patch index 58d95fb98a..cb15ef5dd8 100644 --- a/patches/server/0304-offset-item-frame-ticking.patch +++ b/patches/server/0304-offset-item-frame-ticking.patch @@ -5,7 +5,7 @@ Subject: [PATCH] offset item frame ticking diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java -index b3d05578f38af41f242f6634864ce1d2ecac14f8..2446d649225f96748e2fbb1a53a9e1902ac22aa1 100644 +index aaa579ba04445aa350a439610d460a2415320cfc..4dea85a8ab8ae16d02e35d226fd155891ce2319a 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java +++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java @@ -39,7 +39,7 @@ public abstract class HangingEntity extends Entity { diff --git a/patches/server/0305-Prevent-consuming-the-wrong-itemstack.patch b/patches/server/0305-Prevent-consuming-the-wrong-itemstack.patch index 9a56dc421d..397c7c692d 100644 --- a/patches/server/0305-Prevent-consuming-the-wrong-itemstack.patch +++ b/patches/server/0305-Prevent-consuming-the-wrong-itemstack.patch @@ -5,7 +5,7 @@ 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 f619171b3e436d7263d5229f7f9131954a0941f8..40ad459823268af0e57a348d241ac19bb576683a 100644 +index 4be7b136dd2b35b0637a1455985ab99bbd3af0a5..b4a817e047a78723d746740c88503441625ac8e7 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3730,9 +3730,14 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0308-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch b/patches/server/0308-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch index 983b04c068..82277a287f 100644 --- a/patches/server/0308-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch +++ b/patches/server/0308-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch @@ -5,16 +5,16 @@ 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 964fc8615d071d33c821f0c54ac1ebd4884df0cd..271e913a87a782dbf12686887f768d899bfb0fbf 100644 +index 6fe337e8d6db168ea181ed2597674f4829b03c47..e552ae6a7db765301a3d280dbf9348d9dc28b9c2 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 -@@ -43,7 +43,8 @@ public class SleepInBed extends Behavior<LivingEntity> { +@@ -42,7 +42,8 @@ public class SleepInBed extends Behavior<LivingEntity> { } } - BlockState blockState = world.getBlockState(globalPos.pos()); + BlockState blockState = world.getBlockStateIfLoaded(globalPos.pos()); // Paper - Prevent sync chunk loads when villagers try to find beds + if (blockState == null) { return false; } // Paper - Prevent sync chunk loads when villagers try to find beds - return globalPos.pos().closerToCenterThan(entity.position(), 2.0D) && blockState.is(BlockTags.BEDS) && !blockState.getValue(BedBlock.OCCUPIED); + return globalPos.pos().closerToCenterThan(entity.position(), 2.0) && blockState.is(BlockTags.BEDS) && !blockState.getValue(BedBlock.OCCUPIED); } } diff --git a/patches/server/0309-MC-145656-Fix-Follow-Range-Initial-Target.patch b/patches/server/0309-MC-145656-Fix-Follow-Range-Initial-Target.patch index 20a9321020..528cf153ea 100644 --- a/patches/server/0309-MC-145656-Fix-Follow-Range-Initial-Target.patch +++ b/patches/server/0309-MC-145656-Fix-Follow-Range-Initial-Target.patch @@ -17,19 +17,19 @@ index 0dad5be671f990d0edf0a155e2534b3812438902..175ba1184fc997f562f0834b172e17dc @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java -index f29823f2e8a54bd4e81e2940b5c505b152f23e88..fae0dbfb6ac09a0c152c0f74a72583f44316def7 100644 +index bc4b9a46056e83762e29bb04485ad7c754a20336..aecb0ad814586bfc5e56755ee14379a69388b38c 100644 --- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java -@@ -76,7 +76,7 @@ public class TargetingConditions { +@@ -77,7 +77,7 @@ public class TargetingConditions { - if (this.range > 0.0D) { - double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0D; -- double e = Math.max(this.range * d, 2.0D); -+ double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0D); // Paper - Fix MC-145656 + if (this.range > 0.0) { + double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0; +- double e = Math.max(this.range * d, 2.0); ++ double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0); // Paper - Fix MC-145656 double f = baseEntity.distanceToSqr(targetEntity.getX(), targetEntity.getY(), targetEntity.getZ()); if (f > e * e) { return false; -@@ -94,4 +94,18 @@ public class TargetingConditions { +@@ -92,4 +92,18 @@ public class TargetingConditions { return true; } } diff --git a/patches/server/0311-PlayerDeathEvent-shouldDropExperience.patch b/patches/server/0311-PlayerDeathEvent-shouldDropExperience.patch index 8ce26f265a..c7a6d1afba 100644 --- a/patches/server/0311-PlayerDeathEvent-shouldDropExperience.patch +++ b/patches/server/0311-PlayerDeathEvent-shouldDropExperience.patch @@ -5,7 +5,7 @@ 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 71372fad81d34bb0a4035d3a69d656db3b45d9ce..8678efd1b0ad2e6dbf49ed47d0dc959027762b40 100644 +index eb9668f94dbc36f3abc7d5c47c9b1b657aa94ced..79a0accd8230c76d792ed3f7558e8b3ea6d2f6d1 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -934,7 +934,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0313-Don-t-load-Chunks-from-Hoppers-and-other-things.patch b/patches/server/0313-Don-t-load-Chunks-from-Hoppers-and-other-things.patch index dcdab50579..3b189be4e4 100644 --- a/patches/server/0313-Don-t-load-Chunks-from-Hoppers-and-other-things.patch +++ b/patches/server/0313-Don-t-load-Chunks-from-Hoppers-and-other-things.patch @@ -13,10 +13,10 @@ This of course is undesirable, so just return the loaded side as "primary" and treat it as a single chest if the other sides are unloaded diff --git a/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java b/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java -index 0a40d9b7e394fa10d6bfb0057440e1b0e55d1fc4..c889d2e08b9e7c8ee374f0148e72bb3bc9a1d826 100644 +index 963092cd5a4e756ad6a471379a81d8996cc2b091..20c9921339ec6b5127fbadcedc19577f3906074d 100644 --- a/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java +++ b/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java -@@ -25,7 +25,12 @@ public class DoubleBlockCombiner { +@@ -34,7 +34,12 @@ public class DoubleBlockCombiner { return new DoubleBlockCombiner.NeighborCombineResult.Single<>(blockEntity); } else { BlockPos blockPos = pos.relative(directionMapper.apply(state)); @@ -29,4 +29,4 @@ index 0a40d9b7e394fa10d6bfb0057440e1b0e55d1fc4..c889d2e08b9e7c8ee374f0148e72bb3b + // Paper end - Don't load Chunks from Hoppers and other things if (blockState.is(state.getBlock())) { DoubleBlockCombiner.BlockType blockType2 = typeMapper.apply(blockState); - if (blockType2 != DoubleBlockCombiner.BlockType.SINGLE && blockType != blockType2 && blockState.getValue(directionProperty) == state.getValue(directionProperty)) { + if (blockType2 != DoubleBlockCombiner.BlockType.SINGLE diff --git a/patches/server/0314-Optimise-EntityGetter-getPlayerByUUID.patch b/patches/server/0314-Optimise-EntityGetter-getPlayerByUUID.patch index 3066fc8b68..01113bf72e 100644 --- a/patches/server/0314-Optimise-EntityGetter-getPlayerByUUID.patch +++ b/patches/server/0314-Optimise-EntityGetter-getPlayerByUUID.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimise EntityGetter#getPlayerByUUID Use the PlayerList 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 514b3af4f8ac04744ae44cad7c01086a3f821d5f..3f70bab49d58ec36f6153a7dae577d22c90d2918 100644 +index 20de3be232ccc7ec7bbc3c6aee9acf66fd396af1..54c0aa440cd8e7e1cedc6ef9ae963c68558b6080 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -324,6 +324,15 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0316-Optimize-call-to-getFluid-for-explosions.patch b/patches/server/0316-Optimize-call-to-getFluid-for-explosions.patch index 6afa3465ac..a63134d6ec 100644 --- a/patches/server/0316-Optimize-call-to-getFluid-for-explosions.patch +++ b/patches/server/0316-Optimize-call-to-getFluid-for-explosions.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize call to getFluid for explosions diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index 00cfa26783ce0772c75166266ead258a415097bc..b03b4d366cae39081a7b70524e8615c986d76362 100644 +index ade10a9fd93f4c0f04cd56ce5e1da06af4a05060..b057a67a416928ae30bd407b3da982b73ae3be03 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -191,7 +191,7 @@ public class Explosion { diff --git a/patches/server/0320-Tracking-Range-Improvements.patch b/patches/server/0320-Tracking-Range-Improvements.patch index 6370a7e08a..2daaa84425 100644 --- a/patches/server/0320-Tracking-Range-Improvements.patch +++ b/patches/server/0320-Tracking-Range-Improvements.patch @@ -8,7 +8,7 @@ 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 1b102f4c800dc6aa4e977c8ae8c9aada5d94e194..eff31fdd159dc7844bd3be3b769625a5704c2f17 100644 +index 8805fd57e7198aa9afaafe45fab13fd343e2a545..c69f1d970e1014f1be601e34bdd8b5fd749da339 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1761,6 +1761,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0321-Fix-items-vanishing-through-end-portal.patch b/patches/server/0321-Fix-items-vanishing-through-end-portal.patch index 952b1672dc..b2763538f5 100644 --- a/patches/server/0321-Fix-items-vanishing-through-end-portal.patch +++ b/patches/server/0321-Fix-items-vanishing-through-end-portal.patch @@ -13,7 +13,7 @@ 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 92521a46de31b13812d82a844ddc178df2b34919..8a8bdd3f77462b6aff97a2341d454b11c578f97f 100644 +index 257be4dd3f38c089dd970b9ac6f292b4f010a01c..98db75a013905ddd38ffd26d615ad8d02d8ddd22 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3363,6 +3363,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0325-Add-debug-for-sync-chunk-loads.patch b/patches/server/0325-Add-debug-for-sync-chunk-loads.patch index b3e2d87143..57fda6ab95 100644 --- a/patches/server/0325-Add-debug-for-sync-chunk-loads.patch +++ b/patches/server/0325-Add-debug-for-sync-chunk-loads.patch @@ -312,7 +312,7 @@ index 326b67c15ee3df162bf4468729c49dd98b582f02..8a118a7b2878d3c99dadfa97e2ae58fd chunkproviderserver_b.managedBlock(completablefuture::isDone); this.level.timings.syncChunkLoad.stopTiming(); // Paper diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 3f70bab49d58ec36f6153a7dae577d22c90d2918..14958ce7c7cb1a55da6b6dd6c32a32c9346e866b 100644 +index 54c0aa440cd8e7e1cedc6ef9ae963c68558b6080..4d1d84383c11ef1e83edb50be62173533b7a641b 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -415,6 +415,13 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0328-Entity-Jump-API.patch b/patches/server/0328-Entity-Jump-API.patch index 5dcf9bf76f..d1a852319f 100644 --- a/patches/server/0328-Entity-Jump-API.patch +++ b/patches/server/0328-Entity-Jump-API.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Entity Jump API public net.minecraft.world.entity.LivingEntity jumping diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 169a9aa06350dccf2624534754be3a22b2f42b33..c7b8c823ea1a1cafb98b4305febd52aa3652bc37 100644 +index b4a817e047a78723d746740c88503441625ac8e7..2a417145d9fe4d029cf3738f3320c0bcd3e025a9 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3304,8 +3304,10 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0329-Add-option-to-nerf-pigmen-from-nether-portals.patch b/patches/server/0329-Add-option-to-nerf-pigmen-from-nether-portals.patch index e1d5c928f0..d5d6d0d4ca 100644 --- a/patches/server/0329-Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/patches/server/0329-Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add option to nerf pigmen from nether portals diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8a8bdd3f77462b6aff97a2341d454b11c578f97f..c08b856e56996cf7ad1926d717effb9a1b98d8c6 100644 +index 98db75a013905ddd38ffd26d615ad8d02d8ddd22..537461e60366580bd18e3814113ef1f8b7009b39 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -397,6 +397,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0340-Pillager-patrol-spawn-settings-and-per-player-option.patch b/patches/server/0340-Pillager-patrol-spawn-settings-and-per-player-option.patch index bcdbf37892..4d9ffc8193 100644 --- a/patches/server/0340-Pillager-patrol-spawn-settings-and-per-player-option.patch +++ b/patches/server/0340-Pillager-patrol-spawn-settings-and-per-player-option.patch @@ -10,7 +10,7 @@ When not per player it will use the Vanilla mechanic of one delay per world and the world age for the start day. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8678efd1b0ad2e6dbf49ed47d0dc959027762b40..7649367da5ff97815b710f4902b793a0f6b0e6fa 100644 +index 79a0accd8230c76d792ed3f7558e8b3ea6d2f6d1..9f0d42256d1b41242bd08939f88583e2d337ede3 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -249,6 +249,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0341-Remote-Connections-shouldn-t-hold-up-shutdown.patch b/patches/server/0341-Remote-Connections-shouldn-t-hold-up-shutdown.patch index 6eb90f4536..157b6e74e9 100644 --- a/patches/server/0341-Remote-Connections-shouldn-t-hold-up-shutdown.patch +++ b/patches/server/0341-Remote-Connections-shouldn-t-hold-up-shutdown.patch @@ -24,10 +24,10 @@ index 78775feb965d6eb98a1ff655ae44b9f0399ef9aa..28fe088d97bd5fbfcc29dcc7d2a657d5 System.exit(0); // CraftBukkit 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 3bf60f640aa9fa4cabd2b3e5d3931e8467b9df24..8a493fa049dec741294098e3fee540a60f2accab 100644 +index cabaa1ea22b0ed66a45f6c0c2c051764ad65f37e..5849d1163e70fb887b7596382dd24c204fab1339 100644 --- a/src/main/java/net/minecraft/server/rcon/thread/RconThread.java +++ b/src/main/java/net/minecraft/server/rcon/thread/RconThread.java -@@ -107,6 +107,14 @@ public class RconThread extends GenericThread { +@@ -106,6 +106,14 @@ public class RconThread extends GenericThread { this.clients.clear(); } @@ -41,4 +41,4 @@ index 3bf60f640aa9fa4cabd2b3e5d3931e8467b9df24..8a493fa049dec741294098e3fee540a6 + // Paper end - don't wait for remote connections private void closeSocket(ServerSocket socket) { - LOGGER.debug("closeSocket: {}", (Object)socket); + LOGGER.debug("closeSocket: {}", socket); diff --git a/patches/server/0343-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/patches/server/0343-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index a0fdf0378d..c5cc3ce8c7 100644 --- a/patches/server/0343-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/patches/server/0343-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -7,7 +7,7 @@ Suspected case would be around the technique used in .stopRiding Stack will identify any causer of this and warn instead of crashing. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index eff31fdd159dc7844bd3be3b769625a5704c2f17..2c954f8a91b9f50ce69eda475b22d4159b87d277 100644 +index c69f1d970e1014f1be601e34bdd8b5fd749da339..2fba58fd5c9b17512eadacb899c59a04df5d415f 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1452,6 +1452,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -25,7 +25,7 @@ index eff31fdd159dc7844bd3be3b769625a5704c2f17..2c954f8a91b9f50ce69eda475b22d415 EntityType<?> 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 14958ce7c7cb1a55da6b6dd6c32a32c9346e866b..d2da284aa7284c5205e656c48262061980893be6 100644 +index 4d1d84383c11ef1e83edb50be62173533b7a641b..9af1877321356348ad96b92ae8c5f4811bef50ac 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2224,7 +2224,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0344-Don-t-tick-dead-players.patch b/patches/server/0344-Don-t-tick-dead-players.patch index 7338d09f93..ed79ba1216 100644 --- a/patches/server/0344-Don-t-tick-dead-players.patch +++ b/patches/server/0344-Don-t-tick-dead-players.patch @@ -7,7 +7,7 @@ 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 7649367da5ff97815b710f4902b793a0f6b0e6fa..e695b5ee0b9ce5dad81a7f894ef1e7fd868f11eb 100644 +index 9f0d42256d1b41242bd08939f88583e2d337ede3..ca75d22e90fd879d464733813939f877ec875905 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -684,7 +684,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0346-Don-t-move-existing-players-to-world-spawn.patch b/patches/server/0346-Don-t-move-existing-players-to-world-spawn.patch index f002120e54..58204fae45 100644 --- a/patches/server/0346-Don-t-move-existing-players-to-world-spawn.patch +++ b/patches/server/0346-Don-t-move-existing-players-to-world-spawn.patch @@ -13,7 +13,7 @@ By skipping this, we avoid potential for a large spike on server start. public net.minecraft.server.level.ServerPlayer fudgeSpawnLocation(Lnet/minecraft/server/level/ServerLevel;)V diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index e695b5ee0b9ce5dad81a7f894ef1e7fd868f11eb..b6698a65d778cea6b7dc9b8ebfceec2425c732b7 100644 +index ca75d22e90fd879d464733813939f877ec875905..04e54d2214d0ae0202490aceab54b8b10ef38229 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -337,7 +337,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0347-Optimize-Pathfinding.patch b/patches/server/0347-Optimize-Pathfinding.patch index 0bd6e09507..c4d6cafff0 100644 --- a/patches/server/0347-Optimize-Pathfinding.patch +++ b/patches/server/0347-Optimize-Pathfinding.patch @@ -7,10 +7,10 @@ Prevents pathfinding from spamming failures for things such as arrow attacks. 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 c3b406e6302ae0ac1ef56253ab614ca201a7a1c8..a04fb58c29b462e20ed0b702cef478e3985b7cd2 100644 +index 25a9f1fd69fbafab5129740e26e9741e35885ce0..e3a7eaf31ab19cc9f23a0c87649b74bb42976cb4 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 -@@ -193,9 +193,29 @@ public abstract class PathNavigation { +@@ -192,9 +192,29 @@ public abstract class PathNavigation { return this.moveTo(this.createPath(x, y, z, 1), speed); } diff --git a/patches/server/0349-Reduce-memory-footprint-of-CompoundTag.patch b/patches/server/0349-Reduce-memory-footprint-of-CompoundTag.patch index c714de8792..95b6084d67 100644 --- a/patches/server/0349-Reduce-memory-footprint-of-CompoundTag.patch +++ b/patches/server/0349-Reduce-memory-footprint-of-CompoundTag.patch @@ -8,10 +8,10 @@ is important because we clone chunk data after reading it for safety. So, reduce the impact of the clone on GC. diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java -index c77a6bb6885ffaaa4d9e1aa9d4770d5e847a590b..2c760084cd1b84a1f2c4f6a6db8d396a1b3c5395 100644 +index 8a8dd896328ec3f392f3c5ef7c94633922e45ee3..17df3322cd407191465cc4ad09f355569228c772 100644 --- a/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java -@@ -50,7 +50,7 @@ public class CompoundTag implements Tag { +@@ -53,7 +53,7 @@ public class CompoundTag implements Tag { private static CompoundTag loadCompound(DataInput input, NbtAccounter tracker) throws IOException { tracker.accountBytes(48L); @@ -19,8 +19,8 @@ index c77a6bb6885ffaaa4d9e1aa9d4770d5e847a590b..2c760084cd1b84a1f2c4f6a6db8d396a + it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<String, Tag> map = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(8, 0.8f); // Paper - Reduce memory footprint of CompoundTag byte b; - while((b = input.readByte()) != 0) { -@@ -171,7 +171,7 @@ public class CompoundTag implements Tag { + while ((b = input.readByte()) != 0) { +@@ -170,7 +170,7 @@ public class CompoundTag implements Tag { } public CompoundTag() { @@ -29,7 +29,7 @@ index c77a6bb6885ffaaa4d9e1aa9d4770d5e847a590b..2c760084cd1b84a1f2c4f6a6db8d396a } @Override -@@ -490,8 +490,16 @@ public class CompoundTag implements Tag { +@@ -483,8 +483,16 @@ public class CompoundTag implements Tag { @Override public CompoundTag copy() { diff --git a/patches/server/0350-Prevent-opening-inventories-when-frozen.patch b/patches/server/0350-Prevent-opening-inventories-when-frozen.patch index 2ea12128dc..f1f9ea6812 100644 --- a/patches/server/0350-Prevent-opening-inventories-when-frozen.patch +++ b/patches/server/0350-Prevent-opening-inventories-when-frozen.patch @@ -5,7 +5,7 @@ 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 b6698a65d778cea6b7dc9b8ebfceec2425c732b7..347747282c77f5d1dde907b99cc2c8029675dc34 100644 +index 04e54d2214d0ae0202490aceab54b8b10ef38229..3a856f28237246660665aef983e5e9fe2bac8c37 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -653,7 +653,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0351-Don-t-run-entity-collision-code-if-not-needed.patch b/patches/server/0351-Don-t-run-entity-collision-code-if-not-needed.patch index 5c6be151ec..4fb9ce321f 100644 --- a/patches/server/0351-Don-t-run-entity-collision-code-if-not-needed.patch +++ b/patches/server/0351-Don-t-run-entity-collision-code-if-not-needed.patch @@ -12,7 +12,7 @@ The entity's current team collision rule causes them to NEVER collide. Co-authored-by: Owen1212055 <[email protected]> diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f441d7a1188cecd91206d78b58457c330e4e8663..178d8e9795a6c451e0ff350d9412bc2e0ee686ae 100644 +index 2a417145d9fe4d029cf3738f3320c0bcd3e025a9..e8410acb2f4be966177a0ec62fc93b8fe2cc0af3 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3419,10 +3419,24 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0352-Implement-Player-Client-Options-API.patch b/patches/server/0352-Implement-Player-Client-Options-API.patch index 2a651ebbc3..adc09129e4 100644 --- a/patches/server/0352-Implement-Player-Client-Options-API.patch +++ b/patches/server/0352-Implement-Player-Client-Options-API.patch @@ -87,7 +87,7 @@ 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 347747282c77f5d1dde907b99cc2c8029675dc34..eb0a0a9faacf3c7d879b435b637a9c8203319aa6 100644 +index 3a856f28237246660665aef983e5e9fe2bac8c37..3d7a938f72424a4f30f75563393a953cf9f11933 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -338,7 +338,7 @@ public class ServerPlayer extends Player { @@ -136,7 +136,7 @@ index 347747282c77f5d1dde907b99cc2c8029675dc34..eb0a0a9faacf3c7d879b435b637a9c82 this.adventure$locale = java.util.Objects.requireNonNullElse(net.kyori.adventure.translation.Translator.parseLocale(this.language), java.util.Locale.US); // Paper this.requestedViewDistance = clientOptions.viewDistance(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index c5ea6d424c8009c8afd791e58a75174291696d05..d6bddec130167af3d72555535045568ee941bb88 100644 +index 476b7bc14b4d2e7ed30c23b65dbc7aa0c6679b6b..5ba0fa6fda6d496f7540185e6dc58439cc1e04f1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -573,6 +573,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0354-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch b/patches/server/0354-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch index be256ac7cb..79298e93c2 100644 --- a/patches/server/0354-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch +++ b/patches/server/0354-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch @@ -43,7 +43,7 @@ index 2fba58fd5c9b17512eadacb899c59a04df5d415f..4c1dd470ac561f61d7f49adf90d273b1 EntityType<?> entitytypes = entity.getType(); int i = entitytypes.clientTrackingRange() * 16; diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index eb0a0a9faacf3c7d879b435b637a9c8203319aa6..e5653695a3fbcd260ce44ca37291406a1033a3fa 100644 +index 3d7a938f72424a4f30f75563393a953cf9f11933..b64b20312396638b8fd596bca3794863601d2bb4 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -267,6 +267,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0355-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/patches/server/0355-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index 483de53840..74931d2851 100644 --- a/patches/server/0355-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/patches/server/0355-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -87,7 +87,7 @@ index c5614cc12789fdfad3519434e115a50c12844b3b..d0e158235915e4efc8bda99d552d029c } // Paper end - Entity#getEntitySpawnReason diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c08b856e56996cf7ad1926d717effb9a1b98d8c6..7619f6e772d2fab177a83b083bcce3d2ee1d9a95 100644 +index 537461e60366580bd18e3814113ef1f8b7009b39..5863d7118d9935735400cff4a09dd8546f67bac5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2289,27 +2289,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0356-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/server/0356-Add-PlayerAttackEntityCooldownResetEvent.patch index 35dea473a5..e8b17654bf 100644 --- a/patches/server/0356-Add-PlayerAttackEntityCooldownResetEvent.patch +++ b/patches/server/0356-Add-PlayerAttackEntityCooldownResetEvent.patch @@ -5,7 +5,7 @@ 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 178d8e9795a6c451e0ff350d9412bc2e0ee686ae..d53069d6b0be5a82f7b34a336439fdfd356e4a79 100644 +index e8410acb2f4be966177a0ec62fc93b8fe2cc0af3..1e5ffd48251c0727e662da4d9a59bc8c23eb95ff 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2211,7 +2211,16 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0359-Fix-item-duplication-and-teleport-issues.patch b/patches/server/0359-Fix-item-duplication-and-teleport-issues.patch index fa8f837500..7e568e11ce 100644 --- a/patches/server/0359-Fix-item-duplication-and-teleport-issues.patch +++ b/patches/server/0359-Fix-item-duplication-and-teleport-issues.patch @@ -80,7 +80,7 @@ index 5863d7118d9935735400cff4a09dd8546f67bac5..23ee63119d55b40829c03a855ae0f8b2 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 b4b2cf6875c96ab213522814ab79bfeaa9848f3b..947ea9f79b0115207e42fa80fe5368ed8c0a1d1c 100644 +index 1e5ffd48251c0727e662da4d9a59bc8c23eb95ff..685c0028032b60c025f825c55e975b08c97d86f2 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1714,9 +1714,9 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0361-Validate-PickItem-Packet-and-kick-for-invalid.patch b/patches/server/0361-Validate-PickItem-Packet-and-kick-for-invalid.patch index daa5857791..c1704d1690 100644 --- a/patches/server/0361-Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/patches/server/0361-Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -5,7 +5,7 @@ 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 89da9267c4c1a884e5483c423ccc68ed1d79259b..83cd7c4157b49f2cc86a44f5040f33585ced4270 100644 +index f78f5be4a1d3e551649090b296881d8dafea1ab9..f0cacf20fbe7dbe11856d89f423c1c74a242853e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -867,7 +867,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0363-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch b/patches/server/0363-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch index 7501e408f6..890d937ec1 100644 --- a/patches/server/0363-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch +++ b/patches/server/0363-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 ee9bb75f2850bf421cc8ff02aca5b230538d6503..db6398c1822f6ad499feddd6a915984ef9917777 100644 +index f21bff10aa56b418b1c3c3f1a40b88c4e992c26d..44f49cc8b7800eebda426a1a04a311979e4516b9 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -26,6 +26,7 @@ public class Main { diff --git a/patches/server/0364-misc-debugging-dumps.patch b/patches/server/0364-misc-debugging-dumps.patch index 23c37105f1..37d8c2638d 100644 --- a/patches/server/0364-misc-debugging-dumps.patch +++ b/patches/server/0364-misc-debugging-dumps.patch @@ -42,7 +42,7 @@ index 40ff3090fb17fb0f01a9b52639fb783ea57ce6b6..d39743d9626eb01c942194387dafb110 StackTraceElement[] astacktraceelement = exception.getStackTrace(); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e5ecca5ae9e37e4d4d6d2adfd5f487a869ab775d..390bc01c19d5fed7ed455ddf9823697469e0d7fe 100644 +index 1a7dffb3947dab0e334cd5873c69542f383aed61..f4e9929c956585a9305c2b40a995ec4fff08e7e4 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -904,6 +904,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0365-Prevent-teleporting-dead-entities.patch b/patches/server/0365-Prevent-teleporting-dead-entities.patch index e1b8ad63b4..f4f8db3845 100644 --- a/patches/server/0365-Prevent-teleporting-dead-entities.patch +++ b/patches/server/0365-Prevent-teleporting-dead-entities.patch @@ -5,7 +5,7 @@ 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 83cd7c4157b49f2cc86a44f5040f33585ced4270..874a1998b6aaff9f4c7818481298ad51e1adc525 100644 +index f0cacf20fbe7dbe11856d89f423c1c74a242853e..c0907af0169862702a4f28985d141c0acb506f51 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1545,6 +1545,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0366-Deobfuscate-stacktraces-in-log-messages-crash-report.patch b/patches/server/0366-Deobfuscate-stacktraces-in-log-messages-crash-report.patch index cc8b376c6f..09e4a010dd 100644 --- a/patches/server/0366-Deobfuscate-stacktraces-in-log-messages-crash-report.patch +++ b/patches/server/0366-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 1eedfc00ab7da96f07ae542b8c5775f41708dd37..dc552a35977b2e62ec1534ffbb9c744135b4b3fc 100644 +index 9cd80bc7f2b47e1044eef2592274e38d1988ff5d..2b3da4b69e89a6b98ec98820e55044fefdafc061 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -35,6 +35,7 @@ dependencies { @@ -483,10 +483,10 @@ index a9a0248b1bd1ac454064e977b61f9b7d80962ff8..6f2452de76e8f5fcc1367066e0e75374 this.exception = cause; this.systemReport.setDetail("CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit diff --git a/src/main/java/net/minecraft/CrashReportCategory.java b/src/main/java/net/minecraft/CrashReportCategory.java -index 52eb3176437113f9a0ff85d10ce5c2415e1b5570..b54ddd0ba0b001fbcb1838a838ca4890df936f1b 100644 +index 91073d755f78bb427cd4b72c21ca0de5d12ec6b1..d0679882606bc84cb2a4abb69022d94caeee86ef 100644 --- a/src/main/java/net/minecraft/CrashReportCategory.java +++ b/src/main/java/net/minecraft/CrashReportCategory.java -@@ -104,6 +104,7 @@ public class CrashReportCategory { +@@ -110,6 +110,7 @@ public class CrashReportCategory { } else { this.stackTrace = new StackTraceElement[stackTraceElements.length - 3 - ignoredCallCount]; System.arraycopy(stackTraceElements, 3 + ignoredCallCount, this.stackTrace, 0, this.stackTrace.length); @@ -525,7 +525,7 @@ index 7648b889bc488197f32545e8c3671a54102c01ec..44e62675a2d612a8d727d9ce6db5fb85 protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet<?> packet) { diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index 61f05f34ca33837c643f2915e753ec3935a38314..85b8be8ffac0fb40e9cae0528271ed41473811c8 100644 +index 061eada043325142d33a0cec02e9e484d14a7fca..96d5448019d53ac3575e209c1c5c223a62a2638d 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java @@ -47,7 +47,14 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { diff --git a/patches/server/0367-Implement-Mob-Goal-API.patch b/patches/server/0367-Implement-Mob-Goal-API.patch index 13572c9b4d..6b2e0d999b 100644 --- a/patches/server/0367-Implement-Mob-Goal-API.patch +++ b/patches/server/0367-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 e9cda97679ed18156baf009926d6f210093112bd..7cbfd129efcc2e971b75aaa272dee79a3b4d2d5c 100644 +index 2b3da4b69e89a6b98ec98820e55044fefdafc061..d16c0311142e44ec1048818221796c09ab7a90d8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -44,6 +44,7 @@ dependencies { diff --git a/patches/server/0368-Add-villager-reputation-API.patch b/patches/server/0368-Add-villager-reputation-API.patch index 04891189ff..4a32aef874 100644 --- a/patches/server/0368-Add-villager-reputation-API.patch +++ b/patches/server/0368-Add-villager-reputation-API.patch @@ -9,10 +9,10 @@ public net.minecraft.world.entity.ai.gossip.GossipContainer$EntityGossips <init> public net.minecraft.world.entity.ai.gossip.GossipContainer gossips 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 a28f359202e6502c6ea5e9c918ec0b3e9a3fca61..f1e717dc8320a00c0cc0ff53d97b74e7c1e109fe 100644 +index 398e6fe9de9fa49675a9a04facdfe54cb8c62c0c..2ac97b08932a182c1512ed935a4d76b341c6a6aa 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 -@@ -231,6 +231,43 @@ public class GossipContainer { +@@ -225,6 +225,43 @@ public class GossipContainer { public void remove(GossipType gossipType) { this.entries.removeInt(gossipType); } diff --git a/patches/server/0371-Fix-PotionEffect-ignores-icon-flag.patch b/patches/server/0371-Fix-PotionEffect-ignores-icon-flag.patch index 208862b074..11cb193b27 100644 --- a/patches/server/0371-Fix-PotionEffect-ignores-icon-flag.patch +++ b/patches/server/0371-Fix-PotionEffect-ignores-icon-flag.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix PotionEffect ignores icon flag Co-authored-by: Tamion <[email protected]> diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index e5cd09c9c27f23860fc31cb22377a54e5e60bd38..7dfc5966e6262ded29c60d7423f8a1e4a42ca948 100644 +index 29fa2231cc5d9c3ac36d508f14408d6077b6594c..d84503ab329ebeb4c74f10f9897661ee6799e3d3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -484,7 +484,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0373-Wait-for-Async-Tasks-during-shutdown.patch b/patches/server/0373-Wait-for-Async-Tasks-during-shutdown.patch index bf00f6de7d..780d2a450b 100644 --- a/patches/server/0373-Wait-for-Async-Tasks-during-shutdown.patch +++ b/patches/server/0373-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 390bc01c19d5fed7ed455ddf9823697469e0d7fe..f786bf10a42fa4e9f610416959c60c52729c277b 100644 +index f4e9929c956585a9305c2b40a995ec4fff08e7e4..af68110105a9a3ec0ebd31ea9733af8dfed1037b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -931,6 +931,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0381-Fix-piston-physics-inconsistency-MC-188840.patch b/patches/server/0381-Fix-piston-physics-inconsistency-MC-188840.patch index d5379f5106..0c989a3736 100644 --- a/patches/server/0381-Fix-piston-physics-inconsistency-MC-188840.patch +++ b/patches/server/0381-Fix-piston-physics-inconsistency-MC-188840.patch @@ -66,10 +66,10 @@ index b3732a6246a2b011e36c5c35fa2ac7749e75db16..3ae61e7b50bfc440c597f88843f92903 } diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -index 45f55c79a9d105f732054d61c4cf83eb5db49762..b1061db1d9b3bfde61d5016e10556c4320095827 100644 +index f7a2490d58cac95cb6dc8643e8e64df7e04f09df..8a5fccf52230eae9777a0157cc25c1321fcf094c 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -@@ -284,7 +284,7 @@ public class PistonMovingBlockEntity extends BlockEntity { +@@ -300,7 +300,7 @@ public class PistonMovingBlockEntity extends BlockEntity { if (world.getBlockState(pos).is(Blocks.MOVING_PISTON)) { BlockState blockState = Block.updateFromNeighbourShapes(blockEntity.movedState, world, pos); if (blockState.isAir()) { diff --git a/patches/server/0382-Fix-missing-chunks-due-to-integer-overflow.patch b/patches/server/0382-Fix-missing-chunks-due-to-integer-overflow.patch index 979e1e474e..771107a256 100644 --- a/patches/server/0382-Fix-missing-chunks-due-to-integer-overflow.patch +++ b/patches/server/0382-Fix-missing-chunks-due-to-integer-overflow.patch @@ -15,15 +15,15 @@ allows the distance calculation to avoid overflow and work as intended. This issue is being tracked in Mojira ticket MC-159283 diff --git a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java -index 299116c5c4d25c78a2af00bb44c4f51ac04286e8..fac92f37c32e0398ebc05d9a0378446fcabaef1a 100644 +index 381dd2af60e9f45c0132a90e8dc1baec30aee4ad..61fcd3fc7b0990388a1bdde1b6c7f8a608520eeb 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java +++ b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java -@@ -502,7 +502,7 @@ public final class DensityFunctions { +@@ -525,7 +525,7 @@ public final class DensityFunctions { int j = z / 2; int k = x % 2; int l = z % 2; - float f = 100.0F - Mth.sqrt((float)(x * x + z * z)) * 8.0F; + float f = 100.0F - Mth.sqrt((long) x * (long) x + (long) z * (long) z) * 8.0F; // Paper - cast ints to long to avoid integer overflow - f = Mth.clamp(f, -100.0F, 80.0F); + float var18 = Mth.clamp(f, -100.0F, 80.0F); - for(int m = -12; m <= 12; ++m) { + for (int m = -12; m <= 12; m++) { diff --git a/patches/server/0389-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/0389-Fix-Per-World-Difficulty-Remembering-Difficulty.patch index a0f8975647..8088452701 100644 --- a/patches/server/0389-Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/patches/server/0389-Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -76,7 +76,7 @@ index c41c53ee3b1a8b5c2c41fc9846f557eeb4d10f9b..ebea8a827aad108dd6d4222e8dfd251d @Override diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index e5653695a3fbcd260ce44ca37291406a1033a3fa..966b86a2b26a32aad2656d1f2beb6daf5b81b3b1 100644 +index b64b20312396638b8fd596bca3794863601d2bb4..8729fb23a7d7700fbccba03d07382091134c6549 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1161,7 +1161,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0394-Support-old-UUID-format-for-NBT.patch b/patches/server/0394-Support-old-UUID-format-for-NBT.patch index 590d6d62e6..d144298802 100644 --- a/patches/server/0394-Support-old-UUID-format-for-NBT.patch +++ b/patches/server/0394-Support-old-UUID-format-for-NBT.patch @@ -8,10 +8,10 @@ We have stored UUID in plenty of places that did not get DFU'd So just look for old format and load it if it exists. diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java -index 2c760084cd1b84a1f2c4f6a6db8d396a1b3c5395..eea9866aecb7189455319d83561fcef35a777d7a 100644 +index 17df3322cd407191465cc4ad09f355569228c772..528b2b84889982fb37c81a72d51eb835c84eb843 100644 --- a/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java -@@ -237,6 +237,12 @@ public class CompoundTag implements Tag { +@@ -236,6 +236,12 @@ public class CompoundTag implements Tag { } public void putUUID(String key, UUID value) { @@ -24,7 +24,7 @@ index 2c760084cd1b84a1f2c4f6a6db8d396a1b3c5395..eea9866aecb7189455319d83561fcef3 this.tags.put(key, NbtUtils.createUUID(value)); } -@@ -245,10 +251,20 @@ public class CompoundTag implements Tag { +@@ -244,10 +250,20 @@ public class CompoundTag implements Tag { * You must use {@link #hasUUID(String)} before or else it <b>will</b> throw an NPE. */ public UUID getUUID(String key) { @@ -46,10 +46,10 @@ index 2c760084cd1b84a1f2c4f6a6db8d396a1b3c5395..eea9866aecb7189455319d83561fcef3 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 4388f2a8b05f5ed2f0934c1693299a4c92072adc..ba0726157417cdde1c9bca93a9e37e68d9b2286d 100644 +index c5ac21c4cc50c7acf96f0ba3ac4713cd508f6a01..c613577572532fd1b8a8c912b9fd8e41c54669bb 100644 --- a/src/main/java/net/minecraft/nbt/NbtUtils.java +++ b/src/main/java/net/minecraft/nbt/NbtUtils.java -@@ -72,6 +72,14 @@ public final class NbtUtils { +@@ -73,6 +73,14 @@ public final class NbtUtils { @Nullable public static GameProfile readGameProfile(CompoundTag nbt) { UUID uUID = nbt.hasUUID("Id") ? nbt.getUUID("Id") : Util.NIL_UUID; diff --git a/patches/server/0401-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch b/patches/server/0401-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch index c744a5628c..4f39c3bd5a 100644 --- a/patches/server/0401-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch +++ b/patches/server/0401-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch @@ -5,7 +5,7 @@ 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 67ff37d395f83c1a0f5c8305375f703cbe4c0609..4aad2d99148a0d6ee06049f20de2aaa6218c1d39 100644 +index 685c0028032b60c025f825c55e975b08c97d86f2..b98f82b619a1932e6d820a2c42120efdc03fc839 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3531,7 +3531,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0405-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch b/patches/server/0405-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch index 40af6ad187..8c7dd5304b 100644 --- a/patches/server/0405-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch +++ b/patches/server/0405-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch @@ -29,10 +29,10 @@ index d46b7bff34b9b43e895f713d2e73071bc62de443..567ca2f09d7bf03ef1758459829a865e String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath()); diff --git a/src/main/java/net/minecraft/server/Services.java b/src/main/java/net/minecraft/server/Services.java -index d200619b4aa820e273c26f2f6133589c727f8a0e..d89c624554ab08bd1b33a3f62b52aa57aaafb8b4 100644 +index 5928e5f1934b8e247ba516595018ed5c633d3b5d..33e3815a0c979609d4c7ab83ad91e87ac07a556d 100644 --- a/src/main/java/net/minecraft/server/Services.java +++ b/src/main/java/net/minecraft/server/Services.java -@@ -22,12 +22,12 @@ public record Services(MinecraftSessionService sessionService, ServicesKeySet se +@@ -24,12 +24,12 @@ public record Services( return java.util.Objects.requireNonNull(this.paperConfigurations); } // Paper end - add paper configuration files diff --git a/patches/server/0407-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch b/patches/server/0407-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch index f1039e4bf0..cf3d7a4259 100644 --- a/patches/server/0407-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch +++ b/patches/server/0407-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch @@ -9,10 +9,10 @@ itself, so the criterion object stores no references - and thus needs no cleanup. diff --git a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java -index 5450734060428426981e2c1f1025b1aa5aa4d271..805459ba815520165c86a537fbb1f3e04b85bfbd 100644 +index 4e6d623de07bf1741050a9e899b85cd6c0efcaa0..670e59432979740caf283d839c2f42c9748fe215 100644 --- a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java +++ b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java -@@ -15,22 +15,22 @@ import net.minecraft.server.level.ServerPlayer; +@@ -15,34 +15,34 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.level.storage.loot.LootContext; public abstract class SimpleCriterionTrigger<T extends SimpleCriterionTrigger.SimpleInstance> implements CriterionTrigger<T> { @@ -21,8 +21,8 @@ index 5450734060428426981e2c1f1025b1aa5aa4d271..805459ba815520165c86a537fbb1f3e0 @Override public final void addPlayerListener(PlayerAdvancements manager, CriterionTrigger.Listener<T> conditions) { -- this.players.computeIfAbsent(manager, (managerx) -> { -+ manager.criterionData.computeIfAbsent(this, (managerx) -> { // Paper - fix AdvancementDataPlayer leak +- this.players.computeIfAbsent(manager, managerx -> { ++ manager.criterionData.computeIfAbsent(this, managerx -> { // Paper - fix AdvancementDataPlayer leak return Sets.newHashSet(); }).add(conditions); } @@ -38,8 +38,7 @@ index 5450734060428426981e2c1f1025b1aa5aa4d271..805459ba815520165c86a537fbb1f3e0 + manager.criterionData.remove(this); // Paper - fix AdvancementDataPlayer leak } } - -@@ -38,12 +38,12 @@ public abstract class SimpleCriterionTrigger<T extends SimpleCriterionTrigger.Si + } @Override public final void removePlayerListeners(PlayerAdvancements tracker) { diff --git a/patches/server/0408-Optimize-NetworkManager-Exception-Handling.patch b/patches/server/0408-Optimize-NetworkManager-Exception-Handling.patch index d1999714a1..c13a2fef23 100644 --- a/patches/server/0408-Optimize-NetworkManager-Exception-Handling.patch +++ b/patches/server/0408-Optimize-NetworkManager-Exception-Handling.patch @@ -5,19 +5,19 @@ 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 ac1aa37329bd4d411964ea34ea8147f6db945b9a..0ed8d5691a5562a944b68f385b97ef814c2380e1 100644 +index fca5251008f21c0f3eee9390eca9b9fa2fef1151..147836d6dbbcf6978e82d1031eee754743bc254e 100644 --- a/src/main/java/net/minecraft/network/ConnectionProtocol.java +++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java -@@ -341,6 +341,7 @@ public enum ConnectionProtocol { +@@ -596,6 +596,7 @@ public enum ConnectionProtocol { @Nullable public Packet<?> createPacket(int id, FriendlyByteBuf buf) { + if (id < 0 || id >= this.idToDeserializer.size()) return null; // Paper - Perf: Optimize exception handling Function<FriendlyByteBuf, ? extends Packet<? super T>> function = this.idToDeserializer.get(id); - return function != null ? function.apply(buf) : null; + return (Packet<?>)(function != null ? function.apply(buf) : null); } diff --git a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java -index 00c170a16a57f41f881c6b282cba474ce485b34c..137b9a088c82ce6813bf8a80468675bb4992ce53 100644 +index 421dd76816063d56ea80339b77531729edd6aa55..1523d69b7b332f0085f40310a94d406da6513edc 100644 --- a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java +++ b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java @@ -39,6 +39,12 @@ public class Varint21FrameDecoder extends ByteToMessageDecoder { diff --git a/patches/server/0409-Fix-some-rails-connecting-improperly.patch b/patches/server/0409-Fix-some-rails-connecting-improperly.patch index 85d4d5d18d..e75b5f296c 100644 --- a/patches/server/0409-Fix-some-rails-connecting-improperly.patch +++ b/patches/server/0409-Fix-some-rails-connecting-improperly.patch @@ -5,17 +5,17 @@ Subject: [PATCH] Fix some rails connecting improperly diff --git a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java -index d8dd9f26fe4344541d0544e35bbc66c5d567a80b..6bd4e4d173f34e0234f4474e49ce2d897f85386f 100644 +index 0483ff1b10bc733ffbfe75ef3a2527c3fed90b8a..b62d77c9aa44447de698ffacf26e0b821c7e11c3 100644 --- a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java @@ -68,6 +68,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl - state = this.updateDir(world, pos, state, true); + BlockState var5 = this.updateDir(world, pos, state, true); if (this.isStraight) { - world.neighborChanged(state, pos, this, pos, notify); -+ state = world.getBlockState(pos); // Paper - Fix some rails connecting improperly + world.neighborChanged(var5, pos, this, pos, notify); ++ var5 = world.getBlockState(pos); // Paper - Fix some rails connecting improperly } - return state; + return var5; diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java index 41452abc7b761858ff2f3ff6a833b09c16fded4f..17242c24d73c9ffb1c976a45925f85d1aa9e96b3 100644 --- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java @@ -29,7 +29,7 @@ index 41452abc7b761858ff2f3ff6a833b09c16fded4f..17242c24d73c9ffb1c976a45925f85d1 boolean flag1 = false; List<AbstractMinecart> list = this.getInteractingMinecartOfType(world, pos, AbstractMinecart.class, (entity) -> { diff --git a/src/main/java/net/minecraft/world/level/block/RailState.java b/src/main/java/net/minecraft/world/level/block/RailState.java -index 0cbfad97371b59de95963a09aa16f3dad7a37222..939665cbe4cce36cd64c299908a738a4d1c2140e 100644 +index 6caafa73b03ed55c95303e49735eaf3dfd34903a..aa7ebaccad8dc555d9e1dee300e75fcd968a3608 100644 --- a/src/main/java/net/minecraft/world/level/block/RailState.java +++ b/src/main/java/net/minecraft/world/level/block/RailState.java @@ -17,6 +17,12 @@ public class RailState { @@ -45,7 +45,7 @@ index 0cbfad97371b59de95963a09aa16f3dad7a37222..939665cbe4cce36cd64c299908a738a4 public RailState(Level world, BlockPos pos, BlockState state) { this.level = world; this.pos = pos; -@@ -143,6 +149,11 @@ public class RailState { +@@ -141,6 +147,11 @@ public class RailState { } private void connectTo(RailState placementHelper) { @@ -57,7 +57,7 @@ index 0cbfad97371b59de95963a09aa16f3dad7a37222..939665cbe4cce36cd64c299908a738a4 this.connections.add(placementHelper.pos); BlockPos blockPos = this.pos.north(); BlockPos blockPos2 = this.pos.south(); -@@ -333,10 +344,15 @@ public class RailState { +@@ -331,10 +342,15 @@ public class RailState { this.state = this.state.setValue(this.block.getShapeProperty(), railShape2); if (forceUpdate || this.level.getBlockState(this.pos) != this.state) { this.level.setBlock(this.pos, this.state, 3); @@ -67,14 +67,14 @@ index 0cbfad97371b59de95963a09aa16f3dad7a37222..939665cbe4cce36cd64c299908a738a4 + } + // Paper end - Fix some rails connecting improperly - for(int i = 0; i < this.connections.size(); ++i) { + for (int i = 0; i < this.connections.size(); i++) { RailState railState = this.getRail(this.connections.get(i)); - if (railState != null) { + if (railState != null && railState.isValid()) { // Paper - Fix some rails connecting improperly railState.removeSoftConnections(); if (railState.canConnectTo(this)) { railState.connectTo(this); -@@ -349,6 +365,6 @@ public class RailState { +@@ -347,6 +363,6 @@ public class RailState { } public BlockState getState() { diff --git a/patches/server/0411-Brand-support.patch b/patches/server/0411-Brand-support.patch index bccbce58fe..bc78c3b986 100644 --- a/patches/server/0411-Brand-support.patch +++ b/patches/server/0411-Brand-support.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Brand support diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 966b86a2b26a32aad2656d1f2beb6daf5b81b3b1..587cce4d3878bc5cba5f4f4e58eacce2f656e242 100644 +index 8729fb23a7d7700fbccba03d07382091134c6549..7c7e3d541733ea1784f8b90acbc8b1aecb6d7859 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -273,6 +273,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0424-Add-methods-to-get-translation-keys.patch b/patches/server/0424-Add-methods-to-get-translation-keys.patch index d602369647..26a527c94e 100644 --- a/patches/server/0424-Add-methods-to-get-translation-keys.patch +++ b/patches/server/0424-Add-methods-to-get-translation-keys.patch @@ -25,7 +25,7 @@ index f041b5d80bff9c022b007e04ef1558e9116acc6b..a586442422a2b2c06b785af0d261d3e1 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java -index f0f7fb977edb7e7009716429f007e44fa36bfcda..7aa4035a4df1ddcc71065034eafd569ca59be810 100644 +index f24b4732db849893fd870b4b6a49f1c4b3eacdec..3feaaca5aaee12e48fa2e5f5d05329c9980b161e 100644 --- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java @@ -152,6 +152,11 @@ public class CraftEnchantment extends Enchantment implements Handleable<net.mine diff --git a/patches/server/0426-Cache-block-data-strings.patch b/patches/server/0426-Cache-block-data-strings.patch index 92b4d334d6..5fc1d46b5b 100644 --- a/patches/server/0426-Cache-block-data-strings.patch +++ b/patches/server/0426-Cache-block-data-strings.patch @@ -5,7 +5,7 @@ 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 21176d6e57ae9e975b1e7de14b3364365cc1012d..47ad733022e5d17d839209e4163e8508e57b43c8 100644 +index 0c0356339abbf255a411993b9bd3e09d31cf2636..d8e528073019514077d36d7395d3056c2d8c1b83 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2068,6 +2068,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0427-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch b/patches/server/0427-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch index 8d60c2216a..d00d08bc20 100644 --- a/patches/server/0427-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch +++ b/patches/server/0427-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch @@ -69,7 +69,7 @@ index b771f954f3fccd92e15196bf542e0d3703cfb71a..41d2793e69bd664456b5e3c5891b03bd if (entity instanceof Mob) { Mob entityinsentient = (Mob) entity; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 061b7215a678c8ec563bdb9c2a8beb65061faf0e..c8033bde8976c128da832befe4225238737a992a 100644 +index 326978aedbd9cc81db2bf1d5398c1cd2ce68a866..f664fd4aa8d79e95787848b5a3e0ed7bc182fa25 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -238,7 +238,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0434-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch b/patches/server/0434-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch index ad63085c7a..404e2050ca 100644 --- a/patches/server/0434-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch +++ b/patches/server/0434-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch @@ -6,7 +6,7 @@ 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 47ad733022e5d17d839209e4163e8508e57b43c8..c2892af4e98d6a436a43fea950726cc1ca60ebda 100644 +index d8e528073019514077d36d7395d3056c2d8c1b83..99ae9628d96d6d3e42cd038eb4a0d01237cc6b1b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2151,13 +2151,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0435-Fix-Concurrency-issue-in-ShufflingList.patch b/patches/server/0435-Fix-Concurrency-issue-in-ShufflingList.patch index 36f5a879a8..2df4bc442f 100644 --- a/patches/server/0435-Fix-Concurrency-issue-in-ShufflingList.patch +++ b/patches/server/0435-Fix-Concurrency-issue-in-ShufflingList.patch @@ -7,10 +7,10 @@ if multiple threads from worldgen sort at same time, it will crash. So make a copy of the list for sorting purposes. diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java -index 419eadbe31b86b7192fd7a63268d547705e7c7ce..4b31a91a8d8a3b231e323692d0a0f7ae04dc7e89 100644 +index 93c9075a5a1fe8bc27b8cfef13f84689f75580f3..ef1e9457aa215afd0d9a0a9cda2f6b5c4ac6974f 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java -@@ -17,7 +17,7 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E> +@@ -18,7 +18,7 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E> private final Set<MemoryModuleType<?>> exitErasedMemories; private final GateBehavior.OrderPolicy orderPolicy; private final GateBehavior.RunningPolicy runningPolicy; @@ -18,9 +18,9 @@ index 419eadbe31b86b7192fd7a63268d547705e7c7ce..4b31a91a8d8a3b231e323692d0a0f7ae + private final ShufflingList<BehaviorControl<? super E>> behaviors = new ShufflingList<>(false); // Paper - Fix Concurrency issue in ShufflingList during worldgen private Behavior.Status status = Behavior.Status.STOPPED; - public GateBehavior(Map<MemoryModuleType<?>, MemoryStatus> requiredMemoryState, Set<MemoryModuleType<?>> memoriesToForgetWhenStopped, GateBehavior.OrderPolicy order, GateBehavior.RunningPolicy runMode, List<Pair<? extends BehaviorControl<? super E>, Integer>> tasks) { + public GateBehavior( diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java -index 9fb20cd00568aeea25284ea0e80fe52cb1c3eede..9d01471da0571c92a60cd57ebd22a5f0b5648fb4 100644 +index 9b1203ce731f5de84c84fab149177ae6c7a389a3..21afbc0512c650399ebde59ac5938f83ef8439e8 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java @@ -16,12 +16,25 @@ import net.minecraft.util.RandomSource; @@ -53,7 +53,7 @@ index 9fb20cd00568aeea25284ea0e80fe52cb1c3eede..9d01471da0571c92a60cd57ebd22a5f0 } public ShufflingList<U> shuffle() { -- this.entries.forEach((entry) -> { +- this.entries.forEach(entry -> { - entry.setRandom(this.random.nextFloat()); - }); - this.entries.sort(Comparator.comparingDouble(ShufflingList.WeightedEntry::getRandWeight)); diff --git a/patches/server/0440-Retain-block-place-order-when-capturing-blockstates.patch b/patches/server/0440-Retain-block-place-order-when-capturing-blockstates.patch index f568cd0d92..81ed0ec42c 100644 --- a/patches/server/0440-Retain-block-place-order-when-capturing-blockstates.patch +++ b/patches/server/0440-Retain-block-place-order-when-capturing-blockstates.patch @@ -10,7 +10,7 @@ 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 cb6c6e8c8fe744350a117f38e474ce8f5dd0a43a..1bb7cc9462cab7fbd09b944662711ae5bc5cf950 100644 +index 6d5a0aa8f8cee0897a920c2abf18efc03cad2abb..40f1b4ba266f96629b989590c7c81cd7534e93da 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -154,7 +154,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0441-Reduce-blockpos-allocation-from-pathfinding.patch b/patches/server/0441-Reduce-blockpos-allocation-from-pathfinding.patch index 8d14eb1a05..b53931f78d 100644 --- a/patches/server/0441-Reduce-blockpos-allocation-from-pathfinding.patch +++ b/patches/server/0441-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 dbb6a7d950b1a6f58a845b4d399ead6eb6d4fe14..70c7c735fdd0c1b66243915622e47eab8a57e7cc 100644 +index 5ff66dd2ff2e3027ee7f7b62d5398c965195d8ed..347cd0b7e1abbb03ee884261953da7e44ead0028 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -479,7 +479,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { +@@ -487,7 +487,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { return BlockPathTypes.DANGER_FIRE; } @@ -17,12 +17,12 @@ index dbb6a7d950b1a6f58a845b4d399ead6eb6d4fe14..70c7c735fdd0c1b66243915622e47eab return BlockPathTypes.WATER_BORDER; } -@@ -510,7 +510,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { - } else if (blockState.is(Blocks.COCOA)) { - return BlockPathTypes.COCOA; - } else if (!blockState.is(Blocks.WITHER_ROSE) && !blockState.is(Blocks.POINTED_DRIPSTONE)) { -- FluidState fluidState = world.getFluidState(pos); +@@ -520,7 +520,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { + } else if (blockState.is(Blocks.COCOA)) { + return BlockPathTypes.COCOA; + } else if (!blockState.is(Blocks.WITHER_ROSE) && !blockState.is(Blocks.POINTED_DRIPSTONE)) { +- FluidState fluidState = world.getFluidState(pos); + FluidState fluidState = blockState.getFluidState(); // Paper - Perf: Reduce blockpos allocation from pathfinding - if (fluidState.is(FluidTags.LAVA)) { - return BlockPathTypes.LAVA; - } else if (isBurningBlock(blockState)) { + if (fluidState.is(FluidTags.LAVA)) { + return BlockPathTypes.LAVA; + } else if (isBurningBlock(blockState)) { diff --git a/patches/server/0448-Fix-client-lag-on-advancement-loading.patch b/patches/server/0448-Fix-client-lag-on-advancement-loading.patch index 4882b3fd23..18483eae32 100644 --- a/patches/server/0448-Fix-client-lag-on-advancement-loading.patch +++ b/patches/server/0448-Fix-client-lag-on-advancement-loading.patch @@ -15,7 +15,7 @@ manually reload the advancement data for all players, which normally takes place as a part of the datapack reloading. diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 2bc3d9c02256269845d140764b7b1b201e38b569..14d094d9af9b76277859901db908b8a36b24986b 100644 +index f4a7da134584a065a34b4f6a8eaebfcb81b6d735..f10457466cbaaba2d3aa49a64092847f635ce752 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -334,7 +334,13 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0451-Add-API-for-quit-reason.patch b/patches/server/0451-Add-API-for-quit-reason.patch index b506a95e94..a5ab74ddf4 100644 --- a/patches/server/0451-Add-API-for-quit-reason.patch +++ b/patches/server/0451-Add-API-for-quit-reason.patch @@ -25,7 +25,7 @@ index 1113380f6f142d2faf36191aae158c747bed5bb9..ddc84de84c8a503a01e40c42fe83558a Connection.LOGGER.debug("Failed to sent packet", throwable); if (this.getSending() == PacketFlow.CLIENTBOUND) { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 587cce4d3878bc5cba5f4f4e58eacce2f656e242..6e62c5037a69468e7b4c8115a6623d48538de307 100644 +index 7c7e3d541733ea1784f8b90acbc8b1aecb6d7859..efe511fc6ab121263fe0c09763e09e0cf10a354a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -274,6 +274,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch b/patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch index dc7812a211..8e15ca096a 100644 --- a/patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch +++ b/patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch @@ -12,11 +12,11 @@ Co-authored-by: Dylan Xaldin <[email protected]> Co-authored-by: pop4959 <[email protected]> diff --git a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java -index fac92f37c32e0398ebc05d9a0378446fcabaef1a..01b60aaf484e1e327ca42d3573fd86d2abd749fa 100644 +index 61fcd3fc7b0990388a1bdde1b6c7f8a608520eeb..b1a80220d967fcce451a003029ff61e1f72881f2 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java +++ b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java -@@ -490,6 +490,16 @@ public final class DensityFunctions { - public static final KeyDispatchDataCodec<DensityFunctions.EndIslandDensityFunction> CODEC = KeyDispatchDataCodec.of(MapCodec.unit(new DensityFunctions.EndIslandDensityFunction(0L))); +@@ -513,6 +513,16 @@ public final class DensityFunctions { + ); private static final float ISLAND_THRESHOLD = -0.9F; private final SimplexNoise islandNoise; + // Paper start - Perf: Optimize end generation @@ -32,16 +32,16 @@ index fac92f37c32e0398ebc05d9a0378446fcabaef1a..01b60aaf484e1e327ca42d3573fd86d2 public EndIslandDensityFunction(long seed) { RandomSource randomSource = new LegacyRandomSource(seed); -@@ -505,12 +515,26 @@ public final class DensityFunctions { +@@ -528,12 +538,26 @@ public final class DensityFunctions { float f = 100.0F - Mth.sqrt((long) x * (long) x + (long) z * (long) z) * 8.0F; // Paper - cast ints to long to avoid integer overflow - f = Mth.clamp(f, -100.0F, 80.0F); + float var18 = Mth.clamp(f, -100.0F, 80.0F); + NoiseCache cache = noiseCache.get().computeIfAbsent(sampler, noiseKey -> new NoiseCache()); // Paper - Perf: Optimize end generation - for(int m = -12; m <= 12; ++m) { - for(int n = -12; n <= 12; ++n) { + for (int m = -12; m <= 12; m++) { + for (int n = -12; n <= 12; n++) { long o = (long)(i + m); long p = (long)(j + n); -- if (o * o + p * p > 4096L && sampler.getValue((double)o, (double)p) < (double)-0.9F) { +- if (o * o + p * p > 4096L && sampler.getValue((double)o, (double)p) < -0.9F) { - float g = (Mth.abs((float)o) * 3439.0F + Mth.abs((float)p) * 147.0F) % 13.0F + 9.0F; + // Paper start - Perf: Optimize end generation by using a noise cache + long key = net.minecraft.world.level.ChunkPos.asLong((int) o, (int) p); @@ -50,8 +50,8 @@ index fac92f37c32e0398ebc05d9a0378446fcabaef1a..01b60aaf484e1e327ca42d3573fd86d2 + if (cache.keys[index] == key) { + g = cache.values[index]; + } else { -+ if (o * o + p * p > 4096L && sampler.getValue((double)o, (double)p) < (double)-0.9F) { -+ g = (Mth.abs((float) o) * 3439.0F + Mth.abs((float) p) * 147.0F) % 13.0F + 9.0F; ++ if (o * o + p * p > 4096L && sampler.getValue((double)o, (double)p) < -0.9F) { ++ g = (Mth.abs((float)o) * 3439.0F + Mth.abs((float)p) * 147.0F) % 13.0F + 9.0F; + } + cache.keys[index] = key; + cache.values[index] = g; diff --git a/patches/server/0460-Climbing-should-not-bypass-cramming-gamerule.patch b/patches/server/0460-Climbing-should-not-bypass-cramming-gamerule.patch index 6d2f4c2108..290c73d192 100644 --- a/patches/server/0460-Climbing-should-not-bypass-cramming-gamerule.patch +++ b/patches/server/0460-Climbing-should-not-bypass-cramming-gamerule.patch @@ -44,7 +44,7 @@ index ee4495b67c46cf1282cdd6ad15b224b0b7b10bfb..e382a29b441b656f35bc24cb90f95cb4 } 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 4aad2d99148a0d6ee06049f20de2aaa6218c1d39..87fb0fe5579ba09534e379d34b134c868e838143 100644 +index b98f82b619a1932e6d820a2c42120efdc03fc839..ed32b3f1107210d56e5653b2d5eddcf1deb39dfc 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3447,7 +3447,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0462-Add-PlayerShearBlockEvent.patch b/patches/server/0462-Add-PlayerShearBlockEvent.patch index 140bb100a4..5c56301158 100644 --- a/patches/server/0462-Add-PlayerShearBlockEvent.patch +++ b/patches/server/0462-Add-PlayerShearBlockEvent.patch @@ -39,10 +39,10 @@ index 44e72176a0da08a77fa192ee31c0fcd53f0dc22d..27f1c1ac12251f1438ee8bf14f4afb5f entityhuman1.broadcastBreakEvent(hand); }); diff --git a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java -index df11efd22682c2ed799dabf15d2cfa5973e8dca9..cc13b74fa37b5df6fe6f1423496b9fb03d71d083 100644 +index e2e13874bf41178228d0414ea51167cd6aa23053..88dfa1eb8b4c588aafffed7b8e8b68e0bae28f4b 100644 --- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java -@@ -35,13 +35,24 @@ public class PumpkinBlock extends Block { +@@ -35,16 +35,24 @@ public class PumpkinBlock extends Block { ItemStack itemStack = player.getItemInHand(hand); if (itemStack.is(Items.SHEARS)) { if (!world.isClientSide) { @@ -55,16 +55,24 @@ index df11efd22682c2ed799dabf15d2cfa5973e8dca9..cc13b74fa37b5df6fe6f1423496b9fb0 + // Paper end - Add PlayerShearBlockEvent Direction direction = hit.getDirection(); Direction direction2 = direction.getAxis() == Direction.Axis.Y ? player.getDirection().getOpposite() : direction; - world.playSound((Player)null, pos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F); + world.playSound(null, pos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F); world.setBlock(pos, Blocks.CARVED_PUMPKIN.defaultBlockState().setValue(CarvedPumpkinBlock.FACING, direction2), 11); -- ItemEntity itemEntity = new ItemEntity(world, (double)pos.getX() + 0.5D + (double)direction2.getStepX() * 0.65D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D + (double)direction2.getStepZ() * 0.65D, new ItemStack(Items.PUMPKIN_SEEDS, 4)); -+ // Paper start - Add PlayerShearBlockEvent -+ for (org.bukkit.inventory.ItemStack item : event.getDrops()) { -+ ItemEntity itemEntity = new ItemEntity(world, (double) pos.getX() + 0.5D + (double) direction2.getStepX() * 0.65D, (double) pos.getY() + 0.1D, (double) pos.getZ() + 0.5D + (double) direction2.getStepZ() * 0.65D, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item)); -+ // Paper end - Add PlayerShearBlockEvent - itemEntity.setDeltaMovement(0.05D * (double)direction2.getStepX() + world.random.nextDouble() * 0.02D, 0.05D, 0.05D * (double)direction2.getStepZ() + world.random.nextDouble() * 0.02D); ++ for (org.bukkit.inventory.ItemStack item : event.getDrops()) { // Paper - Add PlayerShearBlockEvent + ItemEntity itemEntity = new ItemEntity( + world, + (double)pos.getX() + 0.5 + (double)direction2.getStepX() * 0.65, + (double)pos.getY() + 0.1, + (double)pos.getZ() + 0.5 + (double)direction2.getStepZ() * 0.65, +- new ItemStack(Items.PUMPKIN_SEEDS, 4) ++ org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item) // Paper - Add PlayerShearBlockEvent + ); + itemEntity.setDeltaMovement( + 0.05 * (double)direction2.getStepX() + world.random.nextDouble() * 0.02, +@@ -52,6 +60,7 @@ public class PumpkinBlock extends Block { + 0.05 * (double)direction2.getStepZ() + world.random.nextDouble() * 0.02 + ); world.addFreshEntity(itemEntity); + } // Paper - Add PlayerShearBlockEvent - itemStack.hurtAndBreak(1, player, (playerx) -> { + itemStack.hurtAndBreak(1, player, playerx -> { playerx.broadcastBreakEvent(hand); }); diff --git a/patches/server/0465-Player-Chunk-Load-Unload-Events.patch b/patches/server/0465-Player-Chunk-Load-Unload-Events.patch index 241610bb61..638b4ea18b 100644 --- a/patches/server/0465-Player-Chunk-Load-Unload-Events.patch +++ b/patches/server/0465-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/network/PlayerChunkSender.java b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -index c509a1318bcef38fd4927e38b6ee9846853e2d15..13209267c26f46492a92e820889a9be0bd2287a0 100644 +index 8235d66bb1246f4bb3425d2127b5fe67e4e7eec6..b7778d5296d01870e37560d8f03d48e4a4dd62ae 100644 --- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java +++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -@@ -45,6 +45,11 @@ public class PlayerChunkSender { +@@ -44,6 +44,11 @@ public class PlayerChunkSender { public void dropChunk(ServerPlayer player, ChunkPos pos) { if (!this.pendingChunks.remove(pos.toLong()) && player.isAlive()) { player.connection.send(new ClientboundForgetLevelChunkPacket(pos)); @@ -18,12 +18,12 @@ index c509a1318bcef38fd4927e38b6ee9846853e2d15..13209267c26f46492a92e820889a9be0 + } + // Paper end - PlayerChunkUnloadEvent } - } -@@ -77,6 +82,11 @@ public class PlayerChunkSender { + +@@ -75,6 +80,11 @@ public class PlayerChunkSender { private static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { - handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null)); + handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null)); + // Paper start - PlayerChunkLoadEvent + if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) { + new io.papermc.paper.event.packet.PlayerChunkLoadEvent(new org.bukkit.craftbukkit.CraftChunk(chunk), handler.getPlayer().getBukkitEntity()).callEvent(); diff --git a/patches/server/0470-Add-TargetHitEvent.patch b/patches/server/0470-Add-TargetHitEvent.patch index f623f8091b..2afe7f45de 100644 --- a/patches/server/0470-Add-TargetHitEvent.patch +++ b/patches/server/0470-Add-TargetHitEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add TargetHitEvent diff --git a/src/main/java/net/minecraft/world/level/block/TargetBlock.java b/src/main/java/net/minecraft/world/level/block/TargetBlock.java -index 5ea231aadfafdfc6d08aae472827ff1e3d62f4eb..e885f8defd5fd5059c895ee7906664f9e4561de0 100644 +index 02f6d5b523c3d4185a68adb419b2710768ed249f..da473a8b34e39cecf63fab8f7c4f77d485e5753b 100644 --- a/src/main/java/net/minecraft/world/level/block/TargetBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TargetBlock.java @@ -42,6 +42,10 @@ public class TargetBlock extends Block { @@ -16,10 +16,10 @@ index 5ea231aadfafdfc6d08aae472827ff1e3d62f4eb..e885f8defd5fd5059c895ee7906664f9 + } + private static void awardTargetHitCriteria(Projectile projectile, BlockHitResult hit, int i) { + // Paper end - Add TargetHitEvent - Entity entity = projectile.getOwner(); - if (entity instanceof ServerPlayer serverPlayer) { + if (projectile.getOwner() instanceof ServerPlayer serverPlayer) { serverPlayer.awardStat(Stats.TARGET_HIT); -@@ -53,6 +57,20 @@ public class TargetBlock extends Block { + CriteriaTriggers.TARGET_BLOCK_HIT.trigger(serverPlayer, projectile, hit.getLocation(), i); +@@ -51,6 +55,20 @@ public class TargetBlock extends Block { private static int updateRedstoneOutput(LevelAccessor world, BlockState state, BlockHitResult hitResult, Entity entity) { int i = getRedstoneStrength(hitResult, hitResult.getLocation()); int j = entity instanceof AbstractArrow ? 20 : 8; diff --git a/patches/server/0471-MC-4-Fix-item-position-desync.patch b/patches/server/0471-MC-4-Fix-item-position-desync.patch index 5b680e0dd0..8a363ed41a 100644 --- a/patches/server/0471-MC-4-Fix-item-position-desync.patch +++ b/patches/server/0471-MC-4-Fix-item-position-desync.patch @@ -9,26 +9,26 @@ loss, which forces the server to lose the same precision as the client keeping them in sync. diff --git a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java -index 05ac41e136da43284fb24a6b698ebd36318278fb..3c4ac79c094dc2fff7de94150a34b7bf814ac0de 100644 +index ffec3deb9bcd31d51974c1deda2e76bc8374e5c5..baacaa8fcefdee3c7eeebae1d3a365553e2dbac6 100644 --- a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java +++ b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java @@ -9,12 +9,12 @@ public class VecDeltaCodec { @VisibleForTesting static long encode(double value) { -- return Math.round(value * 4096.0D); -+ return Math.round(value * 4096.0D); // Paper - Fix MC-4; diff on change +- return Math.round(value * 4096.0); ++ return Math.round(value * 4096.0); // Paper - Fix MC-4; diff on change } @VisibleForTesting static double decode(long value) { -- return (double)value / 4096.0D; -+ return (double)value / 4096.0D; // Paper - Fix MC-4; diff on change +- return (double)value / 4096.0; ++ return (double)value / 4096.0; // Paper - Fix MC-4; diff on change } public Vec3 decode(long x, long y, long z) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 82ccfd91dfd3cce35a35edf8f73ccdd1ddd1fd6a..18cf11ddcf51e8b6251fd6df97f85e0ed15900c4 100644 +index 82ccfd91dfd3cce35a35edf8f73ccdd1ddd1fd6a..c3ca11cc4abe85132b099af1cb27772dbf40bfe1 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -4186,6 +4186,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -39,9 +39,9 @@ index 82ccfd91dfd3cce35a35edf8f73ccdd1ddd1fd6a..18cf11ddcf51e8b6251fd6df97f85e0e + if (this instanceof ItemEntity) { + if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.fixEntityPositionDesync) { + // encode/decode from ClientboundMoveEntityPacket -+ x = Mth.lfloor(x * 4096.0D) * (1 / 4096.0D); -+ y = Mth.lfloor(y * 4096.0D) * (1 / 4096.0D); -+ z = Mth.lfloor(z * 4096.0D) * (1 / 4096.0D); ++ x = Mth.lfloor(x * 4096.0) * (1 / 4096.0); ++ y = Mth.lfloor(y * 4096.0) * (1 / 4096.0); ++ z = Mth.lfloor(z * 4096.0) * (1 / 4096.0); + } + } + // Paper end - Fix MC-4 diff --git a/patches/server/0478-Add-PlayerFlowerPotManipulateEvent.patch b/patches/server/0478-Add-PlayerFlowerPotManipulateEvent.patch index bad384da72..dedc31d955 100644 --- a/patches/server/0478-Add-PlayerFlowerPotManipulateEvent.patch +++ b/patches/server/0478-Add-PlayerFlowerPotManipulateEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerFlowerPotManipulateEvent diff --git a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java -index c450faf8c043665eab020141f3c27e3d9890cb86..fbe399fa2c27ba283e4a51f9a2559baf86fdff11 100644 +index ba0cdfb946678bdd96ec065f2ada956addccf610..cadfd0ec0fb04ac817601cbef6230b10b6b1af35 100644 --- a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java -@@ -66,6 +66,21 @@ public class FlowerPotBlock extends Block { +@@ -67,6 +67,21 @@ public class FlowerPotBlock extends Block { boolean bl = blockState.is(Blocks.AIR); boolean bl2 = this.isEmpty(); if (bl != bl2) { diff --git a/patches/server/0484-Add-ServerResourcesReloadedEvent.patch b/patches/server/0484-Add-ServerResourcesReloadedEvent.patch index b01f7c1460..9d87b0e24f 100644 --- a/patches/server/0484-Add-ServerResourcesReloadedEvent.patch +++ b/patches/server/0484-Add-ServerResourcesReloadedEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add ServerResourcesReloadedEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c2892af4e98d6a436a43fea950726cc1ca60ebda..06b7816bafa3ac1093b796ca6e7bb3462df8bfec 100644 +index 99ae9628d96d6d3e42cd038eb4a0d01237cc6b1b..46cc2649ca482bd2bda37247717d8476dbb76a34 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2036,7 +2036,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0489-Configurable-door-breaking-difficulty.patch b/patches/server/0489-Configurable-door-breaking-difficulty.patch index c0ec74016c..ce0156aaf0 100644 --- a/patches/server/0489-Configurable-door-breaking-difficulty.patch +++ b/patches/server/0489-Configurable-door-breaking-difficulty.patch @@ -10,10 +10,10 @@ public net.minecraft.world.entity.monster.Zombie DOOR_BREAKING_PREDICATE Co-authored-by: Doc <[email protected]> diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -index 9fec5823d99d1ae8e41d9e21f7ddb8b8e94bf887..a6af5ac9d09834940d3dd4c80b16450b90484edb 100644 +index 42a12615451f9ea9df683a088df42dc41c8a7ebb..a72c29e3e04c3d649bc5cc2637be1a4ed5ec525c 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java +++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -@@ -197,7 +197,7 @@ public class Vindicator extends AbstractIllager { +@@ -198,7 +198,7 @@ public class Vindicator extends AbstractIllager { static class VindicatorBreakDoorGoal extends BreakDoorGoal { public VindicatorBreakDoorGoal(Mob mob) { diff --git a/patches/server/0496-Collision-option-for-requiring-a-player-participant.patch b/patches/server/0496-Collision-option-for-requiring-a-player-participant.patch index 176ae99bc8..27be6dda95 100644 --- a/patches/server/0496-Collision-option-for-requiring-a-player-participant.patch +++ b/patches/server/0496-Collision-option-for-requiring-a-player-participant.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Collision option for requiring a player participant diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 18cf11ddcf51e8b6251fd6df97f85e0ed15900c4..2d8c476eb9f329ee6827340b6cec26a84901c56a 100644 +index c3ca11cc4abe85132b099af1cb27772dbf40bfe1..5b0502cfcc3d9317941d7444750a49832e1a52a1 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1848,6 +1848,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0506-Reset-shield-blocking-on-dimension-change.patch b/patches/server/0506-Reset-shield-blocking-on-dimension-change.patch index b59a53ac0f..e29d07bebd 100644 --- a/patches/server/0506-Reset-shield-blocking-on-dimension-change.patch +++ b/patches/server/0506-Reset-shield-blocking-on-dimension-change.patch @@ -5,7 +5,7 @@ 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 6e62c5037a69468e7b4c8115a6623d48538de307..8c65b05e66372cf3c92f823d72e94c18fe77622b 100644 +index efe511fc6ab121263fe0c09763e09e0cf10a354a..19baf0ecd04ae058fac709889db34bf27679ab5e 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1198,6 +1198,11 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0508-Add-EntityMoveEvent.patch b/patches/server/0508-Add-EntityMoveEvent.patch index 54dd0d6264..dd7d2720c2 100644 --- a/patches/server/0508-Add-EntityMoveEvent.patch +++ b/patches/server/0508-Add-EntityMoveEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityMoveEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 06b7816bafa3ac1093b796ca6e7bb3462df8bfec..3f061e1135bac08e6ea1530407ff2667904339a5 100644 +index 46cc2649ca482bd2bda37247717d8476dbb76a34..4416feb73fd800787db65f5841eb92b1b29cddb0 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1526,6 +1526,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -29,7 +29,7 @@ index a2113c01d8ea3da13efbf4f0b23460e7fa4e8c68..125e3425af05541e5c848ee0e9390cea public LevelChunk getChunkIfLoaded(int x, int z) { return this.chunkSource.getChunk(x, z, false); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 87fb0fe5579ba09534e379d34b134c868e838143..26ac98e0dbcac5d20a013cc1b8f5d70133e23154 100644 +index ed32b3f1107210d56e5653b2d5eddcf1deb39dfc..d19a0733fe257eb66a02e263d4e053939f7ec978 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3382,6 +3382,20 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0510-Inline-shift-direction-fields.patch b/patches/server/0510-Inline-shift-direction-fields.patch index 4f26750f0e..832d9f67e8 100644 --- a/patches/server/0510-Inline-shift-direction-fields.patch +++ b/patches/server/0510-Inline-shift-direction-fields.patch @@ -7,13 +7,13 @@ Removes a layer of indirection for EnumDirection.getAdjacent(X|Y|Z)(), which is critical section for much of the server, including the lighting engine. diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java -index 3abec6de94f0ef1d788320e33653c598887f17ca..073c717bb676b9e99aada00c349fb7eee91df1e7 100644 +index 60867bd1c64aba844aa7b5d4f9577607be9cc8e5..83a2b952df749b7aaab439db4ec2d38bc4f5b11c 100644 --- a/src/main/java/net/minecraft/core/Direction.java +++ b/src/main/java/net/minecraft/core/Direction.java -@@ -52,6 +52,11 @@ public enum Direction implements StringRepresentable { - })).toArray((i) -> { - return new Direction[i]; - }); +@@ -48,6 +48,11 @@ public enum Direction implements StringRepresentable { + }).sorted(Comparator.comparingInt(direction -> { + return direction.data2d; + })).toArray(Direction[]::new); + // Paper start - Perf: Inline shift direction fields + private final int adjX; + private final int adjY; @@ -22,7 +22,7 @@ index 3abec6de94f0ef1d788320e33653c598887f17ca..073c717bb676b9e99aada00c349fb7ee private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) { this.data3d = id; -@@ -61,6 +66,11 @@ public enum Direction implements StringRepresentable { +@@ -57,6 +62,11 @@ public enum Direction implements StringRepresentable { this.axis = axis; this.axisDirection = direction; this.normal = vector; @@ -34,7 +34,7 @@ index 3abec6de94f0ef1d788320e33653c598887f17ca..073c717bb676b9e99aada00c349fb7ee } public static Direction[] orderedByNearest(Entity entity) { -@@ -348,15 +358,15 @@ public enum Direction implements StringRepresentable { +@@ -220,15 +230,15 @@ public enum Direction implements StringRepresentable { } public int getStepX() { diff --git a/patches/server/0513-living-entity-allow-attribute-registration.patch b/patches/server/0513-living-entity-allow-attribute-registration.patch index b04ce69eb9..154aa1be98 100644 --- a/patches/server/0513-living-entity-allow-attribute-registration.patch +++ b/patches/server/0513-living-entity-allow-attribute-registration.patch @@ -5,12 +5,12 @@ Subject: [PATCH] living entity allow attribute registration diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java -index d5dfb08f550f5644ff5164170d6c16a3b25a3748..897d7632ecfea40890433474870dd7a5e534d8ab 100644 +index a88404f5b7b86692da43a1b64c352b9f9e041238..3ca7909fa233d440dbaa57c05954188687308ecc 100644 --- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java -@@ -152,4 +152,12 @@ public class AttributeMap { +@@ -146,4 +146,12 @@ public class AttributeMap { + }); } - } + + // Paper - start - living entity allow attribute registration @@ -38,7 +38,7 @@ index ea48f1119a940056c37d1d203437bfbfdf13663b..8a678df56fcf30535957e111d81ad07b + // Paper end - living entity allow attribute registration } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 6ee15dee09d3e727df01564282ba5eb6450db51b..7b65a7d1efaf90d1a2b7a601f94be4d9ebe76a2b 100644 +index 4ac52885618bf062eb34672b8fc60331a9c8f76a..0a4df9971c66676dba90fb03c840e25a41103bc0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -755,6 +755,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0517-Improve-ServerGUI.patch b/patches/server/0517-Improve-ServerGUI.patch index ea0b4bbc77..f626efff64 100644 --- a/patches/server/0517-Improve-ServerGUI.patch +++ b/patches/server/0517-Improve-ServerGUI.patch @@ -58,10 +58,10 @@ index 2bbc57b4869caf690f53618d60359c5133ec62a8..c42a9949c4d37d45883867a54222a7ab public void windowClosing(WindowEvent windowevent) { if (!servergui.isClosing.getAndSet(true)) { diff --git a/src/main/java/net/minecraft/server/gui/StatsComponent.java b/src/main/java/net/minecraft/server/gui/StatsComponent.java -index 7938029cb7aa6f09f78fb1c648357c36edb68510..38fe7e5014332f45e41a3d5d91c28dd0acfdc3b0 100644 +index 28cf84d136275d67dd5107dc282f4320a5ae8b1d..8994bf9abb79d958e8928b94e75b3fa30ed9d5cc 100644 --- a/src/main/java/net/minecraft/server/gui/StatsComponent.java +++ b/src/main/java/net/minecraft/server/gui/StatsComponent.java -@@ -36,8 +36,17 @@ public class StatsComponent extends JComponent { +@@ -36,10 +36,19 @@ public class StatsComponent extends JComponent { private void tick() { long l = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); @@ -73,13 +73,15 @@ index 7938029cb7aa6f09f78fb1c648357c36edb68510..38fe7e5014332f45e41a3d5d91c28dd0 + tpsAvg[g] = format( tps[g] ); + } this.msgs[0] = "Memory use: " + l / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)"; - this.msgs[1] = "Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / (double)TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms"; + this.msgs[1] = "Avg tick: " + + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / (double)TimeUtil.NANOSECONDS_PER_MILLISECOND) + + " ms"; + this.msgs[2] = "TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg); + // Paper end - Improve ServerGUI - this.values[this.vp++ & 255] = (int)(l * 100L / Runtime.getRuntime().maxMemory()); + this.values[this.vp++ & 0xFF] = (int)(l * 100L / Runtime.getRuntime().maxMemory()); this.repaint(); } -@@ -67,4 +76,10 @@ public class StatsComponent extends JComponent { +@@ -68,4 +77,10 @@ public class StatsComponent extends JComponent { public void close() { this.timer.stop(); } diff --git a/patches/server/0518-fix-converting-txt-to-json-file.patch b/patches/server/0518-fix-converting-txt-to-json-file.patch index 5f13006cc4..cd8921cdba 100644 --- a/patches/server/0518-fix-converting-txt-to-json-file.patch +++ b/patches/server/0518-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 a20d47f54f12dfc0a5f76dd969238e34c958b618..1c9cf5e1c4ee05724ffcdbd77a19bca1ab2be4d3 100644 +index 929f59bce01c8e6ed4b0b551744d42e131b8fc80..22c4f8dea99f92a1eb3da2baf0a15bf9d2ca0462 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java @@ -18,6 +18,11 @@ public class DedicatedPlayerList extends PlayerList { diff --git a/patches/server/0526-Add-fast-alternative-constructor-for-Rotations.patch b/patches/server/0526-Add-fast-alternative-constructor-for-Rotations.patch index 9b38f8f90d..7c07d6c0ee 100644 --- a/patches/server/0526-Add-fast-alternative-constructor-for-Rotations.patch +++ b/patches/server/0526-Add-fast-alternative-constructor-for-Rotations.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add fast alternative constructor for Rotations diff --git a/src/main/java/net/minecraft/core/Rotations.java b/src/main/java/net/minecraft/core/Rotations.java -index e4b4e78de933b93be87805501d9cbfec429cf68c..95ef904bebeaff3275f25c401ef13c68504f3514 100644 +index 63a6512437a3611f73573f9fc97d4f32fb8be861..d6f1002d0f5760383edd641165f6622f8d6672c2 100644 --- a/src/main/java/net/minecraft/core/Rotations.java +++ b/src/main/java/net/minecraft/core/Rotations.java @@ -19,6 +19,18 @@ public class Rotations { diff --git a/patches/server/0529-forced-whitelist-use-configurable-kick-message.patch b/patches/server/0529-forced-whitelist-use-configurable-kick-message.patch index 48f96930a9..97e28a74cf 100644 --- a/patches/server/0529-forced-whitelist-use-configurable-kick-message.patch +++ b/patches/server/0529-forced-whitelist-use-configurable-kick-message.patch @@ -5,7 +5,7 @@ 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 3f061e1135bac08e6ea1530407ff2667904339a5..773e4850956a7ffcd78cc241a598fd13bcfe1d20 100644 +index 4416feb73fd800787db65f5841eb92b1b29cddb0..c9545f96317fd6692889d82851d76084efa6a61d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2167,7 +2167,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0533-Fix-PlayerItemConsumeEvent-cancelling-properly.patch b/patches/server/0533-Fix-PlayerItemConsumeEvent-cancelling-properly.patch index 23fd145ca7..a644ea6fc4 100644 --- a/patches/server/0533-Fix-PlayerItemConsumeEvent-cancelling-properly.patch +++ b/patches/server/0533-Fix-PlayerItemConsumeEvent-cancelling-properly.patch @@ -9,7 +9,7 @@ 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 26ac98e0dbcac5d20a013cc1b8f5d70133e23154..dad6481439c54567fd6135b39c9209e74a3acba0 100644 +index d19a0733fe257eb66a02e263d4e053939f7ec978..687f379a811ba46cb3cddda33a62039b3b329cb3 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3880,6 +3880,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0557-Expand-PlayerGameModeChangeEvent.patch b/patches/server/0557-Expand-PlayerGameModeChangeEvent.patch index 12c30b462b..72428d5c8f 100644 --- a/patches/server/0557-Expand-PlayerGameModeChangeEvent.patch +++ b/patches/server/0557-Expand-PlayerGameModeChangeEvent.patch @@ -5,39 +5,39 @@ Subject: [PATCH] Expand PlayerGameModeChangeEvent diff --git a/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java b/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java -index 50e581613156cca765dfd8e3596dcb3b58520cec..21d6a2a5d1722d44146384c28a3cba2df9b42771 100644 +index 698db6fc0e1088bb80bf277bf14719cad6b68055..ec813a8a0f7e48ce93bf9d254c68ddd56b0a6737 100644 --- a/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java +++ b/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java @@ -25,9 +25,13 @@ public class DefaultGameModeCommands { GameType gameType = minecraftServer.getForcedGameType(); if (gameType != null) { - for(ServerPlayer serverPlayer : minecraftServer.getPlayerList().getPlayers()) { + for (ServerPlayer serverPlayer : minecraftServer.getPlayerList().getPlayers()) { - if (serverPlayer.setGameMode(gameType)) { -- ++i; +- i++; + // Paper start - Expand PlayerGameModeChangeEvent + org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameType, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, net.kyori.adventure.text.Component.empty()); + if (event != null && event.isCancelled()) { + source.sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false); } + // Paper end - Expand PlayerGameModeChangeEvent -+ ++i; ++ i++; } } diff --git a/src/main/java/net/minecraft/server/commands/GameModeCommand.java b/src/main/java/net/minecraft/server/commands/GameModeCommand.java -index aee8618e27b893b72931e925724dd683d2e6d2aa..f7c9127346261d83413ca03a1cdaa84975ae17d6 100644 +index f5be3b762b096540952421c52e4bd23c2d31b917..b1cbf365125b4db64b46a1f834b6d93808cbd709 100644 --- a/src/main/java/net/minecraft/server/commands/GameModeCommand.java +++ b/src/main/java/net/minecraft/server/commands/GameModeCommand.java -@@ -48,9 +48,14 @@ public class GameModeCommand { +@@ -63,9 +63,14 @@ public class GameModeCommand { int i = 0; - for(ServerPlayer serverPlayer : targets) { + for (ServerPlayer serverPlayer : targets) { - if (serverPlayer.setGameMode(gameMode)) { + // Paper start - Expand PlayerGameModeChangeEvent + org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.COMMAND, net.kyori.adventure.text.Component.empty()); + if (event != null && !event.isCancelled()) { logGamemodeChange(context.getSource(), serverPlayer, gameMode); - ++i; + i++; + } else if (event != null && event.cancelMessage() != null) { + context.getSource().sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true); + // Paper end - Expand PlayerGameModeChangeEvent @@ -45,7 +45,7 @@ index aee8618e27b893b72931e925724dd683d2e6d2aa..f7c9127346261d83413ca03a1cdaa849 } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8c65b05e66372cf3c92f823d72e94c18fe77622b..a09ef51e94a0bf9f51bf358e7cf77dd5d272aab2 100644 +index 19baf0ecd04ae058fac709889db34bf27679ab5e..28baa63b9b750a7f03da364d9c1fe691d3ce1706 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1940,8 +1940,16 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0564-Add-EntityInsideBlockEvent.patch b/patches/server/0564-Add-EntityInsideBlockEvent.patch index a63f8ecbfe..32ac5315b3 100644 --- a/patches/server/0564-Add-EntityInsideBlockEvent.patch +++ b/patches/server/0564-Add-EntityInsideBlockEvent.patch @@ -41,7 +41,7 @@ index 546dbe28edbba32ab2aede1260fbd2c9baa9fe1a..0d92bd6f1e4f3470a62f573add349022 if (state.getValue(BigDripleafBlock.TILT) == Tilt.NONE && BigDripleafBlock.canEntityTilt(pos, entity) && !world.hasNeighborSignal(pos)) { // CraftBukkit start - tilt dripleaf diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java -index 240e01063b5d684020ed2d7d73fc60c64fd8cf2e..78d98a442ea3c14500ac6ae597ff2a5080b7ce15 100644 +index e4e80844ad447536c7f53bcbc721f73880414a76..addd8b3758254e4f4cd4e951cd065f83ad5dcdf8 100644 --- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java @@ -47,6 +47,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup { @@ -125,10 +125,10 @@ index 07629f6106f384751c376d2a99ba2e8b905e49c6..9ee2fd0914ff7836517ca143d51db615 ResourceKey<Level> resourcekey = world.getTypeKey() == LevelStem.END ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends ServerLevel worldserver = ((ServerLevel) world).getServer().getLevel(resourcekey); diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java -index d5c83f3b9d398b2a025e6729980b1b87b35f38a8..68978e1629381ada161225c53a236a54deae6481 100644 +index 166ed5bb0ecd66a70b970e1df77c27f2069d2808..6e283e8c3db31f03dd95c94887e647b8d82a3604 100644 --- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java -@@ -78,6 +78,7 @@ public class FrogspawnBlock extends Block { +@@ -79,6 +79,7 @@ public class FrogspawnBlock extends Block { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -137,10 +137,10 @@ index d5c83f3b9d398b2a025e6729980b1b87b35f38a8..68978e1629381ada161225c53a236a54 this.destroyBlock(world, pos); } diff --git a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java -index 8b84359316e559b94ae6a2d757bda2286d99a903..39e2fe8c5f5a2a4d4f3a7be3645923b5a1dca875 100644 +index 517bd00234892d53300d5a902fda4eed4b8bef66..409b4818840916a8ddbfc1ee87c8c22902939f38 100644 --- a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java +++ b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java -@@ -61,6 +61,7 @@ public class HoneyBlock extends HalfTransparentBlock { +@@ -60,6 +60,7 @@ public class HoneyBlock extends HalfTransparentBlock { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -149,7 +149,7 @@ index 8b84359316e559b94ae6a2d757bda2286d99a903..39e2fe8c5f5a2a4d4f3a7be3645923b5 this.maybeDoSlideAchievement(entity, pos); this.doSlideMovement(entity); diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java -index 99a5821a55f2d2947722d64d60f4ee4ba5dfa74c..04e69d6066faf1c605aeeabe827dc20fc96a3568 100644 +index 004f37120e079465aef40830d3086a820d5752c3..4f86e3d2aec246ff0be258885128086e21457a70 100644 --- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java +++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java @@ -200,6 +200,7 @@ public class HopperBlock extends BaseEntityBlock { @@ -161,7 +161,7 @@ index 99a5821a55f2d2947722d64d60f4ee4ba5dfa74c..04e69d6066faf1c605aeeabe827dc20f if (blockEntity instanceof HopperBlockEntity) { HopperBlockEntity.entityInside(world, pos, state, entity, (HopperBlockEntity)blockEntity); diff --git a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java -index 7e926a4546f89da22080ef28c3858ac7b3cf80f1..29d4553df54236706c76fdec0bb14b5d9fb82ff2 100644 +index 1e6a51f7679af81a00d9f55a926baeed80ed24d3..25b3f2550a099e9938a82f2c0ff31da4e5f23614 100644 --- a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java @@ -32,6 +32,7 @@ public class LavaCauldronBlock extends AbstractCauldronBlock { @@ -197,10 +197,10 @@ index 2a8f97d97ae7f268da920b5e3b9719743fa9a8e0..1b5cc5d6aa0b4313da980ce175c54145 // CraftBukkit start - Entity in portal EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ())); diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java -index f7154d56ad42e0dde497e0e585cc554d34865e3b..690abba9d27ab4061de4dd3676292b1859036868 100644 +index 15696602249465fa1d13eaec3b8b06574ec06f07..c9ed129db2cadd0a33d69993961f43088725c3cb 100644 --- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java -@@ -94,6 +94,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl +@@ -98,6 +98,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -257,7 +257,7 @@ index d89a4c30599cedcb8ce17899631cb58c8a6a2195..61abbcfe97e3d3e3da5ee658672549d1 // CraftBukkit start if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState())) { diff --git a/src/main/java/net/minecraft/world/level/block/WebBlock.java b/src/main/java/net/minecraft/world/level/block/WebBlock.java -index 7206dfa5bdfb94ff98bcdfc735367c22493e925e..4905de6446f07e2fff53a3c8580b64b96306c373 100644 +index 313ac5d2e2dbc9afcfcef8c97f85e56243825ab0..709d5002ad7a1004286bf2749c82e25d7f0d0133 100644 --- a/src/main/java/net/minecraft/world/level/block/WebBlock.java +++ b/src/main/java/net/minecraft/world/level/block/WebBlock.java @@ -22,6 +22,7 @@ public class WebBlock extends Block { @@ -265,7 +265,7 @@ index 7206dfa5bdfb94ff98bcdfc735367c22493e925e..4905de6446f07e2fff53a3c8580b64b9 @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - entity.makeStuckInBlock(state, new Vec3(0.25D, (double)0.05F, 0.25D)); + entity.makeStuckInBlock(state, new Vec3(0.25, 0.05F, 0.25)); } } diff --git a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java diff --git a/patches/server/0569-Add-PlayerKickEvent-causes.patch b/patches/server/0569-Add-PlayerKickEvent-causes.patch index cba228a0e1..8607264816 100644 --- a/patches/server/0569-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0569-Add-PlayerKickEvent-causes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerKickEvent causes diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java -index 96814e626a95e4e3c2f4df1a0339d37bb02f2e61..ba12919c3f9aec34a9e64993b143ae92be5eb172 100644 +index 1bb98a7e5267602bf9c37ba5041ff75d77d53e15..ec260062e5206df08425ad65573691fda262fa93 100644 --- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java +++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java -@@ -35,16 +35,16 @@ public class SignedMessageChain { +@@ -34,16 +34,16 @@ public class SignedMessageChain { return (signature, body) -> { SignedMessageLink signedMessageLink = this.advanceLink(); if (signedMessageLink == null) { @@ -22,14 +22,14 @@ index 96814e626a95e4e3c2f4df1a0339d37bb02f2e61..ba12919c3f9aec34a9e64993b143ae92 + throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.out_of_order_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes } else { this.lastTimeStamp = body.timeStamp(); - PlayerChatMessage playerChatMessage = new PlayerChatMessage(signedMessageLink, signature, body, (Component)null, FilterMask.PASS_THROUGH); + PlayerChatMessage playerChatMessage = new PlayerChatMessage(signedMessageLink, signature, body, null, FilterMask.PASS_THROUGH); if (!playerChatMessage.verify(signatureValidator)) { - throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true); + throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.UNSIGNED_CHAT); // Paper - kick event causes } else { if (playerChatMessage.hasExpiredServer(Instant.now())) { - LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", (Object)body.content()); -@@ -68,10 +68,17 @@ public class SignedMessageChain { + LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", body.content()); +@@ -67,10 +67,17 @@ public class SignedMessageChain { public static class DecodeException extends ThrowingComponent { private final boolean shouldDisconnect; @@ -48,7 +48,7 @@ index 96814e626a95e4e3c2f4df1a0339d37bb02f2e61..ba12919c3f9aec34a9e64993b143ae92 public boolean shouldDisconnect() { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 773e4850956a7ffcd78cc241a598fd13bcfe1d20..7ee46b9f98794d1fec0a8feea71fd495f9199dd0 100644 +index c9545f96317fd6692889d82851d76084efa6a61d..fdda28bd6aa3a2d3079a383157b82ff825cc992d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2167,7 +2167,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -61,23 +61,23 @@ index 773e4850956a7ffcd78cc241a598fd13bcfe1d20..7ee46b9f98794d1fec0a8feea71fd495 } diff --git a/src/main/java/net/minecraft/server/commands/BanIpCommands.java b/src/main/java/net/minecraft/server/commands/BanIpCommands.java -index 78345cf28be16b2e9bf2237ea60a3be424a8dabf..5397a5013bee9589b59c76ce5a2c00a7dc3ec262 100644 +index 33cadaac63f70384f8997a95a41462afcea9d27e..e7c2672798b5b50f25f924ca87db27fac229f820 100644 --- a/src/main/java/net/minecraft/server/commands/BanIpCommands.java +++ b/src/main/java/net/minecraft/server/commands/BanIpCommands.java -@@ -62,7 +62,7 @@ public class BanIpCommands { +@@ -61,7 +61,7 @@ public class BanIpCommands { } - for(ServerPlayer serverPlayer : list) { + for (ServerPlayer serverPlayer : list) { - serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.ip_banned")); + serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.ip_banned"), org.bukkit.event.player.PlayerKickEvent.Cause.IP_BANNED); // Paper - kick event cause } return list.size(); diff --git a/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java b/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java -index 46f45b315011d43c081fb3f004ab62f3da67036a..42c930443505e94ca91a02e65a8df86801034280 100644 +index 8b677cd8974900ef214ebbf441f6a00e88153a77..f5f73d519819e00c8377cd9cf7907704f08a2549 100644 --- a/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java +++ b/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java -@@ -43,7 +43,7 @@ public class BanPlayerCommands { +@@ -44,7 +44,7 @@ public class BanPlayerCommands { }, true); ServerPlayer serverPlayer = source.getServer().getPlayerList().getPlayer(gameProfile.getId()); if (serverPlayer != null) { @@ -87,12 +87,12 @@ index 46f45b315011d43c081fb3f004ab62f3da67036a..42c930443505e94ca91a02e65a8df868 } } diff --git a/src/main/java/net/minecraft/server/commands/KickCommand.java b/src/main/java/net/minecraft/server/commands/KickCommand.java -index b9560b4ae5c0867396006119c5dadd7f3b47f78b..f3e32da770f379d46c65a0ba5a100b5f10be8422 100644 +index 1f82f045d059ba455459e5c9a546c1948e379539..43e0b479891b6e92af7e592bdbe3c7d22888429b 100644 --- a/src/main/java/net/minecraft/server/commands/KickCommand.java +++ b/src/main/java/net/minecraft/server/commands/KickCommand.java -@@ -33,7 +33,7 @@ public class KickCommand { +@@ -35,7 +35,7 @@ public class KickCommand { - for(ServerPlayer serverPlayer : targets) { + for (ServerPlayer serverPlayer : targets) { if (!source.getServer().isSingleplayerOwner(serverPlayer.getGameProfile())) { - serverPlayer.connection.disconnect(reason); + serverPlayer.connection.disconnect(reason, org.bukkit.event.player.PlayerKickEvent.Cause.KICK_COMMAND); // Paper - kick event cause @@ -461,7 +461,7 @@ index e913acef00c0a1a2f49779800b46997588b46253..dcb8de1c28b767068aa10f044bd8cf72 // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java b/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java -index 6724d0a1af13e97bc1d3bd94fd43fef742a0deab..20ba0a0c9eae28658888a77dd2170f629bbcb65b 100644 +index 7e474f8ff62169ad6ef1fdb940bb725cf3a26c43..b45b48df79102af21ef617773ab76be281764ff9 100644 --- a/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java +++ b/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java @@ -24,7 +24,7 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) { @@ -473,7 +473,7 @@ index 6724d0a1af13e97bc1d3bd94fd43fef742a0deab..20ba0a0c9eae28658888a77dd2170f62 } else { return new ProfilePublicKey(publicKeyData); } -@@ -81,8 +81,16 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) { +@@ -90,8 +90,16 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) { } public static class ValidationException extends ThrowingComponent { diff --git a/patches/server/0572-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch b/patches/server/0572-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch index 12b8b851c3..22417860f4 100644 --- a/patches/server/0572-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch +++ b/patches/server/0572-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch @@ -14,7 +14,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 b8fb6d1d85e07f5165bfaf7d80807e069b595851..dd62e257e16974a6d556a7f5e2d113a2cbc08981 100644 +index 8095da1ae11e0b01e8c86346a0bea67ac96443a8..a1ace0df243b43768bbb60a0941c18e3f5d10dfd 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java @@ -32,14 +32,14 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -35,7 +35,7 @@ index b8fb6d1d85e07f5165bfaf7d80807e069b595851..dd62e257e16974a6d556a7f5e2d113a2 } public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) { -@@ -91,7 +91,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer +@@ -111,7 +111,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer } @Override @@ -44,7 +44,7 @@ index b8fb6d1d85e07f5165bfaf7d80807e069b595851..dd62e257e16974a6d556a7f5e2d113a2 PalettedContainer.Data<T> data = this.data; PalettedContainer.Data<T> data2 = this.createOrReuseData(data, newBits); data2.copyFrom(data.palette, data.storage); -@@ -116,7 +116,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer +@@ -136,7 +136,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer return this.getAndSet(this.strategy.getIndex(x, y, z), value); } @@ -53,8 +53,8 @@ index b8fb6d1d85e07f5165bfaf7d80807e069b595851..dd62e257e16974a6d556a7f5e2d113a2 int i = this.data.palette.idFor(value); int j = this.data.storage.getAndSet(index, i); return this.data.palette.valueFor(j); -@@ -133,7 +133,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer - +@@ -152,7 +152,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer + } } - private void set(int index, T value) { @@ -62,7 +62,7 @@ index b8fb6d1d85e07f5165bfaf7d80807e069b595851..dd62e257e16974a6d556a7f5e2d113a2 int i = this.data.palette.idFor(value); this.data.storage.set(index, i); } -@@ -158,7 +158,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer +@@ -177,7 +177,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer }); } @@ -71,7 +71,7 @@ index b8fb6d1d85e07f5165bfaf7d80807e069b595851..dd62e257e16974a6d556a7f5e2d113a2 this.acquire(); try { -@@ -174,7 +174,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer +@@ -192,7 +192,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer } @Override @@ -80,7 +80,7 @@ index b8fb6d1d85e07f5165bfaf7d80807e069b595851..dd62e257e16974a6d556a7f5e2d113a2 this.acquire(); try { -@@ -229,7 +229,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer +@@ -248,7 +248,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer } @Override diff --git a/patches/server/0575-Fix-invulnerable-end-crystals.patch b/patches/server/0575-Fix-invulnerable-end-crystals.patch index 75347e76f0..89680d1543 100644 --- a/patches/server/0575-Fix-invulnerable-end-crystals.patch +++ b/patches/server/0575-Fix-invulnerable-end-crystals.patch @@ -52,13 +52,13 @@ index e7e01effab5f727d9b84a0575d165127e3dfe4c9..036640d49a5e891e9a0f767abe33f1f5 } diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java -index 4b685e185ebac8553f1f81d1a5a04be8166a6ca4..3b36caafde83c87c823277e2085ee82ae497b9be 100644 +index 1333254c4a97c09ad8c358850ee3eea45e182fc0..9dd652fdea219ddb5c376b4f3880bd360035b432 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java +++ b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java -@@ -101,6 +101,7 @@ public class SpikeFeature extends Feature<SpikeConfiguration> { - endCrystal.setBeamTarget(config.getCrystalBeamTarget()); - endCrystal.setInvulnerable(config.isCrystalInvulnerable()); - endCrystal.moveTo((double)spike.getCenterX() + 0.5D, (double)(spike.getHeight() + 1), (double)spike.getCenterZ() + 0.5D, random.nextFloat() * 360.0F, 0.0F); +@@ -114,6 +114,7 @@ public class SpikeFeature extends Feature<SpikeConfiguration> { + endCrystal.moveTo( + (double)spike.getCenterX() + 0.5, (double)(spike.getHeight() + 1), (double)spike.getCenterZ() + 0.5, random.nextFloat() * 360.0F, 0.0F + ); + endCrystal.generatedByDragonFight = true; // Paper - Fix invulnerable end crystals world.addFreshEntity(endCrystal); BlockPos blockPos2 = endCrystal.blockPosition(); diff --git a/patches/server/0577-Fix-dangerous-end-portal-logic.patch b/patches/server/0577-Fix-dangerous-end-portal-logic.patch index 1b1c9918ec..fc17215428 100644 --- a/patches/server/0577-Fix-dangerous-end-portal-logic.patch +++ b/patches/server/0577-Fix-dangerous-end-portal-logic.patch @@ -11,7 +11,7 @@ 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 2d8c476eb9f329ee6827340b6cec26a84901c56a..e3647763bcede42f06250550985e149e39f2b0b8 100644 +index 5b0502cfcc3d9317941d7444750a49832e1a52a1..53e2ca6ddba4936a7387e07a2aae4c282a305222 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -421,6 +421,36 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0578-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch b/patches/server/0578-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch index 53a98e7fb8..db1e86c9fe 100644 --- a/patches/server/0578-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch +++ b/patches/server/0578-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch @@ -6,14 +6,13 @@ Subject: [PATCH] Optimize Biome Mob Lookups for Mob Spawning Uses an EnumMap as well as a Set paired List for O(1) contains calls. diff --git a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java -index 4f4ef3349f512cc6e1588eb58de5b2558c0bd8b9..b10dfbaef9bde9d94c4971b47d77a1514e476f86 100644 +index c9056ce165a39d9c135cbc5bbbd21c5e418fbf31..0550da2840a6a084b3aa308d28e64d2a27cc78ee 100644 --- a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java +++ b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java -@@ -61,11 +61,43 @@ public class MobSpawnSettings { +@@ -81,12 +81,44 @@ public class MobSpawnSettings { } public static class Builder { -- private final Map<MobCategory, List<MobSpawnSettings.SpawnerData>> spawners = Stream.of(MobCategory.values()).collect(ImmutableMap.toImmutableMap((mobCategory) -> { + // Paper start - Perf: keep track of data in a pair set to give O(1) contains calls - we have to hook removals incase plugins mess with it + public static class MobList extends java.util.ArrayList<MobSpawnSettings.SpawnerData> { + java.util.Set<MobSpawnSettings.SpawnerData> biomes = new java.util.HashSet<>(); @@ -45,12 +44,14 @@ index 4f4ef3349f512cc6e1588eb58de5b2558c0bd8b9..b10dfbaef9bde9d94c4971b47d77a151 + } + } + // use toImmutableEnumMap collector -+ private final Map<MobCategory, List<MobSpawnSettings.SpawnerData>> spawners = (Map) Stream.of(MobCategory.values()).collect(Maps.toImmutableEnumMap((mobCategory) -> { - return mobCategory; - }, (mobCategory) -> { -- return Lists.newArrayList(); -+ return new MobList(); // Use MobList instead of ArrayList - })); + private final Map<MobCategory, List<MobSpawnSettings.SpawnerData>> spawners = Stream.of(MobCategory.values()) +- .collect(ImmutableMap.toImmutableMap(mobCategory -> { ++ .collect(Maps.toImmutableEnumMap(mobCategory -> { + return (MobCategory)mobCategory; + }, mobCategory -> { +- return Lists.newArrayList(); ++ return new MobList(); // Use MobList instead of ArrayList + })); + // Paper end - Perf: keep track of data in a pair set to give O(1) contains calls private final Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> mobSpawnCosts = Maps.newLinkedHashMap(); private float creatureGenerationProbability = 0.1F; diff --git a/patches/server/0580-Line-Of-Sight-Changes.patch b/patches/server/0580-Line-Of-Sight-Changes.patch index bb2535a35e..0e0c8ce179 100644 --- a/patches/server/0580-Line-Of-Sight-Changes.patch +++ b/patches/server/0580-Line-Of-Sight-Changes.patch @@ -5,7 +5,7 @@ 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 7f2111586f5a4df8824be575d6215a564f1e294a..1da8e62b57d3b971aab00fd3b2b50f1ae4a8d162 100644 +index 687f379a811ba46cb3cddda33a62039b3b329cb3..60c9bae18f277a90b464a6f1f55d074ed9046aff 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3627,7 +3627,8 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -45,7 +45,7 @@ index b9262b681b51cb68024156b28d33624fddd17b26..af14244caba22e750ee7baba03bb7ce2 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 5b9bb113db1202025c7ebb79f48b434ed8d9e3eb..aaacc38b0b2dd435ef5cb6a934cfcd6659c4ca15 100644 +index 646763f591e67e27c992663379fa3d4b322a3de3..e4a6cb02afdc6c0654ede24265d79092c998f828 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -628,6 +628,23 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0584-Fix-PlayerDropItemEvent-using-wrong-item.patch b/patches/server/0584-Fix-PlayerDropItemEvent-using-wrong-item.patch index e0ef67f1e5..4f374c8de3 100644 --- a/patches/server/0584-Fix-PlayerDropItemEvent-using-wrong-item.patch +++ b/patches/server/0584-Fix-PlayerDropItemEvent-using-wrong-item.patch @@ -5,7 +5,7 @@ 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 a09ef51e94a0bf9f51bf358e7cf77dd5d272aab2..d0369b9db86dc3436e6a016f138f2ffe91da6ed4 100644 +index 28baa63b9b750a7f03da364d9c1fe691d3ce1706..c917b271fb6325840bb791566e9dec607bdd819a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2342,7 +2342,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0585-Missing-Entity-API.patch b/patches/server/0585-Missing-Entity-API.patch index 2d5619dd11..15b6b347f6 100644 --- a/patches/server/0585-Missing-Entity-API.patch +++ b/patches/server/0585-Missing-Entity-API.patch @@ -113,7 +113,7 @@ index 0000000000000000000000000000000000000000..41bf71d116ffc5431586ce54abba7f8d + } +} diff --git a/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java b/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java -index 39ed3ca76d6b64ef3917280ec822721cc02afada..86b437836cb4b1f6e8ca9acd5f1f93b925cf9e51 100644 +index eef7d260dcb9a9c8ea6efef3216d33c08e3ea287..79c79f825e4c9b748d54962d06356ef425359101 100644 --- a/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java +++ b/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java @@ -52,6 +52,7 @@ public abstract class AbstractSchoolingFish extends AbstractFish { @@ -796,7 +796,7 @@ index 2cec61a1bb050c1ef81c5fc3d0afafe9ff29d459..97fa4e1e70203194bd939618b2fad926 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 0a039d3ce686b7e47361c60f141943b621898707..e2a566c4f9402fe035c3363faff84e49956a536b 100644 +index e4a6cb02afdc6c0654ede24265d79092c998f828..a3b9b512c4962c5d38598a504e8f0010304abdc0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -921,14 +921,29 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0588-Use-getChunkIfLoadedImmediately-in-places.patch b/patches/server/0588-Use-getChunkIfLoadedImmediately-in-places.patch index b45da09501..1778a6a85c 100644 --- a/patches/server/0588-Use-getChunkIfLoadedImmediately-in-places.patch +++ b/patches/server/0588-Use-getChunkIfLoadedImmediately-in-places.patch @@ -21,7 +21,7 @@ index 9e4453878246a22e320a6f8eb7aa08cb17438faf..60590ee30d2ff3b94c796bae2d7e9d9b @Override diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 1bb7cc9462cab7fbd09b944662711ae5bc5cf950..48e60e5ce01942fa5d30e043012e888989046cee 100644 +index 40f1b4ba266f96629b989590c7c81cd7534e93da..a1dbd23a5d8ea064f1b7909f3e285a4dadf34d88 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -182,6 +182,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0591-Fix-kick-event-leave-message-not-being-sent.patch b/patches/server/0591-Fix-kick-event-leave-message-not-being-sent.patch index cbe89274cd..c3d3547870 100644 --- a/patches/server/0591-Fix-kick-event-leave-message-not-being-sent.patch +++ b/patches/server/0591-Fix-kick-event-leave-message-not-being-sent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix kick event leave message not being sent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index d0369b9db86dc3436e6a016f138f2ffe91da6ed4..7fab0411fb7d322bf5f201e44b747d8a00638d5d 100644 +index c917b271fb6325840bb791566e9dec607bdd819a..5f69e743e2422bbcfd4678b550940960374ecabd 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -268,7 +268,6 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0592-Add-config-for-mobs-immune-to-default-effects.patch b/patches/server/0592-Add-config-for-mobs-immune-to-default-effects.patch index 756da20f44..10ce8bf043 100644 --- a/patches/server/0592-Add-config-for-mobs-immune-to-default-effects.patch +++ b/patches/server/0592-Add-config-for-mobs-immune-to-default-effects.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add config for mobs immune to default effects diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f7244a0cbb06258d6e553ad35e1040e338cce4eb..a2edccc840f2ba76e236ea7441f3e4909b1a1898 100644 +index 60c9bae18f277a90b464a6f1f55d074ed9046aff..f01ace6a6e517ff3d3cd66e69e2594ae3d702072 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1172,7 +1172,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0593-Don-t-apply-cramming-damage-to-players.patch b/patches/server/0593-Don-t-apply-cramming-damage-to-players.patch index 0882572dff..b0d6a1ad5d 100644 --- a/patches/server/0593-Don-t-apply-cramming-damage-to-players.patch +++ b/patches/server/0593-Don-t-apply-cramming-damage-to-players.patch @@ -11,7 +11,7 @@ It does not make a lot of sense to damage players if they get crammed, For those who really want it a config option is provided. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 7fab0411fb7d322bf5f201e44b747d8a00638d5d..751216261df86402c23d3f0d73944ae51e849caa 100644 +index 5f69e743e2422bbcfd4678b550940960374ecabd..bb0a5e3cdfec18a71c30fde98d21affcd95a9885 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -95,6 +95,7 @@ import net.minecraft.util.Mth; diff --git a/patches/server/0594-Rate-options-and-timings-for-sensors-and-behaviors.patch b/patches/server/0594-Rate-options-and-timings-for-sensors-and-behaviors.patch index b90b81a68f..2832058fe5 100644 --- a/patches/server/0594-Rate-options-and-timings-for-sensors-and-behaviors.patch +++ b/patches/server/0594-Rate-options-and-timings-for-sensors-and-behaviors.patch @@ -28,10 +28,10 @@ index 4bd813161a5d76a83cdbd0a9209b9ea9e60ffe1b..e2764186bd6b838ed5cd86c15597a08d * Get a named timer for the specified tile entity type to track type specific timings. * @param entity diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java -index 4ea437253539e3ee533ca9da77a337cbf4d1e807..1e71cde7cb7654f1c21ae5e27e2fad7b58f593eb 100644 +index f639cafa64d98a001e622882c647701547f5c3ac..03092417cd8ab5c6d266f3af9f20f47b34cfaba3 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java -@@ -13,6 +13,10 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro +@@ -14,6 +14,10 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro private long endTimestamp; private final int minDuration; private final int maxDuration; @@ -42,7 +42,7 @@ index 4ea437253539e3ee533ca9da77a337cbf4d1e807..1e71cde7cb7654f1c21ae5e27e2fad7b public Behavior(Map<MemoryModuleType<?>, MemoryStatus> requiredMemoryState) { this(requiredMemoryState, 60); -@@ -26,6 +30,15 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro +@@ -27,6 +31,15 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro this.minDuration = minRunTime; this.maxDuration = maxRunTime; this.entryCondition = requiredMemoryState; @@ -58,7 +58,7 @@ index 4ea437253539e3ee533ca9da77a337cbf4d1e807..1e71cde7cb7654f1c21ae5e27e2fad7b } @Override -@@ -35,11 +48,19 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro +@@ -36,11 +49,19 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro @Override public final boolean tryStart(ServerLevel world, E entity, long time) { @@ -78,7 +78,7 @@ index 4ea437253539e3ee533ca9da77a337cbf4d1e807..1e71cde7cb7654f1c21ae5e27e2fad7b return true; } else { return false; -@@ -51,11 +72,13 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro +@@ -52,11 +73,13 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro @Override public final void tickOrStop(ServerLevel world, E entity, long time) { @@ -89,15 +89,15 @@ index 4ea437253539e3ee533ca9da77a337cbf4d1e807..1e71cde7cb7654f1c21ae5e27e2fad7b this.doStop(world, entity, time); } + this.timing.stopTiming(); // Paper - behavior timings - } + protected void tick(ServerLevel world, E entity, long time) { diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java -index 7970eebbd6935402223e6bba962bb8ba7d861dfd..fcdb9bde8e1605e30dde3e580491522d4b62cdc0 100644 +index 671fc7725d7c801a2ba009da5bd1bc1a9530f187..9e90cb2f51d1bacacb287e912d14ab9152523205 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java -@@ -19,8 +19,21 @@ public abstract class Sensor<E extends LivingEntity> { - private static final TargetingConditions ATTACK_TARGET_CONDITIONS_IGNORE_INVISIBILITY_AND_LINE_OF_SIGHT = TargetingConditions.forCombat().range(16.0D).ignoreLineOfSight().ignoreInvisibilityTesting(); +@@ -26,8 +26,21 @@ public abstract class Sensor<E extends LivingEntity> { + .ignoreInvisibilityTesting(); private final int scanRate; private long timeToTick; + // Paper start - configurable sensor tick rate and timings @@ -118,7 +118,7 @@ index 7970eebbd6935402223e6bba962bb8ba7d861dfd..fcdb9bde8e1605e30dde3e580491522d this.scanRate = senseInterval; this.timeToTick = (long)RANDOM.nextInt(senseInterval); } -@@ -31,8 +44,12 @@ public abstract class Sensor<E extends LivingEntity> { +@@ -38,8 +51,12 @@ public abstract class Sensor<E extends LivingEntity> { public final void tick(ServerLevel world, E entity) { if (--this.timeToTick <= 0L) { @@ -130,5 +130,5 @@ index 7970eebbd6935402223e6bba962bb8ba7d861dfd..fcdb9bde8e1605e30dde3e580491522d this.doTick(world, entity); + this.timing.stopTiming(); // Paper - sensor timings } - } + diff --git a/patches/server/0595-Add-missing-forceDrop-toggles.patch b/patches/server/0595-Add-missing-forceDrop-toggles.patch index 273710ee36..7e8de16312 100644 --- a/patches/server/0595-Add-missing-forceDrop-toggles.patch +++ b/patches/server/0595-Add-missing-forceDrop-toggles.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add missing forceDrop toggles diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java -index 012586360a48369dad243dbb8892579a1dbcca90..edeb1899996e53d276d7481e8eddee65249a07d3 100644 +index b9c2b41d9c46c871bab44cfb1d454f4141f1627b..d975b349aa81327c6b6c23e83e9552159217f11e 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java -@@ -87,7 +87,9 @@ public class WorkAtComposter extends WorkAtPoi { +@@ -86,7 +86,9 @@ public class WorkAtComposter extends WorkAtPoi { simpleContainer.removeItemType(Items.WHEAT, m); ItemStack itemStack = simpleContainer.addItem(new ItemStack(Items.BREAD, l)); if (!itemStack.isEmpty()) { @@ -16,8 +16,8 @@ index 012586360a48369dad243dbb8892579a1dbcca90..edeb1899996e53d276d7481e8eddee65 entity.spawnAtLocation(itemStack, 0.5F); + entity.forceDrops = false; // Paper - Add missing forceDrop toggles } - } + } 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 4224e8e75613b6ec0228b2757cb98140d83bc2e2..4abd26c7baf8f198f13dd41a3146f9ece13a4164 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Panda.java diff --git a/patches/server/0596-Stinger-API.patch b/patches/server/0596-Stinger-API.patch index eadae86e37..7a81c96422 100644 --- a/patches/server/0596-Stinger-API.patch +++ b/patches/server/0596-Stinger-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Stinger API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 9c69fe09b2cf1172fe0e16f6799cc67bc0ccd397..bc7e2d24dac52091a62ce488c7fc34133dfa2aa8 100644 +index a3b9b512c4962c5d38598a504e8f0010304abdc0..4461663659f351f844ed78adc8c1ffd0531a7878 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -354,6 +354,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0602-Add-PlayerSetSpawnEvent.patch b/patches/server/0602-Add-PlayerSetSpawnEvent.patch index aae9495179..59121d7ad0 100644 --- a/patches/server/0602-Add-PlayerSetSpawnEvent.patch +++ b/patches/server/0602-Add-PlayerSetSpawnEvent.patch @@ -49,7 +49,7 @@ index a2d0699e8427b2262a2396495111125eccafbb66..15db9368227dbc29d07d74e85bd126b3 } } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 751216261df86402c23d3f0d73944ae51e849caa..fb86824192f1fc850a55905757c65cafec1edb6a 100644 +index bb0a5e3cdfec18a71c30fde98d21affcd95a9885..3f4950e0c0525346a89c7402ea85edebc6b36698 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1307,7 +1307,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0604-Optimize-entity-tracker-passenger-checks.patch b/patches/server/0604-Optimize-entity-tracker-passenger-checks.patch index 0908da4471..e1857c2d2c 100644 --- a/patches/server/0604-Optimize-entity-tracker-passenger-checks.patch +++ b/patches/server/0604-Optimize-entity-tracker-passenger-checks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize entity tracker passenger checks diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index fb16216b54eea81fceaf3edafa69b554ad01c807..c21cea7975844e0a04daeb1fcffc26d55fc62025 100644 +index e324c41947b823bba04e3da157e5be7a74d9f099..36e87e8650bef90fab47c4156ce12315f45b2241 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -79,7 +79,7 @@ public class ServerEntity { diff --git a/patches/server/0607-Optimize-indirect-passenger-iteration.patch b/patches/server/0607-Optimize-indirect-passenger-iteration.patch index cdd80aa9b6..ba1f9b4848 100644 --- a/patches/server/0607-Optimize-indirect-passenger-iteration.patch +++ b/patches/server/0607-Optimize-indirect-passenger-iteration.patch @@ -5,7 +5,7 @@ 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 e3647763bcede42f06250550985e149e39f2b0b8..f93e74226e3306a59e17dce1e4f8e72d61d75d49 100644 +index 53e2ca6ddba4936a7387e07a2aae4c282a305222..04f901236a5b9ca59ba45a5bac69ba89fc767679 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3842,20 +3842,34 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0608-Configurable-item-frame-map-cursor-update-interval.patch b/patches/server/0608-Configurable-item-frame-map-cursor-update-interval.patch index 382372348e..18c1f05373 100644 --- a/patches/server/0608-Configurable-item-frame-map-cursor-update-interval.patch +++ b/patches/server/0608-Configurable-item-frame-map-cursor-update-interval.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable item frame map cursor update interval diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index c21cea7975844e0a04daeb1fcffc26d55fc62025..a83b4d9b61230ecf5f776269cab228cf49c5f546 100644 +index 36e87e8650bef90fab47c4156ce12315f45b2241..91563f903834c1a0636dc087f8c6376815165b6c 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -117,7 +117,7 @@ public class ServerEntity { diff --git a/patches/server/0611-Add-BlockBreakBlockEvent.patch b/patches/server/0611-Add-BlockBreakBlockEvent.patch index d621301d17..75f265d55f 100644 --- a/patches/server/0611-Add-BlockBreakBlockEvent.patch +++ b/patches/server/0611-Add-BlockBreakBlockEvent.patch @@ -68,10 +68,10 @@ index 0aeb9faa1ce22359361741a591aa3d465d955970..a98ab20814cc29a25e9d29adfbb7e70d private static short getCacheKey(BlockPos from, BlockPos to) { diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java -index 1897c0012800d5ba9d2fc386f3e2bf57c9d878bb..c5f9eda32f2cd172569c7b7d72f5dd3e41a34a70 100644 +index 7f40e8196cb966424ae63043d1f54e661dbce715..21b4afd053e01073eb514264d4960f0f3b1ee3d8 100644 --- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java +++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java -@@ -64,6 +64,13 @@ public abstract class WaterFluid extends FlowingFluid { +@@ -80,6 +80,13 @@ public abstract class WaterFluid extends FlowingFluid { return world.getGameRules().getBoolean(GameRules.RULE_WATER_SOURCE_CONVERSION); } diff --git a/patches/server/0615-Add-back-EntityPortalExitEvent.patch b/patches/server/0615-Add-back-EntityPortalExitEvent.patch index 566d9576da..0f1992b626 100644 --- a/patches/server/0615-Add-back-EntityPortalExitEvent.patch +++ b/patches/server/0615-Add-back-EntityPortalExitEvent.patch @@ -5,7 +5,7 @@ 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 f93e74226e3306a59e17dce1e4f8e72d61d75d49..7dbbf0884b70acb37c3400364736fa8f6b68c964 100644 +index 04f901236a5b9ca59ba45a5bac69ba89fc767679..11985b5c0e48178a7f995dfc35dd27a172261f1c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3291,6 +3291,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0619-Add-more-advancement-API.patch b/patches/server/0619-Add-more-advancement-API.patch index 98836b6fe4..4490ddc039 100644 --- a/patches/server/0619-Add-more-advancement-API.patch +++ b/patches/server/0619-Add-more-advancement-API.patch @@ -84,17 +84,17 @@ index 0000000000000000000000000000000000000000..adac21ce6db3ff7a56dbcd6bffc02143 + } +} diff --git a/src/main/java/net/minecraft/advancements/DisplayInfo.java b/src/main/java/net/minecraft/advancements/DisplayInfo.java -index d357deb8a9e1d4043f5fb3302b957b20ffc0cc32..54298a80bd86ae8c2bdbfc69d381173aea2f1410 100644 +index 07bff6a054b26332dcbae56a357176a9f6f15d4d..32969022be43fc7094b44e3cd268622ba836c3ae 100644 --- a/src/main/java/net/minecraft/advancements/DisplayInfo.java +++ b/src/main/java/net/minecraft/advancements/DisplayInfo.java -@@ -24,6 +24,7 @@ public class DisplayInfo { +@@ -36,6 +36,7 @@ public class DisplayInfo { private final boolean hidden; private float x; private float y; + public final io.papermc.paper.advancement.AdvancementDisplay paper = new io.papermc.paper.advancement.PaperAdvancementDisplay(this); // Paper - Add more advancement API - public DisplayInfo(ItemStack icon, Component title, Component description, Optional<ResourceLocation> background, AdvancementType frame, boolean showToast, boolean announceToChat, boolean hidden) { - this.title = title; + public DisplayInfo( + ItemStack icon, diff --git a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java index 52baf818579a6841b77ff80e42f4f1b9f635ea08..8dfaca2efa0b0bdc97b75aaa83158a2e46361e4e 100644 --- a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java diff --git a/patches/server/0622-Fix-issues-with-mob-conversion.patch b/patches/server/0622-Fix-issues-with-mob-conversion.patch index 657dd4ec5d..af0f87afee 100644 --- a/patches/server/0622-Fix-issues-with-mob-conversion.patch +++ b/patches/server/0622-Fix-issues-with-mob-conversion.patch @@ -26,10 +26,10 @@ index e88af2dcc0f7fc5190654e2640f67d706e6c8c81..92974452d8f63fde8524cfac305ee2ef } diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 7bcd5498c734873b74bee503992ec4806ae61df7..01a2016ac82807d28ffe407b7dbb74bdbcde503e 100644 +index 2025599c337759d8856e15b606cde604d6c64a88..050ffa4a23feba29fdf4c6a175cdff4e5009027d 100644 --- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -241,6 +241,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -271,6 +271,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { if (zoglin != null) { zoglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)); } @@ -38,9 +38,9 @@ index 7bcd5498c734873b74bee503992ec4806ae61df7..01a2016ac82807d28ffe407b7dbb74bd + this.timeInOverworld = 0; + } + // Paper end - Fix issues with mob conversion - } + @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java index 22c8d6233be5e4f7fb4f03176e83dbee02256b1f..c575a86ca5c1bbdd6d2faf6e4a609af8ba03cab6 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java diff --git a/patches/server/0626-Add-Raw-Byte-Entity-Serialization.patch b/patches/server/0626-Add-Raw-Byte-Entity-Serialization.patch index 55d631cdee..2418a2e08d 100644 --- a/patches/server/0626-Add-Raw-Byte-Entity-Serialization.patch +++ b/patches/server/0626-Add-Raw-Byte-Entity-Serialization.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Add Raw Byte Entity Serialization public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7dbbf0884b70acb37c3400364736fa8f6b68c964..5dce3d38ecd7b7639f02f3e1e92f3723f4a42c39 100644 +index 11985b5c0e48178a7f995dfc35dd27a172261f1c..b9f61d08adf83bbaed522c2258db116492cb24c5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2078,6 +2078,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0628-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch b/patches/server/0628-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch index e55fef3b36..abcdf89c61 100644 --- a/patches/server/0628-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch +++ b/patches/server/0628-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch @@ -28,7 +28,7 @@ index 14b3edc05a04f5049f994df5be68e4f01e8cf1ef..10eb5c342930d2efd7d919f286fe8fa6 } // 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 fb86824192f1fc850a55905757c65cafec1edb6a..48edd0bf7a6f24aaf582a96ee7cb4c29c9e3598a 100644 +index 3f4950e0c0525346a89c7402ea85edebc6b36698..5f43cd7f6cc1e14771c3df6ec1f074e670ec6206 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1581,6 +1581,18 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0630-Improve-and-expand-AsyncCatcher.patch b/patches/server/0630-Improve-and-expand-AsyncCatcher.patch index e296e8ff56..b87817eeb4 100644 --- a/patches/server/0630-Improve-and-expand-AsyncCatcher.patch +++ b/patches/server/0630-Improve-and-expand-AsyncCatcher.patch @@ -29,7 +29,7 @@ index 2941445ea453e2fb88ea8de38c24bf755b93936a..666c6cb6f600973e1d84839aed715606 if (player.isRemoved()) { LOGGER.info("Attempt to teleport removed player {} restricted", player.getScoreboardName()); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 144090912223494cf163a445d7bce868be12d6af..4d8f9c8f375282968e70278da655b6e36ab96a87 100644 +index f01ace6a6e517ff3d3cd66e69e2594ae3d702072..31eb77e4e5f07b120708edeca497ef2eef1fcf13 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1126,7 +1126,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -202,7 +202,7 @@ index 6d74a3a43aee0f7ba4c109bd2443c5fcd950fa54..0b1d918452deee4c75bc61cb6a620f69 ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(Holder.direct(SoundEvent.createVariableRangeEvent(new ResourceLocation(sound))), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index bc7e2d24dac52091a62ce488c7fc34133dfa2aa8..6af7796c9505b43b2c4dfe869214b0f56dc71244 100644 +index 4461663659f351f844ed78adc8c1ffd0531a7878..5a760234a4604cec289705f1439f03c821bb0aab 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -517,6 +517,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0632-Sanitize-ResourceLocation-error-logging.patch b/patches/server/0632-Sanitize-ResourceLocation-error-logging.patch index 1359f8648a..644928b836 100644 --- a/patches/server/0632-Sanitize-ResourceLocation-error-logging.patch +++ b/patches/server/0632-Sanitize-ResourceLocation-error-logging.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Sanitize ResourceLocation error logging diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java -index d3300e43523429fdd0e61c5aa9aed2e6bc78e07e..5f9dcab27a07969c93555ad0892683c62cbebc8c 100644 +index 980ba384d15c69030d033426290678e569af23b4..651a61681b0b484253f82b43a75e76c5a1c40543 100644 --- a/src/main/java/net/minecraft/resources/ResourceLocation.java +++ b/src/main/java/net/minecraft/resources/ResourceLocation.java -@@ -211,7 +211,7 @@ public class ResourceLocation implements Comparable<ResourceLocation> { +@@ -209,7 +209,7 @@ public class ResourceLocation implements Comparable<ResourceLocation> { private static String assertValidNamespace(String namespace, String path) { if (!isValidNamespace(namespace)) { @@ -17,7 +17,7 @@ index d3300e43523429fdd0e61c5aa9aed2e6bc78e07e..5f9dcab27a07969c93555ad0892683c6 } else { return namespace; } -@@ -232,7 +232,7 @@ public class ResourceLocation implements Comparable<ResourceLocation> { +@@ -235,7 +235,7 @@ public class ResourceLocation implements Comparable<ResourceLocation> { private static String assertValidPath(String namespace, String path) { if (!isValidPath(path)) { diff --git a/patches/server/0633-Manually-inline-methods-in-BlockPosition.patch b/patches/server/0633-Manually-inline-methods-in-BlockPosition.patch index e97ce21f71..8a43418cf2 100644 --- a/patches/server/0633-Manually-inline-methods-in-BlockPosition.patch +++ b/patches/server/0633-Manually-inline-methods-in-BlockPosition.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Manually inline methods in BlockPosition diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index 3b3d81886d50ee6510ff366e11817a578c645089..541cef99113af865b995af2cfb7a1e4724dd8878 100644 +index a965c4295b4db0aa304554d7d6d031dbcd591969..f06a51b70df8450801a27bb06e6d7f6e4ee3049e 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -516,9 +516,9 @@ public class BlockPos extends Vec3i { +@@ -547,9 +547,9 @@ public class BlockPos extends Vec3i { } public BlockPos.MutableBlockPos set(int x, int y, int z) { @@ -21,7 +21,7 @@ index 3b3d81886d50ee6510ff366e11817a578c645089..541cef99113af865b995af2cfb7a1e47 return this; } -@@ -581,19 +581,19 @@ public class BlockPos extends Vec3i { +@@ -614,19 +614,19 @@ public class BlockPos extends Vec3i { @Override public BlockPos.MutableBlockPos setX(int i) { @@ -45,7 +45,7 @@ index 3b3d81886d50ee6510ff366e11817a578c645089..541cef99113af865b995af2cfb7a1e47 } diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java -index 5256ff18d992250e04a6180e196c2d5d3f0928ca..369b54b96c682717ef93d05312714b4d30efaceb 100644 +index 8908905d76fb8568c9a3c18a54b03d6a93574be8..5d996ece22d893818cda7c521725b2fd199759ff 100644 --- a/src/main/java/net/minecraft/core/Vec3i.java +++ b/src/main/java/net/minecraft/core/Vec3i.java @@ -19,9 +19,9 @@ public class Vec3i implements Comparable<Vec3i> { @@ -60,4 +60,4 @@ index 5256ff18d992250e04a6180e196c2d5d3f0928ca..369b54b96c682717ef93d05312714b4d + protected int z; // Paper - Perf: Manually inline methods in BlockPosition; protected public static Codec<Vec3i> offsetCodec(int maxAbsValue) { - return ExtraCodecs.validate(CODEC, (vec) -> { + return ExtraCodecs.validate( diff --git a/patches/server/0635-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch b/patches/server/0635-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch index 3834fdb183..aea03ebfb8 100644 --- a/patches/server/0635-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch +++ b/patches/server/0635-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch @@ -10,7 +10,7 @@ chunks did get inlined, but the standard CPS.getChunkAt method was not inlined. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 48e60e5ce01942fa5d30e043012e888989046cee..275c02d480cdf25ba0e735f4a43015ec0af238b3 100644 +index a1dbd23a5d8ea064f1b7909f3e285a4dadf34d88..1ed82afbc3aaa826f8067c65fdfc3ffce36a2ce5 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -358,6 +358,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0647-Ensure-valid-vehicle-status.patch b/patches/server/0647-Ensure-valid-vehicle-status.patch index 24e12fde1c..35c8b1e952 100644 --- a/patches/server/0647-Ensure-valid-vehicle-status.patch +++ b/patches/server/0647-Ensure-valid-vehicle-status.patch @@ -5,7 +5,7 @@ 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 48edd0bf7a6f24aaf582a96ee7cb4c29c9e3598a..be8c6c48287b73693ead9ae22071f2b4af7eed32 100644 +index 5f43cd7f6cc1e14771c3df6ec1f074e670ec6206..b5a3587a9074a1a2fcc2252d2db8b184b6ab6793 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -527,7 +527,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0649-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch b/patches/server/0649-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch index b766f53247..f62cd66b50 100644 --- a/patches/server/0649-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch +++ b/patches/server/0649-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix CocaoDecorator causing a crash when trying to generate diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java b/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java -index 42b4b306ee89a9e422d234bdaa9b43b118f8bd0a..f0085174a8f6e05f30c583b1211a7be43128e540 100644 +index fab1fbd2699c50336e764b8f12ce98a527ebba74..61deaeeb719fae6b27f0afa88357c9018c1bdd7b 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java +++ b/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java @@ -25,6 +25,7 @@ public class CocoaDecorator extends TreeDecorator { diff --git a/patches/server/0653-Update-head-rotation-in-missing-places.patch b/patches/server/0653-Update-head-rotation-in-missing-places.patch index 5fdcb1a6cb..abf2879a6e 100644 --- a/patches/server/0653-Update-head-rotation-in-missing-places.patch +++ b/patches/server/0653-Update-head-rotation-in-missing-places.patch @@ -8,7 +8,7 @@ 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 5dce3d38ecd7b7639f02f3e1e92f3723f4a42c39..ec23aa4f86fed6890273d06b8cfb4000daf3c515 100644 +index b9f61d08adf83bbaed522c2258db116492cb24c5..685cd5c719a0bf8d3e41aa95b0e84effe1241948 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1790,6 +1790,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0654-prevent-unintended-light-block-manipulation.patch b/patches/server/0654-prevent-unintended-light-block-manipulation.patch index 90c181a20a..bacb3c9757 100644 --- a/patches/server/0654-prevent-unintended-light-block-manipulation.patch +++ b/patches/server/0654-prevent-unintended-light-block-manipulation.patch @@ -5,7 +5,7 @@ Subject: [PATCH] prevent unintended light block manipulation diff --git a/src/main/java/net/minecraft/world/level/block/LightBlock.java b/src/main/java/net/minecraft/world/level/block/LightBlock.java -index a0fadee4be7c263ceaf1f4a987169b0f50308072..a847b79da488c9d6059c9da941a50de8b1bfc24f 100644 +index 51452f816b02770d5e015d753cd008f598198ddc..504a2c0ec7e479d80aeb5fc6434c73d6e36167c9 100644 --- a/src/main/java/net/minecraft/world/level/block/LightBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java @@ -54,6 +54,7 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock { diff --git a/patches/server/0660-don-t-attempt-to-teleport-dead-entities.patch b/patches/server/0660-don-t-attempt-to-teleport-dead-entities.patch index 96f8ca01bb..46478011d3 100644 --- a/patches/server/0660-don-t-attempt-to-teleport-dead-entities.patch +++ b/patches/server/0660-don-t-attempt-to-teleport-dead-entities.patch @@ -5,7 +5,7 @@ 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 ec23aa4f86fed6890273d06b8cfb4000daf3c515..a89cd343bee7ea919c3ba5789e37b05e6a1cf334 100644 +index 685cd5c719a0bf8d3e41aa95b0e84effe1241948..a9c1561ae9ec5a3db7a0602314c9a935ddf3fdfd 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -718,7 +718,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0661-Prevent-excessive-velocity-through-repeated-crits.patch b/patches/server/0661-Prevent-excessive-velocity-through-repeated-crits.patch index e77b1154c2..f3ea39fcf2 100644 --- a/patches/server/0661-Prevent-excessive-velocity-through-repeated-crits.patch +++ b/patches/server/0661-Prevent-excessive-velocity-through-repeated-crits.patch @@ -5,7 +5,7 @@ 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 18804ea960f8423d172d9119c0739226a18d4d56..d4abce0b715d5eda99505fa0e29eeab20b538fd9 100644 +index 31eb77e4e5f07b120708edeca497ef2eef1fcf13..ed6fd20ff608e764d6b0f517f6c9c85c533f1646 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2697,13 +2697,26 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0662-Remove-client-side-code-using-deprecated-for-removal.patch b/patches/server/0662-Remove-client-side-code-using-deprecated-for-removal.patch index 2ed18ebaeb..a0878d0d37 100644 --- a/patches/server/0662-Remove-client-side-code-using-deprecated-for-removal.patch +++ b/patches/server/0662-Remove-client-side-code-using-deprecated-for-removal.patch @@ -7,10 +7,10 @@ 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 765e4bc00a0526aab6e263dae7233f63f7f31498..edf937591abf62416bd692e40b7b7a6badbe877d 100644 +index 1bab7a03d433d3745cf9e244f5501dd3efedf583..081b460aa9b3674bf239378a6fc3f6cd30bb2d26 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -951,17 +951,7 @@ public class Util { +@@ -950,16 +950,7 @@ public class Util { } public void openUrl(URL url) { @@ -24,7 +24,6 @@ index 765e4bc00a0526aab6e263dae7233f63f7f31498..edf937591abf62416bd692e40b7b7a6b - } catch (IOException | PrivilegedActionException var3) { - Util.LOGGER.error("Couldn't open url '{}'", url, var3); - } -- + throw new IllegalStateException("This method is not useful on dedicated servers."); // Paper - Fix warnings on build by removing client-only code } diff --git a/patches/server/0664-Prevent-sending-oversized-item-data-in-equipment-and.patch b/patches/server/0664-Prevent-sending-oversized-item-data-in-equipment-and.patch index 66da8d4997..49f1956e75 100644 --- a/patches/server/0664-Prevent-sending-oversized-item-data-in-equipment-and.patch +++ b/patches/server/0664-Prevent-sending-oversized-item-data-in-equipment-and.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent sending oversized item data in equipment and metadata diff --git a/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java b/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java -index f9e15908143f4453c2a5817b412e8a13554553f0..06498788c169133bd563c5a87192b71802c4d4df 100644 +index 0677879604b66fc1442567c5fdf6aa6600407d77..4d4f1be84ea89f5d8685943ad1dc120a5a49d48e 100644 --- a/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java +++ b/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java -@@ -42,7 +42,7 @@ public class EntityDataSerializers { +@@ -46,7 +46,7 @@ public class EntityDataSerializers { public static final EntityDataSerializer<ItemStack> ITEM_STACK = new EntityDataSerializer<ItemStack>() { @Override public void write(FriendlyByteBuf buf, ItemStack value) { @@ -18,7 +18,7 @@ index f9e15908143f4453c2a5817b412e8a13554553f0..06498788c169133bd563c5a87192b718 @Override diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index a83b4d9b61230ecf5f776269cab228cf49c5f546..86f6e5bad325dd3d817b643388b196121624b8c7 100644 +index 91563f903834c1a0636dc087f8c6376815165b6c..a51564e8dce3c125ed5f05cc23548a05c1e79a95 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -335,7 +335,10 @@ public class ServerEntity { @@ -34,7 +34,7 @@ index a83b4d9b61230ecf5f776269cab228cf49c5f546..86f6e5bad325dd3d817b643388b19612 } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d4abce0b715d5eda99505fa0e29eeab20b538fd9..ccbafac8e5930571928e87f1c83f9f481fcfe8c4 100644 +index ed6fd20ff608e764d6b0f517f6c9c85c533f1646..8025e351fb3e24aa67b31eca74be1bc368592851 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3208,7 +3208,10 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0665-Hide-unnecessary-itemmeta-from-clients.patch b/patches/server/0665-Hide-unnecessary-itemmeta-from-clients.patch index 6224365ef1..97005e3398 100644 --- a/patches/server/0665-Hide-unnecessary-itemmeta-from-clients.patch +++ b/patches/server/0665-Hide-unnecessary-itemmeta-from-clients.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Hide unnecessary itemmeta from clients diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 86f6e5bad325dd3d817b643388b196121624b8c7..062225ac8b5fbc44290352d78b215640691f3c23 100644 +index a51564e8dce3c125ed5f05cc23548a05c1e79a95..d2c2075fb0378fd7ec148281d37d886c77a78ce8 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -337,7 +337,7 @@ public class ServerEntity { @@ -33,7 +33,7 @@ index ace2cab310aa7d89e1b76bf5fdc9fd64f56b6cc7..cf173a2315f3a97a89dc2aabe81be285 } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index ccbafac8e5930571928e87f1c83f9f481fcfe8c4..9af308ef5e55df9ce08b25e358e48d1c6f67d663 100644 +index 8025e351fb3e24aa67b31eca74be1bc368592851..e44a45ced6f7cd7db44388bb2e85c722b6b5ca8a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3210,7 +3210,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0666-Fix-Spigot-growth-modifiers.patch b/patches/server/0666-Fix-Spigot-growth-modifiers.patch index 92cddad5f1..e04bd59b80 100644 --- a/patches/server/0666-Fix-Spigot-growth-modifiers.patch +++ b/patches/server/0666-Fix-Spigot-growth-modifiers.patch @@ -13,7 +13,7 @@ Co-authored-by: Noah van der Aa <[email protected]> Co-authored-by: Lulu13022002 <[email protected]> diff --git a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java -index 95f897b9ef73c880aff1cfe35fe490683badfd44..1ec8c2d24ec8468d20f322d67143b9454ff266eb 100644 +index 724d77b014a738ad32a1708bd31c0f1a5d76fd57..bdd9f38dcb16b74c5916b75713dbe5082b32497d 100644 --- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java @@ -51,9 +51,18 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl @@ -76,10 +76,10 @@ index b74e61064926a7c7fb03286651ea52c150f86107..30300ef3ec839dfa944c992ab50db4d3 return (BlockState) state.cycle(GrowingPlantHeadBlock.AGE); } diff --git a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java -index 3c0b0732cdea6c98c58c9639be3a6971575df85b..d5257272ac8b0cf36e9f92e32a4a4ae6782f770c 100644 +index 434d0761858946c802edea14078f567142da19f3..35be55f181255edbb54b47e906b5e811a4480223 100644 --- a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java +++ b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java -@@ -100,7 +100,7 @@ public class MangrovePropaguleBlock extends SaplingBlock implements SimpleWaterl +@@ -115,7 +115,7 @@ public class MangrovePropaguleBlock extends SaplingBlock implements SimpleWaterl @Override public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { if (!isHanging(state)) { @@ -87,12 +87,12 @@ index 3c0b0732cdea6c98c58c9639be3a6971575df85b..d5257272ac8b0cf36e9f92e32a4a4ae6 + if (random.nextFloat() < (world.spigotConfig.saplingModifier / (100.0F * 7))) { // Paper - Fix Spigot growth modifiers this.advanceTree(world, pos, state, random); } - + } else { diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java -index 690abba9d27ab4061de4dd3676292b1859036868..591f32f7c0a7a9c843933d17dad8a34b672f49ac 100644 +index c9ed129db2cadd0a33d69993961f43088725c3cb..d06e3892cf42723f8e3f621b5497c5348fa1a715 100644 --- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java -@@ -119,7 +119,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl +@@ -123,7 +123,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl @Override public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { float f = CropBlock.getGrowthSpeed(this, world, pos); diff --git a/patches/server/0669-Optimize-HashMapPalette.patch b/patches/server/0669-Optimize-HashMapPalette.patch index a8cf001da1..d50159b901 100644 --- a/patches/server/0669-Optimize-HashMapPalette.patch +++ b/patches/server/0669-Optimize-HashMapPalette.patch @@ -24,7 +24,7 @@ to corrupted data. This is also something that Anti-Xray is currently relying on. diff --git a/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java b/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java -index 26e093243c70313b777483d9555fb1557443c9b8..92c360f02ef6be77c6c8eee3226947468194ec23 100644 +index f80cde264393f3606bc0c54ba2fd6a467f4bcb5a..c5e1040c239874dcf20b79472bf690ee7f0a9e5f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java +++ b/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java @@ -20,7 +20,7 @@ public class HashMapPalette<T> implements Palette<T> { diff --git a/patches/server/0674-Forward-CraftEntity-in-teleport-command.patch b/patches/server/0674-Forward-CraftEntity-in-teleport-command.patch index 18a8c45967..d78da2d8e7 100644 --- a/patches/server/0674-Forward-CraftEntity-in-teleport-command.patch +++ b/patches/server/0674-Forward-CraftEntity-in-teleport-command.patch @@ -5,7 +5,7 @@ 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 a89cd343bee7ea919c3ba5789e37b05e6a1cf334..6c8478c9ad154b25e11085ac47552b5855b5e9d1 100644 +index a9c1561ae9ec5a3db7a0602314c9a935ddf3fdfd..a14ac8aef9aec14a3ca31a61d66f03fec0841927 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3263,6 +3263,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0678-Configurable-max-block-light-for-monster-spawning.patch b/patches/server/0678-Configurable-max-block-light-for-monster-spawning.patch index deae03d87c..421d176050 100644 --- a/patches/server/0678-Configurable-max-block-light-for-monster-spawning.patch +++ b/patches/server/0678-Configurable-max-block-light-for-monster-spawning.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable max block light for monster spawning diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java -index 036d79baf372f4900681fee366bcd91c99474e5f..fbca4d6bc84e8be359b989ef089469838f896910 100644 +index 4701bf9ee203f2f15b0b68e84bbfa2c489b66631..759839e912c54598b257ad738481364940f88a18 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Monster.java +++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java -@@ -93,7 +93,7 @@ public abstract class Monster extends PathfinderMob implements Enemy { +@@ -92,7 +92,7 @@ public abstract class Monster extends PathfinderMob implements Enemy { return false; } else { DimensionType dimensionType = world.dimensionType(); diff --git a/patches/server/0680-Load-effect-amplifiers-greater-than-127-correctly.patch b/patches/server/0680-Load-effect-amplifiers-greater-than-127-correctly.patch index 3e88533e6f..45270d599a 100644 --- a/patches/server/0680-Load-effect-amplifiers-greater-than-127-correctly.patch +++ b/patches/server/0680-Load-effect-amplifiers-greater-than-127-correctly.patch @@ -6,10 +6,10 @@ 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 758a9ddd3489be9502cd4e7f31b709c49ce9e009..bf304db1f9506d3e83d16cd632b9155c39346634 100644 +index 77b7ec9bd9ab986ebcf90c8eedd11d2ec6ef50ec..007766522d0e2fe874d43df789eb4c946a5edd15 100644 --- a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java +++ b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java -@@ -293,7 +293,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> { +@@ -306,7 +306,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> { } private static MobEffectInstance loadSpecifiedEffect(MobEffect type, CompoundTag nbt) { diff --git a/patches/server/0685-Make-water-animal-spawn-height-configurable.patch b/patches/server/0685-Make-water-animal-spawn-height-configurable.patch index e523ed36f4..3741f45097 100644 --- a/patches/server/0685-Make-water-animal-spawn-height-configurable.patch +++ b/patches/server/0685-Make-water-animal-spawn-height-configurable.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Make water animal spawn height configurable 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 27624b080e025d943b9c99627568f7dd66165548..9b897cf53f4bb5d366e6ac88dbed93c59d8fe541 100644 +index 7ef707f0098f2663ebc0ef0f5b35897c9d33c1cf..75884a9e69a28404752c1a2cf854335bb78cac01 100644 --- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java +++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java -@@ -73,6 +73,10 @@ public abstract class WaterAnimal extends PathfinderMob { - public static boolean checkSurfaceWaterAnimalSpawnRules(EntityType<? extends WaterAnimal> type, LevelAccessor world, MobSpawnType reason, BlockPos pos, RandomSource random) { +@@ -74,6 +74,10 @@ public abstract class WaterAnimal extends PathfinderMob { + ) { int i = world.getSeaLevel(); int j = i - 13; + // Paper start - Make water animal spawn height configurable diff --git a/patches/server/0689-Multiple-Entries-with-Scoreboards.patch b/patches/server/0689-Multiple-Entries-with-Scoreboards.patch index 9bfd7660c6..a0934c6d89 100644 --- a/patches/server/0689-Multiple-Entries-with-Scoreboards.patch +++ b/patches/server/0689-Multiple-Entries-with-Scoreboards.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Multiple Entries with Scoreboards diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java -index cf31771648549ab6d7e4e38b30409ca48a976bea..e70decbcf87c2a57bfa34ad7be7120d546ff8e35 100644 +index e9d03ebfbd02a46b0ba274be107e099cc24b59e3..c52b91f5a001924e7a15f246004b6dd294fa0aae 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java -@@ -42,6 +42,12 @@ public class ClientboundSetPlayerTeamPacket implements Packet<ClientGamePacketLi - return new ClientboundSetPlayerTeamPacket(team.getName(), operation == ClientboundSetPlayerTeamPacket.Action.ADD ? 3 : 4, Optional.empty(), ImmutableList.of(playerName)); +@@ -51,6 +51,12 @@ public class ClientboundSetPlayerTeamPacket implements Packet<ClientGamePacketLi + ); } + // Paper start - Multiple Entries with Scoreboards diff --git a/patches/server/0695-Freeze-Tick-Lock-API.patch b/patches/server/0695-Freeze-Tick-Lock-API.patch index 65e67e5965..81d065ccaf 100644 --- a/patches/server/0695-Freeze-Tick-Lock-API.patch +++ b/patches/server/0695-Freeze-Tick-Lock-API.patch @@ -5,7 +5,7 @@ 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 6c8478c9ad154b25e11085ac47552b5855b5e9d1..7e6ea850078179f7c63b597a788ef105802a0260 100644 +index a14ac8aef9aec14a3ca31a61d66f03fec0841927..d391114787e4f7491241b6abc45dcf3f2a7f9fb5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -405,6 +405,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -46,7 +46,7 @@ index 6c8478c9ad154b25e11085ac47552b5855b5e9d1..7e6ea850078179f7c63b597a788ef105 } 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 9af308ef5e55df9ce08b25e358e48d1c6f67d663..511e8e789932df77999689659d1efbe311339e40 100644 +index e44a45ced6f7cd7db44388bb2e85c722b6b5ca8a..5de5ca787905d9e0133e5f75280748526c568203 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3472,7 +3472,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -59,7 +59,7 @@ index 9af308ef5e55df9ce08b25e358e48d1c6f67d663..511e8e789932df77999689659d1efbe3 if (this.isInPowderSnow && this.canFreeze()) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 8f0df02a81c36244a3906efa6605f5eba030bfb9..88e05b8ec5f442b3ad14e3b39a06beeca5c169ae 100644 +index 25c064a7da80ef98a758d7cb8bd1aa3de452e2e4..46bc34741394740de46546bd4ce7db35c757316c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -321,6 +321,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0699-Add-missing-structure-set-seed-configs.patch b/patches/server/0699-Add-missing-structure-set-seed-configs.patch index b6627026af..3f162bf933 100644 --- a/patches/server/0699-Add-missing-structure-set-seed-configs.patch +++ b/patches/server/0699-Add-missing-structure-set-seed-configs.patch @@ -148,10 +148,10 @@ index a310bfbf0d08187375ea17f4b04b276a0b7d0b9f..798e22fb4d685b5845ebf687e8004e94 } } diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java b/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java -index 65dcb14241baadb2c9f8f16919d7b562198ad9c3..02e58161a0f5915084230831ee03050d762b67d2 100644 +index bb71545509b8ca804cac25b40e2ce053f8e6a4da..629d2403db1d9927520bbad2da5c7732718e6bf0 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java -@@ -59,10 +59,24 @@ public abstract class StructurePlacement { +@@ -79,9 +79,23 @@ public abstract class StructurePlacement { return this.exclusionZone; } @@ -170,14 +170,13 @@ index 65dcb14241baadb2c9f8f16919d7b562198ad9c3..02e58161a0f5915084230831ee03050d + } + } + // Paper end - Add missing structure set seed configs - if (!this.isPlacementChunk(calculator, chunkX, chunkZ)) { - return false; -- } else if (this.frequency < 1.0F && !this.frequencyReductionMethod.shouldGenerate(calculator.getLevelSeed(), this.salt, chunkX, chunkZ, this.frequency)) { -+ } else if (this.frequency < 1.0F && !this.frequencyReductionMethod.shouldGenerate(calculator.getLevelSeed(), this.salt, chunkX, chunkZ, this.frequency, saltOverride)) { // Paper - Add missing structure set seed configs - return false; - } else { - return !this.exclusionZone.isPresent() || !this.exclusionZone.get().isPlacementForbidden(calculator, chunkX, chunkZ); -@@ -77,25 +91,31 @@ public abstract class StructurePlacement { + return this.isPlacementChunk(calculator, chunkX, chunkZ) +- && (!(this.frequency < 1.0F) || this.frequencyReductionMethod.shouldGenerate(calculator.getLevelSeed(), this.salt, chunkX, chunkZ, this.frequency)) ++ && (!(this.frequency < 1.0F) || this.frequencyReductionMethod.shouldGenerate(calculator.getLevelSeed(), this.salt, chunkX, chunkZ, this.frequency, saltOverride)) // Paper - Add missing structure set seed configs + && (!this.exclusionZone.isPresent() || !this.exclusionZone.get().isPlacementForbidden(calculator, chunkX, chunkZ)); + } + +@@ -93,25 +107,31 @@ public abstract class StructurePlacement { public abstract StructurePlacementType<?> type(); @@ -214,7 +213,7 @@ index 65dcb14241baadb2c9f8f16919d7b562198ad9c3..02e58161a0f5915084230831ee03050d int i = chunkX >> 4; int j = chunkZ >> 4; WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); -@@ -118,7 +138,7 @@ public abstract class StructurePlacement { +@@ -141,7 +161,7 @@ public abstract class StructurePlacement { @FunctionalInterface public interface FrequencyReducer { @@ -223,7 +222,7 @@ index 65dcb14241baadb2c9f8f16919d7b562198ad9c3..02e58161a0f5915084230831ee03050d } public static enum FrequencyReductionMethod implements StringRepresentable { -@@ -136,8 +156,8 @@ public abstract class StructurePlacement { +@@ -161,8 +181,8 @@ public abstract class StructurePlacement { this.reducer = generationPredicate; } diff --git a/patches/server/0704-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch b/patches/server/0704-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch index 06c9d9f99a..24d1f7815d 100644 --- a/patches/server/0704-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch +++ b/patches/server/0704-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch @@ -9,7 +9,7 @@ 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 d19f2ca702ffa32c616ec821219079e2b784a460..1c1d111eba7b625bd36b95fbec83d8c5f8272b97 100644 +index 82ee16f8efb5d32bf648d416010de557e2b90865..186bbc60f6e283aeb00e339c98c034e2268f160d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1296,6 +1296,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0706-Configurable-sculk-sensor-listener-range.patch b/patches/server/0706-Configurable-sculk-sensor-listener-range.patch index f4bdef4317..f525f7812b 100644 --- a/patches/server/0706-Configurable-sculk-sensor-listener-range.patch +++ b/patches/server/0706-Configurable-sculk-sensor-listener-range.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Configurable sculk sensor listener range public-f net.minecraft.world.level.gameevent.vibrations.VibrationListener listenerRange diff --git a/src/main/java/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java -index a18589425006ccabd87b76a9827ab516040009bb..c26492942c854ea311da2369b51692dbbc06e050 100644 +index 4c9c35131e9bd37a48f6c4beb2bbcaf7988069c5..cf865dcfde2ae6c0ae72a8e7469be2dd3e1bc679 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java @@ -19,6 +19,12 @@ public class CalibratedSculkSensorBlockEntity extends SculkSensorBlockEntity { @@ -32,10 +32,10 @@ index a18589425006ccabd87b76a9827ab516040009bb..c26492942c854ea311da2369b51692db } diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java -index a6c226da995eecc323d69a3eff1f8d202410e069..1e699b12e58fe985f41b96882988483fd64c5590 100644 +index aee9119c05bf1d7e2601879e87f002f0e3f11216..a1281c0a769568367145a1a67ffae1d5be63a17e 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java -@@ -24,6 +24,7 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList +@@ -23,6 +23,7 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList private final VibrationSystem.Listener vibrationListener; private final VibrationSystem.User vibrationUser = this.createVibrationUser(); public int lastVibrationFrequency; @@ -43,9 +43,9 @@ index a6c226da995eecc323d69a3eff1f8d202410e069..1e699b12e58fe985f41b96882988483f protected SculkSensorBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) { super(type, pos, state); -@@ -48,9 +49,17 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList - this.vibrationData = listener; - }); +@@ -50,8 +51,16 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList + this.vibrationData = listener; + }); } + // Paper start - Configurable sculk sensor listener range + if (nbt.contains(PAPER_LISTENER_RANGE_NBT_KEY)) { @@ -54,15 +54,14 @@ index a6c226da995eecc323d69a3eff1f8d202410e069..1e699b12e58fe985f41b96882988483f + this.rangeOverride = null; + } + // Paper end - Configurable sculk sensor listener range - } + protected static final String PAPER_LISTENER_RANGE_NBT_KEY = "Paper.ListenerRange"; // Paper - Configurable sculk sensor listener range @Override protected void saveAdditional(CompoundTag nbt) { super.saveAdditional(nbt); -@@ -58,7 +67,13 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList - VibrationSystem.Data.CODEC.encodeStart(NbtOps.INSTANCE, this.vibrationData).resultOrPartial(LOGGER::error).ifPresent((listenerNbt) -> { +@@ -59,7 +68,13 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList + VibrationSystem.Data.CODEC.encodeStart(NbtOps.INSTANCE, this.vibrationData).resultOrPartial(LOGGER::error).ifPresent(listenerNbt -> { nbt.put("listener", listenerNbt); }); + this.saveRangeOverride(nbt); // Paper - Configurable sculk sensor listener range @@ -75,7 +74,7 @@ index a6c226da995eecc323d69a3eff1f8d202410e069..1e699b12e58fe985f41b96882988483f @Override public VibrationSystem.Data getVibrationData() { -@@ -95,6 +110,7 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList +@@ -96,6 +111,7 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList @Override public int getListenerRadius() { diff --git a/patches/server/0708-Option-to-have-default-CustomSpawners-in-custom-worl.patch b/patches/server/0708-Option-to-have-default-CustomSpawners-in-custom-worl.patch index 903a710120..060a7d91fb 100644 --- a/patches/server/0708-Option-to-have-default-CustomSpawners-in-custom-worl.patch +++ b/patches/server/0708-Option-to-have-default-CustomSpawners-in-custom-worl.patch @@ -10,7 +10,7 @@ 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/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 1c1d111eba7b625bd36b95fbec83d8c5f8272b97..239b1616ddd4cb64a0565d0f8f3bef7bbaaf23c9 100644 +index 186bbc60f6e283aeb00e339c98c034e2268f160d..5b4e4459aa0bcdcf422f4191ebda7b42892d24e4 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -617,7 +617,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0709-Put-world-into-worldlist-before-initing-the-world.patch b/patches/server/0709-Put-world-into-worldlist-before-initing-the-world.patch index 998c2caea6..e738059bbd 100644 --- a/patches/server/0709-Put-world-into-worldlist-before-initing-the-world.patch +++ b/patches/server/0709-Put-world-into-worldlist-before-initing-the-world.patch @@ -7,7 +7,7 @@ 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 239b1616ddd4cb64a0565d0f8f3bef7bbaaf23c9..39735cce3c32d9905130dca2d7e34aff144364ef 100644 +index 5b4e4459aa0bcdcf422f4191ebda7b42892d24e4..6a1102f68b0d9851069e08f67b27ada4f5013b5a 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -629,9 +629,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0710-Fix-Entity-Position-Desync.patch b/patches/server/0710-Fix-Entity-Position-Desync.patch index 1fe60a4f46..c12e623f3d 100644 --- a/patches/server/0710-Fix-Entity-Position-Desync.patch +++ b/patches/server/0710-Fix-Entity-Position-Desync.patch @@ -9,7 +9,7 @@ This excludes hanging entities, as this fix caused problematic behavior due to t position field. diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 062225ac8b5fbc44290352d78b215640691f3c23..3608257fabec6ad7edb056def8a6f36c50b4871e 100644 +index d2c2075fb0378fd7ec148281d37d886c77a78ce8..40949825392281c2f7c756007781c672ec24665d 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -171,7 +171,7 @@ public class ServerEntity { diff --git a/patches/server/0711-Custom-Potion-Mixes.patch b/patches/server/0711-Custom-Potion-Mixes.patch index edb4c6d4f4..e863a0d69c 100644 --- a/patches/server/0711-Custom-Potion-Mixes.patch +++ b/patches/server/0711-Custom-Potion-Mixes.patch @@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..7ea357ac2f3a93db4ebdf24b5072be7d + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 39735cce3c32d9905130dca2d7e34aff144364ef..8080eee9babe02660724eee756700a4d5e69014f 100644 +index 6a1102f68b0d9851069e08f67b27ada4f5013b5a..03fd35ee321c80ca674cea9eb366cffcc95bc893 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2081,6 +2081,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -57,7 +57,7 @@ index ad012400d76c263bf26cfa07e2e24f26dc32276b..054555c6b9c61243b1f14139b5c0eb25 } diff --git a/src/main/java/net/minecraft/world/item/alchemy/PotionBrewing.java b/src/main/java/net/minecraft/world/item/alchemy/PotionBrewing.java -index 25e909b90293855321b8f05ab3488bad8c064853..0bba74bd22d66881fc6851797d29c1442f509445 100644 +index a37573d06aeaa4ae05d26fa26c888524dd834421..96197185d1cba4a77bd6afd0e57615b45d4dfc85 100644 --- a/src/main/java/net/minecraft/world/item/alchemy/PotionBrewing.java +++ b/src/main/java/net/minecraft/world/item/alchemy/PotionBrewing.java @@ -14,6 +14,7 @@ public class PotionBrewing { @@ -66,8 +66,8 @@ index 25e909b90293855321b8f05ab3488bad8c064853..0bba74bd22d66881fc6851797d29c144 private static final List<PotionBrewing.Mix<Item>> CONTAINER_MIXES = Lists.newArrayList(); + private static final it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<org.bukkit.NamespacedKey, io.papermc.paper.potion.PaperPotionMix> CUSTOM_MIXES = new it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<>(); // Paper - Custom Potion Mixes private static final List<Ingredient> ALLOWED_CONTAINERS = Lists.newArrayList(); - private static final Predicate<ItemStack> ALLOWED_CONTAINER = (stack) -> { - for(Ingredient ingredient : ALLOWED_CONTAINERS) { + private static final Predicate<ItemStack> ALLOWED_CONTAINER = stack -> { + for (Ingredient ingredient : ALLOWED_CONTAINERS) { @@ -26,7 +27,7 @@ public class PotionBrewing { }; @@ -86,10 +86,10 @@ index 25e909b90293855321b8f05ab3488bad8c064853..0bba74bd22d66881fc6851797d29c144 + return true; + } + // Paper end - Custom Potion Mixes - if (!ALLOWED_CONTAINER.test(input)) { - return false; - } else { -@@ -93,6 +99,13 @@ public class PotionBrewing { + return ALLOWED_CONTAINER.test(input) && (hasContainerMix(input, ingredient) || hasPotionMix(input, ingredient)); + } + +@@ -89,6 +95,13 @@ public class PotionBrewing { public static ItemStack mix(ItemStack ingredient, ItemStack input) { if (!input.isEmpty()) { @@ -103,7 +103,7 @@ index 25e909b90293855321b8f05ab3488bad8c064853..0bba74bd22d66881fc6851797d29c144 Potion potion = PotionUtils.getPotion(input); Item item = input.getItem(); -@@ -112,6 +125,54 @@ public class PotionBrewing { +@@ -108,6 +121,54 @@ public class PotionBrewing { return input; } diff --git a/patches/server/0717-Fix-swamp-hut-cat-generation-deadlock.patch b/patches/server/0717-Fix-swamp-hut-cat-generation-deadlock.patch index bac78b77ff..3c6b80ca04 100644 --- a/patches/server/0717-Fix-swamp-hut-cat-generation-deadlock.patch +++ b/patches/server/0717-Fix-swamp-hut-cat-generation-deadlock.patch @@ -23,10 +23,10 @@ index 534630b0161c8d869e49e7a59572193550be0671..7dfd2b17e82a80683af28779d0bd8f64 this.setPersistenceRequired(); } diff --git a/src/main/java/net/minecraft/world/level/StructureManager.java b/src/main/java/net/minecraft/world/level/StructureManager.java -index b33a015b834873f279bf33a64974ef440a37df79..b59581b92aed0bc1b09008c695b0b112c3e65743 100644 +index da0adda84ad762bba2c0f86ec95fe81a0839ed58..6d22e48b03da6a3bc20c0ee5a1f3008430304fde 100644 --- a/src/main/java/net/minecraft/world/level/StructureManager.java +++ b/src/main/java/net/minecraft/world/level/StructureManager.java -@@ -44,7 +44,12 @@ public class StructureManager { +@@ -46,7 +46,12 @@ public class StructureManager { } public List<StructureStart> startsForStructure(ChunkPos pos, Predicate<Structure> predicate) { @@ -37,10 +37,10 @@ index b33a015b834873f279bf33a64974ef440a37df79..b59581b92aed0bc1b09008c695b0b112 + public List<StructureStart> startsForStructure(ChunkPos pos, Predicate<Structure> predicate, @Nullable ServerLevelAccessor levelAccessor) { + Map<Structure, LongSet> map = (levelAccessor == null ? this.level : levelAccessor).getChunk(pos.x, pos.z, ChunkStatus.STRUCTURE_REFERENCES).getAllReferences(); + // Paper end - Fix swamp hut cat generation deadlock - ImmutableList.Builder<StructureStart> builder = ImmutableList.builder(); + Builder<StructureStart> builder = ImmutableList.builder(); - for(Map.Entry<Structure, LongSet> entry : map.entrySet()) { -@@ -108,13 +113,18 @@ public class StructureManager { + for (Entry<Structure, LongSet> entry : map.entrySet()) { +@@ -111,13 +116,18 @@ public class StructureManager { } public StructureStart getStructureWithPieceAt(BlockPos pos, TagKey<Structure> structureTag) { @@ -51,8 +51,8 @@ index b33a015b834873f279bf33a64974ef440a37df79..b59581b92aed0bc1b09008c695b0b112 + // Paper end - Fix swamp hut cat generation deadlock Registry<Structure> registry = this.registryAccess().registryOrThrow(Registries.STRUCTURE); - for(StructureStart structureStart : this.startsForStructure(new ChunkPos(pos), (structure) -> { - return registry.getHolder(registry.getId(structure)).map((reference) -> { + for (StructureStart structureStart : this.startsForStructure(new ChunkPos(pos), structure -> { + return registry.getHolder(registry.getId(structure)).map(reference -> { return reference.is(structureTag); }).orElse(false); - })) { diff --git a/patches/server/0724-Add-TameableDeathMessageEvent.patch b/patches/server/0724-Add-TameableDeathMessageEvent.patch index 58ea5cd5d1..a3f8770f2a 100644 --- a/patches/server/0724-Add-TameableDeathMessageEvent.patch +++ b/patches/server/0724-Add-TameableDeathMessageEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add TameableDeathMessageEvent diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -index 8f085654f3b9c540346fe4e56c71d572da7a897c..4d893c445af2b6dc74d5ad731b69eb5a488817b4 100644 +index ae474216d54317a9d102cb6832225074c94c8e4b..01b91388577b6013d7bd5c9112a03f818fee1f9c 100644 --- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java +++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -@@ -197,7 +197,12 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { +@@ -195,7 +195,12 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { @Override public void die(DamageSource damageSource) { if (!this.level().isClientSide && this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES) && this.getOwner() instanceof ServerPlayer) { diff --git a/patches/server/0726-fix-player-loottables-running-when-mob-loot-gamerule.patch b/patches/server/0726-fix-player-loottables-running-when-mob-loot-gamerule.patch index 185fdf4437..5fc7657405 100644 --- a/patches/server/0726-fix-player-loottables-running-when-mob-loot-gamerule.patch +++ b/patches/server/0726-fix-player-loottables-running-when-mob-loot-gamerule.patch @@ -5,7 +5,7 @@ Subject: [PATCH] fix player loottables running when mob loot gamerule is false diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index be8c6c48287b73693ead9ae22071f2b4af7eed32..0db3f5b06b6c93882761450ea77ba4ee09869c61 100644 +index b5a3587a9074a1a2fcc2252d2db8b184b6ab6793..3f8f0e88339d847c44120b7657161bf43402db74 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -875,12 +875,14 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0727-Ensure-entity-passenger-world-matches-ridden-entity.patch b/patches/server/0727-Ensure-entity-passenger-world-matches-ridden-entity.patch index a841c24fcd..2c800da975 100644 --- a/patches/server/0727-Ensure-entity-passenger-world-matches-ridden-entity.patch +++ b/patches/server/0727-Ensure-entity-passenger-world-matches-ridden-entity.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Ensure entity passenger world matches ridden entity Bad plugins doing this would cause some obvious problems... diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7e6ea850078179f7c63b597a788ef105802a0260..2476b3fa3ecd976c6f6fb27dc3ad815bbab0165f 100644 +index d391114787e4f7491241b6abc45dcf3f2a7f9fb5..f08908238cc9680310a2b37089b051bf6fdf5ee3 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2580,7 +2580,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0729-Allow-changing-the-EnderDragon-podium.patch b/patches/server/0729-Allow-changing-the-EnderDragon-podium.patch index fc8eed08e4..a9354ec22b 100644 --- a/patches/server/0729-Allow-changing-the-EnderDragon-podium.patch +++ b/patches/server/0729-Allow-changing-the-EnderDragon-podium.patch @@ -58,68 +58,68 @@ index 6d01175ea2092bc5f5ebb7aa066450bfec2443a1..61e4f8be9f5927b65ae03da98250d3cd f1 = Math.max((float) Math.sqrt(blockposition.distToCenterSqr(this.position())) / 4.0F, 1.0F); float f3 = 6.0F / f1; diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java -index f4028b6890fd094360a33403728588380111204d..d6ec0583dbaca95eb6a6444923cc1311a9753825 100644 +index 803d227281d70606691eed95c4b10a27ca5d1125..5663f2ff1eba4a5e00c76c9d735cb553faae6a04 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java -@@ -32,7 +32,7 @@ public class DragonDeathPhase extends AbstractDragonPhaseInstance { - public void doServerTick() { - ++this.time; +@@ -43,7 +43,7 @@ public class DragonDeathPhase extends AbstractDragonPhaseInstance { if (this.targetLocation == null) { -- BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); -+ BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium + BlockPos blockPos = this.dragon + .level() +- .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); ++ .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium this.targetLocation = Vec3.atBottomCenterOf(blockPos); } diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java -index 00228e49c07eeed13b726192d5f9b8f2fc55bb75..bd7be8a5a24f1328dde28ae4a66823c12110fa02 100644 +index 707ef45ccd7fbcbe1947c8941846277f19ee54c9..ddf668205a7cb29b9018bf9eea49667b5fd2d471 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java @@ -54,7 +54,7 @@ public class DragonHoldingPatternPhase extends AbstractDragonPhaseInstance { - - private void findNewTarget() { if (this.currentPath != null && this.currentPath.isDone()) { -- BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new BlockPos(EndPodiumFeature.getLocation(this.dragon.getFightOrigin()))); -+ BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium + BlockPos blockPos = this.dragon + .level() +- .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new BlockPos(EndPodiumFeature.getLocation(this.dragon.getFightOrigin()))); ++ .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new BlockPos(this.dragon.getPodium())); // Paper - Allow changing the EnderDragon podium int i = this.dragon.getDragonFight() == null ? 0 : this.dragon.getDragonFight().getCrystalsAlive(); if (this.dragon.getRandom().nextInt(i + 3) == 0) { this.dragon.getPhaseManager().setPhase(EnderDragonPhase.LANDING_APPROACH); diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java -index 80647b1f5192e6f2b660a31413db1fa45fb92f2c..e161bfb06beeada4987272d01a0f140069b37951 100644 +index e731d0f74692615ce5f42f690e36bd906a39c1dd..557de8a8e21e7f049b6acf27b4ec927ef5a9f9cb 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java -@@ -52,7 +52,7 @@ public class DragonLandingApproachPhase extends AbstractDragonPhaseInstance { - private void findNewTarget() { - if (this.currentPath == null || this.currentPath.isDone()) { +@@ -53,7 +53,7 @@ public class DragonLandingApproachPhase extends AbstractDragonPhaseInstance { int i = this.dragon.findClosestNode(); -- BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); -+ BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium - Player player = this.dragon.level().getNearestPlayer(NEAR_EGG_TARGETING, this.dragon, (double)blockPos.getX(), (double)blockPos.getY(), (double)blockPos.getZ()); - int j; - if (player != null) { + BlockPos blockPos = this.dragon + .level() +- .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); ++ .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium + Player player = this.dragon + .level() + .getNearestPlayer(NEAR_EGG_TARGETING, this.dragon, (double)blockPos.getX(), (double)blockPos.getY(), (double)blockPos.getZ()); diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java -index 48ebc2ab8ebbdc2292af10b955384bf7d722ade2..24db7fafd31277eb1b82eac4a97b2f979c1d3816 100644 +index d913147d692e7e58bec4fac44c7e93a1822e8f65..3b960060f152d0352c2f8cdc1c71543cd7fa0dbd 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java -@@ -39,7 +39,7 @@ public class DragonLandingPhase extends AbstractDragonPhaseInstance { - @Override +@@ -41,7 +41,7 @@ public class DragonLandingPhase extends AbstractDragonPhaseInstance { public void doServerTick() { if (this.targetLocation == null) { -- this.targetLocation = Vec3.atBottomCenterOf(this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin()))); -+ this.targetLocation = Vec3.atBottomCenterOf(this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium())); // Paper - Allow changing the EnderDragon podium + this.targetLocation = Vec3.atBottomCenterOf( +- this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())) ++ this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()) // Paper - Allow changing the EnderDragon podium + ); } - if (this.targetLocation.distanceToSqr(this.dragon.getX(), this.dragon.getY(), this.dragon.getZ()) < 1.0D) { diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java -index 1290090f855840bf64bf3a7ba93e3cb036630dcc..792ff77090fa582a7ffcb7b8c394badfa7586126 100644 +index 8d66284eb96cfc0392c211842e87875a095c3ca2..718bf877179f85ee3f0de384ca3a8aaebaa067a5 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java -@@ -24,7 +24,7 @@ public class DragonTakeoffPhase extends AbstractDragonPhaseInstance { - @Override - public void doServerTick() { +@@ -25,7 +25,7 @@ public class DragonTakeoffPhase extends AbstractDragonPhaseInstance { if (!this.firstTick && this.currentPath != null) { -- BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); -+ BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium - if (!blockPos.closerToCenterThan(this.dragon.position(), 10.0D)) { + BlockPos blockPos = this.dragon + .level() +- .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); ++ .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium + if (!blockPos.closerToCenterThan(this.dragon.position(), 10.0)) { this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java diff --git a/patches/server/0735-Fix-CME-in-CraftPersistentDataTypeRegistry.patch b/patches/server/0735-Fix-CME-in-CraftPersistentDataTypeRegistry.patch index feadff040a..ed8adb4503 100644 --- a/patches/server/0735-Fix-CME-in-CraftPersistentDataTypeRegistry.patch +++ b/patches/server/0735-Fix-CME-in-CraftPersistentDataTypeRegistry.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix CME in CraftPersistentDataTypeRegistry diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataTypeRegistry.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataTypeRegistry.java -index f83fbad4b579726ba5f759de3aa752caaf0aa79c..e0ef6964934ca0b280eded00b38220e3c3a0f035 100644 +index 71dc4a2285ddc86e7aa65ba1a211997ffa8fcce4..20c53aac0aef180ee12de919a8000e4b4bc619ff 100644 --- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataTypeRegistry.java +++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataTypeRegistry.java @@ -121,7 +121,7 @@ public final class CraftPersistentDataTypeRegistry { diff --git a/patches/server/0740-Add-PlayerStopUsingItemEvent.patch b/patches/server/0740-Add-PlayerStopUsingItemEvent.patch index fad59d6983..c78c171d1e 100644 --- a/patches/server/0740-Add-PlayerStopUsingItemEvent.patch +++ b/patches/server/0740-Add-PlayerStopUsingItemEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerStopUsingItemEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 511e8e789932df77999689659d1efbe311339e40..79fd521d5c4a8d6acd2b4f946dfdcc7b4e641b75 100644 +index 5de5ca787905d9e0133e5f75280748526c568203..2b7325d3bcea2175ec22a45101f5bbaf29c2231a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -4045,6 +4045,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0743-Add-support-for-Proxy-Protocol.patch b/patches/server/0743-Add-support-for-Proxy-Protocol.patch index ef41da5d60..1c60d69833 100644 --- a/patches/server/0743-Add-support-for-Proxy-Protocol.patch +++ b/patches/server/0743-Add-support-for-Proxy-Protocol.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add support for Proxy Protocol diff --git a/build.gradle.kts b/build.gradle.kts -index 7cbfd129efcc2e971b75aaa272dee79a3b4d2d5c..5d35409137aff0eab242a0d4eb235e10cb7fe236 100644 +index d16c0311142e44ec1048818221796c09ab7a90d8..f9056ee057a22a11288405cd42cd0ba4c9d120c3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -30,6 +30,7 @@ dependencies { diff --git a/patches/server/0747-Sanitize-sent-BlockEntity-NBT.patch b/patches/server/0747-Sanitize-sent-BlockEntity-NBT.patch index f607c4b19b..96727241f8 100644 --- a/patches/server/0747-Sanitize-sent-BlockEntity-NBT.patch +++ b/patches/server/0747-Sanitize-sent-BlockEntity-NBT.patch @@ -18,10 +18,10 @@ index d79284a790569141c2ac8178d6ecc20b17cdd0d3..3944852921335c78a04a9dc301882ab5 public static ClientboundBlockEntityDataPacket create(BlockEntity blockEntity) { diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java -index f47eeb70661661610ef1a96dd9da67785825c126..89e3163b0301f8414c9400a6e00cdd85841fe2e8 100644 +index 99fe90094f1cabdaea9db89cfc016a98c1ee8c2d..ebd7b78f9d3439f8278846c32ee3317ad9f1e6ad 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java -@@ -152,6 +152,7 @@ public class ClientboundLevelChunkPacketData { +@@ -149,6 +149,7 @@ public class ClientboundLevelChunkPacketData { CompoundTag compoundTag = blockEntity.getUpdateTag(); BlockPos blockPos = blockEntity.getBlockPos(); int i = SectionPos.sectionRelative(blockPos.getX()) << 4 | SectionPos.sectionRelative(blockPos.getZ()); diff --git a/patches/server/0748-Disable-component-selector-resolving-in-books-by-def.patch b/patches/server/0748-Disable-component-selector-resolving-in-books-by-def.patch index 33fd8e47d0..97082feba7 100644 --- a/patches/server/0748-Disable-component-selector-resolving-in-books-by-def.patch +++ b/patches/server/0748-Disable-component-selector-resolving-in-books-by-def.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Disable component selector resolving in books by default diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java -index a324df312d9bb87d9e0962f8028d900933e70c07..258a636a59203c4e5415a89002c6a607338f9514 100644 +index 81bb0abea7ebd2705f84fae31e4a3d2de92d7d18..793ab8acd7445984cff2628e3f001661dc20c8e5 100644 --- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java +++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java -@@ -111,7 +111,7 @@ public class WrittenBookItem extends Item { +@@ -112,7 +112,7 @@ public class WrittenBookItem extends Item { public static boolean resolveBookComponents(ItemStack book, @Nullable CommandSourceStack commandSource, @Nullable Player player) { CompoundTag compoundTag = book.getTag(); diff --git a/patches/server/0749-Prevent-entity-loading-causing-async-lookups.patch b/patches/server/0749-Prevent-entity-loading-causing-async-lookups.patch index 17a6ab001e..d02ab57220 100644 --- a/patches/server/0749-Prevent-entity-loading-causing-async-lookups.patch +++ b/patches/server/0749-Prevent-entity-loading-causing-async-lookups.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent entity loading causing async lookups diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2476b3fa3ecd976c6f6fb27dc3ad815bbab0165f..455cfdc2ce0960347605e149b88afab5ad8a3b05 100644 +index f08908238cc9680310a2b37089b051bf6fdf5ee3..936ce33bffd93ed7210b6659c27c476e1db348bb 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -727,6 +727,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0750-Throw-exception-on-world-create-while-being-ticked.patch b/patches/server/0750-Throw-exception-on-world-create-while-being-ticked.patch index 34fcf49e25..b8f3f47e4d 100644 --- a/patches/server/0750-Throw-exception-on-world-create-while-being-ticked.patch +++ b/patches/server/0750-Throw-exception-on-world-create-while-being-ticked.patch @@ -7,7 +7,7 @@ There are no plans to support creating worlds while worlds are being ticked themselvess. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 8080eee9babe02660724eee756700a4d5e69014f..ab1f4e62b2ffed99b47ae23cae172f20ed586b27 100644 +index 03fd35ee321c80ca674cea9eb366cffcc95bc893..c2326a72a038526c850b7820faa59618eba6eb88 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -307,6 +307,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0752-Add-WardenAngerChangeEvent.patch b/patches/server/0752-Add-WardenAngerChangeEvent.patch index 9344bd47cf..298551c409 100644 --- a/patches/server/0752-Add-WardenAngerChangeEvent.patch +++ b/patches/server/0752-Add-WardenAngerChangeEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add WardenAngerChangeEvent diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java b/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java -index 02abc5f387d781094bd2f39233444add3a470be1..1017c294b48bf0bbf733e1f41d580d1e6c927834 100644 +index e9d7d165974ac2f96d1bb13710a41c36307daa56..053036b4d68a1780f0b1885a7a0c931c02ed648b 100644 --- a/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java +++ b/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java -@@ -146,7 +146,7 @@ public class AngerManagement { +@@ -155,7 +155,7 @@ public class AngerManagement { public int increaseAnger(Entity entity, int amount) { boolean bl = !this.angerBySuspect.containsKey(entity); int i = this.angerBySuspect.computeInt(entity, (suspect, anger) -> { diff --git a/patches/server/0753-Add-option-for-strict-advancement-dimension-checks.patch b/patches/server/0753-Add-option-for-strict-advancement-dimension-checks.patch index 3dd4e6d490..fb51c24820 100644 --- a/patches/server/0753-Add-option-for-strict-advancement-dimension-checks.patch +++ b/patches/server/0753-Add-option-for-strict-advancement-dimension-checks.patch @@ -11,10 +11,10 @@ distance trigger. This adds a config option to ignore that and use the exact dimension key of the worlds involved. diff --git a/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java b/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java -index 5f9cb2c7a2874e423087d04d3360af0364692b5c..428e0afef2cac9f2a19d8cfe8f2504ddd8e50887 100644 +index df1d872869319fe29bd6085f915927e5a01db7b9..aa6a255574feac0f58e2102eca2705fc6832afd5 100644 --- a/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java +++ b/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java -@@ -25,7 +25,7 @@ public record LocationPredicate(Optional<LocationPredicate.PositionPredicate> po +@@ -64,7 +64,7 @@ public record LocationPredicate( public boolean matches(ServerLevel world, double x, double y, double z) { if (this.position.isPresent() && !this.position.get().matches(x, y, z)) { return false; @@ -24,7 +24,7 @@ index 5f9cb2c7a2874e423087d04d3360af0364692b5c..428e0afef2cac9f2a19d8cfe8f2504dd } else { BlockPos blockPos = BlockPos.containing(x, y, z); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 0db3f5b06b6c93882761450ea77ba4ee09869c61..bc95420dcf5d23d028e5df6595899a8712550be8 100644 +index 3f8f0e88339d847c44120b7657161bf43402db74..c99a672dd2d2e4972e9d4025e10e8863d0af1e6a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1272,6 +1272,12 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0760-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch b/patches/server/0760-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch index 8b8d15552f..66e57a50fb 100644 --- a/patches/server/0760-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch +++ b/patches/server/0760-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch @@ -15,10 +15,10 @@ to account for the case where the chunk is _not_ currently loaded and then later loaded. diff --git a/src/main/java/net/minecraft/world/level/gameevent/DynamicGameEventListener.java b/src/main/java/net/minecraft/world/level/gameevent/DynamicGameEventListener.java -index e64435c1dfbaf182d2292a1123701033f817ec38..47647d3db7ce36226a817df640a0b25574fb9b02 100644 +index 13c2a0215ca072b7b30aec773094bbf0c7f8668c..38c89c1f70f5c9aa2d11e0e53e004e513c537dd2 100644 --- a/src/main/java/net/minecraft/world/level/gameevent/DynamicGameEventListener.java +++ b/src/main/java/net/minecraft/world/level/gameevent/DynamicGameEventListener.java -@@ -48,7 +48,7 @@ public class DynamicGameEventListener<T extends GameEventListener> { +@@ -47,7 +47,7 @@ public class DynamicGameEventListener<T extends GameEventListener> { private static void ifChunkExists(LevelReader world, @Nullable SectionPos sectionPos, Consumer<GameEventListenerRegistry> dispatcherConsumer) { if (sectionPos != null) { diff --git a/patches/server/0761-Add-various-missing-EntityDropItemEvent-calls.patch b/patches/server/0761-Add-various-missing-EntityDropItemEvent-calls.patch index a4e7c5b7d4..d3b144009b 100644 --- a/patches/server/0761-Add-various-missing-EntityDropItemEvent-calls.patch +++ b/patches/server/0761-Add-various-missing-EntityDropItemEvent-calls.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add various missing EntityDropItemEvent calls diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 455cfdc2ce0960347605e149b88afab5ad8a3b05..007e5fc95dd5cb3973f45fd6a435cc102d133728 100644 +index 936ce33bffd93ed7210b6659c27c476e1db348bb..319bb4d94f8221e20557c0e0805c581447e2ee57 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2491,6 +2491,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0765-Add-EntityPortalReadyEvent.patch b/patches/server/0765-Add-EntityPortalReadyEvent.patch index 41d4a4e570..99fe9a8280 100644 --- a/patches/server/0765-Add-EntityPortalReadyEvent.patch +++ b/patches/server/0765-Add-EntityPortalReadyEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityPortalReadyEvent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 007e5fc95dd5cb3973f45fd6a435cc102d133728..06fbea11c20db3a1585b969b1578073821c5b316 100644 +index 319bb4d94f8221e20557c0e0805c581447e2ee57..8b44dc6cfddf77bdfe3684d1cdb15bb9125c4137 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2832,6 +2832,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0770-Add-and-fix-missing-BlockFadeEvents.patch b/patches/server/0770-Add-and-fix-missing-BlockFadeEvents.patch index 2813257f0f..d164ac2642 100644 --- a/patches/server/0770-Add-and-fix-missing-BlockFadeEvents.patch +++ b/patches/server/0770-Add-and-fix-missing-BlockFadeEvents.patch @@ -10,7 +10,7 @@ potentially waterlogged block states fading. Co-authored-by: Lulu13022002 <[email protected] diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java -index 68978e1629381ada161225c53a236a54deae6481..4a1f2d326c4ece9da717a50b802af86fd9338a0b 100644 +index 6e283e8c3db31f03dd95c94887e647b8d82a3604..1a842694c076d71b14733904c2052183d86d1f5d 100644 --- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java @@ -92,6 +92,11 @@ public class FrogspawnBlock extends Block { @@ -23,7 +23,7 @@ index 68978e1629381ada161225c53a236a54deae6481..4a1f2d326c4ece9da717a50b802af86f + } + // Paper end - Call BlockFadeEvent this.destroyBlock(world, pos); - world.playSound((Player)null, pos, SoundEvents.FROGSPAWN_HATCH, SoundSource.BLOCKS, 1.0F, 1.0F); + world.playSound(null, pos, SoundEvents.FROGSPAWN_HATCH, SoundSource.BLOCKS, 1.0F, 1.0F); this.spawnTadpoles(world, pos, random); diff --git a/src/main/java/net/minecraft/world/level/block/ScaffoldingBlock.java b/src/main/java/net/minecraft/world/level/block/ScaffoldingBlock.java index f660e58badfcc2a90e6dd618428a21bf5ad34969..13ee09f93ec325e416a2b29e3608e870e7f06aed 100644 @@ -39,10 +39,10 @@ index f660e58badfcc2a90e6dd618428a21bf5ad34969..13ee09f93ec325e416a2b29e3608e870 FallingBlockEntity.fall(world, pos, iblockdata1); } else { diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -index 615ee22b4948d6a4869dc8b2111f48056969dd79..8782b05575e4a8d5e5c667c43808442b81c13f6b 100644 +index 41bc7180d7657d43215fcb283afe1a9ccdd54e9d..1ff0e5c120418c3e5f92326580af7254fb4c699f 100644 --- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -@@ -61,12 +61,26 @@ public class SnifferEggBlock extends Block { +@@ -60,12 +60,26 @@ public class SnifferEggBlock extends Block { return this.getHatchLevel(state) == 2; } @@ -57,15 +57,15 @@ index 615ee22b4948d6a4869dc8b2111f48056969dd79..8782b05575e4a8d5e5c667c43808442b @Override public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { if (!this.isReadyToHatch(state)) { - world.playSound((Player)null, pos, SoundEvents.SNIFFER_EGG_CRACK, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); + world.playSound(null, pos, SoundEvents.SNIFFER_EGG_CRACK, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); world.setBlock(pos, state.setValue(HATCH, Integer.valueOf(this.getHatchLevel(state) + 1)), 2); } else { + // Paper start - Call BlockFadeEvent + if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, state.getFluidState().createLegacyBlock()).isCancelled()) { -+ rescheduleTick(world, pos); ++ this.rescheduleTick(world, pos); + return; + } + // Paper end - Call BlockFadeEvent - world.playSound((Player)null, pos, SoundEvents.SNIFFER_EGG_HATCH, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); + world.playSound(null, pos, SoundEvents.SNIFFER_EGG_HATCH, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); world.destroyBlock(pos, false); Sniffer sniffer = EntityType.SNIFFER.create(world); diff --git a/patches/server/0776-Fix-plugin-loggers-on-server-shutdown.patch b/patches/server/0776-Fix-plugin-loggers-on-server-shutdown.patch index 4f2b23f29b..a4e678729b 100644 --- a/patches/server/0776-Fix-plugin-loggers-on-server-shutdown.patch +++ b/patches/server/0776-Fix-plugin-loggers-on-server-shutdown.patch @@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..c1d3bac79bb8b4796c013ff4472f75dc + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ab1f4e62b2ffed99b47ae23cae172f20ed586b27..97dbe5a44d2791c6dee830654c3935f4ac54aad4 100644 +index c2326a72a038526c850b7820faa59618eba6eb88..bfee202e1dc8ea875b9d2b4e8c3b0be3f6d94b26 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1223,6 +1223,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa diff --git a/patches/server/0777-Stop-large-look-changes-from-crashing-the-server.patch b/patches/server/0777-Stop-large-look-changes-from-crashing-the-server.patch index 92ac8e787a..3b4d6ca5d3 100644 --- a/patches/server/0777-Stop-large-look-changes-from-crashing-the-server.patch +++ b/patches/server/0777-Stop-large-look-changes-from-crashing-the-server.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Stop large look changes from crashing the server Co-authored-by: Jaren Knodel <[email protected]> diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 79fd521d5c4a8d6acd2b4f946dfdcc7b4e641b75..5fd17014c95e04d50d30e79d6e331a06b238b613 100644 +index 2b7325d3bcea2175ec22a45101f5bbaf29c2231a..09a26622db4bb4b504f735454e2b031f4840b092 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3076,37 +3076,15 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0778-Fire-EntityChangeBlockEvent-in-more-places.patch b/patches/server/0778-Fire-EntityChangeBlockEvent-in-more-places.patch index ce2102d524..9bb1ac5623 100644 --- a/patches/server/0778-Fire-EntityChangeBlockEvent-in-more-places.patch +++ b/patches/server/0778-Fire-EntityChangeBlockEvent-in-more-places.patch @@ -80,10 +80,10 @@ index a298f511c8a7eb208a0dd63b24ec050848a31476..41a3ca4edf4fa662f2af13efd7b78b56 }); world.levelEvent(3002, blockposition1, -1); diff --git a/src/main/java/net/minecraft/world/item/AxeItem.java b/src/main/java/net/minecraft/world/item/AxeItem.java -index db507638a97b5a33df712c54daff35b21922c0dd..2e75fd06e9e379eb95ebfe55086ffc327706ab2f 100644 +index da06e2aca90b467f3fa36a4a73d83a432266e6b7..0954d7a3e5a8d35802b6bab217eaff315b9582a0 100644 --- a/src/main/java/net/minecraft/world/item/AxeItem.java +++ b/src/main/java/net/minecraft/world/item/AxeItem.java -@@ -38,6 +38,11 @@ public class AxeItem extends DiggerItem { +@@ -60,6 +60,11 @@ public class AxeItem extends DiggerItem { return InteractionResult.PASS; } else { ItemStack itemStack = context.getItemInHand(); @@ -112,11 +112,11 @@ index 1977e702f6af39ebf100c1f2f2edc2d1c4d003b0..cfcd1778b5ae66395400221879dde357 Block.pushEntitiesUp(iblockdata, iblockdata1, world, blockposition); world.setBlock(blockposition, iblockdata1, 2); diff --git a/src/main/java/net/minecraft/world/item/HoneycombItem.java b/src/main/java/net/minecraft/world/item/HoneycombItem.java -index 78bdf7c0a058e84cafcd831c6d6f5123c0f168b0..e0cae3b6848af74fefc37a1e3183c501155c4710 100644 +index 486b1bdfe93aec49ee9bd3f2152c1e98d72f298f..45bb406bc1c7d95cfe7e24855e7a1cb91b798f40 100644 --- a/src/main/java/net/minecraft/world/item/HoneycombItem.java +++ b/src/main/java/net/minecraft/world/item/HoneycombItem.java -@@ -39,6 +39,14 @@ public class HoneycombItem extends Item implements SignApplicator { - return getWaxed(blockState).map((state) -> { +@@ -78,6 +78,14 @@ public class HoneycombItem extends Item implements SignApplicator { + return getWaxed(blockState).map(state -> { Player player = context.getPlayer(); ItemStack itemStack = context.getItemInHand(); + // Paper start - EntityChangeBlockEvent @@ -148,10 +148,10 @@ index 5c62741e3a3854a7f674bfec49758f837f3bb9a0..b93ed2896ebeb8ec75eb3cfb717a740c entityhuman.setItemInHand(context.getHand(), ItemUtils.createFilledResult(itemstack, entityhuman, new ItemStack(Items.GLASS_BOTTLE))); entityhuman.awardStat(Stats.ITEM_USED.get(itemstack.getItem())); diff --git a/src/main/java/net/minecraft/world/item/ShovelItem.java b/src/main/java/net/minecraft/world/item/ShovelItem.java -index 32995cb5efdad0bc34ecacacb78cccd21220ba8d..21212462e6b415e96536a27b2c009d1562f18946 100644 +index d743f4228f4ff869e823ad8b1aa3b7d5c84ae07a..da225c6fd807eb82196142943207c113e849d843 100644 --- a/src/main/java/net/minecraft/world/item/ShovelItem.java +++ b/src/main/java/net/minecraft/world/item/ShovelItem.java -@@ -36,20 +36,29 @@ public class ShovelItem extends DiggerItem { +@@ -45,20 +45,29 @@ public class ShovelItem extends DiggerItem { Player player = context.getPlayer(); BlockState blockState2 = FLATTENABLES.get(blockState.getBlock()); BlockState blockState3 = null; @@ -163,7 +163,7 @@ index 32995cb5efdad0bc34ecacacb78cccd21220ba8d..21212462e6b415e96536a27b2c009d15 } else if (blockState.getBlock() instanceof CampfireBlock && blockState.getValue(CampfireBlock.LIT)) { + afterAction = () -> { // Paper if (!level.isClientSide()) { - level.levelEvent((Player)null, 1009, blockPos, 0); + level.levelEvent(null, 1009, blockPos, 0); } CampfireBlock.dowse(context.getPlayer(), level, blockPos, blockState); diff --git a/patches/server/0780-Missing-effect-cause.patch b/patches/server/0780-Missing-effect-cause.patch index 6710474f4b..c008aa285d 100644 --- a/patches/server/0780-Missing-effect-cause.patch +++ b/patches/server/0780-Missing-effect-cause.patch @@ -18,7 +18,7 @@ index af5db5da4e5b2fd90a5cf0ca3c92e87ba82d4779..b21e180641d17438997a80e5bcb0ec79 @Override diff --git a/src/main/java/net/minecraft/world/item/HoneyBottleItem.java b/src/main/java/net/minecraft/world/item/HoneyBottleItem.java -index c8e783014a6a09d59e85715a7fbf2a5f65201e77..92266e56200815aa88ebf91bc1ff1a440788275d 100644 +index 5d27598d62c1ddfc84bac64228275749ec01cba5..f0061dab24ee5ee94c151483a553db2590108581 100644 --- a/src/main/java/net/minecraft/world/item/HoneyBottleItem.java +++ b/src/main/java/net/minecraft/world/item/HoneyBottleItem.java @@ -28,7 +28,7 @@ public class HoneyBottleItem extends Item { @@ -31,13 +31,13 @@ index c8e783014a6a09d59e85715a7fbf2a5f65201e77..92266e56200815aa88ebf91bc1ff1a44 if (stack.isEmpty()) { diff --git a/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java b/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java -index 8a7ab376a260bd70a799ce182a03450b3916f733..06ef78580de95bfa0e86f307997664e7b3addaea 100644 +index ed19c3b8d19b4244d8d374d0531b1dcacee2de4a..fb0634f9b9a2b41a4fbcde1411d76bf22b2c73aa 100644 --- a/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java +++ b/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java -@@ -66,7 +66,7 @@ public class SuspiciousStewItem extends Item { +@@ -64,7 +64,7 @@ public class SuspiciousStewItem extends Item { public ItemStack finishUsingItem(ItemStack stack, Level world, LivingEntity user) { ItemStack itemStack = super.finishUsingItem(stack, world, user); - listPotionEffects(itemStack, (effect) -> { + listPotionEffects(itemStack, effect -> { - user.addEffect(effect.createEffectInstance()); + user.addEffect(effect.createEffectInstance(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // Paper - Add missing effect cause }); diff --git a/patches/server/0782-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch b/patches/server/0782-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch index 00601e4c1f..6adc2a884c 100644 --- a/patches/server/0782-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch +++ b/patches/server/0782-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add a consumer parameter to ProjectileSource#launchProjectile diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 6af7796c9505b43b2c4dfe869214b0f56dc71244..2ef22ba88fa65ecddb88f7fceef598f2e7e55e03 100644 +index 5a760234a4604cec289705f1439f03c821bb0aab..9ae20d759965bc9b88b52c15372155ad10bcc199 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -562,8 +562,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0783-Call-BlockPhysicsEvent-more-often.patch b/patches/server/0783-Call-BlockPhysicsEvent-more-often.patch index 3fda4c8065..1839fbe711 100644 --- a/patches/server/0783-Call-BlockPhysicsEvent-more-often.patch +++ b/patches/server/0783-Call-BlockPhysicsEvent-more-often.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Call BlockPhysicsEvent more often diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java -index 7d54abc2553f4b319df4d533a0b689c1807b6102..87db9febbbf53702be0e1e89a95db99e823713e5 100644 +index 457a963ee6ebd3cf5c3831f6660e3850335af49f..106af2b2c7ff72c7549975aef75cdcff8d9a7d97 100644 --- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java +++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java @@ -119,7 +119,20 @@ public class CollectingNeighborUpdater implements NeighborUpdater { @@ -28,5 +28,5 @@ index 7d54abc2553f4b319df4d533a0b689c1807b6102..87db9febbbf53702be0e1e89a95db99e + } + // Paper end - Call BlockPhysicsEvent if (this.idx < NeighborUpdater.UPDATE_ORDER.length && NeighborUpdater.UPDATE_ORDER[this.idx] == this.skipDirection) { - ++this.idx; + this.idx++; } diff --git a/patches/server/0786-fix-Jigsaw-block-kicking-user.patch b/patches/server/0786-fix-Jigsaw-block-kicking-user.patch index 3c04241bd6..95f3747fd3 100644 --- a/patches/server/0786-fix-Jigsaw-block-kicking-user.patch +++ b/patches/server/0786-fix-Jigsaw-block-kicking-user.patch @@ -5,10 +5,10 @@ Subject: [PATCH] fix Jigsaw block kicking user diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java -index 72d89e8999825b43a36ed9ee8f4545bde3927690..e2e31d6383c7de4f2eede46987d51978a5692639 100644 +index 27947d216cf705b8c6a85c9ba6521cdc05149015..d75d43fd3f6bdd9b85bb32e026e20eee9b29a967 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java -@@ -133,7 +133,12 @@ public class JigsawBlockEntity extends BlockEntity { +@@ -138,7 +138,12 @@ public class JigsawBlockEntity extends BlockEntity { public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) { BlockPos blockPos = this.getBlockPos().relative(this.getBlockState().getValue(JigsawBlock.ORIENTATION).front()); Registry<StructureTemplatePool> registry = world.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL); @@ -23,10 +23,10 @@ index 72d89e8999825b43a36ed9ee8f4545bde3927690..e2e31d6383c7de4f2eede46987d51978 } diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool.java b/src/main/java/net/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool.java -index 2c5165835dede1abc07ff508c820f0fe1a1027d0..194864460a5508b6b60f445d6c7923c2ae14a15b 100644 +index d87c2f41ec32178f5663abb43c68d87cdc9e925e..ae4560767d5683a035aa18bf61c2613d0c5947a8 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool.java -@@ -85,7 +85,13 @@ public class StructureTemplatePool { +@@ -101,7 +101,13 @@ public class StructureTemplatePool { } public StructurePoolElement getRandomTemplate(RandomSource random) { diff --git a/patches/server/0789-Fix-a-bunch-of-vanilla-bugs.patch b/patches/server/0789-Fix-a-bunch-of-vanilla-bugs.patch index 80d7e8f072..73ce537a92 100644 --- a/patches/server/0789-Fix-a-bunch-of-vanilla-bugs.patch +++ b/patches/server/0789-Fix-a-bunch-of-vanilla-bugs.patch @@ -87,12 +87,12 @@ index 829c72333664da0c06ce04af93ea39bb90ce0b67..b4f7e3ae855cbf48925f0db916501adf this.setSuccess(true); return stack; diff --git a/src/main/java/net/minecraft/server/commands/DeOpCommands.java b/src/main/java/net/minecraft/server/commands/DeOpCommands.java -index 40490d10649e92cf622849f1bb87538102b130c7..797efca662dcc0fe7f4cf0b4b7baa235ea044f1f 100644 +index 0641b6b77a27ce88794ece2d8b936fabba545717..e5dc7e3890ece93c703e0064bab33bca0457d9af 100644 --- a/src/main/java/net/minecraft/server/commands/DeOpCommands.java +++ b/src/main/java/net/minecraft/server/commands/DeOpCommands.java @@ -34,7 +34,7 @@ public class DeOpCommands { playerList.deop(gameProfile); - ++i; + i++; source.sendSuccess(() -> { - return Component.translatable("commands.deop.success", targets.iterator().next().getName()); + return Component.translatable("commands.deop.success", gameProfile.getName()); // Paper - fixes MC-253721 @@ -100,12 +100,12 @@ index 40490d10649e92cf622849f1bb87538102b130c7..797efca662dcc0fe7f4cf0b4b7baa235 } } diff --git a/src/main/java/net/minecraft/server/commands/OpCommand.java b/src/main/java/net/minecraft/server/commands/OpCommand.java -index 6cd6d69a20e95e344fc18ab67dc300824537a59b..2e2a7c2cf3081187da817479a9da3eb10f662a6d 100644 +index 06419a448a7e28e763c4569e48b7705a846032bb..3c7a3b13756bcf72d5024c273522317051268d48 100644 --- a/src/main/java/net/minecraft/server/commands/OpCommand.java +++ b/src/main/java/net/minecraft/server/commands/OpCommand.java @@ -39,7 +39,7 @@ public class OpCommand { playerList.op(gameProfile); - ++i; + i++; source.sendSuccess(() -> { - return Component.translatable("commands.op.success", targets.iterator().next().getName()); + return Component.translatable("commands.op.success", gameProfile.getName()); // Paper - fixes MC-253721 @@ -139,7 +139,7 @@ index 57f54e3399f9d2d7fecdae62858d20e50caf7afd..b804941c76582871813ba813b9eef242 if (!list.isEmpty()) { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index bc95420dcf5d23d028e5df6595899a8712550be8..84792f21cbb727bdb8f72b3574b39c4dad631612 100644 +index c99a672dd2d2e4972e9d4025e10e8863d0af1e6a..d831fb1f66dc38b6c9d3592944f94cc5eeaac864 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -419,14 +419,14 @@ public class ServerPlayer extends Player { @@ -206,12 +206,12 @@ index effe4c4fb37fe13aece70cdef4966047d4719af9..7152674d3f3fb98198585cb5ece2bb88 default SoundEvent getSaddleSoundEvent() { return SoundEvents.HORSE_SADDLE; diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/BegGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/BegGoal.java -index 9a46007245399481fb6e749d95e9e4791e799250..2afca5652541c9166278f8f2590ddb81003ae579 100644 +index 95ec11bfd4df6c53d6a4828f55c621cd08b0e666..f1b28965f6fe785e6e3a24fdb6db6676701338b9 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/BegGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/BegGoal.java -@@ -65,7 +65,7 @@ public class BegGoal extends Goal { +@@ -62,7 +62,7 @@ public class BegGoal extends Goal { private boolean playerHoldingInteresting(Player player) { - for(InteractionHand interactionHand : InteractionHand.values()) { + for (InteractionHand interactionHand : InteractionHand.values()) { ItemStack itemStack = player.getItemInHand(interactionHand); - if (this.wolf.isTame() && itemStack.is(Items.BONE)) { + if (!this.wolf.isTame() && itemStack.is(Items.BONE)) { // Paper - Fix MC-84789 @@ -264,11 +264,11 @@ index 11cc26954b4e97114b59df35a4f9b75a09132e20..0a3f7dcc0e205a85dbaa6dee1fc9ae2c @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java -index 19540fd4a7f992888fadb6501d0c8a5a7e71fcf6..e241ae250f4f04a17ef2c583d00b065a4ca56a4c 100644 +index ef71b3ef4444c05b4211de87e1c8ec52cbe3e72a..137ec75ee803789deb7b1ca93dd9369c9af362b9 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java @@ -21,6 +21,13 @@ public class SwellGoal extends Goal { - return this.creeper.getSwellDir() > 0 || livingEntity != null && this.creeper.distanceToSqr(livingEntity) < 9.0D; + return this.creeper.getSwellDir() > 0 || livingEntity != null && this.creeper.distanceToSqr(livingEntity) < 9.0; } + // Paper start - Fix MC-179072 @@ -336,15 +336,15 @@ index ab85050a64d4897aff11d0780d8cb26660918ac7..bfb9694087821de206fafe867f207e07 this.getFramedMapId().ifPresent((i) -> { MapItemSavedData worldmap = MapItem.getSavedData(i, this.level()); diff --git a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java -index f174094febfdfdc309f1b50877be60bae8a98156..5f407535298a31a34cfe114dd863fd6a9b977707 100644 +index 1d6e21853aefd14b33e3545795b5c4bf6df0176c..956857123953922a4a750f47dcebfeeffd4e3d51 100644 --- a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java +++ b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java -@@ -87,8 +87,8 @@ public class CatSpawner implements CustomSpawner { +@@ -85,8 +85,8 @@ public class CatSpawner implements CustomSpawner { if (cat == null) { return 0; } else { + cat.moveTo(pos, 0.0F, 0.0F); // Paper - move up - Fix MC-147659 - cat.finalizeSpawn(world, world.getCurrentDifficultyAt(pos), MobSpawnType.NATURAL, (SpawnGroupData)null, (CompoundTag)null); + cat.finalizeSpawn(world, world.getCurrentDifficultyAt(pos), MobSpawnType.NATURAL, null, null); - cat.moveTo(pos, 0.0F, 0.0F); world.addFreshEntityWithPassengers(cat); return 1; @@ -388,10 +388,10 @@ index b670c0cb3886c99d38a91b5c13aa2cefaae702cf..9599a5f96601030bf7f7cbd3392861d6 // Paper start - Add PlayerChangeBeaconEffectEvent io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock()); diff --git a/src/main/java/net/minecraft/world/item/BundleItem.java b/src/main/java/net/minecraft/world/item/BundleItem.java -index 10b0720ce7eed58fa3cd8c8051efa6225f7d73e1..ac0bc87f60c4e1562d1301522183e449558d42f8 100644 +index 2d829860ffefd4c8bb73023a723e9d7685da5cbe..dccad12de9fbd85704f1db205fb011456b88376d 100644 --- a/src/main/java/net/minecraft/world/item/BundleItem.java +++ b/src/main/java/net/minecraft/world/item/BundleItem.java -@@ -52,7 +52,7 @@ public class BundleItem extends Item { +@@ -51,7 +51,7 @@ public class BundleItem extends Item { }); } else if (itemStack.getItem().canFitInsideContainerItems()) { int i = (64 - getContentWeight(stack)) / getWeight(itemStack); @@ -400,7 +400,7 @@ index 10b0720ce7eed58fa3cd8c8051efa6225f7d73e1..ac0bc87f60c4e1562d1301522183e449 if (j > 0) { this.playInsertSound(player); } -@@ -121,7 +121,7 @@ public class BundleItem extends Item { +@@ -122,7 +122,7 @@ public class BundleItem extends Item { int i = getContentWeight(bundle); int j = getWeight(stack); int k = Math.min(stack.getCount(), (64 - i) / j); @@ -410,20 +410,20 @@ index 10b0720ce7eed58fa3cd8c8051efa6225f7d73e1..ac0bc87f60c4e1562d1301522183e449 } else { ListTag listTag = compoundTag.getList("Items", 10); diff --git a/src/main/java/net/minecraft/world/item/SaddleItem.java b/src/main/java/net/minecraft/world/item/SaddleItem.java -index ca6a2b9840c9ade87ec8effab01d4f184fe876b7..43129ecefcc8beccbcf2978f262b1ce8cf49ca43 100644 +index a569b404ece21fa9571e73947334f5aa57a8080c..51d350add4ca1756cb9e364e066bbee7949ffb8c 100644 --- a/src/main/java/net/minecraft/world/item/SaddleItem.java +++ b/src/main/java/net/minecraft/world/item/SaddleItem.java -@@ -18,7 +18,7 @@ public class SaddleItem extends Item { - if (entity instanceof Saddleable saddleable) { - if (entity.isAlive() && !saddleable.isSaddled() && saddleable.isSaddleable()) { - if (!user.level().isClientSide) { -- saddleable.equipSaddle(SoundSource.NEUTRAL); -+ saddleable.equipSaddle(SoundSource.NEUTRAL, stack.copyWithCount(1)); // Paper - Fix saddles losing nbt data - MC-191591 - entity.level().gameEvent(entity, GameEvent.EQUIP, entity.position()); - stack.shrink(1); - } +@@ -17,7 +17,7 @@ public class SaddleItem extends Item { + public InteractionResult interactLivingEntity(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) { + if (entity instanceof Saddleable saddleable && entity.isAlive() && !saddleable.isSaddled() && saddleable.isSaddleable()) { + if (!user.level().isClientSide) { +- saddleable.equipSaddle(SoundSource.NEUTRAL); ++ saddleable.equipSaddle(SoundSource.NEUTRAL, stack.copyWithCount(1)); // Paper - Fix saddles losing nbt data - MC-191591 + entity.level().gameEvent(entity, GameEvent.EQUIP, entity.position()); + stack.shrink(1); + } diff --git a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java -index 6e45582f8ea7dd2a46f58369c5581764538bff0d..3ecc92439fc85d224ff52f41c5e34079e042a5e6 100644 +index 655956f3c50d6a78b0cbfaa23d6a62cd776c1e52..85484d061090d989de8246df81f8e9e5f8906072 100644 --- a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java +++ b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java @@ -51,4 +51,11 @@ public class AzaleaBlock extends BushBlock implements BonemealableBlock { diff --git a/patches/server/0794-Add-PlayerInventorySlotChangeEvent.patch b/patches/server/0794-Add-PlayerInventorySlotChangeEvent.patch index 7c9e04e6e8..14f1948d31 100644 --- a/patches/server/0794-Add-PlayerInventorySlotChangeEvent.patch +++ b/patches/server/0794-Add-PlayerInventorySlotChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerInventorySlotChangeEvent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 84792f21cbb727bdb8f72b3574b39c4dad631612..ecdeaa3f5a793895c3a4584ae7e4594b21087167 100644 +index d831fb1f66dc38b6c9d3592944f94cc5eeaac864..2a1722db668b141705ce47389cd24d0a247e373d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -330,6 +330,25 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0800-Add-EntityToggleSitEvent.patch b/patches/server/0800-Add-EntityToggleSitEvent.patch index e149e09cf1..2f61a7420e 100644 --- a/patches/server/0800-Add-EntityToggleSitEvent.patch +++ b/patches/server/0800-Add-EntityToggleSitEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add EntityToggleSitEvent diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -index 4d893c445af2b6dc74d5ad731b69eb5a488817b4..e4550d3ac8d93e0dd9a54e41fbbbef2ef9d4f55e 100644 +index 01b91388577b6013d7bd5c9112a03f818fee1f9c..cf5cd0e49c4966e7b636a8ad4dec7a12806c6a4d 100644 --- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java +++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -@@ -67,7 +67,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { +@@ -69,7 +69,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { } this.orderedToSit = nbt.getBoolean("Sitting"); diff --git a/patches/server/0806-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch b/patches/server/0806-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch index 9908d15463..e1712bed3b 100644 --- a/patches/server/0806-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch +++ b/patches/server/0806-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix EntityCombustEvent cancellation cant fully prevent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 06fbea11c20db3a1585b969b1578073821c5b316..3778d900c272a815e67f79c6d2827be2bbe8195f 100644 +index 8b44dc6cfddf77bdfe3684d1cdb15bb9125c4137..640d7f248e3696b73ef8d7668358a78037081320 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3111,6 +3111,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0813-check-global-player-list-where-appropriate.patch b/patches/server/0813-check-global-player-list-where-appropriate.patch index 9905886fc6..9ca69c423c 100644 --- a/patches/server/0813-check-global-player-list-where-appropriate.patch +++ b/patches/server/0813-check-global-player-list-where-appropriate.patch @@ -24,7 +24,7 @@ index b5eda9931a82a667c25ca1a49980b01b042dc0cc..5f1a4a35d2179b7ff5a95390f82d65ca + // Paper end - check global player list where appropriate } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 5fd17014c95e04d50d30e79d6e331a06b238b613..4959d8fd8f84f99f289b898fd604d8a9808d62a4 100644 +index 09a26622db4bb4b504f735454e2b031f4840b092..b19b5b8678ce2fb912b703382ae79f5755e025e7 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3698,7 +3698,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -50,10 +50,10 @@ index d4ac3e566b47cfc8688bcc2ab08385b6de4693f8..7de9d012e7416eaa0189b513a0972c84 if (entityhuman instanceof ServerPlayer) { CriteriaTriggers.CURED_ZOMBIE_VILLAGER.trigger((ServerPlayer) entityhuman, this, entityvillager); diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index e7b6f97d8519a5797903664e5ba2a793e37a4bfc..57d4d2014f33a2f069d6c5aaa8e87e36b63a7177 100644 +index c35d5865b77203d0de6467d2793424837704e95a..77cd9d5518ac1d7c3c900354cdeb7be3fb66b0ac 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -231,4 +231,11 @@ public interface EntityGetter { +@@ -241,4 +241,11 @@ public interface EntityGetter { return null; } @@ -66,10 +66,10 @@ index e7b6f97d8519a5797903664e5ba2a793e37a4bfc..57d4d2014f33a2f069d6c5aaa8e87e36 + // Paper end - check global player list where appropriate } diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java -index e143f42e71ac774d49b75e6d85591aa1189ee210..c27b97e9f097c824de7c785b4cc9e0a503259b08 100644 +index ed3c82b96951af247680bde3e4e0951e80c7579e..d3a528f93d174820b3248f708178c71b4c04a9d2 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java -@@ -100,6 +100,13 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi +@@ -101,6 +101,13 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi @Nullable public static ServerPlayer tryGetPlayer(@Nullable Entity entity) { @@ -80,6 +80,6 @@ index e143f42e71ac774d49b75e6d85591aa1189ee210..c27b97e9f097c824de7c785b4cc9e0a5 + @Nullable + private static ServerPlayer tryGetPlayer0(@Nullable Entity entity) { + // Paper end - check global player list where appropriate - if (entity instanceof ServerPlayer serverPlayer) { - return serverPlayer; + if (entity instanceof ServerPlayer) { + return (ServerPlayer)entity; } else { diff --git a/patches/server/0816-Friction-API.patch b/patches/server/0816-Friction-API.patch index 7da72213c7..691571962d 100644 --- a/patches/server/0816-Friction-API.patch +++ b/patches/server/0816-Friction-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Friction API diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 0708502b46ec55d533c7d890b892a57779678854..834607dde3841105b3524b43f59380296924862a 100644 +index b19b5b8678ce2fb912b703382ae79f5755e025e7..084d988ec3dcdae54a10309d34d335ca4f37b7b0 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -262,6 +262,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0819-Sync-offhand-slot-in-menus.patch b/patches/server/0819-Sync-offhand-slot-in-menus.patch index 19c9999a04..5b34f7caeb 100644 --- a/patches/server/0819-Sync-offhand-slot-in-menus.patch +++ b/patches/server/0819-Sync-offhand-slot-in-menus.patch @@ -8,7 +8,7 @@ offhand slot isn't sent. This is not correct because you *can* put stuff into th by pressing the offhand swap item diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index ecdeaa3f5a793895c3a4584ae7e4594b21087167..d4930c40f03c5f331847bf52736c563a688d7daf 100644 +index 2a1722db668b141705ce47389cd24d0a247e373d..406794c439900a0d86fd4fe67d05a98bde625aec 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -299,6 +299,13 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0820-Player-Entity-Tracking-Events.patch b/patches/server/0820-Player-Entity-Tracking-Events.patch index bcba3dec8b..7ec91ddd19 100644 --- a/patches/server/0820-Player-Entity-Tracking-Events.patch +++ b/patches/server/0820-Player-Entity-Tracking-Events.patch @@ -21,7 +21,7 @@ index 43c8f6a0615f392cc560b2259b116cc9d5fba4e7..ca24463405f138deb882f319bf84696f } else if (this.seenBy.remove(player.connection)) { this.serverEntity.removePairing(player); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3778d900c272a815e67f79c6d2827be2bbe8195f..cce640b055932e2fe26800107ad699743324ee4f 100644 +index 640d7f248e3696b73ef8d7668358a78037081320..96a1f1460daba1507659a8ed34b608ded7084c0f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3837,7 +3837,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0822-Fixes-and-additions-to-the-SpawnReason-API.patch b/patches/server/0822-Fixes-and-additions-to-the-SpawnReason-API.patch index 56f1ab09f3..12f3e570a0 100644 --- a/patches/server/0822-Fixes-and-additions-to-the-SpawnReason-API.patch +++ b/patches/server/0822-Fixes-and-additions-to-the-SpawnReason-API.patch @@ -34,28 +34,28 @@ index 58723ea75f7db9bf3889b99139669b14a284a3a1..6bf11d526b82403e9a5443ac77645cf2 this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause } diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java -index 4a1f2d326c4ece9da717a50b802af86fd9338a0b..94618709e742ebe1a7893d418124e309eaab6c5f 100644 +index 1a842694c076d71b14733904c2052183d86d1f5d..eb2f6038133be72c32d31bd1a25bc80f5aa4028f 100644 --- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java @@ -117,7 +117,7 @@ public class FrogspawnBlock extends Block { int k = random.nextInt(1, 361); - tadpole.moveTo(d, (double)pos.getY() - 0.5D, e, (float)k, 0.0F); + tadpole.moveTo(d, (double)pos.getY() - 0.5, e, (float)k, 0.0F); tadpole.setPersistenceRequired(); - world.addFreshEntity(tadpole); + world.addFreshEntity(tadpole, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // Paper - use correct spawn reason } } - + } diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -index 8782b05575e4a8d5e5c667c43808442b81c13f6b..6d073e82daf41e35b63703ab9bce8c576862eb3e 100644 +index 1ff0e5c120418c3e5f92326580af7254fb4c699f..9766a919f85abfd52497ecd6d2e2002d3de8051d 100644 --- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -@@ -88,7 +88,7 @@ public class SnifferEggBlock extends Block { +@@ -87,7 +87,7 @@ public class SnifferEggBlock extends Block { Vec3 vec3 = pos.getCenter(); sniffer.setBaby(true); sniffer.moveTo(vec3.x(), vec3.y(), vec3.z(), Mth.wrapDegrees(world.random.nextFloat() * 360.0F), 0.0F); - world.addFreshEntity(sniffer); + world.addFreshEntity(sniffer, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // Paper - use correct spawn reason } - } + } diff --git a/patches/server/0824-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch b/patches/server/0824-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch index 0394a26686..8b39f81526 100644 --- a/patches/server/0824-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch +++ b/patches/server/0824-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch @@ -52,7 +52,7 @@ index c7b6377aafd32f67eb8ba4dedd7cce5841b2d58d..e57e3a26b0fb856e1ab693df5783fe8b } 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 ea2a04e5298832177fac93568656ac45784d5eb6..c5d1e4e293d15831f9b550b9964dc190763956b6 100644 +index 3e8619f536a5cc4b8c9c10cf8454e38abdb7b721..f20398eab05797d1b23b71cf74076d6382022657 100644 --- a/src/main/java/net/minecraft/world/level/material/FluidState.java +++ b/src/main/java/net/minecraft/world/level/material/FluidState.java @@ -25,9 +25,11 @@ public final class FluidState extends StateHolder<Fluid, FluidState> { diff --git a/patches/server/0827-Add-Sneaking-API-for-Entities.patch b/patches/server/0827-Add-Sneaking-API-for-Entities.patch index 3c82fcadf9..7ab8bbe768 100644 --- a/patches/server/0827-Add-Sneaking-API-for-Entities.patch +++ b/patches/server/0827-Add-Sneaking-API-for-Entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add Sneaking API for Entities diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 254df37281a358cc0ac99b46f34daf2fd9774d5a..b4ed7612a019a3d4d473dfbfed2067ea437fee06 100644 +index f6d6b2c7aefc39a6e6e2b0e61fd9afb334bee764..4dfbcaba4615bd761c1eb9d5994168c7202fc571 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -872,6 +872,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0828-Improve-logging-and-errors.patch b/patches/server/0828-Improve-logging-and-errors.patch index fe00d91a4b..2e809213c7 100644 --- a/patches/server/0828-Improve-logging-and-errors.patch +++ b/patches/server/0828-Improve-logging-and-errors.patch @@ -65,12 +65,12 @@ index b8f1549d1ea98a105577927a735bab331aff3840..45a68beff0c97ead5e9f1201b5fb9ef8 } diff --git a/src/main/java/net/minecraft/server/packs/PathPackResources.java b/src/main/java/net/minecraft/server/packs/PathPackResources.java -index 89aa86a49eda563c82ccedc99641e699f8e578b0..3edd14ce90edf98798b89921ad18547809de5d2c 100644 +index 84990b08c4f9f995dbaf63a7d32957051c73fd58..12fe10191533dc250018239433f378a59e338954 100644 --- a/src/main/java/net/minecraft/server/packs/PathPackResources.java +++ b/src/main/java/net/minecraft/server/packs/PathPackResources.java -@@ -108,6 +108,12 @@ public class PathPackResources extends AbstractPackResources { +@@ -106,6 +106,12 @@ public class PathPackResources extends AbstractPackResources { try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path)) { - for(Path path2 : directoryStream) { + for (Path path2 : directoryStream) { String string = path2.getFileName().toString(); + // Paper start - Improve logging and errors + if (!Files.isDirectory(path2)) { diff --git a/patches/server/0829-Improve-PortalEvents.patch b/patches/server/0829-Improve-PortalEvents.patch index 5ba3f4895a..eb9278ff7b 100644 --- a/patches/server/0829-Improve-PortalEvents.patch +++ b/patches/server/0829-Improve-PortalEvents.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Improve PortalEvents diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index cce640b055932e2fe26800107ad699743324ee4f..66266651194cca02bf3814594e6f43b77741808c 100644 +index 96a1f1460daba1507659a8ed34b608ded7084c0f..99035a91f04cc838e30b860d480ef710e1dbe2ea 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3495,7 +3495,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0835-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch b/patches/server/0835-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch index b9fa911513..1cb4410623 100644 --- a/patches/server/0835-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch +++ b/patches/server/0835-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Expose pre-collision moving velocity to diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 66266651194cca02bf3814594e6f43b77741808c..cf2d4d56dfebeae2baa0712683102b163bdaa9ce 100644 +index 99035a91f04cc838e30b860d480ef710e1dbe2ea..9eecdc0a6fb111fb36e4e8e8666d056563e48cda 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -957,6 +957,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0838-Correctly-shrink-items-during-EntityResurrectEvent.patch b/patches/server/0838-Correctly-shrink-items-during-EntityResurrectEvent.patch index 6aeabf242c..54b162da71 100644 --- a/patches/server/0838-Correctly-shrink-items-during-EntityResurrectEvent.patch +++ b/patches/server/0838-Correctly-shrink-items-during-EntityResurrectEvent.patch @@ -22,7 +22,7 @@ This patch corrects this behaviour by only shrinking the item if a totem of undying was found and the event was called uncancelled. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8e6cb47ce314d4c493047fa1804b2da8c9797fac..d9f9a184e22bc02fbfd1ab029abf48af654c9935 100644 +index 084d988ec3dcdae54a10309d34d335ca4f37b7b0..c022ec61fa6a84f4e68f4df0a0f07ba8bb368302 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1618,7 +1618,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0843-Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch b/patches/server/0843-Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch index efaf1a6e90..8bd2fa8c91 100644 --- a/patches/server/0843-Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch +++ b/patches/server/0843-Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch @@ -10,15 +10,15 @@ https://bugs.mojang.com/browse/MC-157464 https://github.com/PaperMC/Paper/issues/8569 diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java b/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java -index 9400556aca4cd06ad311975d74a9e7eb2ccd9c73..cd7a90ec1073b2b452ca70decefe6a594445003b 100644 +index 28b255b425d2ac4d13b85a7fce67406ea3b6fdae..458cfece2c0ce94f0017aa94ed6f1a356861ec31 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java -@@ -22,7 +22,7 @@ public class VillagerGoalPackages { - private static final float STROLL_SPEED_MODIFIER = 0.4F; - - public static ImmutableList<Pair<Integer, ? extends BehaviorControl<? super Villager>>> getCorePackage(VillagerProfession profession, float speed) { -- return ImmutableList.of(Pair.of(0, new Swim(0.8F)), Pair.of(0, InteractWithDoor.create()), Pair.of(0, new LookAtTargetSink(45, 90)), Pair.of(0, new VillagerPanicTrigger()), Pair.of(0, WakeUp.create()), Pair.of(0, ReactToBell.create()), Pair.of(0, SetRaidStatus.create()), Pair.of(0, ValidateNearbyPoi.create(profession.heldJobSite(), MemoryModuleType.JOB_SITE)), Pair.of(0, ValidateNearbyPoi.create(profession.acquirableJobSite(), MemoryModuleType.POTENTIAL_JOB_SITE)), Pair.of(1, new MoveToTargetSink()), Pair.of(2, PoiCompetitorScan.create()), Pair.of(3, new LookAndFollowTradingPlayerSink(speed)), Pair.of(5, GoToWantedItem.create(speed, false, 4)), Pair.of(6, AcquirePoi.create(profession.acquirableJobSite(), MemoryModuleType.JOB_SITE, MemoryModuleType.POTENTIAL_JOB_SITE, true, Optional.empty())), Pair.of(7, new GoToPotentialJobSite(speed)), Pair.of(8, YieldJobSite.create(speed)), Pair.of(10, AcquirePoi.create((poiType) -> { -+ return ImmutableList.of(Pair.of(0, new Swim(0.8F)), Pair.of(0, InteractWithDoor.create()), Pair.of(0, new LookAtTargetSink(45, 90)), Pair.of(0, new VillagerPanicTrigger()), Pair.of(0, WakeUp.create()), Pair.of(0, ReactToBell.create()), Pair.of(0, SetRaidStatus.create()), Pair.of(0, ValidateNearbyPoi.create(profession.heldJobSite(), MemoryModuleType.JOB_SITE)), Pair.of(0, ValidateNearbyPoi.create(profession.acquirableJobSite(), MemoryModuleType.POTENTIAL_JOB_SITE)), Pair.of(1, new MoveToTargetSink()), Pair.of(2, PoiCompetitorScan.create()), Pair.of(3, new LookAndFollowTradingPlayerSink(speed)), Pair.of(5, GoToWantedItem.create(villager -> !villager.isSleeping(), speed, false, 4)), Pair.of(6, AcquirePoi.create(profession.acquirableJobSite(), MemoryModuleType.JOB_SITE, MemoryModuleType.POTENTIAL_JOB_SITE, true, Optional.empty())), Pair.of(7, new GoToPotentialJobSite(speed)), Pair.of(8, YieldJobSite.create(speed)), Pair.of(10, AcquirePoi.create((poiType) -> { // Paper - Fix MC-157464 - return poiType.is(PoiTypes.HOME); - }, MemoryModuleType.HOME, false, Optional.of((byte)14))), Pair.of(10, AcquirePoi.create((poiType) -> { - return poiType.is(PoiTypes.MEETING); +@@ -35,7 +35,7 @@ public class VillagerGoalPackages { + Pair.of(1, new MoveToTargetSink()), + Pair.of(2, PoiCompetitorScan.create()), + Pair.of(3, new LookAndFollowTradingPlayerSink(speed)), +- Pair.of(5, GoToWantedItem.create(speed, false, 4)), ++ Pair.of(5, GoToWantedItem.create(villager -> !villager.isSleeping(), speed, false, 4)), // Paper - Fix MC-157464 + Pair.of( + 6, AcquirePoi.create(profession.acquirableJobSite(), MemoryModuleType.JOB_SITE, MemoryModuleType.POTENTIAL_JOB_SITE, true, Optional.empty()) + ), diff --git a/patches/server/0844-Add-EntityFertilizeEggEvent.patch b/patches/server/0844-Add-EntityFertilizeEggEvent.patch index 1cd60bd301..975cf31634 100644 --- a/patches/server/0844-Add-EntityFertilizeEggEvent.patch +++ b/patches/server/0844-Add-EntityFertilizeEggEvent.patch @@ -29,19 +29,19 @@ index cfc0cee09dfd522409bb5853fc96528bd0137475..6a98f66b7701e8af389ca9a1e9eb230a } diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -index 90e4e0ec0c7b0ece23c4b53f5f12b1f24e1c18ad..295769d039f2a1e4f48912a60f9dbe267d8992c1 100644 +index 70bbc325e3a1f7f334a6d1024097800efa6bec03..a03fb7aa9f4528f4885db88eaf480202d5f54750 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -@@ -239,7 +239,12 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> { +@@ -263,7 +263,12 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> { @Override public void spawnChildFromBreeding(ServerLevel world, Animal other) { -- this.finalizeSpawnChildFromBreeding(world, other, (AgeableMob)null); +- this.finalizeSpawnChildFromBreeding(world, other, null); + // Paper start - Add EntityFertilizeEggEvent event + final io.papermc.paper.event.entity.EntityFertilizeEggEvent result = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityFertilizeEggEvent(this, other); + if (result.isCancelled()) return; + -+ this.finalizeSpawnChildFromBreeding(world, other, (AgeableMob)null, result.getExperience()); // Paper - use craftbukkit call that takes experience amount ++ this.finalizeSpawnChildFromBreeding(world, other, null, result.getExperience()); // Paper - use craftbukkit call that takes experience amount + // Paper end - Add EntityFertilizeEggEvent event this.getBrain().setMemory(MemoryModuleType.IS_PREGNANT, Unit.INSTANCE); } diff --git a/patches/server/0848-Fix-advancement-triggers-for-entity-damage.patch b/patches/server/0848-Fix-advancement-triggers-for-entity-damage.patch index be0a156199..e5b6bd4878 100644 --- a/patches/server/0848-Fix-advancement-triggers-for-entity-damage.patch +++ b/patches/server/0848-Fix-advancement-triggers-for-entity-damage.patch @@ -23,7 +23,7 @@ index f054d67a637b204de604fadc0d321f5c9816d808..fc5f1e1b445f0a55a35a31d58a90920a return !this.getResponse(); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index bd8d1e90ea6d2f6d3b625f6d264c12cb3ea009e8..e2564a07e0aa4bf2fcd9a749e9fc188dd0633675 100644 +index c022ec61fa6a84f4e68f4df0a0f07ba8bb368302..09a48779046484c2f3628d1499659e247c736fce 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2322,7 +2322,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0849-Fix-text-display-error-on-spawn.patch b/patches/server/0849-Fix-text-display-error-on-spawn.patch index 7074ea7170..7a889319e6 100644 --- a/patches/server/0849-Fix-text-display-error-on-spawn.patch +++ b/patches/server/0849-Fix-text-display-error-on-spawn.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Fix text display error on spawn diff --git a/src/main/java/net/minecraft/world/entity/Display.java b/src/main/java/net/minecraft/world/entity/Display.java -index dcbaa06f807ba3c1b64c96b3c2dd84d46d6be751..2ecd3ed5b36475125c6f63af2612011fc8fba8a5 100644 +index 9658bf8b295380fe6677eeddbcb0f44df3137019..460b82bcb400a73399015ff6588eab5a95be6d23 100644 --- a/src/main/java/net/minecraft/world/entity/Display.java +++ b/src/main/java/net/minecraft/world/entity/Display.java -@@ -864,7 +864,7 @@ public abstract class Display extends Entity { - byte b = loadFlag((byte)0, nbt, "shadow", (byte)1); - b = loadFlag(b, nbt, "see_through", (byte)2); - b = loadFlag(b, nbt, "default_background", (byte)4); -- Optional<Display.TextDisplay.Align> optional = Display.TextDisplay.Align.CODEC.decode(NbtOps.INSTANCE, nbt.get("alignment")).resultOrPartial(Util.prefix("Display entity", Display.LOGGER::error)).map(Pair::getFirst); -+ Optional<Display.TextDisplay.Align> optional = Display.TextDisplay.Align.CODEC.decode(NbtOps.INSTANCE, nbt.get("alignment")).result().map(Pair::getFirst); // Paper - Hide text display error on spawn +@@ -912,7 +912,7 @@ public abstract class Display extends Entity { + byte var10 = loadFlag(b, nbt, "default_background", (byte)4); + Optional<Display.TextDisplay.Align> optional = Display.TextDisplay.Align.CODEC + .decode(NbtOps.INSTANCE, nbt.get("alignment")) +- .resultOrPartial(Util.prefix("Display entity", Display.LOGGER::error)) ++ .result() // Paper - Hide text display error on spawn + .map(Pair::getFirst); if (optional.isPresent()) { - byte var10000; - switch ((Display.TextDisplay.Align)optional.get()) { + var10 = switch ((Display.TextDisplay.Align)optional.get()) { diff --git a/patches/server/0856-Prevent-causing-expired-keys-from-impacting-new-join.patch b/patches/server/0856-Prevent-causing-expired-keys-from-impacting-new-join.patch index 3649dc015b..682e80e173 100644 --- a/patches/server/0856-Prevent-causing-expired-keys-from-impacting-new-join.patch +++ b/patches/server/0856-Prevent-causing-expired-keys-from-impacting-new-join.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent causing expired keys from impacting new joins diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java -index 0e54e8faa48751a651b953bec72543a94edf74bc..d43106eb89b14667e85cd6e8fa047d64f2e8ec87 100644 +index 8875b0d1df39ee2b3de5b4ed61221f38dead2624..71d79adb717729ba6a7a0a97f96b7747e87873c4 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java -@@ -96,7 +96,13 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke +@@ -102,7 +102,13 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke INITIALIZE_CHAT((serialized, buf) -> { serialized.chatSession = buf.readNullable(RemoteChatSession.Data::read); }, (buf, entry) -> { diff --git a/patches/server/0863-Avoid-Lazy-Initialization-for-Enum-Fields.patch b/patches/server/0863-Avoid-Lazy-Initialization-for-Enum-Fields.patch index 346c3fd86c..7bcb96efdd 100644 --- a/patches/server/0863-Avoid-Lazy-Initialization-for-Enum-Fields.patch +++ b/patches/server/0863-Avoid-Lazy-Initialization-for-Enum-Fields.patch @@ -7,18 +7,18 @@ This patch is meant to get rid of any instances of lazy initialization that Mine This has the possibility to create race condition issues, and generally don't make sense to be lazily done anyways. diff --git a/src/main/java/com/mojang/math/OctahedralGroup.java b/src/main/java/com/mojang/math/OctahedralGroup.java -index a5a889d40228a0d6c7259caf8cb2554588d9aaf9..5009192046e5e083d14cef3f448b98b978dd54bf 100644 +index 33ea26e900907a6ef18136720ac6e42ac8382f10..facdba0d515cf124cdab2c60dd2a13cc040c017f 100644 --- a/src/main/java/com/mojang/math/OctahedralGroup.java +++ b/src/main/java/com/mojang/math/OctahedralGroup.java -@@ -111,6 +111,7 @@ public enum OctahedralGroup implements StringRepresentable { +@@ -108,6 +108,7 @@ public enum OctahedralGroup implements StringRepresentable { this.permutation = axisTransformation; - this.transformation = (new Matrix3f()).scaling(flipX ? -1.0F : 1.0F, flipY ? -1.0F : 1.0F, flipZ ? -1.0F : 1.0F); + this.transformation = new Matrix3f().scaling(flipX ? -1.0F : 1.0F, flipY ? -1.0F : 1.0F, flipZ ? -1.0F : 1.0F); this.transformation.mul(axisTransformation.transformation()); + this.initializeRotationDirections(); // Paper - Avoid Lazy Initialization for Enum Fields } private BooleanList packInversions() { -@@ -139,7 +140,7 @@ public enum OctahedralGroup implements StringRepresentable { +@@ -136,7 +137,7 @@ public enum OctahedralGroup implements StringRepresentable { return this.name; } @@ -27,7 +27,7 @@ index a5a889d40228a0d6c7259caf8cb2554588d9aaf9..5009192046e5e083d14cef3f448b98b9 if (this.rotatedDirections == null) { this.rotatedDirections = Maps.newEnumMap(Direction.class); Direction.Axis[] axiss = Direction.Axis.values(); -@@ -154,6 +155,10 @@ public enum OctahedralGroup implements StringRepresentable { +@@ -151,6 +152,10 @@ public enum OctahedralGroup implements StringRepresentable { } } diff --git a/patches/server/0865-Fix-concurrenct-access-to-lookups-field-in-RegistryO.patch b/patches/server/0865-Fix-concurrenct-access-to-lookups-field-in-RegistryO.patch index 01fcd2b852..54ad4f456c 100644 --- a/patches/server/0865-Fix-concurrenct-access-to-lookups-field-in-RegistryO.patch +++ b/patches/server/0865-Fix-concurrenct-access-to-lookups-field-in-RegistryO.patch @@ -11,12 +11,12 @@ more than one Netty IO thread. Fixes https://github.com/PaperMC/Folia/issues/11 diff --git a/src/main/java/net/minecraft/resources/RegistryOps.java b/src/main/java/net/minecraft/resources/RegistryOps.java -index 7709eeac907c4895a264cec0a3d453aa8b194c18..c7cfc3ca58f9439142fe5828117f6d576d7df10e 100644 +index 3dc8333a5c17926679c79d5294a0e72199801c34..fafecd2f5aefd5e6fdc2b0c3674378f03f4dc4f2 100644 --- a/src/main/java/net/minecraft/resources/RegistryOps.java +++ b/src/main/java/net/minecraft/resources/RegistryOps.java -@@ -19,11 +19,14 @@ public class RegistryOps<T> extends DelegatingOps<T> { +@@ -19,7 +19,10 @@ public class RegistryOps<T> extends DelegatingOps<T> { - private static RegistryOps.RegistryInfoLookup memoizeLookup(final RegistryOps.RegistryInfoLookup registryInfoGetter) { + private static RegistryOps.RegistryInfoLookup memoizeLookup(RegistryOps.RegistryInfoLookup registryInfoGetter) { return new RegistryOps.RegistryInfoLookup() { - private final Map<ResourceKey<? extends Registry<?>>, Optional<? extends RegistryOps.RegistryInfo<?>>> lookups = new HashMap<>(); + // The concurrent access occurs on the Netty IO threads when serializing packets. @@ -26,8 +26,3 @@ index 7709eeac907c4895a264cec0a3d453aa8b194c18..c7cfc3ca58f9439142fe5828117f6d57 @Override public <T> Optional<RegistryOps.RegistryInfo<T>> lookup(ResourceKey<? extends Registry<? extends T>> registryRef) { -- return this.lookups.computeIfAbsent(registryRef, registryInfoGetter::lookup); -+ return (Optional<RegistryOps.RegistryInfo<T>>)this.lookups.computeIfAbsent(registryRef, registryInfoGetter::lookup); // Paper - fix concurrent access to lookups field - } - }; - } diff --git a/patches/server/0867-Refresh-ProjectileSource-for-projectiles.patch b/patches/server/0867-Refresh-ProjectileSource-for-projectiles.patch index 1dabec492f..2041ea7689 100644 --- a/patches/server/0867-Refresh-ProjectileSource-for-projectiles.patch +++ b/patches/server/0867-Refresh-ProjectileSource-for-projectiles.patch @@ -14,7 +14,7 @@ clearing the owner. Co-authored-by: Warrior <[email protected]> diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index cf2d4d56dfebeae2baa0712683102b163bdaa9ce..0479dbdf0da7a06735ee08d068ead5fa12fc9860 100644 +index 9eecdc0a6fb111fb36e4e8e8666d056563e48cda..ee9ab1abbed298138e48c659481e03c01ac5940a 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -384,6 +384,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0871-Call-BlockGrowEvent-for-missing-blocks.patch b/patches/server/0871-Call-BlockGrowEvent-for-missing-blocks.patch index 9054b42b6b..4938d57d18 100644 --- a/patches/server/0871-Call-BlockGrowEvent-for-missing-blocks.patch +++ b/patches/server/0871-Call-BlockGrowEvent-for-missing-blocks.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Call BlockGrowEvent for missing blocks Call the event for pitcher crops and sniffer egg diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java -index 591f32f7c0a7a9c843933d17dad8a34b672f49ac..d20c009baf69d083bf8a14000028991b6518cd50 100644 +index d06e3892cf42723f8e3f621b5497c5348fa1a715..5f1ec3f69295760b7b8097916c82cbf9ddd49700 100644 --- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java -@@ -130,7 +130,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl +@@ -133,7 +133,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl int i = Math.min(state.getValue(AGE) + amount, 4); if (this.canGrow(world, pos, state, i)) { BlockState blockState = state.setValue(AGE, Integer.valueOf(i)); @@ -19,20 +19,20 @@ index 591f32f7c0a7a9c843933d17dad8a34b672f49ac..d20c009baf69d083bf8a14000028991b world.setBlock(pos.above(), blockState.setValue(HALF, DoubleBlockHalf.UPPER), 3); } diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -index 6d073e82daf41e35b63703ab9bce8c576862eb3e..7be4e32a4409b539839a480ef83750ed4b5359a6 100644 +index 9766a919f85abfd52497ecd6d2e2002d3de8051d..4f1ff12df44756b63e3c3f9fc43e7ea485df6f57 100644 --- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -@@ -72,8 +72,13 @@ public class SnifferEggBlock extends Block { +@@ -71,8 +71,13 @@ public class SnifferEggBlock extends Block { @Override public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { if (!this.isReadyToHatch(state)) { + // Paper start + if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, pos, state.setValue(HATCH, Integer.valueOf(this.getHatchLevel(state) + 1)), 2)) { -+ rescheduleTick(world, pos); ++ this.rescheduleTick(world, pos); + return; + } + // Paper end - world.playSound((Player)null, pos, SoundEvents.SNIFFER_EGG_CRACK, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); + world.playSound(null, pos, SoundEvents.SNIFFER_EGG_CRACK, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); - world.setBlock(pos, state.setValue(HATCH, Integer.valueOf(this.getHatchLevel(state) + 1)), 2); } else { // Paper start - Call BlockFadeEvent diff --git a/patches/server/0875-Add-method-to-remove-all-active-potion-effects.patch b/patches/server/0875-Add-method-to-remove-all-active-potion-effects.patch index 8f0290e924..1461dfa249 100644 --- a/patches/server/0875-Add-method-to-remove-all-active-potion-effects.patch +++ b/patches/server/0875-Add-method-to-remove-all-active-potion-effects.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add method to remove all active potion effects diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 909e4b139d5e372946b08bbb12665a49f3a09054..4031bf7fa35cfb480fbe6f0558a455f0c6985e39 100644 +index ab1e1a56f3811d4446a6b0a7461c0bddd8015228..c4a166a0c226c6083c25c58145d9631d4296e615 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -556,6 +556,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0876-Fix-incorrect-crafting-result-amount-for-fireworks.patch b/patches/server/0876-Fix-incorrect-crafting-result-amount-for-fireworks.patch index cfcf15909a..6436cefd47 100644 --- a/patches/server/0876-Fix-incorrect-crafting-result-amount-for-fireworks.patch +++ b/patches/server/0876-Fix-incorrect-crafting-result-amount-for-fireworks.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix incorrect crafting result amount for fireworks Although vanilla does not specifically call this method anywhere, this fixes a bug where the result using the Bukkit API returns the wrong amount. diff --git a/src/main/java/net/minecraft/world/item/crafting/FireworkRocketRecipe.java b/src/main/java/net/minecraft/world/item/crafting/FireworkRocketRecipe.java -index af7e7a63eacad2367453924806ffb002c33db951..25405c8eb76e428e689b3afad2c00529f687f550 100644 +index 54da7997123b4159a29baedf402608b7db7cb745..a86507569b759f8ef85f3fc32324677c37f65d28 100644 --- a/src/main/java/net/minecraft/world/item/crafting/FireworkRocketRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/FireworkRocketRecipe.java -@@ -81,7 +81,7 @@ public class FireworkRocketRecipe extends CustomRecipe { +@@ -80,7 +80,7 @@ public class FireworkRocketRecipe extends CustomRecipe { @Override public ItemStack getResultItem(RegistryAccess registryManager) { diff --git a/patches/server/0880-Add-option-to-disable-block-updates.patch b/patches/server/0880-Add-option-to-disable-block-updates.patch index 5550b0c010..817a831971 100644 --- a/patches/server/0880-Add-option-to-disable-block-updates.patch +++ b/patches/server/0880-Add-option-to-disable-block-updates.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add option to disable block updates diff --git a/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java b/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java -index a0f63f17eb4e4bcf986f0573dc13be5c11c37f15..d811ed3623446000d3aa0be59c573f7c759bf55a 100644 +index ad801476cc25d51e4145a41b9c8100382f1f49bb..1ba7a6a14f7fbfdd279cb8c2bebf5ea6c98dbf1f 100644 --- a/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java -@@ -29,6 +29,7 @@ public class ChorusPlantBlock extends PipeBlock { +@@ -38,6 +38,7 @@ public class ChorusPlantBlock extends PipeBlock { @Override public BlockState getStateForPlacement(BlockPlaceContext ctx) { @@ -16,7 +16,7 @@ index a0f63f17eb4e4bcf986f0573dc13be5c11c37f15..d811ed3623446000d3aa0be59c573f7c return getStateWithConnections(ctx.getLevel(), ctx.getClickedPos(), this.defaultBlockState()); } -@@ -45,6 +46,7 @@ public class ChorusPlantBlock extends PipeBlock { +@@ -59,6 +60,7 @@ public class ChorusPlantBlock extends PipeBlock { @Override public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { @@ -24,7 +24,7 @@ index a0f63f17eb4e4bcf986f0573dc13be5c11c37f15..d811ed3623446000d3aa0be59c573f7c if (!state.canSurvive(world, pos)) { world.scheduleTick(pos, this, 1); return super.updateShape(state, direction, neighborState, world, pos, neighborPos); -@@ -56,6 +58,7 @@ public class ChorusPlantBlock extends PipeBlock { +@@ -70,6 +72,7 @@ public class ChorusPlantBlock extends PipeBlock { @Override public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { @@ -32,7 +32,7 @@ index a0f63f17eb4e4bcf986f0573dc13be5c11c37f15..d811ed3623446000d3aa0be59c573f7c if (!state.canSurvive(world, pos)) { world.destroyBlock(pos, true); } -@@ -64,6 +67,7 @@ public class ChorusPlantBlock extends PipeBlock { +@@ -77,6 +80,7 @@ public class ChorusPlantBlock extends PipeBlock { @Override public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { @@ -41,37 +41,41 @@ index a0f63f17eb4e4bcf986f0573dc13be5c11c37f15..d811ed3623446000d3aa0be59c573f7c boolean bl = !world.getBlockState(pos.above()).isAir() && !blockState.isAir(); diff --git a/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java b/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java -index 4fe30b867d7fc39c53307496458b3e438d4f2397..e049e702f58053431bf3e438ea37850c86ae3b7b 100644 +index 322cd656b82611ca8048c3e35cb66551bdea87d6..f70898bddec0b53f92ab88b862e2d865d82d558d 100644 --- a/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java +++ b/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java -@@ -34,6 +34,7 @@ public class HugeMushroomBlock extends Block { +@@ -43,6 +43,7 @@ public class HugeMushroomBlock extends Block { @Override public BlockState getStateForPlacement(BlockPlaceContext ctx) { + if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableMushroomBlockUpdates) return this.defaultBlockState(); // Paper - add option to disable block updates BlockGetter blockGetter = ctx.getLevel(); BlockPos blockPos = ctx.getClickedPos(); - return this.defaultBlockState().setValue(DOWN, Boolean.valueOf(!blockGetter.getBlockState(blockPos.below()).is(this))).setValue(UP, Boolean.valueOf(!blockGetter.getBlockState(blockPos.above()).is(this))).setValue(NORTH, Boolean.valueOf(!blockGetter.getBlockState(blockPos.north()).is(this))).setValue(EAST, Boolean.valueOf(!blockGetter.getBlockState(blockPos.east()).is(this))).setValue(SOUTH, Boolean.valueOf(!blockGetter.getBlockState(blockPos.south()).is(this))).setValue(WEST, Boolean.valueOf(!blockGetter.getBlockState(blockPos.west()).is(this))); -@@ -41,16 +42,19 @@ public class HugeMushroomBlock extends Block { + return this.defaultBlockState() +@@ -56,6 +57,7 @@ public class HugeMushroomBlock extends Block { @Override public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableMushroomBlockUpdates) return state; // Paper - add option to disable block updates - return neighborState.is(this) ? state.setValue(PROPERTY_BY_DIRECTION.get(direction), Boolean.valueOf(false)) : super.updateShape(state, direction, neighborState, world, pos, neighborPos); - } + return neighborState.is(this) + ? state.setValue(PROPERTY_BY_DIRECTION.get(direction), Boolean.valueOf(false)) + : super.updateShape(state, direction, neighborState, world, pos, neighborPos); +@@ -63,6 +65,7 @@ public class HugeMushroomBlock extends Block { @Override public BlockState rotate(BlockState state, Rotation rotation) { + if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableMushroomBlockUpdates) return state; // Paper - add option to disable block updates - return state.setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.NORTH)), state.getValue(NORTH)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.SOUTH)), state.getValue(SOUTH)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.EAST)), state.getValue(EAST)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.WEST)), state.getValue(WEST)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.UP)), state.getValue(UP)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.DOWN)), state.getValue(DOWN)); - } + return state.setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.NORTH)), state.getValue(NORTH)) + .setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.SOUTH)), state.getValue(SOUTH)) + .setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.EAST)), state.getValue(EAST)) +@@ -73,6 +76,7 @@ public class HugeMushroomBlock extends Block { @Override public BlockState mirror(BlockState state, Mirror mirror) { + if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableMushroomBlockUpdates) return state; // Paper - add option to disable block updates - return state.setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.NORTH)), state.getValue(NORTH)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.SOUTH)), state.getValue(SOUTH)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.EAST)), state.getValue(EAST)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.WEST)), state.getValue(WEST)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.UP)), state.getValue(UP)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.DOWN)), state.getValue(DOWN)); - } - + return state.setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.NORTH)), state.getValue(NORTH)) + .setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.SOUTH)), state.getValue(SOUTH)) + .setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.EAST)), state.getValue(EAST)) diff --git a/src/main/java/net/minecraft/world/level/block/NoteBlock.java b/src/main/java/net/minecraft/world/level/block/NoteBlock.java index 92a24cf02f15f3ab893eb9a793770d9819e4f600..a541dc3a6e373b30fff0abf5305e77854c190f10 100644 --- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java diff --git a/patches/server/0882-Don-t-load-chunks-for-supporting-block-checks.patch b/patches/server/0882-Don-t-load-chunks-for-supporting-block-checks.patch index 925e5e90ff..2e07b71256 100644 --- a/patches/server/0882-Don-t-load-chunks-for-supporting-block-checks.patch +++ b/patches/server/0882-Don-t-load-chunks-for-supporting-block-checks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't load chunks for supporting block checks diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 0479dbdf0da7a06735ee08d068ead5fa12fc9860..927c298c1922fdd1016ffc72d2ca196adaccd377 100644 +index ee9ab1abbed298138e48c659481e03c01ac5940a..fe768bd70c08719f11e28e793fe90a908f22c4ad 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1200,7 +1200,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0888-Determine-lava-and-water-fluid-explosion-resistance-.patch b/patches/server/0888-Determine-lava-and-water-fluid-explosion-resistance-.patch index bea2e1c86f..5f51eb317c 100644 --- a/patches/server/0888-Determine-lava-and-water-fluid-explosion-resistance-.patch +++ b/patches/server/0888-Determine-lava-and-water-fluid-explosion-resistance-.patch @@ -22,10 +22,10 @@ index 72f8b72c6436ca3b8eaeb39c7d3efe2c1462ae1d..3bb4a9a1a6249e8ba2de237f801210e7 @Override diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java -index c5f9eda32f2cd172569c7b7d72f5dd3e41a34a70..cde93efaecd42b9081405638af3ba91cb5e184c9 100644 +index 21b4afd053e01073eb514264d4960f0f3b1ee3d8..109f71401c65f476ccf6813137386fc9fef10254 100644 --- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java +++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java -@@ -109,7 +109,7 @@ public abstract class WaterFluid extends FlowingFluid { +@@ -125,7 +125,7 @@ public abstract class WaterFluid extends FlowingFluid { @Override protected float getExplosionResistance() { diff --git a/patches/server/0893-Add-whitelist-events.patch b/patches/server/0893-Add-whitelist-events.patch index 44cddb390d..96884032fb 100644 --- a/patches/server/0893-Add-whitelist-events.patch +++ b/patches/server/0893-Add-whitelist-events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add whitelist events diff --git a/src/main/java/net/minecraft/server/players/UserWhiteList.java b/src/main/java/net/minecraft/server/players/UserWhiteList.java -index a6c70decad1a496595944a5dd2aeeb387757fef3..37635f58cd78ff50991dde413470004400259c89 100644 +index 3226a3b69453fb5e13003e941ccbc2d941e047b0..aaa3d5769e0e184e19d01109a76a65be634f830d 100644 --- a/src/main/java/net/minecraft/server/players/UserWhiteList.java +++ b/src/main/java/net/minecraft/server/players/UserWhiteList.java -@@ -30,4 +30,23 @@ public class UserWhiteList extends StoredUserList<GameProfile, UserWhiteListEntr +@@ -28,4 +28,23 @@ public class UserWhiteList extends StoredUserList<GameProfile, UserWhiteListEntr protected String getKeyForUser(GameProfile gameProfile) { return gameProfile.getId().toString(); } diff --git a/patches/server/0895-Folia-scheduler-and-owned-region-API.patch b/patches/server/0895-Folia-scheduler-and-owned-region-API.patch index e9b9ddb406..ab7ab5a341 100644 --- a/patches/server/0895-Folia-scheduler-and-owned-region-API.patch +++ b/patches/server/0895-Folia-scheduler-and-owned-region-API.patch @@ -1185,7 +1185,7 @@ index 0747b0042446271385371f1ca9c8fefdebd851b8..fade1e36037075aae968eb90bbfeac76 this.players.remove(entityplayer); this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 927c298c1922fdd1016ffc72d2ca196adaccd377..ecd7deadbddeb9571b2b8975214e4167c8333ce0 100644 +index fe768bd70c08719f11e28e793fe90a908f22c4ad..3ae2f450ac43c3752f779eeb40ec7761590f9e51 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -247,11 +247,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -1332,7 +1332,7 @@ index 56a6b3921c74bdeb27f8736302503bee1f731065..b5140b37d2161d89c6c5d6465949e96f ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); ConfigurationSerialization.registerClass(CraftPlayerProfile.class); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 509550bbfb7c6bcff5dffa535f40af12aab898a8..8086eae45b03fd53bc7cac625b51fc10d8523f4f 100644 +index 8025b3e9afebc9ad0c08453403422589bf5dd27d..a47d3dba348a058ea9ca675b7f6490a46c1ad970 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -68,6 +68,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0903-Remove-UpgradeData-neighbour-ticks-outside-of-range.patch b/patches/server/0903-Remove-UpgradeData-neighbour-ticks-outside-of-range.patch index 6701e32f16..bcf2216c32 100644 --- a/patches/server/0903-Remove-UpgradeData-neighbour-ticks-outside-of-range.patch +++ b/patches/server/0903-Remove-UpgradeData-neighbour-ticks-outside-of-range.patch @@ -7,11 +7,11 @@ The lists are only supposed to contain ticks for the 1 radius neighbours of the chunk. diff --git a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java -index 8943081f270d5328b4f333b7bc1ae1a449d1788c..a5b90222cfad5b282f3f2db4dd5d1b201761fb72 100644 +index 45329a79338821c6f988f8e5f55749043271e603..5b6ccb52689af685380193f3a0eef2f121f9bd26 100644 --- a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java +++ b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java -@@ -99,6 +99,25 @@ public class UpgradeData { - +@@ -98,6 +98,25 @@ public class UpgradeData { + } } + // Paper start - filter out relocated neighbour ticks @@ -36,7 +36,7 @@ index 8943081f270d5328b4f333b7bc1ae1a449d1788c..a5b90222cfad5b282f3f2db4dd5d1b20 public void upgrade(LevelChunk chunk) { this.upgradeInside(chunk); -@@ -106,6 +125,11 @@ public class UpgradeData { +@@ -105,6 +124,11 @@ public class UpgradeData { upgradeSides(chunk, direction8); } @@ -46,5 +46,5 @@ index 8943081f270d5328b4f333b7bc1ae1a449d1788c..a5b90222cfad5b282f3f2db4dd5d1b20 + // Paper end - filter out relocated neighbour ticks + Level level = chunk.getLevel(); - this.neighborBlockTicks.forEach((tick) -> { + this.neighborBlockTicks.forEach(tick -> { Block block = tick.type() == Blocks.AIR ? level.getBlockState(tick.pos()).getBlock() : tick.type(); diff --git a/patches/server/0914-Add-Listing-API-for-Player.patch b/patches/server/0914-Add-Listing-API-for-Player.patch index 05e8427ee0..57bbb114f0 100644 --- a/patches/server/0914-Add-Listing-API-for-Player.patch +++ b/patches/server/0914-Add-Listing-API-for-Player.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Listing API for Player diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java -index d43106eb89b14667e85cd6e8fa047d64f2e8ec87..56eddd28429cf42c02d88b8bf79f8b616fa45289 100644 +index 71d79adb717729ba6a7a0a97f96b7747e87873c4..c487241f20ac989d37371e0d49c529cb5cd86abe 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java -@@ -29,12 +29,46 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke +@@ -29,6 +29,17 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke this.actions = EnumSet.of(action); this.entries = List.of(new ClientboundPlayerInfoUpdatePacket.Entry(player)); } @@ -25,7 +25,8 @@ index d43106eb89b14667e85cd6e8fa047d64f2e8ec87..56eddd28429cf42c02d88b8bf79f8b61 + // Paper end - Add Listing API for Player public static ClientboundPlayerInfoUpdatePacket createPlayerInitializing(Collection<ServerPlayer> players) { - EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet = EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME); + EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet = EnumSet.of( +@@ -42,6 +53,29 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke return new ClientboundPlayerInfoUpdatePacket(enumSet, players); } @@ -54,21 +55,29 @@ index d43106eb89b14667e85cd6e8fa047d64f2e8ec87..56eddd28429cf42c02d88b8bf79f8b61 + public ClientboundPlayerInfoUpdatePacket(FriendlyByteBuf buf) { this.actions = buf.readEnumSet(ClientboundPlayerInfoUpdatePacket.Action.class); - this.entries = buf.readList((buf2) -> { -@@ -144,8 +178,16 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke - - public static record Entry(UUID profileId, @Nullable GameProfile profile, boolean listed, int latency, GameType gameMode, @Nullable Component displayName, @Nullable RemoteChatSession.Data chatSession) { + this.entries = buf.readList(buf2 -> { +@@ -158,16 +192,24 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke + @Nullable RemoteChatSession.Data chatSession + ) { Entry(ServerPlayer player) { -- this(player.getUUID(), player.getGameProfile(), true, player.connection.latency(), player.gameMode.getGameModeForPlayer(), player.getTabListDisplayName(), Optionull.map(player.getChatSession(), RemoteChatSession::asData)); + // Paper start - Add Listing API for Player + this(player, true); + } + Entry(ServerPlayer player, boolean listed) { -+ this(player.getUUID(), player.getGameProfile(), listed, player.connection.latency(), player.gameMode.getGameModeForPlayer(), player.getTabListDisplayName(), Optionull.map(player.getChatSession(), RemoteChatSession::asData)); -+ } + this( + player.getUUID(), + player.getGameProfile(), +- true, ++ listed, + player.connection.latency(), + player.gameMode.getGameModeForPlayer(), + player.getTabListDisplayName(), + Optionull.map(player.getChatSession(), RemoteChatSession::asData) + ); + } + Entry(UUID profileId, boolean listed) { + this(profileId, null, listed, 0, GameType.DEFAULT_MODE, null, null); - } ++ } + // Paper end - Add Listing API for Player } diff --git a/patches/server/0915-Configurable-Region-Compression-Format.patch b/patches/server/0915-Configurable-Region-Compression-Format.patch index 25a1d4bb16..7ae1778b0e 100644 --- a/patches/server/0915-Configurable-Region-Compression-Format.patch +++ b/patches/server/0915-Configurable-Region-Compression-Format.patch @@ -18,11 +18,11 @@ index 169e375c814ff814d15101d09dccc67783f50465..8d20e265872e1f8200de186a69a29f49 public RegionFile(Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync) throws IOException { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java -index 5fa7a842431dd64c7a0dc5d8e940563a2aeef463..374ff77f15e339500714580673ae8077482ba247 100644 +index b6cd5163ee9cd0dfb78fd2393431677186a9b78a..4bfd16b73163fb502cb8716d3ef43f9fa1c3d184 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java @@ -30,6 +30,17 @@ public class RegionFileVersion { - }, (stream) -> { + }, stream -> { return stream; })); + diff --git a/patches/server/0918-Expand-Pose-API.patch b/patches/server/0918-Expand-Pose-API.patch index 33bb7d2bc7..8704e4d4d2 100644 --- a/patches/server/0918-Expand-Pose-API.patch +++ b/patches/server/0918-Expand-Pose-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expand Pose API diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index ecd7deadbddeb9571b2b8975214e4167c8333ce0..4db254f76bc2fb9867441016b3ac4f45f19d3bea 100644 +index 3ae2f450ac43c3752f779eeb40ec7761590f9e51..ad3cdb1a3ab07c48bf6b2662b93ddad5974db1a6 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -419,6 +419,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -25,7 +25,7 @@ index ecd7deadbddeb9571b2b8975214e4167c8333ce0..4db254f76bc2fb9867441016b3ac4f45 if (pose == this.getPose()) { return; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index d91d56175e91fb06138901bad56c1c2544b3d20e..a81c8a9d76c1d9fdee19132a9a40ffc2ab4d107e 100644 +index cbcfb0bc3a85b60e13014245f256e5c356b4b79b..6fcc7949351c5741908a0150498b811f57961899 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -897,6 +897,20 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0927-Add-titleOverride-to-InventoryOpenEvent.patch b/patches/server/0927-Add-titleOverride-to-InventoryOpenEvent.patch index 98a9e5449f..76cb094c35 100644 --- a/patches/server/0927-Add-titleOverride-to-InventoryOpenEvent.patch +++ b/patches/server/0927-Add-titleOverride-to-InventoryOpenEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add titleOverride to InventoryOpenEvent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index d4930c40f03c5f331847bf52736c563a688d7daf..7272dc058c575efee5ac2643ce41b7d12e346e89 100644 +index 406794c439900a0d86fd4fe67d05a98bde625aec..2bb82dcffd8fdc25d658ec36a34f959b25217396 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1523,12 +1523,17 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0928-Configure-sniffer-egg-hatch-time.patch b/patches/server/0928-Configure-sniffer-egg-hatch-time.patch index b42c26e59c..702bef1759 100644 --- a/patches/server/0928-Configure-sniffer-egg-hatch-time.patch +++ b/patches/server/0928-Configure-sniffer-egg-hatch-time.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configure sniffer egg hatch time diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -index 7be4e32a4409b539839a480ef83750ed4b5359a6..03da13d1fdf22b425addf0b1b7a82803f6a35b60 100644 +index 4f1ff12df44756b63e3c3f9fc43e7ea485df6f57..e225595bbf044ff126797f44b233221c358ef641 100644 --- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -@@ -63,7 +63,7 @@ public class SnifferEggBlock extends Block { +@@ -62,7 +62,7 @@ public class SnifferEggBlock extends Block { // Paper start - Call BlockFadeEvent private void rescheduleTick(ServerLevel world, BlockPos pos) { @@ -17,7 +17,7 @@ index 7be4e32a4409b539839a480ef83750ed4b5359a6..03da13d1fdf22b425addf0b1b7a82803 world.scheduleTick(pos, this, (baseDelay / 3) + world.random.nextInt(RANDOM_HATCH_OFFSET_TICKS)); // reschedule to avoid being stuck here and behave like the other calls (see #onPlace) } -@@ -106,7 +106,7 @@ public class SnifferEggBlock extends Block { +@@ -104,7 +104,7 @@ public class SnifferEggBlock extends Block { world.levelEvent(3009, pos, 0); } diff --git a/patches/server/0930-Skip-POI-finding-if-stuck-in-vehicle.patch b/patches/server/0930-Skip-POI-finding-if-stuck-in-vehicle.patch index e0235836a4..a7cde65a3a 100644 --- a/patches/server/0930-Skip-POI-finding-if-stuck-in-vehicle.patch +++ b/patches/server/0930-Skip-POI-finding-if-stuck-in-vehicle.patch @@ -19,14 +19,14 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -index 9fd6cf0c98cbf6300ef23d4aab32a6110aeba665..a0799baca3ae05ef1ff818abfe6a53d28fd99246 100644 +index 977e477ca46e2c560e00858d3c992be13d3a2413..05d529a74fa3412b4b07bcf0d469118c38862279 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -@@ -47,6 +47,7 @@ public class AcquirePoi { - return false; - } else { - mutableLong.setValue(time + 20L + (long)world.getRandom().nextInt(20)); -+ if (entity.getNavigation().isStuck()) mutableLong.add(200); // Paper - Perf: Wait an additional 10s to check again if they're stuck - PoiManager poiManager = world.getPoiManager(); - long2ObjectMap.long2ObjectEntrySet().removeIf((entry) -> { - return !entry.getValue().isStillValid(time); +@@ -59,6 +59,7 @@ public class AcquirePoi { + return false; + } else { + mutableLong.setValue(time + 20L + (long)world.getRandom().nextInt(20)); ++ if (entity.getNavigation().isStuck()) mutableLong.add(200); // Paper - Perf: Wait an additional 10s to check again if they're stuck + PoiManager poiManager = world.getPoiManager(); + long2ObjectMap.long2ObjectEntrySet().removeIf(entry -> { + return !entry.getValue().isStillValid(time); diff --git a/patches/server/0939-Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch b/patches/server/0939-Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch index e2c7a15a63..f618e16c94 100644 --- a/patches/server/0939-Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch +++ b/patches/server/0939-Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch @@ -14,14 +14,14 @@ field by calling any method on the class, and for convenience we use values(). diff --git a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java -index a5b90222cfad5b282f3f2db4dd5d1b201761fb72..4a2c233898c00e09a7e1b75d3a9a82b572b849d6 100644 +index 5b6ccb52689af685380193f3a0eef2f121f9bd26..5a4b512bbb190153e28b638e6f9e52c9264eb24d 100644 --- a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java +++ b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java -@@ -139,6 +139,7 @@ public class UpgradeData { +@@ -138,6 +138,7 @@ public class UpgradeData { Fluid fluid = tick.type() == Fluids.EMPTY ? level.getFluidState(tick.pos()).getType() : tick.type(); level.scheduleTick(tick.pos(), fluid, tick.delay(), tick.priority()); }); + UpgradeData.BlockFixers.values(); // Paper - force the class init so that we don't access CHUNKY_FIXERS before all BlockFixers are initialised - CHUNKY_FIXERS.forEach((logic) -> { + CHUNKY_FIXERS.forEach(logic -> { logic.processChunk(level); }); diff --git a/patches/server/0950-Optimize-VarInts.patch b/patches/server/0950-Optimize-VarInts.patch index 19e7fc574a..b96957d432 100644 --- a/patches/server/0950-Optimize-VarInts.patch +++ b/patches/server/0950-Optimize-VarInts.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimize VarInts https://github.com/PaperMC/Paper/pull/6957#issuecomment-985250854 diff --git a/src/main/java/net/minecraft/network/VarInt.java b/src/main/java/net/minecraft/network/VarInt.java -index 18d5a22ad3ef4cb279475531dbc2c65e07c69929..3f362eb42587b333e27b9cf25588a9cfcb8a56e7 100644 +index 49a8ddc269d53458cfbd639b7de838c2e5765748..74ed47659d3e615c2dae7da98d5a8cf1559625bf 100644 --- a/src/main/java/net/minecraft/network/VarInt.java +++ b/src/main/java/net/minecraft/network/VarInt.java @@ -9,6 +9,18 @@ public class VarInt { @@ -24,8 +24,8 @@ index 18d5a22ad3ef4cb279475531dbc2c65e07c69929..3f362eb42587b333e27b9cf25588a9cf + VARINT_EXACT_BYTE_LENGTHS[32] = 1; // Special case for the number 0. + } + public static int getByteSizeOld(int i) { -+ //Paper end - Optimize VarInts - for(int j = 1; j < 5; ++j) { ++ // Paper end - Optimize VarInts + for (int j = 1; j < 5; j++) { if ((i & -1 << j * 7) == 0) { return j; @@ -39,6 +51,21 @@ public class VarInt { @@ -47,6 +47,6 @@ index 18d5a22ad3ef4cb279475531dbc2c65e07c69929..3f362eb42587b333e27b9cf25588a9cf + } + public static ByteBuf writeOld(ByteBuf buf, int i) { + // Paper end - Optimize VarInts - while((i & -128) != 0) { + while ((i & -128) != 0) { buf.writeByte(i & 127 | 128); i >>>= 7; diff --git a/patches/server/0953-Broadcast-take-item-packets-with-collector-as-source.patch b/patches/server/0953-Broadcast-take-item-packets-with-collector-as-source.patch index 393709e2e0..762ec4c8fd 100644 --- a/patches/server/0953-Broadcast-take-item-packets-with-collector-as-source.patch +++ b/patches/server/0953-Broadcast-take-item-packets-with-collector-as-source.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Broadcast take item packets with collector as source This fixes players (which can't view the collector) seeing item pickups with themselves as the target. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index e2564a07e0aa4bf2fcd9a749e9fc188dd0633675..8567cdfc42ea2388dd44ed1de83bebca433abe12 100644 +index 09a48779046484c2f3628d1499659e247c736fce..6b591f8b484be20418e8a6ca09aba84cda398a3d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3724,7 +3724,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0960-Fix-missing-event-call-for-entity-teleport-API.patch b/patches/server/0960-Fix-missing-event-call-for-entity-teleport-API.patch index 7da83443f1..77319ed2b1 100644 --- a/patches/server/0960-Fix-missing-event-call-for-entity-teleport-API.patch +++ b/patches/server/0960-Fix-missing-event-call-for-entity-teleport-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix missing event call for entity teleport API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index a81c8a9d76c1d9fdee19132a9a40ffc2ab4d107e..38c14e06bcada9678b64c6eacf351de10232ee56 100644 +index 6fcc7949351c5741908a0150498b811f57961899..76193067a21ff962cf2634b36d0ddf3eff8f85d7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -256,6 +256,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0961-Lazily-create-LootContext-for-criterions.patch b/patches/server/0961-Lazily-create-LootContext-for-criterions.patch index 293dfbd694..7ef28810ed 100644 --- a/patches/server/0961-Lazily-create-LootContext-for-criterions.patch +++ b/patches/server/0961-Lazily-create-LootContext-for-criterions.patch @@ -8,10 +8,10 @@ For each player on each tick, enter block triggers are invoked, and these create To avoid this, we now lazily create the LootContext if the criterion passes the predicate AND if any of the listener triggers require a loot context instance diff --git a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java -index 805459ba815520165c86a537fbb1f3e04b85bfbd..a327973e37b5b8d4e15683ef24548482ac3dc3d5 100644 +index 670e59432979740caf283d839c2f42c9748fe215..9c95c83e74c84e15c8d03503fc3cd0ee10044fd3 100644 --- a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java +++ b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java -@@ -45,14 +45,14 @@ public abstract class SimpleCriterionTrigger<T extends SimpleCriterionTrigger.Si +@@ -44,14 +44,14 @@ public abstract class SimpleCriterionTrigger<T extends SimpleCriterionTrigger.Si PlayerAdvancements playerAdvancements = player.getAdvancements(); Set<CriterionTrigger.Listener<T>> set = (Set) playerAdvancements.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak if (set != null && !set.isEmpty()) { @@ -19,7 +19,7 @@ index 805459ba815520165c86a537fbb1f3e04b85bfbd..a327973e37b5b8d4e15683ef24548482 + LootContext lootContext = null; // EntityPredicate.createContext(player, player); // Paper - Perf: lazily create LootContext for criterions List<CriterionTrigger.Listener<T>> list = null; - for(CriterionTrigger.Listener<T> listener : set) { + for (CriterionTrigger.Listener<T> listener : set) { T simpleInstance = listener.trigger(); if (predicate.test(simpleInstance)) { Optional<ContextAwarePredicate> optional = simpleInstance.player(); diff --git a/patches/server/0962-Don-t-fire-sync-events-during-worldgen.patch b/patches/server/0962-Don-t-fire-sync-events-during-worldgen.patch index 1b53c1ac5c..086273d9ca 100644 --- a/patches/server/0962-Don-t-fire-sync-events-during-worldgen.patch +++ b/patches/server/0962-Don-t-fire-sync-events-during-worldgen.patch @@ -31,7 +31,7 @@ index 8235dace0f4a1090dfbd403db34231ccafe5f30e..9816913ad729fd39c173364b92e5db06 if (entity.valid) { MinecraftServer.LOGGER.error("Attempted Double World add on {}", entity, new Throwable()); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4db254f76bc2fb9867441016b3ac4f45f19d3bea..4125802dda07d79dd0e1f7e7dc3c0ee85fa0383c 100644 +index ad3cdb1a3ab07c48bf6b2662b93ddad5974db1a6..2848be4604e08d0d651d16e960cda9a4d0234d41 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -637,7 +637,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -68,7 +68,7 @@ index 656c68b37bc25d6b77f295f9efe0a81dd20b69c1..8ba573bb4099ee5b27b61f333e72d794 }, () -> { EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8567cdfc42ea2388dd44ed1de83bebca433abe12..d36e1d6f7bba220f7e6b0d8d23aff26275d9f33e 100644 +index 6b591f8b484be20418e8a6ca09aba84cda398a3d..a648cc01f2cdfac46fd2e760705cf85e534e926f 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1142,6 +1142,11 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0965-Restore-vanilla-entity-drops-behavior.patch b/patches/server/0965-Restore-vanilla-entity-drops-behavior.patch index 625d431fff..531ac1d639 100644 --- a/patches/server/0965-Restore-vanilla-entity-drops-behavior.patch +++ b/patches/server/0965-Restore-vanilla-entity-drops-behavior.patch @@ -9,7 +9,7 @@ on dropping the item instead of generalizing it for all dropped items like CB does. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 7272dc058c575efee5ac2643ce41b7d12e346e89..ae5a2136a0e266d4c35190f5d33552994c842786 100644 +index 2bb82dcffd8fdc25d658ec36a34f959b25217396..bd6c60ebfc76d19313bf01048268f8ce7e6603c5 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -891,22 +891,20 @@ public class ServerPlayer extends Player { @@ -50,7 +50,7 @@ index 7272dc058c575efee5ac2643ce41b7d12e346e89..ae5a2136a0e266d4c35190f5d3355299 if (entityitem == null) { return null; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4125802dda07d79dd0e1f7e7dc3c0ee85fa0383c..7c99742e01e894bcc7d89a8588b2f128cf9b765d 100644 +index 2848be4604e08d0d651d16e960cda9a4d0234d41..5275e7a34f86830d43edcab3a0e94f8d8e9cfae5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2496,6 +2496,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -104,7 +104,7 @@ index 4125802dda07d79dd0e1f7e7dc3c0ee85fa0383c..7c99742e01e894bcc7d89a8588b2f128 return this.spawnAtLocation(entityitem); } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d36e1d6f7bba220f7e6b0d8d23aff26275d9f33e..c43927781c579f7237cd795e71e18e5a11074c7b 100644 +index a648cc01f2cdfac46fd2e760705cf85e534e926f..d396201655fde7ff35cf2a342fa458e5ea3f80a8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -255,7 +255,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0968-Improve-Registry.patch b/patches/server/0968-Improve-Registry.patch index 740baefc42..aed822acfc 100644 --- a/patches/server/0968-Improve-Registry.patch +++ b/patches/server/0968-Improve-Registry.patch @@ -37,7 +37,7 @@ index b12b99253543445475b73a1d3d7c6364856b49e8..4fc02698a9312496e7f9bce1c64f3173 + // Paper end - improve Registry } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java -index 49752459ad67db3182c6d6d30ab91f2a420847a8..b1e87b52753242c7210cb250e4e272d016317c26 100644 +index 147950b8a1c853e1b52fdb29b26e839c2dd7bd01..8a20186618de8de8dd941a12aeb7d4f3b7e70c18 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java @@ -35,6 +35,7 @@ public class CraftTrimMaterial implements TrimMaterial, Handleable<net.minecraft @@ -49,7 +49,7 @@ index 49752459ad67db3182c6d6d30ab91f2a420847a8..b1e87b52753242c7210cb250e4e272d0 } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java -index cd5f68a6fb8290c238ba466a34d955eb90667459..b1a3d3f2f9948e41ed41a5d374f78f95899199ed 100644 +index 88e9acd2084c5e7738017a91a454fc5407ab833b..dbb1619f8e8d98feb30f76beb8c23ebcd3ddca1f 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java @@ -35,6 +35,7 @@ public class CraftTrimPattern implements TrimPattern, Handleable<net.minecraft.w diff --git a/patches/server/0969-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch b/patches/server/0969-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch index 1977393bff..b554986b74 100644 --- a/patches/server/0969-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch +++ b/patches/server/0969-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch @@ -26,7 +26,7 @@ index 3fec07b250a8f145e30c8c41888e47d2a3c902e1..2ddd033e1c3a2e5c8950b93c83849192 x = to.getX(); y = to.getY(); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index c43927781c579f7237cd795e71e18e5a11074c7b..693ea3891f18f071cdd79f9162f1521472b3ed24 100644 +index d396201655fde7ff35cf2a342fa458e5ea3f80a8..bb52d084637c97d9cc1ebaeec28358a0ddb3952b 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -4201,7 +4201,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0973-Validate-ResourceLocation-in-NBT-reading.patch b/patches/server/0973-Validate-ResourceLocation-in-NBT-reading.patch index e5ce3cf93b..ed9dd93bc3 100644 --- a/patches/server/0973-Validate-ResourceLocation-in-NBT-reading.patch +++ b/patches/server/0973-Validate-ResourceLocation-in-NBT-reading.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Validate ResourceLocation in NBT reading diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java -index ba0726157417cdde1c9bca93a9e37e68d9b2286d..e3a3f19a6e63fd42e29c418e5a7439972484d492 100644 +index c613577572532fd1b8a8c912b9fd8e41c54669bb..128c6615374e85b772f109200813aa696d784035 100644 --- a/src/main/java/net/minecraft/nbt/NbtUtils.java +++ b/src/main/java/net/minecraft/nbt/NbtUtils.java @@ -230,8 +230,10 @@ public final class NbtUtils { @@ -22,10 +22,10 @@ index ba0726157417cdde1c9bca93a9e37e68d9b2286d..e3a3f19a6e63fd42e29c418e5a743997 return Blocks.AIR.defaultBlockState(); } else { diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java -index 5f9dcab27a07969c93555ad0892683c62cbebc8c..a4d875df936b6de16f0233482b03af05b427a79f 100644 +index 651a61681b0b484253f82b43a75e76c5a1c40543..b00e2fe01a433363f75b891086f4c77d27c38209 100644 --- a/src/main/java/net/minecraft/resources/ResourceLocation.java +++ b/src/main/java/net/minecraft/resources/ResourceLocation.java -@@ -31,6 +31,13 @@ public class ResourceLocation implements Comparable<ResourceLocation> { +@@ -33,6 +33,13 @@ public class ResourceLocation implements Comparable<ResourceLocation> { private final String path; protected ResourceLocation(String namespace, String path, @Nullable ResourceLocation.Dummy extraData) { @@ -53,7 +53,7 @@ index 8ba573bb4099ee5b27b61f333e72d794c48d5f29..69bdf3f2ee731e59e8d454816a9ca72c @Nullable diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 693ea3891f18f071cdd79f9162f1521472b3ed24..7f5457522835b073246054e66699fe73f7005b25 100644 +index bb52d084637c97d9cc1ebaeec28358a0ddb3952b..40e21effc948b02874a6ed1d1c340c4dc87579d6 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -879,12 +879,13 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -98,10 +98,10 @@ index c30f19162e33dbe8f018b7dc66210681b6027389..e8faca6e443239968f0111519f9e5cd0 this.setShotFromCrossbow(nbt.getBoolean("ShotFromCrossbow")); diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java -index 7529751afa2932fd16bc4591189b0358268a7b14..e2e1c7a017e82dc7299e5cd1783818e4f0319c0b 100644 +index f4ad1eea5bced6997edbc3a5ed1360b12b70f68f..648eefb973a4e5e543818c417a6ee39f283ea361 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java -@@ -67,7 +67,7 @@ public interface ContainerEntity extends Container, MenuProvider { +@@ -66,7 +66,7 @@ public interface ContainerEntity extends Container, MenuProvider { default void readChestVehicleSaveData(CompoundTag nbt) { this.clearItemStacks(); if (nbt.contains("LootTable", 8)) { @@ -109,7 +109,7 @@ index 7529751afa2932fd16bc4591189b0358268a7b14..e2e1c7a017e82dc7299e5cd1783818e4 + this.setLootTable(ResourceLocation.tryParse(nbt.getString("LootTable"))); // Paper - Validate ResourceLocation this.setLootTableSeed(nbt.getLong("LootTableSeed")); } - + ContainerHelper.loadAllItems(nbt, this.getItemStacks()); // Paper - always load the items, table may still remain 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 d04fc84eef11adb5ea64077f48794b6ed7fb3ada..89d06253b00604114e543ebbe12a9993ae95dc41 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/patches/server/0977-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/server/0977-Reduce-allocation-of-Vec3D-by-entity-tracker.patch index d6756e53cf..b1345b9284 100644 --- a/patches/server/0977-Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/patches/server/0977-Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Reduce allocation of Vec3D by entity tracker diff --git a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java -index 3c4ac79c094dc2fff7de94150a34b7bf814ac0de..38b56923a642afc1cb411480ba03cc784ed7cd24 100644 +index baacaa8fcefdee3c7eeebae1d3a365553e2dbac6..0d079f33c5cbc063081d5722c0823e332b448ea2 100644 --- a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java +++ b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java @@ -5,7 +5,7 @@ import org.jetbrains.annotations.VisibleForTesting; public class VecDeltaCodec { - private static final double TRUNCATION_STEPS = 4096.0D; + private static final double TRUNCATION_STEPS = 4096.0; - private Vec3 base = Vec3.ZERO; + public Vec3 base = Vec3.ZERO; // Paper diff --git a/patches/server/0978-Rewrite-dataconverter-system.patch b/patches/server/0978-Rewrite-dataconverter-system.patch index 2919728f24..5728a626b2 100644 --- a/patches/server/0978-Rewrite-dataconverter-system.patch +++ b/patches/server/0978-Rewrite-dataconverter-system.patch @@ -24837,7 +24837,7 @@ index 6743dca44e6552ad39aca757a24f3c4df400d83d..eebaf98bc0fa4696af59b2a79563beb7 NbtUtils.addCurrentDataVersion(nbttagcompound); } 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 d80580574a9e5d1c850270d93807f3a66a9c76f8..98b3909b536f11eda9c481ffd74066ad0cdb0ebc 100644 +index 01e54bd6c8157bc5c20375180a29c62599d72a3b..0eaecd48f763d60e3bfe684fae1700c2ced78cc2 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 @@ -115,7 +115,7 @@ public class EntityStorage implements EntityPersistentStorage<Entity> { @@ -24850,10 +24850,10 @@ index d80580574a9e5d1c850270d93807f3a66a9c76f8..98b3909b536f11eda9c481ffd74066ad @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 28e0f782c24afb3d8d2296bd0d3493a32ef66961..56f0e217276b01aed2f20a71f6849826285fc15b 100644 +index fd7060813fdf335813c1e6ef5a695931cfce242a..8c0e4a0e451d1e0ff8ff20fbe3a92bb20b8b4bda 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 -@@ -142,7 +142,14 @@ public class SectionStorage<R> implements AutoCloseable { +@@ -150,7 +150,14 @@ public class SectionStorage<R> implements AutoCloseable { int j = getVersion(dynamic); int k = SharedConstants.getCurrentVersion().getDataVersion().getVersion(); boolean bl = j != k; @@ -24868,12 +24868,12 @@ index 28e0f782c24afb3d8d2296bd0d3493a32ef66961..56f0e217276b01aed2f20a71f6849826 + // Paper end - route to new converter system OptionalDynamic<T> optionalDynamic = dynamic2.get("Sections"); - for(int l = this.levelHeightAccessor.getMinSection(); l < this.levelHeightAccessor.getMaxSection(); ++l) { + 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 15a9736a870055d639d03063c7cf67fd769fff36..1ca00340aaa201dd34e5c350d23ef53e126a0ca6 100644 +index da919ad85ce06572f8e7e4c121a2c222f975c7f5..4303dc2366275dfab3901af4e522113f9a84ce4a 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 -@@ -115,7 +115,7 @@ public class StructureCheck { +@@ -141,7 +141,7 @@ public class StructureCheck { CompoundTag compoundTag2; try { @@ -24883,10 +24883,10 @@ index 15a9736a870055d639d03063c7cf67fd769fff36..1ca00340aaa201dd34e5c350d23ef53e LOGGER.warn("Failed to partially datafix chunk {}", pos, var12); return StructureCheckResult.CHUNK_LOAD_NEEDED; diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java -index e534dac9d69147174f6b9e8ce7f27fde536351ce..270fd52ec733c89bd91155c8222936fafbcf94d6 100644 +index 4ddd6a05b538ba1514ca510bf8233a60aa2a21bb..bc6dabe66758c1b8142d0a8be01f146c0d442531 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java -@@ -236,7 +236,7 @@ public class StructureTemplateManager { +@@ -247,7 +247,7 @@ public class StructureTemplateManager { public StructureTemplate readStructure(CompoundTag nbt) { StructureTemplate structureTemplate = new StructureTemplate(); int i = NbtUtils.getDataVersion(nbt, 500); diff --git a/patches/server/0979-Starlight.patch b/patches/server/0979-Starlight.patch index f7c01379eb..8312055b47 100644 --- a/patches/server/0979-Starlight.patch +++ b/patches/server/0979-Starlight.patch @@ -4518,7 +4518,7 @@ index 4e1618462840a1378dbe6492696c97544815edf2..8e8e3896040241bba8fd15f4d6d04656 while (objectiterator.hasNext()) { diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java -index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0da9796dba 100644 +index f103a885777557af6cb864bfe8a6c5ca6ff351ab..814689f9eb0d4024bfa8512b799acf4547786e9c 100644 --- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java +++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java @@ -23,6 +23,17 @@ import net.minecraft.world.level.chunk.LightChunkGetter; @@ -4539,7 +4539,7 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCloseable { public static final int DEFAULT_BATCH_SIZE = 1000; private static final Logger LOGGER = LogUtils.getLogger(); -@@ -33,13 +44,161 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -33,6 +44,12 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl private final int taskPerBatch = 1000; private final AtomicBoolean scheduled = new AtomicBoolean(); @@ -4549,7 +4549,13 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d + public final boolean hasSkyLight; + // Paper end - replace light engine impl + - public ThreadedLevelLightEngine(LightChunkGetter chunkProvider, ChunkMap chunkStorage, boolean hasBlockLight, ProcessorMailbox<Runnable> processor, ProcessorHandle<ChunkTaskPriorityQueueSorter.Message<Runnable>> executor) { + public ThreadedLevelLightEngine( + LightChunkGetter chunkProvider, + ChunkMap chunkStorage, +@@ -40,12 +57,154 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl + ProcessorMailbox<Runnable> processor, + ProcessorHandle<ChunkTaskPriorityQueueSorter.Message<Runnable>> executor + ) { - super(chunkProvider, true, hasBlockLight); + super(chunkProvider, false, false); // Paper - destroy vanilla light engine state this.chunkMap = chunkStorage; @@ -4675,14 +4681,14 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d + LOGGER.error("Failed to remove ticket level for post chunk task " + new ChunkPos(chunkX, chunkZ), thr); + } + }); - } - ++ } ++ + @Override + public boolean hasLightWork() { + // route to new light engine + return this.theLightEngine.hasUpdates(); -+ } -+ + } + + @Override + public LayerLightEventListener getLayerListener(final LightLayer lightType) { + return lightType == LightLayer.BLOCK ? this.theLightEngine.getBlockReader() : this.theLightEngine.getSkyReader(); @@ -4702,16 +4708,21 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d @Override public void close() { } -@@ -51,15 +210,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -57,20 +216,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @Override public void checkBlock(BlockPos pos) { - BlockPos blockPos = pos.immutable(); -- this.addTask(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ()), ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -- super.checkBlock(blockPos); -- }, () -> { -- return "checkBlock " + blockPos; -- })); +- this.addTask( +- SectionPos.blockToSectionCoord(pos.getX()), +- SectionPos.blockToSectionCoord(pos.getZ()), +- ThreadedLevelLightEngine.TaskType.PRE_UPDATE, +- Util.name(() -> { +- super.checkBlock(blockPos); +- }, () -> { +- return "checkBlock " + blockPos; +- }) +- ); + // Paper start - replace light engine impl + final BlockPos posCopy = pos.immutable(); + this.queueTaskForSection(posCopy.getX() >> 4, posCopy.getY() >> 4, posCopy.getZ() >> 4, () -> { @@ -4725,7 +4736,7 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d this.addTask(pos.x, pos.z, () -> { return 0; }, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -@@ -82,17 +242,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -92,17 +247,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @Override public void updateSectionStatus(SectionPos pos, boolean notReady) { @@ -4749,7 +4760,7 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d this.addTask(chunkPos.x, chunkPos.z, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { super.propagateLightSources(chunkPos); }, () -> { -@@ -102,6 +261,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -112,6 +266,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @Override public void setLightEnabled(ChunkPos pos, boolean retainData) { @@ -4757,7 +4768,7 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d this.addTask(pos.x, pos.z, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { super.setLightEnabled(pos, retainData); }, () -> { -@@ -111,6 +271,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -121,6 +276,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @Override public void queueSectionData(LightLayer lightType, SectionPos pos, @Nullable DataLayer nibbles) { @@ -4765,7 +4776,7 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d this.addTask(pos.x(), pos.z(), () -> { return 0; }, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -@@ -136,6 +297,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -145,6 +301,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @Override public void retainData(ChunkPos pos, boolean retainData) { @@ -4773,7 +4784,7 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d this.addTask(pos.x, pos.z, () -> { return 0; }, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -@@ -146,6 +308,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -155,6 +312,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } public CompletableFuture<ChunkAccess> initializeLight(ChunkAccess chunk, boolean bl) { @@ -4781,7 +4792,7 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d ChunkPos chunkPos = chunk.getPos(); this.addTask(chunkPos.x, chunkPos.z, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { LevelChunkSection[] levelChunkSections = chunk.getSections(); -@@ -171,6 +334,37 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -179,6 +337,37 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } public CompletableFuture<ChunkAccess> lightChunk(ChunkAccess chunk, boolean excludeBlocks) { @@ -4819,7 +4830,7 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d ChunkPos chunkPos = chunk.getPos(); chunk.setLightCorrect(false); this.addTask(chunkPos.x, chunkPos.z, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -@@ -191,7 +385,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -198,7 +387,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } public void tryScheduleUpdate() { @@ -4828,14 +4839,14 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d this.taskMailbox.tell(() -> { this.runUpdate(); this.scheduled.set(false); -@@ -213,7 +407,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -219,7 +408,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } objectListIterator.back(j); - super.runLightUpdates(); + this.theLightEngine.propagateChanges(); // Paper - rewrite light engine - for(int var5 = 0; objectListIterator.hasNext() && var5 < i; ++var5) { + for (int var5 = 0; objectListIterator.hasNext() && var5 < i; var5++) { Pair<ThreadedLevelLightEngine.TaskType, Runnable> pair2 = objectListIterator.next(); diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java index 0d536d72ac918fbd403397ff369d10143ee9c204..6051e5f272838ef23276a90e21c2fc821ca155d1 100644 @@ -5081,10 +5092,10 @@ index 2ee1658532cb00d7bcd1d11e03f19d21ca7f2a9e..ac754827172a4de600d0a57a7d118534 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 6bb508105641b5729572736c5c3f9bd6711e309a..60e760b42dd6471a229dfd45490dcf8c51979d35 100644 +index 6d1f924f7a1efe87f1a79f07ac4b4fbaae92f586..030fafe3b0bcad9e95251f5824ac2ef58640c705 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -@@ -39,6 +39,48 @@ public class ImposterProtoChunk extends ProtoChunk { +@@ -45,6 +45,48 @@ public class ImposterProtoChunk extends ProtoChunk { this.allowWrites = propagateToWrapped; } @@ -5169,10 +5180,10 @@ index af757309cb46af6df07872f7596b66df6d6f18d7..73e682bb3ef3b2e450ec8c594b5365c7 this.level.getChunkSource().getLightEngine().checkBlock(blockposition); gameprofilerfiller.pop(); 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 dd62e257e16974a6d556a7f5e2d113a2cbc08981..dfae0918079425df92d958b04275be8ae60d4b60 100644 +index a1ace0df243b43768bbb60a0941c18e3f5d10dfd..a6a8fbe2d6d538a0fea8a202ec8fdbecc009d664 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -143,7 +143,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer +@@ -162,7 +162,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer return this.get(this.strategy.getIndex(x, y, z)); } @@ -5182,10 +5193,10 @@ index dd62e257e16974a6d556a7f5e2d113a2cbc08981..dfae0918079425df92d958b04275be8a 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 38ec21faaa16df5485a81a581506700a5ab0a440..7da1ed9640211b0e064162dcdb0000538e7b30f3 100644 +index aee460cd2cfed3134870b5c02bf4ecb5738a5aa0..b4cf3d1405b79fb419be5116484f19dc76187b4a 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -130,7 +130,7 @@ public class ProtoChunk extends ChunkAccess { +@@ -141,7 +141,7 @@ public class ProtoChunk extends ChunkAccess { } if (LightEngine.hasDifferentLightProperties(this, pos, blockState, state)) { diff --git a/patches/server/0980-Rewrite-chunk-system.patch b/patches/server/0980-Rewrite-chunk-system.patch index 19cbac85d0..6093ffd30a 100644 --- a/patches/server/0980-Rewrite-chunk-system.patch +++ b/patches/server/0980-Rewrite-chunk-system.patch @@ -18856,7 +18856,7 @@ index 9816913ad729fd39c173364b92e5db06a733bc55..a3881964bad0cab8f480eda634216d73 return crashreportsystemdetails; } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index ae5a2136a0e266d4c35190f5d33552994c842786..5657f1ecbadda96a79978f918393c0c9a58dca83 100644 +index bd6c60ebfc76d19313bf01048268f8ce7e6603c5..18356db5d998dccb9e645a9ee0bebc5cbbfa5f7a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -276,6 +276,50 @@ public class ServerPlayer extends Player { @@ -18911,7 +18911,7 @@ index ae5a2136a0e266d4c35190f5d33552994c842786..5657f1ecbadda96a79978f918393c0c9 super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); this.chatVisibility = ChatVisiblity.FULL; diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java -index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056cccbfc89 100644 +index 814689f9eb0d4024bfa8512b799acf4547786e9c..abf096eaa0ea1ada68a80c72d72b38e8b9d70c02 100644 --- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java +++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java @@ -37,15 +37,12 @@ import net.minecraft.world.level.chunk.ChunkStatus; @@ -18933,8 +18933,8 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 public final boolean hasBlockLight; public final boolean hasSkyLight; // Paper end - replace light engine impl -@@ -53,8 +50,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl - public ThreadedLevelLightEngine(LightChunkGetter chunkProvider, ChunkMap chunkStorage, boolean hasBlockLight, ProcessorMailbox<Runnable> processor, ProcessorHandle<ChunkTaskPriorityQueueSorter.Message<Runnable>> executor) { +@@ -59,8 +56,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl + ) { super(chunkProvider, false, false); // Paper - destroy vanilla light engine state this.chunkMap = chunkStorage; - this.sorterMailbox = executor; @@ -18943,7 +18943,7 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 // Paper start - replace light engine impl this.hasBlockLight = true; this.hasSkyLight = hasBlockLight; // Nice variable name. -@@ -98,7 +94,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -104,7 +100,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl ++totalChunks; } @@ -18952,7 +18952,7 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 this.theLightEngine.relightChunks(chunks, (ChunkPos chunkPos) -> { chunkLightCallback.accept(chunkPos); ((java.util.concurrent.Executor)((ServerLevel)this.theLightEngine.getWorld()).getChunkSource().mainThreadProcessor).execute(() -> { -@@ -115,7 +111,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -121,7 +117,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl private final Long2IntOpenHashMap chunksBeingWorkedOn = new Long2IntOpenHashMap(); private void queueTaskForSection(final int chunkX, final int chunkY, final int chunkZ, @@ -18961,7 +18961,7 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 final ServerLevel world = (ServerLevel)this.theLightEngine.getWorld(); final ChunkAccess center = this.theLightEngine.getAnyChunkNow(chunkX, chunkZ); -@@ -142,7 +138,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -148,7 +144,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl final long key = CoordinateUtils.getChunkKey(chunkX, chunkZ); @@ -18970,7 +18970,7 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 if (updateFuture == null) { // not scheduled -@@ -282,17 +278,11 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -287,16 +283,11 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } private void addTask(int x, int z, ThreadedLevelLightEngine.TaskType stage, Runnable task) { @@ -18984,13 +18984,12 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 - if (this.lightTasks.size() >= 1000) { - this.runUpdate(); - } -- - }, ChunkPos.asLong(x, z), completedLevelSupplier)); + throw new UnsupportedOperationException(); // Paper - rewrite chunk system } @Override -@@ -334,90 +324,15 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -337,87 +328,15 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } public CompletableFuture<ChunkAccess> lightChunk(ChunkAccess chunk, boolean excludeBlocks) { @@ -19031,7 +19030,6 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 - if (!excludeBlocks) { - super.propagateLightSources(chunkPos); - } -- - }, () -> { - return "lightChunk " + chunkPos + " " + excludeBlocks; - })); @@ -19039,7 +19037,7 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 - chunk.setLightCorrect(true); - this.chunkMap.releaseLightTicket(chunkPos); - return chunk; -- }, (task) -> { +- }, task -> { - this.addTask(chunkPos.x, chunkPos.z, ThreadedLevelLightEngine.TaskType.POST_UPDATE, task); - }); + throw new UnsupportedOperationException(); // Paper - rewrite chunk system @@ -19052,7 +19050,6 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 - this.scheduled.set(false); - }); - } -- + // Paper - rewrite chunk system } @@ -19061,7 +19058,7 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 - ObjectListIterator<Pair<ThreadedLevelLightEngine.TaskType, Runnable>> objectListIterator = this.lightTasks.iterator(); - - int j; -- for(j = 0; objectListIterator.hasNext() && j < i; ++j) { +- for (j = 0; objectListIterator.hasNext() && j < i; j++) { - Pair<ThreadedLevelLightEngine.TaskType, Runnable> pair = objectListIterator.next(); - if (pair.getFirst() == ThreadedLevelLightEngine.TaskType.PRE_UPDATE) { - pair.getSecond().run(); @@ -19071,7 +19068,7 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 - objectListIterator.back(j); - this.theLightEngine.propagateChanges(); // Paper - rewrite light engine - -- for(int var5 = 0; objectListIterator.hasNext() && var5 < i; ++var5) { +- for (int var5 = 0; objectListIterator.hasNext() && var5 < i; var5++) { - Pair<ThreadedLevelLightEngine.TaskType, Runnable> pair2 = objectListIterator.next(); - if (pair2.getFirst() == ThreadedLevelLightEngine.TaskType.POST_UPDATE) { - pair2.getSecond().run(); @@ -19079,13 +19076,12 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 - - objectListIterator.remove(); - } -- + throw new UnsupportedOperationException(); // Paper - rewrite chunk system } public CompletableFuture<?> waitForPendingTasks(int x, int z) { diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java -index b346fa94b23d81da7da073f71dd12e672e0f079c..0edb97617f0c0da8dda901a26891b33c324715c7 100644 +index eba83b085435150e5954fd5d41dda9ce1d0601ad..e97329f867de2acbdd666925ba5d2aafa7a90574 100644 --- a/src/main/java/net/minecraft/server/level/Ticket.java +++ b/src/main/java/net/minecraft/server/level/Ticket.java @@ -6,9 +6,12 @@ public final class Ticket<T> implements Comparable<Ticket<?>> { @@ -19103,7 +19099,7 @@ index b346fa94b23d81da7da073f71dd12e672e0f079c..0edb97617f0c0da8dda901a26891b33c this.type = type; this.ticketLevel = level; this.key = argument; -@@ -44,7 +47,7 @@ public final class Ticket<T> implements Comparable<Ticket<?>> { +@@ -41,7 +44,7 @@ public final class Ticket<T> implements Comparable<Ticket<?>> { @Override public String toString() { @@ -19112,7 +19108,7 @@ index b346fa94b23d81da7da073f71dd12e672e0f079c..0edb97617f0c0da8dda901a26891b33c } public TicketType<T> getType() { -@@ -56,11 +59,10 @@ public final class Ticket<T> implements Comparable<Ticket<?>> { +@@ -53,11 +56,10 @@ public final class Ticket<T> implements Comparable<Ticket<?>> { } protected void setCreatedTick(long tickCreated) { @@ -19181,10 +19177,10 @@ index c3e7bd8865cc8990fc59f1ff0dfc1697cbb5ca49..5ece375eaf6bcc61864997a389bb5e24 + // Paper end } diff --git a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -index 13209267c26f46492a92e820889a9be0bd2287a0..f3b96a921e7d085b51da62fa5493384a7ded1f9d 100644 +index b7778d5296d01870e37560d8f03d48e4a4dd62ae..cc56479a54ccbb80e352c3e876e306647807c551 100644 --- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java +++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -@@ -44,17 +44,23 @@ public class PlayerChunkSender { +@@ -43,16 +43,23 @@ public class PlayerChunkSender { public void dropChunk(ServerPlayer player, ChunkPos pos) { if (!this.pendingChunks.remove(pos.toLong()) && player.isAlive()) { @@ -19201,7 +19197,6 @@ index 13209267c26f46492a92e820889a9be0bd2287a0..f3b96a921e7d085b51da62fa5493384a } // Paper end - PlayerChunkUnloadEvent - } -- } + // Paper end - rewrite player chunk loader @@ -19210,22 +19205,22 @@ index 13209267c26f46492a92e820889a9be0bd2287a0..f3b96a921e7d085b51da62fa5493384a if (this.unacknowledgedBatches < this.maxUnacknowledgedBatches) { float f = Math.max(1.0F, this.desiredChunksPerTick); this.batchQuota = Math.min(this.batchQuota + this.desiredChunksPerTick, f); -@@ -80,7 +86,8 @@ public class PlayerChunkSender { +@@ -78,7 +85,8 @@ public class PlayerChunkSender { } } - private static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { + public static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { // Paper - rewrite chunk loader - public + handler.player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(chunk.getPos().toLong()).addPlayer(handler.player); - handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null)); + handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null)); // Paper start - PlayerChunkLoadEvent if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) { -@@ -110,6 +117,7 @@ public class PlayerChunkSender { +@@ -115,6 +123,7 @@ public class PlayerChunkSender { } public void onChunkBatchReceivedByClient(float desiredBatchSize) { + if (true) return; // Paper - rewrite player chunk loader - --this.unacknowledgedBatches; + this.unacknowledgedBatches--; this.desiredChunksPerTick = Double.isNaN((double)desiredBatchSize) ? 0.01F : Mth.clamp(desiredBatchSize, 0.01F, 64.0F); if (this.unacknowledgedBatches == 0) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -19271,7 +19266,7 @@ index d38fe02af4cc35ed5b22acec41bedb76151f8af5..4a569bf782bfdd870f32fe0ab5c3b8b8 while (iterator.hasNext()) { diff --git a/src/main/java/net/minecraft/util/SortedArraySet.java b/src/main/java/net/minecraft/util/SortedArraySet.java -index ca788f0dcec4a117b410fe8348969e056b138b1e..a6ac76707da39cf86113003b1f326433fdc86c86 100644 +index ea72dcb064a35bc6245bc5c94d592efedd8faf41..0793dfe47e68a2b48b010aad5b12dcfa1701293a 100644 --- a/src/main/java/net/minecraft/util/SortedArraySet.java +++ b/src/main/java/net/minecraft/util/SortedArraySet.java @@ -14,6 +14,14 @@ public class SortedArraySet<T> extends AbstractSet<T> { @@ -19380,7 +19375,7 @@ index 640db9f71608310a64e09f1e3e677c01e6ccd98a..f2a7cb6ebed7a4b4019a09af2a025f62 if (flag1) { ++this.converted; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7c99742e01e894bcc7d89a8588b2f128cf9b765d..3f620c4b8415f09a8d4664481b2d41d421ee836e 100644 +index 5275e7a34f86830d43edcab3a0e94f8d8e9cfae5..b108f779abe3d9798c0bcbc983f41d48b33aa153 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -480,6 +480,58 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -19516,7 +19511,7 @@ index 7c99742e01e894bcc7d89a8588b2f128cf9b765d..3f620c4b8415f09a8d4664481b2d41d4 @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f5558573745762c 100644 +index 9d6b226e297af07486e4ee16091c23acafea9418..c80e75ba66bcd5957d6360a8d5de4f052dbf87d7 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java @@ -38,12 +38,28 @@ import net.minecraft.world.level.chunk.storage.SectionStorage; @@ -19551,7 +19546,7 @@ index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f555857 } public void add(BlockPos pos, Holder<PoiType> type) { -@@ -180,8 +196,8 @@ public class PoiManager extends SectionStorage<PoiSection> { +@@ -201,8 +217,8 @@ public class PoiManager extends SectionStorage<PoiSection> { } public int sectionsToVillage(SectionPos pos) { @@ -19562,7 +19557,7 @@ index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f555857 } boolean isVillageCenter(long pos) { -@@ -195,21 +211,118 @@ public class PoiManager extends SectionStorage<PoiSection> { +@@ -216,21 +232,118 @@ public class PoiManager extends SectionStorage<PoiSection> { @Override public void tick(BooleanSupplier shouldKeepTicking) { @@ -19607,8 +19602,8 @@ index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f555857 + io.papermc.paper.chunk.system.poi.PoiChunk ret = manager.getPoiChunkIfLoaded(chunkX, chunkZ, true); + + return ret == null ? Optional.empty() : ret.getSectionForVanilla(chunkY); -+ } -+ + } + + @Override + public Optional<PoiSection> getOrLoad(long pos) { + int chunkX = io.papermc.paper.util.CoordinateUtils.getChunkSectionX(pos); @@ -19670,8 +19665,8 @@ index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f555857 + this.onSectionLoad(SectionPos.asLong(chunkX, sectionY, chunkZ)); + } + } - } - ++ } ++ + public void checkConsistency(net.minecraft.world.level.chunk.ChunkAccess chunk) { + int chunkX = chunk.getPos().x; + int chunkZ = chunk.getPos().z; @@ -19685,18 +19680,18 @@ index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f555857 + // Paper end - rewrite chunk system + public void checkConsistencyWithBlocks(SectionPos sectionPos, LevelChunkSection chunkSection) { - Util.ifElse(this.getOrLoad(sectionPos.asLong()), (poiSet) -> { - poiSet.refresh((populator) -> { -@@ -248,7 +361,7 @@ public class PoiManager extends SectionStorage<PoiSection> { - }).map((pair) -> { - return pair.getFirst().chunk(); - }).filter((chunkPos) -> { -- return this.loadedChunks.add(chunkPos.toLong()); -+ return true; // Paper - rewrite chunk system - }).forEach((chunkPos) -> { - world.getChunk(chunkPos.x, chunkPos.z, ChunkStatus.EMPTY); - }); -@@ -264,7 +377,7 @@ public class PoiManager extends SectionStorage<PoiSection> { + Util.ifElse(this.getOrLoad(sectionPos.asLong()), poiSet -> { + poiSet.refresh(populator -> { +@@ -276,7 +389,7 @@ public class PoiManager extends SectionStorage<PoiSection> { + return pair.getFirst().chunk(); + }) + .filter(chunkPos -> { +- return this.loadedChunks.add(chunkPos.toLong()); ++ return true; // Paper - rewrite chunk system + }) + .forEach(chunkPos -> { + world.getChunk(chunkPos.x, chunkPos.z, ChunkStatus.EMPTY); +@@ -293,7 +406,7 @@ public class PoiManager extends SectionStorage<PoiSection> { @Override protected int getLevelFromSource(long id) { @@ -19705,7 +19700,7 @@ index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f555857 } @Override -@@ -287,6 +400,35 @@ public class PoiManager extends SectionStorage<PoiSection> { +@@ -315,6 +428,35 @@ public class PoiManager extends SectionStorage<PoiSection> { } } @@ -19742,7 +19737,7 @@ index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f555857 HAS_SPACE(PoiRecord::hasSpace), IS_OCCUPIED(PoiRecord::isOccupied), 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 795a02941d7cecb58ec45b5e79c8d510ff21163a..3fc17817906876e83f040f908b8b1ba6cfa37b8b 100644 +index b54c6f70a9cb583ddcf1647dbbd05b4e1e5a1308..dbdcc8c842d427e1b0ce178a5d3cad23c4ccaf5e 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 @@ -29,6 +29,7 @@ public class PoiSection { @@ -19752,7 +19747,7 @@ index 795a02941d7cecb58ec45b5e79c8d510ff21163a..3fc17817906876e83f040f908b8b1ba6 + public final Optional<PoiSection> noAllocateOptional = Optional.of(this); // Paper - rewrite chunk system public static Codec<PoiSection> codec(Runnable updateListener) { - return RecordCodecBuilder.<PoiSection>create((instance) -> { + return RecordCodecBuilder.<PoiSection>create(instance -> { @@ -46,6 +47,12 @@ public class PoiSection { this(updateListener, true, ImmutableList.of()); } @@ -19767,10 +19762,10 @@ index 795a02941d7cecb58ec45b5e79c8d510ff21163a..3fc17817906876e83f040f908b8b1ba6 this.setDirty = updateListener; this.isValid = valid; diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index 57d4d2014f33a2f069d6c5aaa8e87e36b63a7177..cc888bbcd6a50124fa553bc4a8ffd1e8885d3856 100644 +index 77cd9d5518ac1d7c3c900354cdeb7be3fb66b0ac..eba4663a6928989bfa14d57303d77fdabea31481 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -18,6 +18,18 @@ import net.minecraft.world.phys.shapes.Shapes; +@@ -19,6 +19,18 @@ import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; public interface EntityGetter { @@ -19940,7 +19935,7 @@ index cedde2235227eb5820beefb98549994e1cca1198..9c743c980697a14d7348554fb77f242d + // Paper end } diff --git a/src/main/java/net/minecraft/world/level/LevelReader.java b/src/main/java/net/minecraft/world/level/LevelReader.java -index cc0d20e9f851268fe8403ac516f426ec1d008150..12eaafdbd324fa36b3f46c3b644bc8117a4123ad 100644 +index ced67cf88c91c5270a0060a7307f36739237cbb2..dab86988686cf7c926b7432b8a4afffd7a23327a 100644 --- a/src/main/java/net/minecraft/world/level/LevelReader.java +++ b/src/main/java/net/minecraft/world/level/LevelReader.java @@ -26,6 +26,15 @@ public interface LevelReader extends BlockAndTintGetter, CollisionGetter, Signal @@ -20526,10 +20521,10 @@ index eebaf98bc0fa4696af59b2a79563beb73501a554..645a1773237f2002c233ec1f3ff6f0ca } } 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 98b3909b536f11eda9c481ffd74066ad0cdb0ebc..0ec0be22f7292d57c40da6f1f4575bdebf8dbd09 100644 +index 0eaecd48f763d60e3bfe684fae1700c2ced78cc2..e8f8e1f2128df81705a88cee4b9a7760fb123750 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 -@@ -30,43 +30,31 @@ public class EntityStorage implements EntityPersistentStorage<Entity> { +@@ -30,45 +30,31 @@ public class EntityStorage implements EntityPersistentStorage<Entity> { private static final String ENTITIES_TAG = "Entities"; private static final String POSITION_TAG = "Position"; public final ServerLevel level; @@ -20550,43 +20545,45 @@ index 98b3909b536f11eda9c481ffd74066ad0cdb0ebc..0ec0be22f7292d57c40da6f1f4575bde @Override public CompletableFuture<ChunkEntities<Entity>> loadEntities(ChunkPos pos) { -- return this.emptyChunks.contains(pos.toLong()) ? CompletableFuture.completedFuture(emptyChunk(pos)) : this.worker.loadAsync(pos).thenApplyAsync((nbt) -> { -- if (nbt.isEmpty()) { -- this.emptyChunks.add(pos.toLong()); -- return emptyChunk(pos); -- } else { -- try { -- ChunkPos chunkPos2 = readChunkPos(nbt.get()); -- if (!Objects.equals(pos, chunkPos2)) { -- LOGGER.error("Chunk file at {} is in the wrong location. (Expected {}, got {})", pos, pos, chunkPos2); +- return this.emptyChunks.contains(pos.toLong()) +- ? CompletableFuture.completedFuture(emptyChunk(pos)) +- : this.worker.loadAsync(pos).thenApplyAsync(nbt -> { +- if (nbt.isEmpty()) { +- this.emptyChunks.add(pos.toLong()); +- return emptyChunk(pos); +- } else { +- try { +- ChunkPos chunkPos2 = readChunkPos(nbt.get()); +- if (!Objects.equals(pos, chunkPos2)) { +- LOGGER.error("Chunk file at {} is in the wrong location. (Expected {}, got {})", pos, pos, chunkPos2); +- } +- } catch (Exception var6) { +- LOGGER.warn("Failed to parse chunk {} position info", pos, var6); - } -- } catch (Exception var6) { -- LOGGER.warn("Failed to parse chunk {} position info", pos, var6); +- +- CompoundTag compoundTag = this.upgradeChunkTag(nbt.get()); +- ListTag listTag = compoundTag.getList("Entities", 10); +- List<Entity> list = EntityType.loadEntitiesRecursive(listTag, this.level).collect(ImmutableList.toImmutableList()); +- return new ChunkEntities<>(pos, list); - } -- -- CompoundTag compoundTag = this.upgradeChunkTag(nbt.get()); -- ListTag listTag = compoundTag.getList("Entities", 10); -- List<Entity> list = EntityType.loadEntitiesRecursive(listTag, this.level).collect(ImmutableList.toImmutableList()); -- return new ChunkEntities<>(pos, list); -- } -- }, this.entityDeserializerQueue::tell); +- }, this.entityDeserializerQueue::tell); + throw new UnsupportedOperationException(); // Paper - rewrite chunk system - copy out read logic into readEntities -+ } -+ + } + +- private static ChunkPos readChunkPos(CompoundTag chunkNbt) { + // Paper start - rewrite chunk system + public static List<Entity> readEntities(ServerLevel level, CompoundTag compoundTag) { + ListTag listTag = compoundTag.getList("Entities", 10); + List<Entity> list = EntityType.loadEntitiesRecursive(listTag, level).collect(ImmutableList.toImmutableList()); + return list; - } ++ } + // Paper end - rewrite chunk system - -- private static ChunkPos readChunkPos(CompoundTag chunkNbt) { ++ + public static ChunkPos readChunkPos(CompoundTag chunkNbt) { // Paper - public int[] is = chunkNbt.getIntArray("Position"); return new ChunkPos(is[0], is[1]); } -@@ -81,45 +69,75 @@ public class EntityStorage implements EntityPersistentStorage<Entity> { +@@ -83,43 +69,74 @@ public class EntityStorage implements EntityPersistentStorage<Entity> { @Override public void storeEntities(ChunkEntities<Entity> dataList) { @@ -20598,23 +20595,21 @@ index 98b3909b536f11eda9c481ffd74066ad0cdb0ebc..0ec0be22f7292d57c40da6f1f4575bde ChunkPos chunkPos = dataList.getPos(); if (dataList.isEmpty()) { if (this.emptyChunks.add(chunkPos.toLong())) { -- this.worker.store(chunkPos, (CompoundTag)null); +- this.worker.store(chunkPos, null); + // Paper - rewrite chunk system } - } else { - ListTag listTag = new ListTag(); -- dataList.getEntities().forEach((entity) -> { -- CompoundTag compoundTag = new CompoundTag(); -- if (entity.save(compoundTag)) { -- listTag.add(compoundTag); +- dataList.getEntities().forEach(entity -> { +- CompoundTag compoundTagx = new CompoundTag(); +- if (entity.save(compoundTagx)) { +- listTag.add(compoundTagx); - } -- - }); - CompoundTag compoundTag = NbtUtils.addCurrentDataVersion(new CompoundTag()); - compoundTag.put("Entities", listTag); - writeChunkPos(compoundTag, chunkPos); -- this.worker.store(chunkPos, compoundTag).exceptionally((ex) -> { +- this.worker.store(chunkPos, compoundTag).exceptionally(ex -> { - LOGGER.error("Failed to store chunk {}", chunkPos, ex); - return null; - }); @@ -20899,10 +20894,10 @@ index fa086a19f038b929f356292b2f657929765f7b6f..f1ecc3832da094400ed9d45bfc60af10 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 56f0e217276b01aed2f20a71f6849826285fc15b..54db563d80bbabd87a2be6f5ead92b482ac07b10 100644 +index 8c0e4a0e451d1e0ff8ff20fbe3a92bb20b8b4bda..05c71f8468a3ea075c45465515fd1f075d6ce313 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 -@@ -34,27 +34,28 @@ import net.minecraft.world.level.ChunkPos; +@@ -34,17 +34,17 @@ import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.LevelHeightAccessor; import org.slf4j.Logger; @@ -20922,7 +20917,11 @@ index 56f0e217276b01aed2f20a71f6849826285fc15b..54db563d80bbabd87a2be6f5ead92b48 + public final RegistryAccess registryAccess; // Paper - rewrite chunk system protected final LevelHeightAccessor levelHeightAccessor; - public SectionStorage(Path path, Function<Runnable, Codec<R>> codecFactory, Function<Runnable, R> factory, DataFixer dataFixer, DataFixTypes dataFixTypes, boolean dsync, RegistryAccess dynamicRegistryManager, LevelHeightAccessor world) { + public SectionStorage( +@@ -57,13 +57,14 @@ public class SectionStorage<R> implements AutoCloseable { + RegistryAccess dynamicRegistryManager, + LevelHeightAccessor world + ) { + super(path, dsync); // Paper - remove mojang I/O thread this.codec = codecFactory; this.factory = factory; @@ -20935,18 +20934,18 @@ index 56f0e217276b01aed2f20a71f6849826285fc15b..54db563d80bbabd87a2be6f5ead92b48 } protected void tick(BooleanSupplier shouldKeepTicking) { -@@ -116,23 +117,21 @@ public class SectionStorage<R> implements AutoCloseable { +@@ -124,23 +125,21 @@ public class SectionStorage<R> implements AutoCloseable { } private void readColumn(ChunkPos pos) { - Optional<CompoundTag> optional = this.tryRead(pos).join(); - RegistryOps<Tag> registryOps = RegistryOps.create(NbtOps.INSTANCE, this.registryAccess); -- this.readColumn(pos, registryOps, optional.orElse((CompoundTag)null)); +- this.readColumn(pos, registryOps, optional.orElse(null)); + throw new IllegalStateException("Only chunk system can load in state, offending class:" + this.getClass().getName()); // Paper - rewrite chunk system } private CompletableFuture<Optional<CompoundTag>> tryRead(ChunkPos pos) { -- return this.worker.loadAsync(pos).exceptionally((throwable) -> { +- return this.worker.loadAsync(pos).exceptionally(throwable -> { - if (throwable instanceof IOException iOException) { - LOGGER.error("Error reading chunk {} data from disk", pos, iOException); - return Optional.empty(); @@ -20966,18 +20965,18 @@ index 56f0e217276b01aed2f20a71f6849826285fc15b..54db563d80bbabd87a2be6f5ead92b48 private <T> void readColumn(ChunkPos pos, DynamicOps<T> ops, @Nullable T data) { + if (true) throw new IllegalStateException("Only chunk system can load in state, offending class:" + this.getClass().getName()); // Paper - rewrite chunk system if (data == null) { - for(int i = this.levelHeightAccessor.getMinSection(); i < this.levelHeightAccessor.getMaxSection(); ++i) { + for (int i = this.levelHeightAccessor.getMinSection(); i < this.levelHeightAccessor.getMaxSection(); i++) { this.storage.put(getKey(pos, i), Optional.empty()); -@@ -177,7 +176,7 @@ public class SectionStorage<R> implements AutoCloseable { +@@ -183,7 +182,7 @@ public class SectionStorage<R> implements AutoCloseable { Dynamic<Tag> dynamic = this.writeColumn(pos, registryOps); Tag tag = dynamic.getValue(); if (tag instanceof CompoundTag) { - this.worker.store(pos, (CompoundTag)tag); + try { this.write(pos, (CompoundTag)tag); } catch (IOException ioexception) { SectionStorage.LOGGER.error("Error writing data to disk", ioexception); } // Paper - nuke IOWorker } else { - LOGGER.error("Expected compound tag, got {}", (Object)tag); + LOGGER.error("Expected compound tag, got {}", tag); } -@@ -222,7 +221,7 @@ public class SectionStorage<R> implements AutoCloseable { +@@ -237,7 +236,7 @@ public class SectionStorage<R> implements AutoCloseable { } private static int getVersion(Dynamic<?> dynamic) { @@ -20986,7 +20985,7 @@ index 56f0e217276b01aed2f20a71f6849826285fc15b..54db563d80bbabd87a2be6f5ead92b48 } public void flush(ChunkPos pos) { -@@ -240,6 +239,9 @@ public class SectionStorage<R> implements AutoCloseable { +@@ -254,6 +253,9 @@ public class SectionStorage<R> implements AutoCloseable { @Override public void close() throws IOException { @@ -20998,10 +20997,10 @@ index 56f0e217276b01aed2f20a71f6849826285fc15b..54db563d80bbabd87a2be6f5ead92b48 + // Paper - rewrite chunk system } diff --git a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java -index 2830d32bba3dc85847e3a5d9b4d98f822e34b606..4cdfc433df67afcd455422e9baf56f167dd712ae 100644 +index 74a285b8b018a9c94ccea519f1ce8b9e2ef3cb64..83a39f900551e39d5af6f17a339a386ddee4feef 100644 --- a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java +++ b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java -@@ -8,54 +8,42 @@ import javax.annotation.Nullable; +@@ -9,52 +9,41 @@ import javax.annotation.Nullable; import net.minecraft.world.entity.Entity; public class EntityTickList { @@ -21015,7 +21014,7 @@ index 2830d32bba3dc85847e3a5d9b4d98f822e34b606..4cdfc433df67afcd455422e9baf56f16 - if (this.iterated == this.active) { - this.passive.clear(); - -- for(Int2ObjectMap.Entry<Entity> entry : Int2ObjectMaps.fastIterable(this.active)) { +- for (Entry<Entity> entry : Int2ObjectMaps.fastIterable(this.active)) { - this.passive.put(entry.getIntKey(), entry.getValue()); - } - @@ -21024,7 +21023,6 @@ index 2830d32bba3dc85847e3a5d9b4d98f822e34b606..4cdfc433df67afcd455422e9baf56f16 - this.passive = int2ObjectMap; - } + // Paper - replace with better logic, do not delay removals - } public void add(Entity entity) { @@ -21053,7 +21051,7 @@ index 2830d32bba3dc85847e3a5d9b4d98f822e34b606..4cdfc433df67afcd455422e9baf56f16 - this.iterated = this.active; - - try { -- for(Entity entity : this.active.values()) { +- for (Entity entity : this.active.values()) { - action.accept(entity); - } - } finally { @@ -21067,7 +21065,6 @@ index 2830d32bba3dc85847e3a5d9b4d98f822e34b606..4cdfc433df67afcd455422e9baf56f16 + while (iterator.hasNext()) { + action.accept(iterator.next()); } -- + } finally { + iterator.finishedIterating(); } @@ -21097,10 +21094,10 @@ index 54308f1decc3982f30bf8b7a8a9d8865bfdbb9fd..902156477bdfc9917105f1229f760c26 while (iterator.hasNext()) { 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 1ca00340aaa201dd34e5c350d23ef53e126a0ca6..16356d7f388561300e794a52f3f263b8e7d9b880 100644 +index 4303dc2366275dfab3901af4e522113f9a84ce4a..f6af4f61775eee7932e96fc600423ff59040d50d 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 -@@ -50,8 +50,101 @@ public class StructureCheck { +@@ -49,8 +49,101 @@ public class StructureCheck { private final BiomeSource biomeSource; private final long seed; private final DataFixer fixerUpper; @@ -21202,9 +21199,9 @@ index 1ca00340aaa201dd34e5c350d23ef53e126a0ca6..16356d7f388561300e794a52f3f263b8 + } + // Paper end - rewrite chunk system - synchronise this class - public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureTemplateManager structureTemplateManager, ResourceKey<net.minecraft.world.level.dimension.LevelStem> worldKey, ChunkGenerator chunkGenerator, RandomState noiseConfig, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { // Paper - fix missing CB diff - this.storageAccess = chunkIoWorker; -@@ -70,7 +163,7 @@ public class StructureCheck { + public StructureCheck( + ChunkScanAccess chunkIoWorker, +@@ -80,7 +173,7 @@ public class StructureCheck { public StructureCheckResult checkStart(ChunkPos pos, Structure type, boolean skipReferencedStructures) { long l = pos.toLong(); @@ -21213,25 +21210,25 @@ index 1ca00340aaa201dd34e5c350d23ef53e126a0ca6..16356d7f388561300e794a52f3f263b8 if (object2IntMap != null) { return this.checkStructureInfo(object2IntMap, type, skipReferencedStructures); } else { -@@ -78,9 +171,9 @@ public class StructureCheck { +@@ -88,9 +181,9 @@ public class StructureCheck { if (structureCheckResult != null) { return structureCheckResult; } else { -- boolean bl = this.featureChecks.computeIfAbsent(type, (structure2) -> { +- boolean bl = this.featureChecks.computeIfAbsent(type, structure2 -> { - return new Long2BooleanOpenHashMap(); -- }).computeIfAbsent(l, (chunkPos) -> { -+ boolean bl = this.featureChecksSafe.computeIfAbsent(type, (structure2) -> { // Paper - rewrite chunk system - synchronise this class +- }).computeIfAbsent(l, chunkPos -> { ++ boolean bl = this.featureChecksSafe.computeIfAbsent(type, structure2 -> { // Paper - rewrite chunk system - synchronise this class + return new SynchronisedLong2BooleanMap(PER_FEATURE_CHECK_LIMIT); // Paper - rewrite chunk system - synchronise this class -+ }).getOrCompute(l, (chunkPos) -> { // Paper - rewrite chunk system - synchronise this class ++ }).getOrCompute(l, chunkPos -> { // Paper - rewrite chunk system - synchronise this class return this.canCreateStructure(pos, type); }); return !bl ? StructureCheckResult.START_NOT_PRESENT : StructureCheckResult.CHUNK_LOAD_NEEDED; -@@ -193,17 +286,26 @@ public class StructureCheck { +@@ -218,17 +311,26 @@ public class StructureCheck { } private void storeFullResults(long pos, Object2IntMap<Structure> referencesByStructure) { - this.loadedChunks.put(pos, deduplicateEmptyMap(referencesByStructure)); -- this.featureChecks.values().forEach((generationPossibilityByChunkPos) -> { +- this.featureChecks.values().forEach(generationPossibilityByChunkPos -> { - generationPossibilityByChunkPos.remove(pos); - }); + // Paper start - rewrite chunk system - synchronise this class @@ -21260,10 +21257,10 @@ index 1ca00340aaa201dd34e5c350d23ef53e126a0ca6..16356d7f388561300e794a52f3f263b8 referencesByStructure.computeInt(structure, (feature, references) -> { return references == null ? 1 : references + 1; diff --git a/src/main/java/net/minecraft/world/ticks/LevelChunkTicks.java b/src/main/java/net/minecraft/world/ticks/LevelChunkTicks.java -index 9f6c2e5b5d9e8d714a47c770e255d06c0ef7c190..ac807277a6b26d140ea9873d17c7aa4fb5fe37b2 100644 +index 47c2b2da9799690291396effb9e1b06d71efc6fd..2cdd18f724296f10cd4a522d1e8196723d39cf45 100644 --- a/src/main/java/net/minecraft/world/ticks/LevelChunkTicks.java +++ b/src/main/java/net/minecraft/world/ticks/LevelChunkTicks.java -@@ -25,6 +25,19 @@ public class LevelChunkTicks<T> implements SerializableTickContainer<T>, TickCon +@@ -26,6 +26,19 @@ public class LevelChunkTicks<T> implements SerializableTickContainer<T>, TickCon @Nullable private BiConsumer<LevelChunkTicks<T>, ScheduledTick<T>> onTickAdded; @@ -21298,9 +21295,9 @@ index 9f6c2e5b5d9e8d714a47c770e255d06c0ef7c190..ac807277a6b26d140ea9873d17c7aa4f + this.dirty = true; // Paper - add dirty flag this.scheduleUnchecked(orderedTick); } - -@@ -83,7 +98,7 @@ public class LevelChunkTicks<T> implements SerializableTickContainer<T>, TickCon - while(iterator.hasNext()) { + } +@@ -81,7 +96,7 @@ public class LevelChunkTicks<T> implements SerializableTickContainer<T>, TickCon + while (iterator.hasNext()) { ScheduledTick<T> scheduledTick = iterator.next(); if (predicate.test(scheduledTick)) { - iterator.remove(); @@ -21308,15 +21305,15 @@ index 9f6c2e5b5d9e8d714a47c770e255d06c0ef7c190..ac807277a6b26d140ea9873d17c7aa4f this.ticksPerPosition.remove(scheduledTick); } } -@@ -101,6 +116,7 @@ public class LevelChunkTicks<T> implements SerializableTickContainer<T>, TickCon +@@ -98,6 +113,7 @@ public class LevelChunkTicks<T> implements SerializableTickContainer<T>, TickCon @Override public ListTag save(long l, Function<T, String> function) { + this.lastSaved = l; // Paper - add dirty system to level ticks ListTag listTag = new ListTag(); if (this.pendingTicks != null) { - for(SavedTick<T> savedTick : this.pendingTicks) { -@@ -117,6 +133,11 @@ public class LevelChunkTicks<T> implements SerializableTickContainer<T>, TickCon + for (SavedTick<T> savedTick : this.pendingTicks) { +@@ -114,6 +130,11 @@ public class LevelChunkTicks<T> implements SerializableTickContainer<T>, TickCon public void unpack(long time) { if (this.pendingTicks != null) { @@ -21327,7 +21324,7 @@ index 9f6c2e5b5d9e8d714a47c770e255d06c0ef7c190..ac807277a6b26d140ea9873d17c7aa4f + // Paper end - add dirty system to level chunk ticks int i = -this.pendingTicks.size(); - for(SavedTick<T> savedTick : this.pendingTicks) { + for (SavedTick<T> savedTick : this.pendingTicks) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index 260ca4a9c170567b27488466f802c91212997f91..e47b00912fc76e9639f9c51d96e6d39da3c963e3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java diff --git a/patches/server/0981-incremental-chunk-and-player-saving.patch b/patches/server/0981-incremental-chunk-and-player-saving.patch index 7f2209d3c1..ee962a9466 100644 --- a/patches/server/0981-incremental-chunk-and-player-saving.patch +++ b/patches/server/0981-incremental-chunk-and-player-saving.patch @@ -118,7 +118,7 @@ index a3881964bad0cab8f480eda634216d73dfbf7bb0..b6407dd3e5b87782503988f898bbf054 // Paper start - rewrite chunk system - add close param this.save(progressListener, flush, savingDisabled, false); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 5657f1ecbadda96a79978f918393c0c9a58dca83..910c5087406837033e580ec2a23f5d30d807b723 100644 +index 18356db5d998dccb9e645a9ee0bebc5cbbfa5f7a..4a62c2937460dca9d938c40da47529e106503cad 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -191,6 +191,7 @@ import org.bukkit.inventory.MainHand; diff --git a/patches/server/0982-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch b/patches/server/0982-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch index d1ad0bf59f..ed273d35cb 100644 --- a/patches/server/0982-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch +++ b/patches/server/0982-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch @@ -12,11 +12,11 @@ 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 369b54b96c682717ef93d05312714b4d30efaceb..beadef19ee136c27601f0d116a86967344c2e403 100644 +index 5d996ece22d893818cda7c521725b2fd199759ff..9003ca5e317145728cd290710bc426adc574ac13 100644 --- a/src/main/java/net/minecraft/core/Vec3i.java +++ b/src/main/java/net/minecraft/core/Vec3i.java -@@ -31,6 +31,12 @@ public class Vec3i implements Comparable<Vec3i> { - }); +@@ -36,6 +36,12 @@ public class Vec3i implements Comparable<Vec3i> { + ); } + // Paper start @@ -54,10 +54,10 @@ index 3e5addb60ae8f466dad09edb3ae1fc88fe2681e9..5e8d2e4245757a0889645ea79ee68afb public abstract BlockState setBlockState(BlockPos pos, BlockState state, boolean moved); 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 60e760b42dd6471a229dfd45490dcf8c51979d35..4a3ac7dedf5cb1e76f16ec4f18e82afc717d0ced 100644 +index 030fafe3b0bcad9e95251f5824ac2ef58640c705..b4e05ce176dfc6a2e66b294ed461c32020adf203 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -@@ -91,6 +91,12 @@ public class ImposterProtoChunk extends ProtoChunk { +@@ -97,6 +97,12 @@ public class ImposterProtoChunk extends ProtoChunk { public BlockState getBlockState(BlockPos pos) { return this.wrapped.getBlockState(pos); } @@ -71,10 +71,10 @@ index 60e760b42dd6471a229dfd45490dcf8c51979d35..4a3ac7dedf5cb1e76f16ec4f18e82afc @Override public FluidState getFluidState(BlockPos pos) { 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 7da1ed9640211b0e064162dcdb0000538e7b30f3..7aa585875dad5296526bb5d67fc5ea0f8875e452 100644 +index b4cf3d1405b79fb419be5116484f19dc76187b4a..34343246f2d5ce082cd4a342249f4f189255b629 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -86,14 +86,18 @@ public class ProtoChunk extends ChunkAccess { +@@ -95,14 +95,18 @@ public class ProtoChunk extends ChunkAccess { @Override public BlockState getBlockState(BlockPos pos) { diff --git a/patches/server/0984-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch b/patches/server/0984-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch index 9b7e64077b..46e1b7e745 100644 --- a/patches/server/0984-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch +++ b/patches/server/0984-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch @@ -26,7 +26,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 7f5457522835b073246054e66699fe73f7005b25..3f3498e0a24ad8b890173ce71cd63c1fffb561df 100644 +index 40e21effc948b02874a6ed1d1c340c4dc87579d6..aa261d3ad04bc3a19b3200214214650d9a9ac2af 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3746,7 +3746,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0988-Flat-bedrock-generator-settings.patch b/patches/server/0988-Flat-bedrock-generator-settings.patch index 7e54f34f22..d1bbbdf7ef 100644 --- a/patches/server/0988-Flat-bedrock-generator-settings.patch +++ b/patches/server/0988-Flat-bedrock-generator-settings.patch @@ -168,16 +168,17 @@ index b99283c31193e2110f6e3f39c23dbfc2442bab2b..a34e53249668d917c9d77c6837b91360 + // Paper end - Flat bedrock generator settings } 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 a745458ea3581ea91a68c863e3fd0a0292d73a61..6fcb84e4d2cd310bd1e04f4cf7b9bc2bbbf4fdad 100644 +index 390bcf9c302effd9db42d7a0e65b5433cc2eadd6..b9e919d31e442f49300744395af3cf9431e86c57 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 -@@ -21,8 +21,8 @@ public class CarvingContext extends WorldGenerationContext { - private final RandomState randomState; - private final SurfaceRules.RuleSource surfaceRule; - -- public CarvingContext(NoiseBasedChunkGenerator noiseChunkGenerator, RegistryAccess registryManager, LevelHeightAccessor heightLimitView, NoiseChunk chunkNoiseSampler, RandomState noiseConfig, SurfaceRules.RuleSource materialRule) { +@@ -27,9 +27,9 @@ public class CarvingContext extends WorldGenerationContext { + LevelHeightAccessor heightLimitView, + NoiseChunk chunkNoiseSampler, + RandomState noiseConfig, +- SurfaceRules.RuleSource materialRule ++ SurfaceRules.RuleSource materialRule, @javax.annotation.Nullable net.minecraft.world.level.Level level // Paper - Flat bedrock generator settings + ) { - super(noiseChunkGenerator, heightLimitView); -+ public CarvingContext(NoiseBasedChunkGenerator noiseChunkGenerator, RegistryAccess registryManager, LevelHeightAccessor heightLimitView, NoiseChunk chunkNoiseSampler, RandomState noiseConfig, SurfaceRules.RuleSource materialRule, @javax.annotation.Nullable net.minecraft.world.level.Level level) { // Paper - Flat bedrock generator settings + super(noiseChunkGenerator, heightLimitView, level); // Paper - Flat bedrock generator settings this.registryAccess = registryManager; this.noiseChunk = chunkNoiseSampler; diff --git a/patches/server/0989-Entity-Activation-Range-2.0.patch b/patches/server/0989-Entity-Activation-Range-2.0.patch index c26295b371..89ff4e2c84 100644 --- a/patches/server/0989-Entity-Activation-Range-2.0.patch +++ b/patches/server/0989-Entity-Activation-Range-2.0.patch @@ -183,10 +183,10 @@ index d6393210cfee53685f83c8491bea8b9c13b01eea..3d95257d2203fe40bb1fab58ad2a1f9e 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 07c1ca01c38d5d7d0a95ad5004b5df9f4a222935..e5995d0db5dcfba59a873ff439601894fdacd556 100644 +index 05142a6c332b8f2257199fee9db57d3d92f6bff2..b236ac6e261790b53944885d0d6575eba0986fde 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 { +@@ -34,6 +34,7 @@ public class GoalSelector { private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class); private int tickCount; private int newGoalRate = 3; @@ -194,7 +194,7 @@ index 07c1ca01c38d5d7d0a95ad5004b5df9f4a222935..e5995d0db5dcfba59a873ff439601894 public GoalSelector(Supplier<ProfilerFiller> profiler) { this.profiler = profiler; -@@ -49,6 +50,20 @@ public class GoalSelector { +@@ -50,6 +51,20 @@ public class GoalSelector { }); } @@ -213,10 +213,10 @@ index 07c1ca01c38d5d7d0a95ad5004b5df9f4a222935..e5995d0db5dcfba59a873ff439601894 + } + // Paper end public void removeGoal(Goal goal) { - this.availableGoals.stream().filter((wrappedGoal) -> { + 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 9fc374c17f6b3ee4ab3c582d05e96321b772f2d6..07519c817cc6de04a98198c43a0c2b02ba3141eb 100644 +index 6d8ea05e5e86e9f6359b560043bb55a10784e952..aee0147649d458b87d92496eda0c1723ebe570d2 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 @@ -23,6 +23,14 @@ public abstract class MoveToBlockGoal extends Goal { @@ -234,7 +234,7 @@ index 9fc374c17f6b3ee4ab3c582d05e96321b772f2d6..07519c817cc6de04a98198c43a0c2b02 public MoveToBlockGoal(PathfinderMob mob, double speed, int range, int maxYDifference) { this.mob = mob; -@@ -114,6 +122,7 @@ public abstract class MoveToBlockGoal extends Goal { +@@ -115,6 +123,7 @@ public abstract class MoveToBlockGoal extends Goal { mutableBlockPos.setWithOffset(blockPos, m, k - 1, n); if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) { this.blockPos = mutableBlockPos; @@ -302,7 +302,7 @@ index fa2569fecefb3e3af3264928a3c7a347710deedf..24044795d8e0f1fb15a4f2f5401f4489 super.customServerAiStep(); } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java -index b149e8bcac034bb3fc118a9adcb0de45e18ed5e9..fc35cfc9d045f3e5b6a50af1d0ba83b6e322091f 100644 +index eaafb57c14ead01ffd2650fdec9ca75406201e41..761142374f793a1cd4228936b21a68d7a0458894 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java @@ -52,6 +52,7 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper @@ -310,23 +310,24 @@ index b149e8bcac034bb3fc118a9adcb0de45e18ed5e9..fc35cfc9d045f3e5b6a50af1d0ba83b6 this.setEnabled(bl); } + this.immunize(); // Paper - } -@@ -89,10 +90,12 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper + public boolean isEnabled() { +@@ -87,11 +88,13 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper public boolean suckInItems() { if (HopperBlockEntity.suckInItems(this.level(), this)) { + this.immunize(); // Paper return true; } else { - for(ItemEntity itemEntity : this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.25D, 0.0D, 0.25D), EntitySelector.ENTITY_STILL_ALIVE)) { + for (ItemEntity itemEntity : this.level() + .getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.25, 0.0, 0.25), EntitySelector.ENTITY_STILL_ALIVE)) { if (HopperBlockEntity.addItem(this, itemEntity)) { + this.immunize(); // Paper return true; } } -@@ -122,4 +125,11 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper +@@ -121,4 +124,11 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) { return new HopperMenu(syncId, playerInventory, this); } @@ -356,10 +357,10 @@ index 5c209e323a5559480231c6d99357ba8b89edb027..4bedd5801cc8ce14387f02dfb361a00a public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot // Paper start - add paper world config diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -index b1061db1d9b3bfde61d5016e10556c4320095827..c71690dbc3dc52803945f1608f0ee3ba94146354 100644 +index 8a5fccf52230eae9777a0157cc25c1321fcf094c..fc6bf624f63beb61737460d5e2ffb70a824b565b 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -@@ -143,6 +143,10 @@ public class PistonMovingBlockEntity extends BlockEntity { +@@ -149,6 +149,10 @@ public class PistonMovingBlockEntity extends BlockEntity { } entity.setDeltaMovement(e, g, h); diff --git a/patches/server/0990-Optional-per-player-mob-spawns.patch b/patches/server/0990-Optional-per-player-mob-spawns.patch index b80d633556..dc4d88d053 100644 --- a/patches/server/0990-Optional-per-player-mob-spawns.patch +++ b/patches/server/0990-Optional-per-player-mob-spawns.patch @@ -64,7 +64,7 @@ index 20cdfd2bbd5dc71fd37ccedaf3a8d06b45553c9b..059ab637adf1be576fa1fff36a91b6c5 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 910c5087406837033e580ec2a23f5d30d807b723..651aceca9030e1f6060af9fc9f8d349dc0451728 100644 +index 4a62c2937460dca9d938c40da47529e106503cad..7fb2c0f2576142423cd0e50b811ce4f55795e43d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -256,6 +256,10 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0991-Anti-Xray.patch b/patches/server/0991-Anti-Xray.patch index 584b0a7774..e314f559e8 100644 --- a/patches/server/0991-Anti-Xray.patch +++ b/patches/server/0991-Anti-Xray.patch @@ -1001,7 +1001,7 @@ index 0000000000000000000000000000000000000000..80a2dfb266ae1221680a7b24fee2f7e2 + } +} diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java -index 6cff1a98dc7cf33947ec760dbc3d3d0ec5db5f6c..51f647de153255c919b1440338cf1b3e2d6b5dbf 100644 +index 51b01a1d4f3a33f9c321349051b038acc9786b9c..76114aa1369539855ccebd4361218693f8975821 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java @@ -63,8 +63,10 @@ public record ClientboundChunksBiomesPacket(List<ClientboundChunksBiomesPacket.C @@ -1009,15 +1009,15 @@ index 6cff1a98dc7cf33947ec760dbc3d3d0ec5db5f6c..51f647de153255c919b1440338cf1b3e public static void extractChunkData(FriendlyByteBuf buf, LevelChunk chunk) { + int chunkSectionIndex = 0; // Paper - Anti-Xray - for(LevelChunkSection levelChunkSection : chunk.getSections()) { + for (LevelChunkSection levelChunkSection : chunk.getSections()) { - levelChunkSection.getBiomes().write(buf); + levelChunkSection.getBiomes().write(buf, null, chunkSectionIndex); // Paper - Anti-Xray + chunkSectionIndex++; // Paper - Anti-Xray } - } + diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java -index 89e3163b0301f8414c9400a6e00cdd85841fe2e8..74b5cec09d953a247bc5aba3c4232a4c28ea1046 100644 +index ebd7b78f9d3439f8278846c32ee3317ad9f1e6ad..9c51c4d12bac588002f530f484ee89b094269349 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java @@ -25,7 +25,10 @@ public class ClientboundLevelChunkPacketData { @@ -1031,7 +1031,7 @@ index 89e3163b0301f8414c9400a6e00cdd85841fe2e8..74b5cec09d953a247bc5aba3c4232a4c + // Paper end this.heightmaps = new CompoundTag(); - for(Map.Entry<Heightmap.Types, Heightmap> entry : chunk.getHeightmaps()) { + for (Entry<Heightmap.Types, Heightmap> entry : chunk.getHeightmaps()) { @@ -35,7 +38,14 @@ public class ClientboundLevelChunkPacketData { } @@ -1047,8 +1047,8 @@ index 89e3163b0301f8414c9400a6e00cdd85841fe2e8..74b5cec09d953a247bc5aba3c4232a4c + // Paper end this.blockEntitiesData = Lists.newArrayList(); - for(Map.Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) { -@@ -85,9 +95,15 @@ public class ClientboundLevelChunkPacketData { + for (Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) { +@@ -84,9 +94,15 @@ public class ClientboundLevelChunkPacketData { return byteBuf; } @@ -1058,14 +1058,14 @@ index 89e3163b0301f8414c9400a6e00cdd85841fe2e8..74b5cec09d953a247bc5aba3c4232a4c + public static void extractChunkData(FriendlyByteBuf buf, LevelChunk chunk, com.destroystokyo.paper.antixray.ChunkPacketInfo<net.minecraft.world.level.block.state.BlockState> chunkPacketInfo) { + int chunkSectionIndex = 0; + - for(LevelChunkSection levelChunkSection : chunk.getSections()) { + for (LevelChunkSection levelChunkSection : chunk.getSections()) { - levelChunkSection.write(buf); + levelChunkSection.write(buf, chunkPacketInfo, chunkSectionIndex); + chunkSectionIndex++; + // Paper end } - } + diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java index 26e46d751c8f8162c2bafe2fc109fc91dc4b7c0f..6412dff5ed0505f62dd5b71ab9606257858a7317 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java @@ -1139,17 +1139,17 @@ index 5063eb6d4a24600262c32d2c9eb5fb5bf8fa354e..692a01b52a71e26887ee42cbd5fd64b0 public void destroyAndAck(BlockPos pos, int sequence, String reason) { diff --git a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -index f3b96a921e7d085b51da62fa5493384a7ded1f9d..12f2bf95d3ea3d29f6b4b9ec38a92f7102daa4a1 100644 +index cc56479a54ccbb80e352c3e876e306647807c551..eddff7cf4bc7d0a491994fd0a20a6509dc2b6efc 100644 --- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java +++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -@@ -88,7 +88,10 @@ public class PlayerChunkSender { +@@ -87,7 +87,10 @@ public class PlayerChunkSender { public static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { // Paper - rewrite chunk loader - public handler.player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(chunk.getPos().toLong()).addPlayer(handler.player); -- handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null)); +- handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null)); + // Paper start - Anti-Xray + final boolean shouldModify = world.chunkPacketBlockController.shouldModify(handler.player, chunk); -+ handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null, shouldModify)); ++ handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null, shouldModify)); + // Paper end - Anti-Xray // Paper start - PlayerChunkLoadEvent if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) { @@ -1280,7 +1280,7 @@ index b606e33f8b64eaba28c008cc353d88aa45549e31..8852263cb6faec1b68326145aa30e5cd 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 dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224588f852f 100644 +index a6a8fbe2d6d538a0fea8a202ec8fdbecc009d664..5418261725f7a0dc9a0e8295fe511f69b558a6cd 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java @@ -30,6 +30,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -1309,19 +1309,25 @@ index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224 public static <T> Codec<PalettedContainerRO<T>> codecRO(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) { PalettedContainerRO.Unpacker<T, PalettedContainerRO<T>> unpacker = (idListx, paletteProviderx, serialized) -> { -- return unpack(idListx, paletteProviderx, serialized).map((result) -> { -+ return unpack(idListx, paletteProviderx, serialized, defaultValue, null).map((result) -> { // Paper - Anti-Xray - Add preset values - return result; +- return unpack(idListx, paletteProviderx, serialized).map(result -> { ++ return unpack(idListx, paletteProviderx, serialized, defaultValue, null).map(result -> { // Paper - Anti-Xray - Add preset values + return (PalettedContainerRO<T>)result; }); }; -@@ -66,19 +72,52 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer - }); +@@ -78,25 +84,58 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer + }); } -- public PalettedContainer(IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainer.Configuration<T> dataProvider, BitStorage storage, List<T> paletteEntries) { + // Paper start - Anti-Xray - Add preset values + @Deprecated @io.papermc.paper.annotation.DoNotUse public PalettedContainer(IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainer.Configuration<T> dataProvider, BitStorage storage, List<T> paletteEntries) { this(idList, paletteProvider, dataProvider, storage, paletteEntries, null, null); } -+ public PalettedContainer(IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainer.Configuration<T> dataProvider, BitStorage storage, List<T> paletteEntries, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues) { + public PalettedContainer( + IdMap<T> idList, + PalettedContainer.Strategy paletteProvider, + PalettedContainer.Configuration<T> dataProvider, + BitStorage storage, +- List<T> paletteEntries ++ List<T> paletteEntries, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues + ) { + this.presetValues = presetValues; this.registry = idList; this.strategy = paletteProvider; @@ -1369,8 +1375,8 @@ index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224 + // Paper end this.strategy = paletteProvider; this.registry = idList; - this.data = this.createOrReuseData((PalettedContainer.Data<T>)null, 0); -@@ -93,11 +132,33 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer + this.data = this.createOrReuseData(null, 0); +@@ -113,11 +152,33 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @Override public synchronized int onResize(int newBits, T object) { // Paper - synchronize PalettedContainer.Data<T> data = this.data; @@ -1405,7 +1411,7 @@ index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224 public T getAndSet(int x, int y, int z, T value) { this.acquire(); -@@ -167,25 +228,34 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer +@@ -186,24 +247,33 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer data.palette.read(buf); buf.readLongArray(data.storage.getRaw()); this.data = data; @@ -1413,7 +1419,6 @@ index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224 } finally { this.release(); } - } + // Paper start - Anti-Xray; Add chunk packet info @@ -1435,15 +1440,15 @@ index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224 } finally { this.release(); } - } -- private static <T> DataResult<PalettedContainer<T>> unpack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData<T> serialized) { -+ private static <T> DataResult<PalettedContainer<T>> unpack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData<T> serialized, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues) { // Paper - Anti-Xray - Add preset values + private static <T> DataResult<PalettedContainer<T>> unpack( +- IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData<T> serialized ++ IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData<T> serialized, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues // Paper - Anti-Xray - Add preset values + ) { List<T> list = serialized.paletteEntries(); int i = paletteProvider.size(); - int j = paletteProvider.calculateBitsForSerialization(idList, list.size()); -@@ -225,7 +295,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer +@@ -244,7 +314,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer } } @@ -1452,7 +1457,7 @@ index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224 } @Override -@@ -285,12 +355,12 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer +@@ -303,12 +373,12 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer } public PalettedContainer<T> copy() { @@ -1467,7 +1472,7 @@ index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224 } @Override -@@ -334,9 +404,18 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer +@@ -351,9 +421,18 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer return 1 + this.palette.getSerializedSize() + VarInt.getByteSize(this.storage.getRaw().length) + this.storage.getRaw().length * 8; } diff --git a/patches/server/0992-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch b/patches/server/0992-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch index c9e2fc6398..05c9814be3 100644 --- a/patches/server/0992-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch +++ b/patches/server/0992-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch @@ -60,7 +60,7 @@ index 059ab637adf1be576fa1fff36a91b6c5f1b5f035..5afbb5b307cc67d86dd916dc8f7521d5 spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, null, true); } else { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 651aceca9030e1f6060af9fc9f8d349dc0451728..acc9858e0cf10cb2aae0554037096411a208bd05 100644 +index 7fb2c0f2576142423cd0e50b811ce4f55795e43d..acc1751324f040accc4fc18914ed281e572358eb 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -260,6 +260,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0993-Optimize-Collision-to-not-load-chunks.patch b/patches/server/0993-Optimize-Collision-to-not-load-chunks.patch index b992c3fadf..0ade44ccc3 100644 --- a/patches/server/0993-Optimize-Collision-to-not-load-chunks.patch +++ b/patches/server/0993-Optimize-Collision-to-not-load-chunks.patch @@ -26,7 +26,7 @@ index 461c27292af06a5150de8ec263d0c8527e8c5278..37245ff682837e7e8c9647f4afe30f0d // CraftBukkit end 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 703b32362cf6a23dfe9326aa4e0ee74511e0d2cb..8531304667a85436fd557d319fe36a37b3661ae5 100644 +index e6ba58cf8aef66bacdff8bf538c73b14e16fbea5..5cc7043d2783d38f9d3a28d0cb62f8834e971e1e 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -242,6 +242,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -38,30 +38,51 @@ index 703b32362cf6a23dfe9326aa4e0ee74511e0d2cb..8531304667a85436fd557d319fe36a37 public @org.jetbrains.annotations.Nullable net.minecraft.server.level.ChunkMap.TrackedEntity tracker; // Paper diff --git a/src/main/java/net/minecraft/world/level/BlockCollisions.java b/src/main/java/net/minecraft/world/level/BlockCollisions.java -index f2c423154ed6a00882a46d93b69ed4f6ba73782c..a3eaf80b020c3bbc0306c5d17659ee661dfd275b 100644 +index 1c10835b59aaefa3a65ff64f784620bdc54ddcdc..354290f88af285af229e4315e53e9bd76439d0da 100644 --- a/src/main/java/net/minecraft/world/level/BlockCollisions.java +++ b/src/main/java/net/minecraft/world/level/BlockCollisions.java -@@ -65,22 +65,41 @@ public class BlockCollisions<T> extends AbstractIterator<T> { +@@ -65,35 +65,64 @@ public class BlockCollisions<T> extends AbstractIterator<T> { + + @Override protected T computeNext() { - while(true) { - if (this.cursor.advance()) { -- int i = this.cursor.nextX(); -- int j = this.cursor.nextY(); -- int k = this.cursor.nextZ(); +- while (this.cursor.advance()) { +- int i = this.cursor.nextX(); +- int j = this.cursor.nextY(); +- int k = this.cursor.nextZ(); +- int l = this.cursor.getNextType(); +- if (l != 3) { +- BlockGetter blockGetter = this.getChunk(i, k); +- if (blockGetter != null) { +- this.pos.set(i, j, k); +- BlockState blockState = blockGetter.getBlockState(this.pos); +- if ((!this.onlySuffocatingBlocks || blockState.isSuffocating(blockGetter, this.pos)) +- && (l != 1 || blockState.hasLargeCollisionShape()) +- && (l != 2 || blockState.is(Blocks.MOVING_PISTON))) { +- VoxelShape voxelShape = blockState.getCollisionShape(this.collisionGetter, this.pos, this.context); +- if (voxelShape == Shapes.block()) { +- if (this.box.intersects((double)i, (double)j, (double)k, (double)i + 1.0, (double)j + 1.0, (double)k + 1.0)) { +- return this.resultProvider.apply(this.pos, voxelShape.move((double)i, (double)j, (double)k)); +- } +- } else { +- VoxelShape voxelShape2 = voxelShape.move((double)i, (double)j, (double)k); +- if (!voxelShape2.isEmpty() && Shapes.joinIsNotEmpty(voxelShape2, this.entityShape, BooleanOp.AND)) { +- return this.resultProvider.apply(this.pos, voxelShape2); +- } +- } ++ while(true) { ++ if (this.cursor.advance()) { + int i = this.cursor.nextX(); final int x = i; // Paper + int j = this.cursor.nextY(); final int y = j; // Paper + int k = this.cursor.nextZ(); final int z = k; // Paper - int l = this.cursor.getNextType(); - if (l == 3) { - continue; - } ++ int l = this.cursor.getNextType(); ++ if (l == 3) { ++ continue; ++ } + // Paper start - ensure we don't load chunks + final @Nullable Entity source = this.context instanceof net.minecraft.world.phys.shapes.EntityCollisionContext entityContext ? entityContext.getEntity() : null; + boolean far = source != null && io.papermc.paper.util.MCUtil.distanceSq(source.getX(), y, source.getZ(), x, y, z) > 14; + this.pos.set(x, y, z); - -- BlockGetter blockGetter = this.getChunk(i, k); -- if (blockGetter == null) { ++ + BlockState blockState; + if (this.collisionGetter instanceof net.minecraft.server.level.WorldGenRegion) { + BlockGetter blockGetter = this.getChunk(x, z); @@ -80,19 +101,39 @@ index f2c423154ed6a00882a46d93b69ed4f6ba73782c..a3eaf80b020c3bbc0306c5d17659ee66 + return this.resultProvider.apply(new BlockPos.MutableBlockPos(x, y, z), Shapes.create(far ? source.getBoundingBox() : new AABB(new BlockPos(x, y, z)))); + } + // Paper end - continue; - } - -- this.pos.set(i, j, k); -- BlockState blockState = blockGetter.getBlockState(this.pos); -- if (this.onlySuffocatingBlocks && !blockState.isSuffocating(blockGetter, this.pos) || l == 1 && !blockState.hasLargeCollisionShape() || l == 2 && !blockState.is(Blocks.MOVING_PISTON)) { ++ continue; ++ } ++ + // Paper - moved up + if (/*this.onlySuffocatingBlocks && (!blockState.isSuffocating(blockGetter, this.pos)) ||*/ l == 1 && !blockState.hasLargeCollisionShape() || l == 2 && !blockState.is(Blocks.MOVING_PISTON)) { // Paper - onlySuffocatingBlocks is only true on the client, so we don't care about it here - continue; ++ continue; ++ } ++ ++ VoxelShape voxelShape = blockState.getCollisionShape(this.collisionGetter, this.pos, this.context); ++ if (voxelShape == Shapes.block()) { ++ if (!this.box.intersects((double)i, (double)j, (double)k, (double)i + 1.0D, (double)j + 1.0D, (double)k + 1.0D)) { ++ continue; + } ++ ++ return this.resultProvider.apply(this.pos, voxelShape.move((double)i, (double)j, (double)k)); ++ } ++ ++ VoxelShape voxelShape2 = voxelShape.move((double)i, (double)j, (double)k); ++ if (voxelShape2.isEmpty() || !Shapes.joinIsNotEmpty(voxelShape2, this.entityShape, BooleanOp.AND)) { ++ continue; } ++ ++ return this.resultProvider.apply(this.pos, voxelShape2); + } +- } +- return this.endOfData(); ++ return this.endOfData(); ++ } + } + } diff --git a/src/main/java/net/minecraft/world/level/CollisionGetter.java b/src/main/java/net/minecraft/world/level/CollisionGetter.java -index 140d10807a3a6806578cd203ba58383590c2f2c0..c476e37df8a75d77f5093b2a449e04f25ef2c2dd 100644 +index 204791d893383a17b47e4c683cad3ba6c0839762..a4200e1992207e7665673c2acdb45facfd0bc676 100644 --- a/src/main/java/net/minecraft/world/level/CollisionGetter.java +++ b/src/main/java/net/minecraft/world/level/CollisionGetter.java @@ -44,11 +44,13 @@ public interface CollisionGetter extends BlockGetter { @@ -100,7 +141,7 @@ index 140d10807a3a6806578cd203ba58383590c2f2c0..c476e37df8a75d77f5093b2a449e04f2 default boolean noCollision(@Nullable Entity entity, AABB box) { + try { if (entity != null) entity.collisionLoadChunks = true; // Paper - for(VoxelShape voxelShape : this.getBlockCollisions(entity, box)) { + for (VoxelShape voxelShape : this.getBlockCollisions(entity, box)) { if (!voxelShape.isEmpty()) { return false; } diff --git a/patches/server/0994-Optimize-GoalSelector-Goal.Flag-Set-operations.patch b/patches/server/0994-Optimize-GoalSelector-Goal.Flag-Set-operations.patch index 8e879a28af..b3736865b4 100644 --- a/patches/server/0994-Optimize-GoalSelector-Goal.Flag-Set-operations.patch +++ b/patches/server/0994-Optimize-GoalSelector-Goal.Flag-Set-operations.patch @@ -58,10 +58,10 @@ index 16f9a98b8a939e5ca7e2dc04f87134a7ed66736b..dd423302b1baa64ef86ded87a2965934 protected int adjustedTickDelay(int ticks) { 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 e5995d0db5dcfba59a873ff439601894fdacd556..676f5485a4ca9252e911213dcda8d51776b637b6 100644 +index b236ac6e261790b53944885d0d6575eba0986fde..1a9d20db26d6e3d633df5484b6f7f3125c6b2c97 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 -@@ -30,10 +30,12 @@ public class GoalSelector { +@@ -31,10 +31,12 @@ public class GoalSelector { private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class); private final Set<WrappedGoal> availableGoals = Sets.newLinkedHashSet(); private final Supplier<ProfilerFiller> profiler; @@ -75,20 +75,20 @@ index e5995d0db5dcfba59a873ff439601894fdacd556..676f5485a4ca9252e911213dcda8d517 public GoalSelector(Supplier<ProfilerFiller> profiler) { this.profiler = profiler; -@@ -65,26 +67,32 @@ public class GoalSelector { +@@ -66,26 +68,32 @@ public class GoalSelector { } // Paper end public void removeGoal(Goal goal) { -- this.availableGoals.stream().filter((wrappedGoal) -> { +- this.availableGoals.stream().filter(wrappedGoal -> { - return wrappedGoal.getGoal() == goal; - }).filter(WrappedGoal::isRunning).forEach(WrappedGoal::stop); -- this.availableGoals.removeIf((wrappedGoal) -> { +- this.availableGoals.removeIf(wrappedGoal -> { - return wrappedGoal.getGoal() == goal; - }); - } - - private static boolean goalContainsAnyFlags(WrappedGoal goal, EnumSet<Goal.Flag> controls) { -- for(Goal.Flag flag : goal.getFlags()) { +- for (Goal.Flag flag : goal.getFlags()) { - if (controls.contains(flag)) { - return true; + // Paper start - remove streams from pathfindergoalselector @@ -111,7 +111,7 @@ index e5995d0db5dcfba59a873ff439601894fdacd556..676f5485a4ca9252e911213dcda8d517 } private static boolean goalCanBeReplacedForAllFlags(WrappedGoal goal, Map<Goal.Flag, WrappedGoal> goalsByControl) { -- for(Goal.Flag flag : goal.getFlags()) { +- for (Goal.Flag flag : goal.getFlags()) { + // Paper start + long flagIterator = goal.getFlags().getBackingSet(); + int wrappedGoalSize = goal.getFlags().size(); @@ -122,21 +122,24 @@ index e5995d0db5dcfba59a873ff439601894fdacd556..676f5485a4ca9252e911213dcda8d517 if (!goalsByControl.getOrDefault(flag, NO_GOAL).canBeReplacedBy(goal)) { return false; } -@@ -98,7 +106,7 @@ public class GoalSelector { +@@ -99,7 +107,7 @@ public class GoalSelector { profilerFiller.push("goalCleanup"); - for(WrappedGoal wrappedGoal : this.availableGoals) { + for (WrappedGoal wrappedGoal : this.availableGoals) { - if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.disabledFlags) || !wrappedGoal.canContinueToUse())) { -+ if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { ++ if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { // Paper wrappedGoal.stop(); } } -@@ -116,8 +124,14 @@ public class GoalSelector { +@@ -117,11 +125,14 @@ public class GoalSelector { profilerFiller.push("goalUpdate"); - for(WrappedGoal wrappedGoal2 : this.availableGoals) { -- if (!wrappedGoal2.isRunning() && !goalContainsAnyFlags(wrappedGoal2, this.disabledFlags) && goalCanBeReplacedForAllFlags(wrappedGoal2, this.lockedFlags) && wrappedGoal2.canUse()) { -- for(Goal.Flag flag : wrappedGoal2.getFlags()) { + for (WrappedGoal wrappedGoal2 : this.availableGoals) { +- if (!wrappedGoal2.isRunning() +- && !goalContainsAnyFlags(wrappedGoal2, this.disabledFlags) +- && goalCanBeReplacedForAllFlags(wrappedGoal2, this.lockedFlags) +- && wrappedGoal2.canUse()) { +- for (Goal.Flag flag : wrappedGoal2.getFlags()) { + // Paper start + if (!wrappedGoal2.isRunning() && !goalContainsAnyFlags(wrappedGoal2, this.goalTypes) && goalCanBeReplacedForAllFlags(wrappedGoal2, this.lockedFlags) && wrappedGoal2.canUse()) { + long flagIterator = wrappedGoal2.getFlags().getBackingSet(); @@ -148,7 +151,7 @@ index e5995d0db5dcfba59a873ff439601894fdacd556..676f5485a4ca9252e911213dcda8d517 WrappedGoal wrappedGoal3 = this.lockedFlags.getOrDefault(flag, NO_GOAL); wrappedGoal3.stop(); this.lockedFlags.put(flag, wrappedGoal2); -@@ -157,11 +171,11 @@ public class GoalSelector { +@@ -161,11 +172,11 @@ public class GoalSelector { } public void disableControlFlag(Goal.Flag control) { @@ -163,7 +166,7 @@ index e5995d0db5dcfba59a873ff439601894fdacd556..676f5485a4ca9252e911213dcda8d517 public void setControlFlag(Goal.Flag control, boolean enabled) { diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/WrappedGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/WrappedGoal.java -index 6665ce5f48316e626907e6937d5ef1bc398a7ebd..51deb4455cac055ffa455e4f34aa30858d2fb448 100644 +index b02d3deb550830245c8945ef17d3073ea930fdda..65ccdbaa5230c02d44a5959bca0f6fc30237a6fd 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/WrappedGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/WrappedGoal.java @@ -69,8 +69,10 @@ public class WrappedGoal extends Goal { diff --git a/patches/server/0995-Entity-load-save-limit-per-chunk.patch b/patches/server/0995-Entity-load-save-limit-per-chunk.patch index 69f16dddbf..85299c2e1e 100644 --- a/patches/server/0995-Entity-load-save-limit-per-chunk.patch +++ b/patches/server/0995-Entity-load-save-limit-per-chunk.patch @@ -34,10 +34,10 @@ index 69bdf3f2ee731e59e8d454816a9ca72cb49c0fe0..09e8445a3f8c6b3ebc852a75a9a25b41 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 0ec0be22f7292d57c40da6f1f4575bdebf8dbd09..23dc37ff1f92951817864963bf93220d5aae91bb 100644 +index e8f8e1f2128df81705a88cee4b9a7760fb123750..995fbfa225efe40274c20608b9b30b8afa847698 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 -@@ -110,7 +110,18 @@ public class EntityStorage implements EntityPersistentStorage<Entity> { +@@ -109,7 +109,18 @@ public class EntityStorage implements EntityPersistentStorage<Entity> { } ListTag listTag = new ListTag(); diff --git a/patches/server/0997-Improved-Watchdog-Support.patch b/patches/server/0997-Improved-Watchdog-Support.patch index 3df0b44629..720936ff38 100644 --- a/patches/server/0997-Improved-Watchdog-Support.patch +++ b/patches/server/0997-Improved-Watchdog-Support.patch @@ -279,17 +279,17 @@ index 37245ff682837e7e8c9647f4afe30f0dd87cb384..594cb6ce4bfa6c42212000a1ed983ea9 // Paper start - Configurable player collision; 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 f5829ae484d93b547a5437b85a9621346384a11b..83701fbfaa56a232593ee8f11a3afb8941238bfa 100644 +index 03e8707258e9b73cf12a4750270ab7573bb1c812..d0dbe7e3c7c9c2727d5de456808765b2666108e4 100644 --- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java +++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -@@ -152,6 +152,7 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler +@@ -148,6 +148,7 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler try { task.run(); } catch (Exception var3) { + if (var3.getCause() instanceof ThreadDeath) throw var3; // Paper 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 16e0b4bcc903e6decbdf66ac4fb3d0dc261dbded..983dad7ecc58033ecb6f523f7aef24de122417e8 100644 --- a/src/main/java/net/minecraft/world/level/Level.java diff --git a/patches/server/0998-Optimize-Voxel-Shape-Merging.patch b/patches/server/0998-Optimize-Voxel-Shape-Merging.patch index 2c47963e34..06761a3e33 100644 --- a/patches/server/0998-Optimize-Voxel-Shape-Merging.patch +++ b/patches/server/0998-Optimize-Voxel-Shape-Merging.patch @@ -30,7 +30,7 @@ Additionally, this lets us avoid even allocating new objects for this too, furth reducing memory usage. diff --git a/src/main/java/net/minecraft/world/phys/shapes/IndirectMerger.java b/src/main/java/net/minecraft/world/phys/shapes/IndirectMerger.java -index 0d9c15120148409967027dead617e80769939697..2214a3198c712deaac0f3d3478c85352185761d4 100644 +index e164c524aef4fa81fe96ac43454eecff1c38b9c1..9cfbbc61fcfc678f0988d6d45c7994d128051744 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/IndirectMerger.java +++ b/src/main/java/net/minecraft/world/phys/shapes/IndirectMerger.java @@ -10,12 +10,33 @@ public class IndirectMerger implements IndexMerger { @@ -68,10 +68,10 @@ index 0d9c15120148409967027dead617e80769939697..2214a3198c712deaac0f3d3478c85352 this.firstIndices = new int[k]; this.secondIndices = new int[k]; diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -index 2d273be8145bbd86ffdf33358629da7fc08b4d4c..9176735c08a75854209f24113b0e78332249dc4d 100644 +index 8d8775e87c4aa719e23f115bb6933958beb49c39..d88f69275ffee4669dd6d31e2669c41f66a1919d 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java +++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -@@ -247,9 +247,21 @@ public final class Shapes { +@@ -286,9 +286,21 @@ public final class Shapes { } @VisibleForTesting @@ -94,11 +94,11 @@ index 2d273be8145bbd86ffdf33358629da7fc08b4d4c..9176735c08a75854209f24113b0e7833 if (first instanceof CubePointRange && second instanceof CubePointRange) { long l = lcm(i, j); if ((long)size * l <= 256L) { -@@ -257,13 +269,22 @@ public final class Shapes { +@@ -296,15 +308,22 @@ public final class Shapes { } } -- if (first.getDouble(i) < second.getDouble(0) - 1.0E-7D) { +- if (first.getDouble(i) < second.getDouble(0) - 1.0E-7) { + // Paper start - Identical happens more often than Disjoint + if (i == j && Objects.equals(first, second)) { + if (first instanceof IdenticalMerger) { @@ -107,12 +107,14 @@ index 2d273be8145bbd86ffdf33358629da7fc08b4d4c..9176735c08a75854209f24113b0e7833 + return (IndexMerger) second; + } + return new IdenticalMerger(first); -+ } else if (first.getDouble(i) < second.getDouble(0) - 1.0E-7D) { ++ } else if (first.getDouble(i) < second.getDouble(0) - 1.0E-7) { return new NonOverlappingMerger(first, second, false); - } else if (second.getDouble(j) < first.getDouble(0) - 1.0E-7D) { + } else if (second.getDouble(j) < first.getDouble(0) - 1.0E-7) { return new NonOverlappingMerger(second, first, true); } else { -- return (IndexMerger)(i == j && Objects.equals(first, second) ? new IdenticalMerger(first) : new IndirectMerger(first, second, includeFirst, includeSecond)); +- return (IndexMerger)(i == j && Objects.equals(first, second) +- ? new IdenticalMerger(first) +- : new IndirectMerger(first, second, includeFirst, includeSecond)); + return new IndirectMerger(first, second, includeFirst, includeSecond); } + // Paper end diff --git a/patches/server/0999-Write-SavedData-IO-async.patch b/patches/server/0999-Write-SavedData-IO-async.patch index a61e63bdcc..fc9b211347 100644 --- a/patches/server/0999-Write-SavedData-IO-async.patch +++ b/patches/server/0999-Write-SavedData-IO-async.patch @@ -139,7 +139,7 @@ index 697df9a9f050c0130246ce2b08a859965bddf184..0655a26a58b3df19d81b18abf6b8ab81 public static record Factory<T extends SavedData>(Supplier<T> constructor, Function<CompoundTag, T> deserializer, DataFixTypes type) { 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 d051e8c1db6b5c42b8df0be54d9d48ba0e7b0077..1c16f43872d9cf9b087f247e9aaa04e7abe3d4ae 100644 +index de44680d9bc34c6ce22e12c3008019c8c6803437..b89bd2d046e99d0c4848579a5ab4385453358b89 100644 --- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java @@ -20,15 +20,18 @@ import net.minecraft.util.datafix.DataFixTypes; @@ -186,5 +186,5 @@ index d051e8c1db6b5c42b8df0be54d9d48ba0e7b0077..1c16f43872d9cf9b087f247e9aaa04e7 + } + // Paper end - Write SavedData IO async } - }); + } diff --git a/patches/server/1001-Use-distance-map-to-optimise-entity-tracker.patch b/patches/server/1001-Use-distance-map-to-optimise-entity-tracker.patch index 986378b88f..8cf1aa5a19 100644 --- a/patches/server/1001-Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/server/1001-Use-distance-map-to-optimise-entity-tracker.patch @@ -236,7 +236,7 @@ index ac1a4ff5f83e53fa2983ff6e834775e51fba715e..284f9548d62f9230c668bb1adb8cb808 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 8531304667a85436fd557d319fe36a37b3661ae5..f220e9ba35b07b690df93b1d733e9c666c772de9 100644 +index 5cc7043d2783d38f9d3a28d0cb62f8834e971e1e..eb269e90c62544d6e56ac8e6e81d0e5d4bc1f7e9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -56,6 +56,7 @@ import net.minecraft.network.syncher.EntityDataSerializers; diff --git a/patches/server/1002-Optimize-Bit-Operations-by-inlining.patch b/patches/server/1002-Optimize-Bit-Operations-by-inlining.patch index 269787b9ed..72a4578554 100644 --- a/patches/server/1002-Optimize-Bit-Operations-by-inlining.patch +++ b/patches/server/1002-Optimize-Bit-Operations-by-inlining.patch @@ -7,7 +7,7 @@ Inline bit operations and reduce instruction count to make these hot operations faster diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index 541cef99113af865b995af2cfb7a1e4724dd8878..e17fa30966dea2836fb791becd032fc7d5cc2611 100644 +index f06a51b70df8450801a27bb06e6d7f6e4ee3049e..58573dba0ad7590d1f799af2bebadc03853393ef 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java @@ -37,15 +37,16 @@ public class BlockPos extends Vec3i { @@ -84,7 +84,7 @@ index 541cef99113af865b995af2cfb7a1e4724dd8878..e17fa30966dea2836fb791becd032fc7 public static long getFlatIndex(long y) { diff --git a/src/main/java/net/minecraft/core/SectionPos.java b/src/main/java/net/minecraft/core/SectionPos.java -index eb97928380384b8c33cf142dd9a5db65951c94c6..392c3681c08d9e3d99cbabaf72d22c1d1518998d 100644 +index 27e0d53d5893a13a340deddc93a1128968db7e5b..fe3577e533fb829c85fd4881b1bcca3b70aaf1a5 100644 --- a/src/main/java/net/minecraft/core/SectionPos.java +++ b/src/main/java/net/minecraft/core/SectionPos.java @@ -38,7 +38,7 @@ public class SectionPos extends Vec3i { @@ -210,4 +210,4 @@ index eb97928380384b8c33cf142dd9a5db65951c94c6..392c3681c08d9e3d99cbabaf72d22c1d + return betweenClosedStream(center.x - radius, 0, center.z - radius, center.x + radius, 15, center.z + radius); // Paper - simplify/inline } - public static Stream<SectionPos> betweenClosedStream(final int minX, final int minY, final int minZ, final int maxX, final int maxY, final int maxZ) { + public static Stream<SectionPos> betweenClosedStream(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { diff --git a/patches/server/1003-Remove-streams-from-hot-code.patch b/patches/server/1003-Remove-streams-from-hot-code.patch index 75a38173c7..bf425cde83 100644 --- a/patches/server/1003-Remove-streams-from-hot-code.patch +++ b/patches/server/1003-Remove-streams-from-hot-code.patch @@ -7,10 +7,10 @@ Co-authored-by: Bjarne Koll <[email protected]> Co-authored-by: Spottedleaf <[email protected]> diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java -index 4b31a91a8d8a3b231e323692d0a0f7ae04dc7e89..79e7a7adf9f9d8b9fee7ae3bb3bebab86fa7fd72 100644 +index ef1e9457aa215afd0d9a0a9cda2f6b5c4ac6974f..f93543049d014e26d16e6b5d7995f776948212af 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java -@@ -52,7 +52,7 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E> +@@ -59,7 +59,7 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E> if (this.hasRequiredMemories(entity)) { this.status = Behavior.Status.RUNNING; this.orderPolicy.apply(this.behaviors); @@ -19,13 +19,13 @@ index 4b31a91a8d8a3b231e323692d0a0f7ae04dc7e89..79e7a7adf9f9d8b9fee7ae3bb3bebab8 return true; } else { return false; -@@ -61,11 +61,13 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E> +@@ -68,11 +68,13 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E> @Override public final void tickOrStop(ServerLevel world, E entity, long time) { -- this.behaviors.stream().filter((task) -> { +- this.behaviors.stream().filter(task -> { - return task.getStatus() == Behavior.Status.RUNNING; -- }).forEach((task) -> { +- }).forEach(task -> { - task.tickOrStop(world, entity, time); - }); + // Paper start - Perf: Remove streams from hot code @@ -35,16 +35,16 @@ index 4b31a91a8d8a3b231e323692d0a0f7ae04dc7e89..79e7a7adf9f9d8b9fee7ae3bb3bebab8 + } + } + // Paper end - Perf: Remove streams from hot code - if (this.behaviors.stream().noneMatch((task) -> { + if (this.behaviors.stream().noneMatch(task -> { return task.getStatus() == Behavior.Status.RUNNING; })) { -@@ -77,12 +79,16 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E> +@@ -83,12 +85,16 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E> @Override public final void doStop(ServerLevel world, E entity, long time) { this.status = Behavior.Status.STOPPED; -- this.behaviors.stream().filter((task) -> { +- this.behaviors.stream().filter(task -> { - return task.getStatus() == Behavior.Status.RUNNING; -- }).forEach((task) -> { +- }).forEach(task -> { - task.doStop(world, entity, time); - }); - this.exitErasedMemories.forEach(entity.getBrain()::eraseMemory); @@ -61,16 +61,16 @@ index 4b31a91a8d8a3b231e323692d0a0f7ae04dc7e89..79e7a7adf9f9d8b9fee7ae3bb3bebab8 } @Override -@@ -116,26 +122,30 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E> +@@ -122,26 +128,30 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E> public static enum RunningPolicy { RUN_ONE { + // Paper start - Perf: Remove streams from hot code @Override - public <E extends LivingEntity> void apply(Stream<BehaviorControl<? super E>> tasks, ServerLevel world, E entity, long time) { -- tasks.filter((task) -> { +- tasks.filter(task -> { - return task.getStatus() == Behavior.Status.STOPPED; -- }).filter((task) -> { +- }).filter(task -> { - return task.tryStart(world, entity, time); - }).findFirst(); + public <E extends LivingEntity> void apply(ShufflingList<BehaviorControl<? super E>> tasks, ServerLevel world, E entity, long time) { @@ -86,9 +86,9 @@ index 4b31a91a8d8a3b231e323692d0a0f7ae04dc7e89..79e7a7adf9f9d8b9fee7ae3bb3bebab8 + // Paper start - Perf: Remove streams from hot code @Override - public <E extends LivingEntity> void apply(Stream<BehaviorControl<? super E>> tasks, ServerLevel world, E entity, long time) { -- tasks.filter((task) -> { +- tasks.filter(task -> { - return task.getStatus() == Behavior.Status.STOPPED; -- }).forEach((task) -> { +- }).forEach(task -> { - task.tryStart(world, entity, time); - }); + public <E extends LivingEntity> void apply(ShufflingList<BehaviorControl<? super E>> tasks, ServerLevel world, E entity, long time) { @@ -106,7 +106,7 @@ index 4b31a91a8d8a3b231e323692d0a0f7ae04dc7e89..79e7a7adf9f9d8b9fee7ae3bb3bebab8 } } 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 f1e717dc8320a00c0cc0ff53d97b74e7c1e109fe..2240fc6d5ba9530fcd62d6b560c17a275d4f164a 100644 +index 2ac97b08932a182c1512ed935a4d76b341c6a6aa..703ae9b8e38cf829dbf5a8be9364e7d413591ea7 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 @@ -61,8 +61,22 @@ public class GossipContainer { @@ -133,23 +133,23 @@ index f1e717dc8320a00c0cc0ff53d97b74e7c1e109fe..2240fc6d5ba9530fcd62d6b560c17a27 if (list.isEmpty()) { return Collections.emptyList(); } else { -@@ -156,7 +170,7 @@ public class GossipContainer { +@@ -152,7 +166,7 @@ public class GossipContainer { } public <T> T store(DynamicOps<T> ops) { -- return GossipContainer.GossipEntry.LIST_CODEC.encodeStart(ops, this.unpack().toList()).resultOrPartial((error) -> { -+ return GossipContainer.GossipEntry.LIST_CODEC.encodeStart(ops, this.decompress()).resultOrPartial((error) -> { // Paper - Perf: Remove streams from hot code - LOGGER.warn("Failed to serialize gossips: {}", (Object)error); +- return GossipContainer.GossipEntry.LIST_CODEC.encodeStart(ops, this.unpack().toList()).resultOrPartial(error -> { ++ return GossipContainer.GossipEntry.LIST_CODEC.encodeStart(ops, this.decompress()).resultOrPartial(error -> { // Paper - Perf: Remove streams from hot code + LOGGER.warn("Failed to serialize gossips: {}", error); }).orElseGet(ops::emptyList); } -@@ -184,11 +198,23 @@ public class GossipContainer { +@@ -180,11 +194,23 @@ public class GossipContainer { final Object2IntMap<GossipType> entries = new Object2IntOpenHashMap<>(); public int weightedValue(Predicate<GossipType> gossipTypeFilter) { -- return this.entries.object2IntEntrySet().stream().filter((entry) -> { +- return this.entries.object2IntEntrySet().stream().filter(entry -> { - return gossipTypeFilter.test(entry.getKey()); -- }).mapToInt((entry) -> { -- return entry.getIntValue() * (entry.getKey()).weight; +- }).mapToInt(entry -> { +- return entry.getIntValue() * entry.getKey().weight; - }).sum(); + // Paper start - Perf: Remove streams from hot code + int weight = 0; @@ -172,21 +172,21 @@ index f1e717dc8320a00c0cc0ff53d97b74e7c1e109fe..2240fc6d5ba9530fcd62d6b560c17a27 public Stream<GossipContainer.GossipEntry> unpack(UUID target) { diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java -index a41c3365db8e9999b686f5bf4bd888458cee43a5..18e2fd705fe0db7cb9e3afe1ce7c8dcfaf93b1a5 100644 +index b518a843e9b599c15558f27476a758c7980ed5c3..bbe2d8f64b1cfd952bba45f4408bb3bc66464a15 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java @@ -25,14 +25,18 @@ public class NearestItemSensor extends Sensor<Mob> { protected void doTick(ServerLevel world, Mob entity) { Brain<?> brain = entity.getBrain(); - List<ItemEntity> list = world.getEntitiesOfClass(ItemEntity.class, entity.getBoundingBox().inflate(32.0D, 16.0D, 32.0D), (itemEntity) -> { + List<ItemEntity> list = world.getEntitiesOfClass(ItemEntity.class, entity.getBoundingBox().inflate(32.0, 16.0, 32.0), itemEntity -> { - return true; + return itemEntity.closerThan(entity, MAX_DISTANCE_TO_WANTED_ITEM) && entity.wantsToPickUp(itemEntity.getItem()); // Paper - Perf: Move predicate into getEntities }); list.sort(Comparator.comparingDouble(entity::distanceToSqr)); -- Optional<ItemEntity> optional = list.stream().filter((itemEntity) -> { +- Optional<ItemEntity> optional = list.stream().filter(itemEntity -> { - return entity.wantsToPickUp(itemEntity.getItem()); -- }).filter((itemEntity) -> { -- return itemEntity.closerThan(entity, 32.0D); +- }).filter(itemEntity -> { +- return itemEntity.closerThan(entity, 32.0); - }).filter(entity::hasLineOfSight).findFirst(); - brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, optional); + // Paper start - Perf: remove streams from hot code @@ -202,42 +202,31 @@ index a41c3365db8e9999b686f5bf4bd888458cee43a5..18e2fd705fe0db7cb9e3afe1ce7c8dcf } } 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 bb8d8edb47621665872a5e8fc01512ba40c1b913..dcb62d768d234f60af77ffb589ac2011afcfae4b 100644 +index 0082d641d3fb9631f3262d8dc41863cb638d341a..ba549438664c8bfa736084b256663f9e7c5e26c6 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java +++ b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java -@@ -36,9 +36,10 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { +@@ -35,11 +35,10 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { int j = pos.getMinBlockZ(); ObjectList<Beardifier.Rigid> objectList = new ObjectArrayList<>(10); ObjectList<JigsawJunction> objectList2 = new ObjectArrayList<>(32); -- world.startsForStructure(pos, (structure) -> { +- world.startsForStructure(pos, structure -> { +- return structure.terrainAdaptation() != TerrainAdjustment.NONE; +- }) +- .forEach( +- start -> { + // Paper start - Perf: Remove streams from hot code + for (net.minecraft.world.level.levelgen.structure.StructureStart start : world.startsForStructure(pos, (structure) -> { - return structure.terrainAdaptation() != TerrainAdjustment.NONE; -- }).forEach((start) -> { ++ return structure.terrainAdaptation() != TerrainAdjustment.NONE; + })) { // Paper end - Perf: Remove streams from hot code - TerrainAdjustment terrainAdjustment = start.getStructure().terrainAdaptation(); - - for(StructurePiece structurePiece : start.getPieces()) { -@@ -51,9 +52,11 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { - } - - for(JigsawJunction jigsawJunction : poolElementStructurePiece.getJunctions()) { -- int i = jigsawJunction.getSourceX(); -- int j = jigsawJunction.getSourceZ(); -- if (i > i - 12 && j > j - 12 && i < i + 15 + 12 && j < j + 15 + 12) { -+ // Paper start - decompile fix -+ int i2 = jigsawJunction.getSourceX(); -+ int j2 = jigsawJunction.getSourceZ(); -+ if (i2 > i - 12 && j2 > j - 12 && i2 < i + 15 + 12 && j2 < j + 15 + 12) { -+ // Paper end - decompile fix - objectList2.add(jigsawJunction); + TerrainAdjustment terrainAdjustment = start.getStructure().terrainAdaptation(); + + for (StructurePiece structurePiece : start.getPieces()) { +@@ -67,8 +66,7 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { } } -@@ -63,7 +66,7 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { - } - } - -- }); + } +- } +- ); + } // Paper - Perf: Remove streams from hot code return new Beardifier(objectList.iterator(), objectList2.iterator()); } diff --git a/patches/server/1005-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch b/patches/server/1005-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch index f0c0562d70..ae79f5fd1c 100644 --- a/patches/server/1005-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch +++ b/patches/server/1005-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch @@ -16,14 +16,14 @@ This lets us get faster foreach iteration, as well as avoids map lookups on the values when needed. diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -index 8519383a9abd45434c1e9888e77548941a80c79c..8aa4ac3a6affbe888d6084a27b668c58dfda6c79 100644 +index 846e84d59303661f06f871879cccca3d721d4f04..d1e1f12451058f7f276f8277536a4c0a4d736601 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java @@ -38,9 +38,12 @@ public class PathFinder { if (node == null) { return null; } else { -- Map<Target, BlockPos> map = positions.stream().collect(Collectors.toMap((pos) -> { +- Map<Target, BlockPos> map = positions.stream().collect(Collectors.toMap(pos -> { - return this.nodeEvaluator.getGoal((double)pos.getX(), (double)pos.getY(), (double)pos.getZ()); - }, Function.identity())); + // Paper start - Perf: remove streams and optimize collection @@ -59,14 +59,14 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..8aa4ac3a6affbe888d6084a27b668c58 + List<Map.Entry<Target, BlockPos>> entryList = Lists.newArrayListWithExpectedSize(positions.size()); // Paper - optimize collection int j = (int)((float)this.maxVisitedNodes * rangeMultiplier); - while(!this.openSet.isEmpty()) { -@@ -71,14 +75,18 @@ public class PathFinder { + while (!this.openSet.isEmpty()) { +@@ -70,14 +74,18 @@ public class PathFinder { Node node = this.openSet.pop(); node.closed = true; -- for(Target target : set) { +- for (Target target : set) { + // Paper start - optimize collection -+ for(int i1 = 0; i1 < positions.size(); i1++) { ++ for (int i1 = 0; i1 < positions.size(); i1++) { + final Map.Entry<Target, BlockPos> entry = positions.get(i1); + Target target = entry.getKey(); if (node.distanceManhattan(target) <= (float)distance) { @@ -82,7 +82,7 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..8aa4ac3a6affbe888d6084a27b668c58 break; } -@@ -93,7 +101,7 @@ public class PathFinder { +@@ -92,7 +100,7 @@ public class PathFinder { if (node2.walkedDistance < followRange && (!node2.inOpenSet() || g < node2.g)) { node2.cameFrom = node; node2.g = g; @@ -91,14 +91,14 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..8aa4ac3a6affbe888d6084a27b668c58 if (node2.inOpenSet()) { this.openSet.changeCost(node2, node2.g + node2.h); } else { -@@ -105,23 +113,32 @@ public class PathFinder { +@@ -104,23 +112,32 @@ public class PathFinder { } } -- Optional<Path> optional = !set3.isEmpty() ? set3.stream().map((node) -> { +- Optional<Path> optional = !set3.isEmpty() ? set3.stream().map(node -> { - return this.reconstructPath(node.getBestNode(), positions.get(node), true); -- }).min(Comparator.comparingInt(Path::getNodeCount)) : set.stream().map((target) -> { -- return this.reconstructPath(target.getBestNode(), positions.get(target), false); +- }).min(Comparator.comparingInt(Path::getNodeCount)) : set.stream().map(targetx -> { +- return this.reconstructPath(targetx.getBestNode(), positions.get(targetx), false); - }).min(Comparator.comparingDouble(Path::getDistToTarget).thenComparingInt(Path::getNodeCount)); + // Paper start - Perf: remove streams and optimize collection + Path best = null; @@ -124,7 +124,7 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..8aa4ac3a6affbe888d6084a27b668c58 + private float getBestH(Node node, List<Map.Entry<Target, BlockPos>> targets) { // Paper - Perf: remove streams and optimize collection; Set<Target> -> List<Map.Entry<Target, BlockPos>> float f = Float.MAX_VALUE; -- for(Target target : targets) { +- for (Target target : targets) { + // Paper start - Perf: remove streams and optimize collection + for (int i = 0, targetsSize = targets.size(); i < targetsSize; i++) { + final Target target = targets.get(i).getKey(); diff --git a/patches/server/1006-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch b/patches/server/1006-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch index 14c24b80b2..de82ef89da 100644 --- a/patches/server/1006-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch +++ b/patches/server/1006-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch @@ -168,7 +168,7 @@ index 743a2adc465be5477d204185967265389d7102de..9c17c14de888ef3fbf4139cbad3889ec return itemstack; diff --git a/src/main/java/net/minecraft/world/inventory/MerchantResultSlot.java b/src/main/java/net/minecraft/world/inventory/MerchantResultSlot.java -index e49bbb803399ef696665c5844a18b55a551654f6..23c1ba476869c9846a63138a8a11154bfd9379a2 100644 +index 26227033613a641a9d5a6f29356b19e54753b3f1..c2376538215604210d08acd33e8e5fdc8a35c7d3 100644 --- a/src/main/java/net/minecraft/world/inventory/MerchantResultSlot.java +++ b/src/main/java/net/minecraft/world/inventory/MerchantResultSlot.java @@ -47,13 +47,32 @@ public class MerchantResultSlot extends Slot { diff --git a/patches/server/1007-Improve-boat-collision-performance.patch b/patches/server/1007-Improve-boat-collision-performance.patch index f0c60b4a39..3de7a875b6 100644 --- a/patches/server/1007-Improve-boat-collision-performance.patch +++ b/patches/server/1007-Improve-boat-collision-performance.patch @@ -5,19 +5,19 @@ 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 edf937591abf62416bd692e40b7b7a6badbe877d..b40864e41e1506884fdefefbf3cf4833a8f706c3 100644 +index 081b460aa9b3674bf239378a6fc3f6cd30bb2d26..7eb6562ac38fed3fc79e98ebbcb2633ea8cb6e48 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -121,6 +121,7 @@ public class Util { +@@ -123,6 +123,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 - Improve boat collision performance - private static Consumer<String> thePauser = (message) -> { + private static Consumer<String> 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 3f3498e0a24ad8b890173ce71cd63c1fffb561df..e35dd853bbffbf1771543d2a59878879cd09fb9c 100644 +index aa261d3ad04bc3a19b3200214214650d9a9ac2af..a9d549d1f35928b7e9220e1e2e4ac30f3199ba2d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1446,7 +1446,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/1008-Optimise-general-POI-access.patch b/patches/server/1008-Optimise-general-POI-access.patch index 9be40e9753..f1f6ef5a39 100644 --- a/patches/server/1008-Optimise-general-POI-access.patch +++ b/patches/server/1008-Optimise-general-POI-access.patch @@ -841,31 +841,35 @@ index 0000000000000000000000000000000000000000..69be1761b3b5ba7b496c1c10a4db897e + } +} diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -index a0799baca3ae05ef1ff818abfe6a53d28fd99246..abcc3ef59475ac170fd10b4dd4a4f3371faf17e0 100644 +index 05d529a74fa3412b4b07bcf0d469118c38862279..a46aa33d3013003a899659c4bd039d12544b73d7 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -@@ -63,7 +63,11 @@ public class AcquirePoi { - return true; - } - }; -- Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllClosestFirstWithType(poiPredicate, predicate2, entity.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE).limit(5L).collect(Collectors.toSet()); -+ // Paper start - optimise POI access -+ java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>(); -+ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); -+ Set<Pair<Holder<PoiType>, BlockPos>> set = new java.util.HashSet<>(poiposes); -+ // Paper end - optimise POI access - Path path = findPathToPois(entity, set); - if (path != null && path.canReach()) { - BlockPos blockPos = path.getTarget(); +@@ -75,11 +75,11 @@ public class AcquirePoi { + return true; + } + }; +- Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllClosestFirstWithType( +- poiPredicate, predicate2, entity.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE +- ) +- .limit(5L) +- .collect(Collectors.toSet()); ++ // Paper start - optimise POI access ++ java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>(); ++ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); ++ Set<Pair<Holder<PoiType>, BlockPos>> set = new java.util.HashSet<>(poiposes); ++ // Paper end - optimise POI access + Path path = findPathToPois(entity, set); + if (path != null && path.canReach()) { + BlockPos blockPos = path.getTarget(); diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java -index 33fbf72b440e0d164ecd4fb0fdec72e2394d0a1e..8db20db72cd51046213625fac46c35854c59ec5d 100644 +index 1fb3059d96910c095c881e1f89d52dbbf82b8c1c..700c16020a5c40f49bc1c74c47cb4b52a4021bbb 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java @@ -53,10 +53,12 @@ public class NearestBedSensor extends Sensor<Mob> { return true; } }; -- Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllWithType((holder) -> { +- Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllWithType(holder -> { - return holder.is(PoiTypes.HOME); - }, predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY).collect(Collectors.toSet()); - Path path = AcquirePoi.findPathToPois(entity, set); @@ -879,13 +883,13 @@ index 33fbf72b440e0d164ecd4fb0fdec72e2394d0a1e..8db20db72cd51046213625fac46c3585 BlockPos blockPos = path.getTarget(); Optional<Holder<PoiType>> optional = poiManager.getType(blockPos); diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -index 6f2c7baea0d1ac7813c7b85e1f5558573745762c..12a7aaeaa8b4b788b620b1985591c3b93253ccd5 100644 +index c80e75ba66bcd5957d6360a8d5de4f052dbf87d7..bdd24b0978fac23d3ea04c76caa5061434a5883e 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -@@ -127,43 +127,62 @@ public class PoiManager extends SectionStorage<PoiSection> { - } - - public Optional<BlockPos> find(Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) { +@@ -135,40 +135,45 @@ public class PoiManager extends SectionStorage<PoiSection> { + public Optional<BlockPos> find( + Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus + ) { - return this.findAll(typePredicate, posPredicate, pos, radius, occupationStatus).findFirst(); + // Paper start - re-route to faster logic + BlockPos ret = io.papermc.paper.util.PoiAccess.findAnyPoiPosition(this, typePredicate, posPredicate, pos, radius, occupationStatus, false); @@ -894,7 +898,7 @@ index 6f2c7baea0d1ac7813c7b85e1f5558573745762c..12a7aaeaa8b4b788b620b1985591c3b9 } public Optional<BlockPos> findClosest(Predicate<Holder<PoiType>> typePredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) { -- return this.getInRange(typePredicate, pos, radius, occupationStatus).map(PoiRecord::getPos).min(Comparator.comparingDouble((blockPos2) -> { +- return this.getInRange(typePredicate, pos, radius, occupationStatus).map(PoiRecord::getPos).min(Comparator.comparingDouble(blockPos2 -> { - return blockPos2.distSqr(pos); - })); + // Paper start - re-route to faster logic @@ -903,10 +907,12 @@ index 6f2c7baea0d1ac7813c7b85e1f5558573745762c..12a7aaeaa8b4b788b620b1985591c3b9 + // Paper end - re-route to faster logic } - public Optional<Pair<Holder<PoiType>, BlockPos>> findClosestWithType(Predicate<Holder<PoiType>> typePredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) { -- return this.getInRange(typePredicate, pos, radius, occupationStatus).min(Comparator.comparingDouble((poi) -> { + public Optional<Pair<Holder<PoiType>, BlockPos>> findClosestWithType( + Predicate<Holder<PoiType>> typePredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus + ) { +- return this.getInRange(typePredicate, pos, radius, occupationStatus).min(Comparator.comparingDouble(poi -> { - return poi.getPos().distSqr(pos); -- })).map((poi) -> { +- })).map(poi -> { - return Pair.of(poi.getPoiType(), poi.getPos()); - }); + // Paper start - re-route to faster logic @@ -916,10 +922,15 @@ index 6f2c7baea0d1ac7813c7b85e1f5558573745762c..12a7aaeaa8b4b788b620b1985591c3b9 + // Paper end - re-route to faster logic } - public Optional<BlockPos> findClosest(Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) { -- return this.getInRange(typePredicate, pos, radius, occupationStatus).map(PoiRecord::getPos).filter(posPredicate).min(Comparator.comparingDouble((blockPos2) -> { -- return blockPos2.distSqr(pos); -- })); + public Optional<BlockPos> findClosest( + Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus + ) { +- return this.getInRange(typePredicate, pos, radius, occupationStatus) +- .map(PoiRecord::getPos) +- .filter(posPredicate) +- .min(Comparator.comparingDouble(blockPos2 -> { +- return blockPos2.distSqr(pos); +- })); + // Paper start - re-route to faster logic + BlockPos ret = io.papermc.paper.util.PoiAccess.findClosestPoiDataPosition(this, typePredicate, posPredicate, pos, radius, radius * radius, occupationStatus, false); + return Optional.ofNullable(ret); @@ -927,9 +938,9 @@ index 6f2c7baea0d1ac7813c7b85e1f5558573745762c..12a7aaeaa8b4b788b620b1985591c3b9 } public Optional<BlockPos> take(Predicate<Holder<PoiType>> typePredicate, BiPredicate<Holder<PoiType>, BlockPos> biPredicate, BlockPos pos, int radius) { -- return this.getInRange(typePredicate, pos, radius, PoiManager.Occupancy.HAS_SPACE).filter((poi) -> { +- return this.getInRange(typePredicate, pos, radius, PoiManager.Occupancy.HAS_SPACE).filter(poi -> { - return biPredicate.test(poi.getPoiType(), poi.getPos()); -- }).findFirst().map((poi) -> { +- }).findFirst().map(poi -> { + // Paper start - re-route to faster logic + final @javax.annotation.Nullable PoiRecord closest = io.papermc.paper.util.PoiAccess.findClosestPoiDataRecord( + this, typePredicate, biPredicate, pos, radius, radius * radius, Occupancy.HAS_SPACE, false @@ -939,11 +950,12 @@ index 6f2c7baea0d1ac7813c7b85e1f5558573745762c..12a7aaeaa8b4b788b620b1985591c3b9 poi.acquireTicket(); return poi.getPos(); }); - } - - public Optional<BlockPos> getRandom(Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> positionPredicate, PoiManager.Occupancy occupationStatus, BlockPos pos, int radius, RandomSource random) { +@@ -182,10 +187,21 @@ public class PoiManager extends SectionStorage<PoiSection> { + int radius, + RandomSource random + ) { - List<PoiRecord> list = Util.toShuffledList(this.getInRange(typePredicate, pos, radius, occupationStatus), random); -- return list.stream().filter((poi) -> { +- return list.stream().filter(poi -> { - return positionPredicate.test(poi.getPos()); - }).findFirst().map(PoiRecord::getPos); + // Paper start - re-route to faster logic @@ -965,7 +977,7 @@ index 6f2c7baea0d1ac7813c7b85e1f5558573745762c..12a7aaeaa8b4b788b620b1985591c3b9 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 3fc17817906876e83f040f908b8b1ba6cfa37b8b..9f138bc471b5c2a4fa813ff943dbe34018b8df74 100644 +index dbdcc8c842d427e1b0ce178a5d3cad23c4ccaf5e..2fdde213fde2f7f509b339a2041d582fc0d876e8 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 @@ -26,7 +26,7 @@ import org.slf4j.Logger; @@ -978,10 +990,10 @@ index 3fc17817906876e83f040f908b8b1ba6cfa37b8b..9f138bc471b5c2a4fa813ff943dbe340 private boolean isValid; public final Optional<PoiSection> noAllocateOptional = Optional.of(this); // Paper - rewrite chunk system 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 54db563d80bbabd87a2be6f5ead92b482ac07b10..4aac1979cf57300825a999c876fcf24d3170e68e 100644 +index 05c71f8468a3ea075c45465515fd1f075d6ce313..9fb15c86d0fc0f6463454ac8d6dcebce6157d993 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 -@@ -71,11 +71,11 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl +@@ -79,11 +79,11 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl } @Nullable diff --git a/patches/server/1009-Custom-table-implementation-for-blockstate-state-loo.patch b/patches/server/1009-Custom-table-implementation-for-blockstate-state-loo.patch index 52bdb3212c..66c7db3ba9 100644 --- a/patches/server/1009-Custom-table-implementation-for-blockstate-state-loo.patch +++ b/patches/server/1009-Custom-table-implementation-for-blockstate-state-loo.patch @@ -173,10 +173,10 @@ index 0000000000000000000000000000000000000000..57d0cd3ad6f972e986c72a57f1a6e360 + } +} diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -index 89ba12d44865ecddebabbc39c769af4cd8c82702..5f285d190186a2ff5a61d05070593e1d633dd79a 100644 +index 23155d3181f78b5eec1412828441c54826ea8ca5..32df70def3551adc759aec22803fb4195d48c843 100644 --- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java +++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -@@ -39,11 +39,13 @@ public abstract class StateHolder<O, S> { +@@ -42,11 +42,13 @@ public abstract class StateHolder<O, S> { private final ImmutableMap<Property<?>, Comparable<?>> values; private Table<Property<?>, Comparable<?>, S> neighbours; protected final MapCodec<S> propertiesCodec; @@ -190,7 +190,7 @@ index 89ba12d44865ecddebabbc39c769af4cd8c82702..5f285d190186a2ff5a61d05070593e1d } public <T extends Comparable<T>> S cycle(Property<T> property) { -@@ -84,11 +86,11 @@ public abstract class StateHolder<O, S> { +@@ -87,11 +89,11 @@ public abstract class StateHolder<O, S> { } public <T extends Comparable<T>> boolean hasProperty(Property<T> property) { @@ -204,7 +204,7 @@ index 89ba12d44865ecddebabbc39c769af4cd8c82702..5f285d190186a2ff5a61d05070593e1d if (comparable == null) { throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.owner); } else { -@@ -97,24 +99,18 @@ public abstract class StateHolder<O, S> { +@@ -100,24 +102,18 @@ public abstract class StateHolder<O, S> { } public <T extends Comparable<T>> Optional<T> getOptionalValue(Property<T> property) { @@ -236,7 +236,7 @@ index 89ba12d44865ecddebabbc39c769af4cd8c82702..5f285d190186a2ff5a61d05070593e1d } public <T extends Comparable<T>, V extends T> S trySetValue(Property<T> property, V value) { -@@ -147,7 +143,7 @@ public abstract class StateHolder<O, S> { +@@ -150,7 +146,7 @@ public abstract class StateHolder<O, S> { } } @@ -246,7 +246,7 @@ index 89ba12d44865ecddebabbc39c769af4cd8c82702..5f285d190186a2ff5a61d05070593e1d } diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java -index 8da64429eaf083578c672cd34f52dd42389ff396..bdd7d9c80eda872496272e46d8772634e44e622a 100644 +index b63116b333b6e06494091a82588acfb639bddb71..ff5fd91257c4554c523682009efe1db83f53fd5b 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java @@ -7,6 +7,13 @@ import java.util.Optional; @@ -264,7 +264,7 @@ index 8da64429eaf083578c672cd34f52dd42389ff396..bdd7d9c80eda872496272e46d8772634 super(name, Boolean.class); } diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java -index 0a7a6c0e7635d0ada101074d4229df7edc6dd31b..e658d0b1a025192b48090e865b082ac4d99088d4 100644 +index cd7efe4a09e114ab68a90365a6f5363a5c4c17a2..19337b8adefdec32626f5ed788a714a24f39dc35 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java @@ -15,6 +15,15 @@ public class EnumProperty<T extends Enum<T> & StringRepresentable> extends Prope @@ -283,23 +283,23 @@ index 0a7a6c0e7635d0ada101074d4229df7edc6dd31b..e658d0b1a025192b48090e865b082ac4 protected EnumProperty(String name, Class<T> type, Collection<T> values) { super(name, type); this.values = ImmutableSet.copyOf(values); -@@ -28,6 +37,14 @@ public class EnumProperty<T extends Enum<T> & StringRepresentable> extends Prope +@@ -27,6 +36,14 @@ public class EnumProperty<T extends Enum<T> & StringRepresentable> extends Prope + this.names.put(string, enum_); } - -+ // Paper start - optimise iblockdata state lookup ++ // Paper start - optimise BlockState lookup + int id = 0; + this.idLookupTable = new int[type.getEnumConstants().length]; + java.util.Arrays.fill(this.idLookupTable, -1); + for (final T value : this.getPossibleValues()) { + this.idLookupTable[value.ordinal()] = id++; + } -+ // Paper end - optimise iblockdata state lookup ++ // Paper end - optimise BlockState lookup } @Override diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java -index cbe6e4579cc55a427dd8f8fe403478faf6d35b8f..765b1092d50608d479bbbe09c457999790ecf42c 100644 +index 3a850321a4bcc68058483b5fd53e829c425a68af..977504f2641d0133a572b0d5de85d058609343bb 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java @@ -11,6 +11,16 @@ public class IntegerProperty extends Property<Integer> { @@ -320,7 +320,7 @@ index cbe6e4579cc55a427dd8f8fe403478faf6d35b8f..765b1092d50608d479bbbe09c4579997 super(name, Integer.class); if (min < 0) { diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java -index 08c2e4ba9147fbea41e0fce26ad20586832a525b..1d8c3f2e57aa9b0830cf7cfb6354fcf636e9c74b 100644 +index bad6c58b0adc1ca630d3e943a86a2bc66dd94c9f..129bac4e41a6d50532709fadd3b0d1db8aa85e4d 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java @@ -24,6 +24,17 @@ public abstract class Property<T extends Comparable<T>> { diff --git a/patches/server/1011-Optimise-random-block-ticking.patch b/patches/server/1011-Optimise-random-block-ticking.patch index c8b294330a..8becffdb12 100644 --- a/patches/server/1011-Optimise-random-block-ticking.patch +++ b/patches/server/1011-Optimise-random-block-ticking.patch @@ -258,10 +258,10 @@ index 68648c5a5e3ff079f832092af0f2f801c42d1ede..8bafd5fd7499ba4a04bf706cfd1e1560 + // Paper end } diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java -index acd820b19aff4e093536cc47002a899498b3fd6b..453c1d7e01970fd817d27f59c3b00ffc70e8ca0c 100644 +index 236ce41328758cb173a239133073944adb484dd1..abef177f074706f13ae6acbcfe036fcaecf00cd6 100644 --- a/src/main/java/net/minecraft/util/SimpleBitStorage.java +++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java -@@ -124,6 +124,28 @@ public class SimpleBitStorage implements BitStorage { +@@ -315,6 +315,28 @@ public class SimpleBitStorage implements BitStorage { return this.bits; } @@ -291,7 +291,7 @@ index acd820b19aff4e093536cc47002a899498b3fd6b..453c1d7e01970fd817d27f59c3b00ffc public void getAll(IntConsumer action) { int i = 0; diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java -index b7a3f15dc1ed9e9322a86921052984c7cbd3262a..f8de91393564b3691c17339ac9196cc0fc1cf748 100644 +index 50040c497a819cd1229042ab3cb057d34a32cacc..01f5b946fabbe34f31110e75973dab9f39897346 100644 --- a/src/main/java/net/minecraft/util/ZeroBitStorage.java +++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java @@ -46,6 +46,15 @@ public class ZeroBitStorage implements BitStorage { @@ -309,7 +309,7 @@ index b7a3f15dc1ed9e9322a86921052984c7cbd3262a..f8de91393564b3691c17339ac9196cc0 + @Override public void getAll(IntConsumer action) { - for(int i = 0; i < this.size; ++i) { + 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 6a98f66b7701e8af389ca9a1e9eb230a6100c838..dbdb6c432448b151fa4421f14235f8bad23dc720 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java @@ -436,10 +436,10 @@ index 8852263cb6faec1b68326145aa30e5cd36d066e7..eb05c01e85825cbd5b7cf43bc6d261db public PalettedContainer<BlockState> 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 0f930f8355ea99d1cb1a8d27edc1c224588f852f..983799520ce052d98c9231f4f7925492d4f7d5c9 100644 +index 5418261725f7a0dc9a0e8295fe511f69b558a6cd..07137251105f7023936a67038d03ff4f24a9f19b 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -386,6 +386,14 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer +@@ -404,6 +404,14 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer } } diff --git a/patches/server/1012-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch b/patches/server/1012-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch index b294b05766..2113dfcb95 100644 --- a/patches/server/1012-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch +++ b/patches/server/1012-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch @@ -55,7 +55,7 @@ index 645a1773237f2002c233ec1f3ff6f0ca46ca4024..d16d7c2fed89fb1347df7ddd95856e7f public boolean isOldChunkAround(ChunkPos chunkPos, int checkRadius) { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionBitmap.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionBitmap.java -index c8298a597818227de33a4afce4698ec0666cf758..6762b0f71ea9e369bb77103b7f1938983cb77a44 100644 +index a23dc2f8f4475de1ee35bf18a7a8a53233ccac12..226af44fd469053451a0403a95ffb446face9530 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionBitmap.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionBitmap.java @@ -9,6 +9,27 @@ import java.util.BitSet; @@ -763,7 +763,7 @@ index 42d37bee3a459adcd46408596ccf93abbcff51fe..fe312b1aef579cb4bf81bdd967cf72ff } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java -index 374ff77f15e339500714580673ae8077482ba247..6210a202d27788b1304e749b5bc2d9e2b88f5a63 100644 +index 4bfd16b73163fb502cb8716d3ef43f9fa1c3d184..d38ad94312bbb1b41d2ab71fd981649a69fe4929 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java @@ -14,7 +14,7 @@ import javax.annotation.Nullable; @@ -772,6 +772,6 @@ index 374ff77f15e339500714580673ae8077482ba247..6210a202d27788b1304e749b5bc2d9e2 public class RegionFileVersion { - private static final Int2ObjectMap<RegionFileVersion> VERSIONS = new Int2ObjectOpenHashMap<>(); + public static final Int2ObjectMap<RegionFileVersion> VERSIONS = new Int2ObjectOpenHashMap<>(); // Paper - private -> public - public static final RegionFileVersion VERSION_GZIP = register(new RegionFileVersion(1, (stream) -> { + public static final RegionFileVersion VERSION_GZIP = register(new RegionFileVersion(1, stream -> { return new FastBufferedInputStream(new GZIPInputStream(stream)); - }, (stream) -> { + }, stream -> { diff --git a/patches/server/1013-Use-Velocity-compression-and-cipher-natives.patch b/patches/server/1013-Use-Velocity-compression-and-cipher-natives.patch index 396697ea84..d06acf313e 100644 --- a/patches/server/1013-Use-Velocity-compression-and-cipher-natives.patch +++ b/patches/server/1013-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 5d35409137aff0eab242a0d4eb235e10cb7fe236..9c323b4ad76ee8a6386bca52d56615fd98e6d3cb 100644 +index f9056ee057a22a11288405cd42cd0ba4c9d120c3..bcfe59b6efb628ee1e7f9d60667360d4d885fb6a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -40,6 +40,11 @@ dependencies { @@ -102,7 +102,7 @@ index 0f3d502a9680006bcdcd7d272240a2e5c3b46790..ffa1c48585fbbc1d30826d435043527f + // Paper end - Use Velocity cipher } diff --git a/src/main/java/net/minecraft/network/CompressionDecoder.java b/src/main/java/net/minecraft/network/CompressionDecoder.java -index 2758c257cb4e2b0497bd9243c635f8fe3dbc414c..2763052eb2d5b8eb432022ab00a417976f4b2927 100644 +index 5927c928b27f64bd3973e95d5867b59f67476d41..76aeebe60ac321ed604661a0ec969bb25210643f 100644 --- a/src/main/java/net/minecraft/network/CompressionDecoder.java +++ b/src/main/java/net/minecraft/network/CompressionDecoder.java @@ -13,13 +13,20 @@ public class CompressionDecoder extends ByteToMessageDecoder { @@ -171,7 +171,7 @@ index 2758c257cb4e2b0497bd9243c635f8fe3dbc414c..2763052eb2d5b8eb432022ab00a41797 ByteBuffer byteBuffer; if (buf.nioBufferCount() > 0) { diff --git a/src/main/java/net/minecraft/network/CompressionEncoder.java b/src/main/java/net/minecraft/network/CompressionEncoder.java -index 859af8c845bae9781a62fa4acae56c6e2d449e10..f67f59f287d9a5cdd685b6b56ed1daf3f091e099 100644 +index 11a466558c77b43969b8e4be3a3470f84c7fcb1a..3e648aa2f15708ebec3d6e002e5fb49347876767 100644 --- a/src/main/java/net/minecraft/network/CompressionEncoder.java +++ b/src/main/java/net/minecraft/network/CompressionEncoder.java @@ -6,21 +6,36 @@ import io.netty.handler.codec.MessageToByteEncoder; @@ -214,7 +214,7 @@ index 859af8c845bae9781a62fa4acae56c6e2d449e10..f67f59f287d9a5cdd685b6b56ed1daf3 byte[] bs = new byte[i]; byteBuf.readBytes(bs); VarInt.write(byteBuf2, bs.length); -@@ -33,10 +48,48 @@ public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> { +@@ -33,8 +48,46 @@ public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> { } this.deflater.reset(); @@ -229,10 +229,9 @@ index 859af8c845bae9781a62fa4acae56c6e2d449e10..f67f59f287d9a5cdd685b6b56ed1daf3 + compatibleIn.release(); + } + // Paper end - Use Velocity cipher - } - - } - ++ } ++ } ++ + // Paper start - Use Velocity cipher + @Override + protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) throws Exception{ @@ -256,13 +255,12 @@ index 859af8c845bae9781a62fa4acae56c6e2d449e10..f67f59f287d9a5cdd685b6b56ed1daf3 + public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { + if (this.compressor != null) { + this.compressor.close(); -+ } -+ } + } + } + // Paper end - Use Velocity cipher -+ + public int getThreshold() { return this.threshold; - } diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java index 7f2aa5e17fe675f3404d67b1794d2ca68b188eb9..fff375fd50fa1a804636a92ded1ae55cff42977d 100644 --- a/src/main/java/net/minecraft/network/Connection.java diff --git a/patches/server/1014-Detail-more-information-in-watchdog-dumps.patch b/patches/server/1014-Detail-more-information-in-watchdog-dumps.patch index e69bd162ef..2dce8a04c2 100644 --- a/patches/server/1014-Detail-more-information-in-watchdog-dumps.patch +++ b/patches/server/1014-Detail-more-information-in-watchdog-dumps.patch @@ -122,7 +122,7 @@ index 9d18da228c6709e7665ba8babb6ee6d0b36b5dc5..af9f58328c09dddb2875f79128f906b8 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 f220e9ba35b07b690df93b1d733e9c666c772de9..c1a8de736ee39e4e177399bc51aedfd135a8100d 100644 +index eb269e90c62544d6e56ac8e6e81d0e5d4bc1f7e9..865c5ee8a8a14ef1a7d71dcab3e324932d065d5f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1063,8 +1063,43 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/1015-Collision-optimisations.patch b/patches/server/1015-Collision-optimisations.patch index 176352b0ab..2b153fafde 100644 --- a/patches/server/1015-Collision-optimisations.patch +++ b/patches/server/1015-Collision-optimisations.patch @@ -2153,10 +2153,10 @@ index 0000000000000000000000000000000000000000..1f42bdfdb052056e62a939ab0d1944f8 + +} diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java -index 073c717bb676b9e99aada00c349fb7eee91df1e7..2a9fc1f1dfc0c5894c1e74dad5a79ae9b02ac74f 100644 +index 83a2b952df749b7aaab439db4ec2d38bc4f5b11c..6bcf4d8e5c69dbc655d522abadc7f14ee7b21d71 100644 --- a/src/main/java/net/minecraft/core/Direction.java +++ b/src/main/java/net/minecraft/core/Direction.java -@@ -57,6 +57,21 @@ public enum Direction implements StringRepresentable { +@@ -53,6 +53,21 @@ public enum Direction implements StringRepresentable { private final int adjY; private final int adjZ; // Paper end - Perf: Inline shift direction fields @@ -2179,7 +2179,7 @@ index 073c717bb676b9e99aada00c349fb7eee91df1e7..2a9fc1f1dfc0c5894c1e74dad5a79ae9 private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) { this.data3d = id; diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index acc9858e0cf10cb2aae0554037096411a208bd05..c99d2f2d64b73179e4e27b63030e26a07953041b 100644 +index acc1751324f040accc4fc18914ed281e572358eb..17a6d43685f35a6978c2d941876a1f8a9a2c8b42 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -496,7 +496,7 @@ public class ServerPlayer extends Player { @@ -2214,7 +2214,7 @@ index 594cb6ce4bfa6c42212000a1ed983ea95ee2c4bf..97b0119ac71284b3a223c089bec26d87 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 c1a8de736ee39e4e177399bc51aedfd135a8100d..6de971aca46caad091271d125a079a1b7a5f163d 100644 +index 865c5ee8a8a14ef1a7d71dcab3e324932d065d5f..8c2c877a26af90dae6d083e12a51384755c7a1de 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1250,9 +1250,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2466,10 +2466,10 @@ index ffa4f34d964fbcc53e2dfe11677832db21a6eb93..7618364e5373fe17cfe45a5a4ee9ab25 } diff --git a/src/main/java/net/minecraft/world/level/BlockCollisions.java b/src/main/java/net/minecraft/world/level/BlockCollisions.java -index a3eaf80b020c3bbc0306c5d17659ee661dfd275b..1b6f72932fbdd567a1534bcf15e8a610b00f974d 100644 +index 354290f88af285af229e4315e53e9bd76439d0da..b87bcc4a465fb83463da4811a79c381141c6f70b 100644 --- a/src/main/java/net/minecraft/world/level/BlockCollisions.java +++ b/src/main/java/net/minecraft/world/level/BlockCollisions.java -@@ -105,7 +105,7 @@ public class BlockCollisions<T> extends AbstractIterator<T> { +@@ -107,7 +107,7 @@ public class BlockCollisions<T> extends AbstractIterator<T> { VoxelShape voxelShape = blockState.getCollisionShape(this.collisionGetter, this.pos, this.context); if (voxelShape == Shapes.block()) { @@ -2494,7 +2494,7 @@ index 86a4f30c8784c602436ecf1c78efb0bdca4b7089..b0bea28e9261767c60d30fb0e76f4f3a public ClipContext(Vec3 start, Vec3 end, ClipContext.Block shapeType, ClipContext.Fluid fluidHandling, Entity entity) { diff --git a/src/main/java/net/minecraft/world/level/CollisionGetter.java b/src/main/java/net/minecraft/world/level/CollisionGetter.java -index c476e37df8a75d77f5093b2a449e04f25ef2c2dd..5d66aadae51db1ae760812849bfc8740b82af9a9 100644 +index a4200e1992207e7665673c2acdb45facfd0bc676..4e32426a3d261f77d6066bb5256596a4ae0de0a3 100644 --- a/src/main/java/net/minecraft/world/level/CollisionGetter.java +++ b/src/main/java/net/minecraft/world/level/CollisionGetter.java @@ -35,6 +35,12 @@ public interface CollisionGetter extends BlockGetter { @@ -2508,13 +2508,13 @@ index c476e37df8a75d77f5093b2a449e04f25ef2c2dd..5d66aadae51db1ae760812849bfc8740 + // Paper end - optimise collisions + default boolean noCollision(AABB box) { - return this.noCollision((Entity)null, box); + return this.noCollision(null, box); } diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index cc888bbcd6a50124fa553bc4a8ffd1e8885d3856..f42dd9602805e9d538506ee4e3eac7e2811a3da6 100644 +index eba4663a6928989bfa14d57303d77fdabea31481..44cfa3821774f22ac05aa679fdee34d8d68b7d60 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -45,17 +45,36 @@ public interface EntityGetter { +@@ -46,20 +46,36 @@ public interface EntityGetter { } default boolean isUnobstructed(@Nullable Entity except, VoxelShape shape) { @@ -2522,8 +2522,11 @@ index cc888bbcd6a50124fa553bc4a8ffd1e8885d3856..f42dd9602805e9d538506ee4e3eac7e2 if (shape.isEmpty()) { - return true; - } else { -- for(Entity entity : this.getEntities(except, shape.bounds())) { -- if (!entity.isRemoved() && entity.blocksBuilding && (except == null || !entity.isPassengerOfSameVehicle(except)) && Shapes.joinIsNotEmpty(shape, Shapes.create(entity.getBoundingBox()), BooleanOp.AND)) { +- for (Entity entity : this.getEntities(except, shape.bounds())) { +- if (!entity.isRemoved() +- && entity.blocksBuilding +- && (except == null || !entity.isPassengerOfSameVehicle(except)) +- && Shapes.joinIsNotEmpty(shape, Shapes.create(entity.getBoundingBox()), BooleanOp.AND)) { - return false; + return false; + } @@ -2557,11 +2560,11 @@ index cc888bbcd6a50124fa553bc4a8ffd1e8885d3856..f42dd9602805e9d538506ee4e3eac7e2 } default <T extends Entity> List<T> getEntitiesOfClass(Class<T> entityClass, AABB box) { -@@ -63,23 +82,41 @@ public interface EntityGetter { +@@ -67,23 +83,41 @@ public interface EntityGetter { } default List<VoxelShape> getEntityCollisions(@Nullable Entity entity, AABB box) { -- if (box.getSize() < 1.0E-7D) { +- if (box.getSize() < 1.0E-7) { - return List.of(); + // Paper start - optimise collisions + // first behavior change is to correctly check for empty AABB @@ -2580,13 +2583,13 @@ index cc888bbcd6a50124fa553bc4a8ffd1e8885d3856..f42dd9602805e9d538506ee4e3eac7e2 + entities = this.getEntities(entity, box, null); } else { - Predicate<Entity> predicate = entity == null ? EntitySelector.CAN_BE_COLLIDED_WITH : EntitySelector.NO_SPECTATORS.and(entity::canCollideWith); -- List<Entity> list = this.getEntities(entity, box.inflate(1.0E-7D), predicate); +- List<Entity> list = this.getEntities(entity, box.inflate(1.0E-7), predicate); - if (list.isEmpty()) { - return List.of(); - } else { -- ImmutableList.Builder<VoxelShape> builder = ImmutableList.builderWithExpectedSize(list.size()); +- Builder<VoxelShape> builder = ImmutableList.builderWithExpectedSize(list.size()); - -- for(Entity entity2 : list) { +- for (Entity entity2 : list) { - builder.add(Shapes.create(entity2.getBoundingBox())); - } + entities = this.getHardCollidingEntities(entity, box, null); @@ -3215,7 +3218,7 @@ index a98ab20814cc29a25e9d29adfbb7e70d46768df2..6d8ff6c06af5545634f255ed17dc1e48 if (!state.getBlock().hasDynamicShape() && !fromState.getBlock().hasDynamicShape()) { diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java -index b8443953de15066f32f629c0dd7e24bad750f558..67d595f75e0c3bffdb27b85b25ccd1f0bf1427d5 100644 +index 62752e28a68400f0e1a44f0196f0e51e3dd702b8..92394960fc76886f393cba02ac33c57739a4b383 100644 --- a/src/main/java/net/minecraft/world/phys/AABB.java +++ b/src/main/java/net/minecraft/world/phys/AABB.java @@ -25,6 +25,17 @@ public class AABB { @@ -3236,21 +3239,21 @@ index b8443953de15066f32f629c0dd7e24bad750f558..67d595f75e0c3bffdb27b85b25ccd1f0 public AABB(BlockPos pos) { this((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 1), (double)(pos.getZ() + 1)); } -@@ -305,7 +316,7 @@ public class AABB { +@@ -321,7 +332,7 @@ public class AABB { } @Nullable -- private static Direction getDirection(AABB box, Vec3 intersectingVector, double[] traceDistanceResult, @Nullable Direction approachDirection, double deltaX, double deltaY, double deltaZ) { -+ public static Direction getDirection(AABB box, Vec3 intersectingVector, double[] traceDistanceResult, @Nullable Direction approachDirection, double deltaX, double deltaY, double deltaZ) { // Paper - optimise collisions - public - if (deltaX > 1.0E-7D) { - approachDirection = clipPoint(traceDistanceResult, approachDirection, deltaX, deltaY, deltaZ, box.minX, box.minY, box.maxY, box.minZ, box.maxZ, Direction.WEST, intersectingVector.x, intersectingVector.y, intersectingVector.z); - } else if (deltaX < -1.0E-7D) { +- private static Direction getDirection( ++ public static Direction getDirection( // Paper - optimise collisions - public + AABB box, Vec3 intersectingVector, double[] traceDistanceResult, @Nullable Direction approachDirection, double deltaX, double deltaY, double deltaZ + ) { + if (deltaX > 1.0E-7) { diff --git a/src/main/java/net/minecraft/world/phys/shapes/ArrayVoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/ArrayVoxelShape.java -index 9d627b8e6bf3140b894d38b9a720896e2d776369..a232b9396a41c11579a4d691b05717b16473513e 100644 +index fc7f986812bdf74e0aea3bd09a1d53ba6def697f..0583d40a235aaecd9d6081486bbfb7355709a5ac 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/ArrayVoxelShape.java +++ b/src/main/java/net/minecraft/world/phys/shapes/ArrayVoxelShape.java -@@ -15,7 +15,7 @@ public class ArrayVoxelShape extends VoxelShape { - this(shape, (DoubleList)DoubleArrayList.wrap(Arrays.copyOf(xPoints, shape.getXSize() + 1)), (DoubleList)DoubleArrayList.wrap(Arrays.copyOf(yPoints, shape.getYSize() + 1)), (DoubleList)DoubleArrayList.wrap(Arrays.copyOf(zPoints, shape.getZSize() + 1))); +@@ -20,7 +20,7 @@ public class ArrayVoxelShape extends VoxelShape { + ); } - ArrayVoxelShape(DiscreteVoxelShape shape, DoubleList xPoints, DoubleList yPoints, DoubleList zPoints) { @@ -3258,22 +3261,22 @@ index 9d627b8e6bf3140b894d38b9a720896e2d776369..a232b9396a41c11579a4d691b05717b1 super(shape); int i = shape.getXSize() + 1; int j = shape.getYSize() + 1; -@@ -27,6 +27,7 @@ public class ArrayVoxelShape extends VoxelShape { - } else { - throw (IllegalArgumentException)Util.pauseInIde(new IllegalArgumentException("Lengths of point arrays must be consistent with the size of the VoxelShape.")); +@@ -34,6 +34,7 @@ public class ArrayVoxelShape extends VoxelShape { + new IllegalArgumentException("Lengths of point arrays must be consistent with the size of the VoxelShape.") + ); } + this.initCache(); // Paper - optimise collisions } @Override -@@ -42,4 +43,5 @@ public class ArrayVoxelShape extends VoxelShape { +@@ -49,4 +50,5 @@ public class ArrayVoxelShape extends VoxelShape { throw new IllegalArgumentException(); } } + } diff --git a/src/main/java/net/minecraft/world/phys/shapes/BitSetDiscreteVoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/BitSetDiscreteVoxelShape.java -index c25f409d63a50c5de1434db1d6b298935f106221..6f532d9aa613ecb0f5695b108ec6d7ed3598ca82 100644 +index 31b570517c1047e8e1cd5280baf80977af2b6121..d8b80632f6186641ee2ddaef9eba7ba998b09136 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/BitSetDiscreteVoxelShape.java +++ b/src/main/java/net/minecraft/world/phys/shapes/BitSetDiscreteVoxelShape.java @@ -4,13 +4,13 @@ import java.util.BitSet; @@ -3297,7 +3300,7 @@ index c25f409d63a50c5de1434db1d6b298935f106221..6f532d9aa613ecb0f5695b108ec6d7ed public BitSetDiscreteVoxelShape(int sizeX, int sizeY, int sizeZ) { super(sizeX, sizeY, sizeZ); -@@ -150,46 +150,106 @@ public final class BitSetDiscreteVoxelShape extends DiscreteVoxelShape { +@@ -151,45 +151,106 @@ public final class BitSetDiscreteVoxelShape extends DiscreteVoxelShape { } protected static void forAllBoxes(DiscreteVoxelShape voxelSet, DiscreteVoxelShape.IntLineConsumer callback, boolean coalesce) { @@ -3305,11 +3308,22 @@ index c25f409d63a50c5de1434db1d6b298935f106221..6f532d9aa613ecb0f5695b108ec6d7ed + // Paper start - optimise collisions + // called with the shape of a VoxelShape, so we can expect the cache to exist + final io.papermc.paper.util.collisions.CachedShapeData cache = voxelSet.getOrCreateCachedShapeData(); -+ + +- for (int i = 0; i < bitSetDiscreteVoxelShape.ySize; i++) { +- for (int j = 0; j < bitSetDiscreteVoxelShape.xSize; j++) { +- int k = -1; + final int sizeX = cache.sizeX(); + final int sizeY = cache.sizeY(); + final int sizeZ = cache.sizeZ(); -+ + +- for (int l = 0; l <= bitSetDiscreteVoxelShape.zSize; l++) { +- if (bitSetDiscreteVoxelShape.isFullWide(j, i, l)) { +- if (coalesce) { +- if (k == -1) { +- k = l; +- } +- } else { +- callback.consume(j, i, l, j + 1, i + 1, l + 1); + int indexX; + int indexY = 0; + int indexZ; @@ -3339,21 +3353,10 @@ index c25f409d63a50c5de1434db1d6b298935f106221..6f532d9aa613ecb0f5695b108ec6d7ed + } else { + // same notes about loop order as the above + // this branch is actually important to optimise, as it affects uncached toAabbs() (which affects optimize()) - -- for(int i = 0; i < bitSetDiscreteVoxelShape.ySize; ++i) { -- for(int j = 0; j < bitSetDiscreteVoxelShape.xSize; ++j) { -- int k = -1; ++ + // only clone when we may write to it + bitset = bitset.clone(); - -- for(int l = 0; l <= bitSetDiscreteVoxelShape.zSize; ++l) { -- if (bitSetDiscreteVoxelShape.isFullWide(j, i, l)) { -- if (coalesce) { -- if (k == -1) { -- k = l; -- } -- } else { -- callback.consume(j, i, l, j + 1, i + 1, l + 1); ++ + for (int y = 0; y < sizeY; ++y, indexY += incY) { + indexX = indexY; + for (int x = 0; x < sizeX; ++x, indexX += incX) { @@ -3368,17 +3371,17 @@ index c25f409d63a50c5de1434db1d6b298935f106221..6f532d9aa613ecb0f5695b108ec6d7ed - int n = i; - bitSetDiscreteVoxelShape.clearZStrip(k, l, j, i); - -- while(bitSetDiscreteVoxelShape.isZStripFull(k, l, m + 1, i)) { +- while (bitSetDiscreteVoxelShape.isZStripFull(k, l, m + 1, i)) { - bitSetDiscreteVoxelShape.clearZStrip(k, l, m + 1, i); -- ++m; +- m++; + + int lastSetZ = io.papermc.paper.util.collisions.FlatBitsetUtil.firstClear(bitset, firstSetZ, endIndex); + if (lastSetZ == -1) { + lastSetZ = endIndex; } -- while(bitSetDiscreteVoxelShape.isXZRectangleFull(j, m + 1, k, l, n + 1)) { -- for(int o = j; o <= m; ++o) { +- while (bitSetDiscreteVoxelShape.isXZRectangleFull(j, m + 1, k, l, n + 1)) { +- for (int o = j; o <= m; o++) { - bitSetDiscreteVoxelShape.clearZStrip(k, l, o, n + 1); + io.papermc.paper.util.collisions.FlatBitsetUtil.clearRange(bitset, firstSetZ, lastSetZ); + @@ -3408,7 +3411,7 @@ index c25f409d63a50c5de1434db1d6b298935f106221..6f532d9aa613ecb0f5695b108ec6d7ed + } } -- ++n; +- n++; + ++endY; + + // passed, so we can clear it @@ -3426,13 +3429,12 @@ index c25f409d63a50c5de1434db1d6b298935f106221..6f532d9aa613ecb0f5695b108ec6d7ed } } } -- + // Paper end - optimise collisions } private boolean isZStripFull(int z1, int z2, int x, int y) { diff --git a/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java -index 68e89dbd79171627046e89699057964e44c40e7d..110405e6e70d980d3e09f04d79562b32a7413071 100644 +index 32632368f06b79f53342fde060bbcd1b7c64767a..b9af1d14c7815c99273bce8165cf384d669c1a75 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java +++ b/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java @@ -7,6 +7,7 @@ import net.minecraft.util.Mth; @@ -3444,7 +3446,7 @@ index 68e89dbd79171627046e89699057964e44c40e7d..110405e6e70d980d3e09f04d79562b32 @Override diff --git a/src/main/java/net/minecraft/world/phys/shapes/DiscreteVoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/DiscreteVoxelShape.java -index b27ed92b2a87d4c20c1aa300202adfab896c99ea..d0a4547f95ee24283af77cfa130979d05915292f 100644 +index 87a8f12dc3d47fb093115030e0222f065f1dcb1c..44b62f1f6685084c0cff02bd31eb5a7c2ef9eead 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/DiscreteVoxelShape.java +++ b/src/main/java/net/minecraft/world/phys/shapes/DiscreteVoxelShape.java @@ -9,6 +9,71 @@ public abstract class DiscreteVoxelShape { @@ -3535,12 +3537,12 @@ index 7ec02a7849437a18860aa0df7d9ddd71b2447d4c..5e45e49ab09344cb95736f4124b1c6e0 public OffsetDoubleList(DoubleList oldList, double offset) { this.delegate = oldList; diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8357900f4 100644 +index d88f69275ffee4669dd6d31e2669c41f66a1919d..ce8fff01475bdfe9094c237fc5f294f3958edb42 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java +++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -@@ -16,13 +16,43 @@ public final class Shapes { - public static final double EPSILON = 1.0E-7D; - public static final double BIG_EPSILON = 1.0E-6D; +@@ -16,9 +16,15 @@ public final class Shapes { + public static final double EPSILON = 1.0E-7; + public static final double BIG_EPSILON = 1.0E-6; private static final VoxelShape BLOCK = Util.make(() -> { - DiscreteVoxelShape discreteVoxelShape = new BitSetDiscreteVoxelShape(1, 1, 1); - discreteVoxelShape.fill(0, 0, 0); @@ -3555,8 +3557,11 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 + ); + // Paper end - optimise collisions - force arrayvoxelshape }); - public static final VoxelShape INFINITY = box(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); - private static final VoxelShape EMPTY = new ArrayVoxelShape(new BitSetDiscreteVoxelShape(0, 0, 0), (DoubleList)(new DoubleArrayList(new double[]{0.0D})), (DoubleList)(new DoubleArrayList(new double[]{0.0D})), (DoubleList)(new DoubleArrayList(new double[]{0.0D}))); + public static final VoxelShape INFINITY = box( + Double.NEGATIVE_INFINITY, +@@ -35,6 +41,30 @@ public final class Shapes { + new DoubleArrayList(new double[]{0.0}) + ); + // Paper start - optimise collisions - force arrayvoxelshape + private static final DoubleArrayList[] PARTS_BY_BITS = new DoubleArrayList[] { @@ -3585,16 +3590,22 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 public static VoxelShape empty() { return EMPTY; } -@@ -41,22 +71,39 @@ public final class Shapes { +@@ -53,35 +83,39 @@ public final class Shapes { public static VoxelShape create(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { - if (!(maxX - minX < 1.0E-7D) && !(maxY - minY < 1.0E-7D) && !(maxZ - minZ < 1.0E-7D)) { + if (!(maxX - minX < 1.0E-7) && !(maxY - minY < 1.0E-7) && !(maxZ - minZ < 1.0E-7)) { - int i = findBits(minX, maxX); - int j = findBits(minY, maxY); - int k = findBits(minZ, maxZ); -- if (i >= 0 && j >= 0 && k >= 0) { -- if (i == 0 && j == 0 && k == 0) { -- return block(); +- if (i < 0 || j < 0 || k < 0) { +- return new ArrayVoxelShape( +- BLOCK.shape, +- DoubleArrayList.wrap(new double[]{minX, maxX}), +- DoubleArrayList.wrap(new double[]{minY, maxY}), +- DoubleArrayList.wrap(new double[]{minZ, maxZ}) +- ); +- } else if (i == 0 && j == 0 && k == 0) { +- return block(); + // Paper start - optimise collisions + // force ArrayVoxelShape in every case + final int bitsX = findBits(minX, maxX); @@ -3603,12 +3614,7 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 + if (bitsX >= 0 && bitsY >= 0 && bitsZ >= 0) { + if (bitsX == 0 && bitsY == 0 && bitsZ == 0) { + return BLOCK; - } else { -- int l = 1 << i; -- int m = 1 << j; -- int n = 1 << k; -- BitSetDiscreteVoxelShape bitSetDiscreteVoxelShape = BitSetDiscreteVoxelShape.withFilledBounds(l, m, n, (int)Math.round(minX * (double)l), (int)Math.round(minY * (double)m), (int)Math.round(minZ * (double)n), (int)Math.round(maxX * (double)l), (int)Math.round(maxY * (double)m), (int)Math.round(maxZ * (double)n)); -- return new CubeVoxelShape(bitSetDiscreteVoxelShape); ++ } else { + final int sizeX = 1 << bitsX; + final int sizeY = 1 << bitsY; + final int sizeZ = 1 << bitsZ; @@ -3623,21 +3629,34 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 + PARTS_BY_BITS[bitsY], + PARTS_BY_BITS[bitsZ] + ); - } ++ } } else { -- return new ArrayVoxelShape(BLOCK.shape, (DoubleList)DoubleArrayList.wrap(new double[]{minX, maxX}), (DoubleList)DoubleArrayList.wrap(new double[]{minY, maxY}), (DoubleList)DoubleArrayList.wrap(new double[]{minZ, maxZ})); +- int l = 1 << i; +- int m = 1 << j; +- int n = 1 << k; +- BitSetDiscreteVoxelShape bitSetDiscreteVoxelShape = BitSetDiscreteVoxelShape.withFilledBounds( +- l, +- m, +- n, +- (int)Math.round(minX * (double)l), +- (int)Math.round(minY * (double)m), +- (int)Math.round(minZ * (double)n), +- (int)Math.round(maxX * (double)l), +- (int)Math.round(maxY * (double)m), +- (int)Math.round(maxZ * (double)n) + return new ArrayVoxelShape( + BLOCK.shape, + minX == 0.0 && maxX == 1.0 ? io.papermc.paper.util.CollisionUtil.ZERO_ONE : DoubleArrayList.wrap(new double[] { minX, maxX }), + minY == 0.0 && maxY == 1.0 ? io.papermc.paper.util.CollisionUtil.ZERO_ONE : DoubleArrayList.wrap(new double[] { minY, maxY }), + minZ == 0.0 && maxZ == 1.0 ? io.papermc.paper.util.CollisionUtil.ZERO_ONE : DoubleArrayList.wrap(new double[] { minZ, maxZ }) -+ ); + ); +- return new CubeVoxelShape(bitSetDiscreteVoxelShape); } + // Paper end - optimise collisions } else { return empty(); } -@@ -95,67 +142,53 @@ public final class Shapes { +@@ -120,79 +154,53 @@ public final class Shapes { } public static VoxelShape or(VoxelShape first, VoxelShape... others) { @@ -3699,9 +3718,17 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 - } else { - IndexMerger indexMerger = createIndexMerger(1, one.getCoords(Direction.Axis.X), two.getCoords(Direction.Axis.X), bl, bl2); - IndexMerger indexMerger2 = createIndexMerger(indexMerger.size() - 1, one.getCoords(Direction.Axis.Y), two.getCoords(Direction.Axis.Y), bl, bl2); -- IndexMerger indexMerger3 = createIndexMerger((indexMerger.size() - 1) * (indexMerger2.size() - 1), one.getCoords(Direction.Axis.Z), two.getCoords(Direction.Axis.Z), bl, bl2); -- BitSetDiscreteVoxelShape bitSetDiscreteVoxelShape = BitSetDiscreteVoxelShape.join(one.shape, two.shape, indexMerger, indexMerger2, indexMerger3, function); -- return (VoxelShape)(indexMerger instanceof DiscreteCubeMerger && indexMerger2 instanceof DiscreteCubeMerger && indexMerger3 instanceof DiscreteCubeMerger ? new CubeVoxelShape(bitSetDiscreteVoxelShape) : new ArrayVoxelShape(bitSetDiscreteVoxelShape, indexMerger.getList(), indexMerger2.getList(), indexMerger3.getList())); +- IndexMerger indexMerger3 = createIndexMerger( +- (indexMerger.size() - 1) * (indexMerger2.size() - 1), one.getCoords(Direction.Axis.Z), two.getCoords(Direction.Axis.Z), bl, bl2 +- ); +- BitSetDiscreteVoxelShape bitSetDiscreteVoxelShape = BitSetDiscreteVoxelShape.join( +- one.shape, two.shape, indexMerger, indexMerger2, indexMerger3, function +- ); +- return (VoxelShape)(indexMerger instanceof DiscreteCubeMerger +- && indexMerger2 instanceof DiscreteCubeMerger +- && indexMerger3 instanceof DiscreteCubeMerger +- ? new CubeVoxelShape(bitSetDiscreteVoxelShape) +- : new ArrayVoxelShape(bitSetDiscreteVoxelShape, indexMerger.getList(), indexMerger2.getList(), indexMerger3.getList())); - } - } + return io.papermc.paper.util.CollisionUtil.joinUnoptimized(one, two, function); // Paper - optimise collisions @@ -3720,19 +3747,23 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 - boolean bl3 = predicate.apply(true, false); - boolean bl4 = predicate.apply(false, true); - -- for(Direction.Axis axis : AxisCycle.AXIS_VALUES) { -- if (shape1.max(axis) < shape2.min(axis) - 1.0E-7D) { +- for (Direction.Axis axis : AxisCycle.AXIS_VALUES) { +- if (shape1.max(axis) < shape2.min(axis) - 1.0E-7) { - return bl3 || bl4; - } - -- if (shape2.max(axis) < shape1.min(axis) - 1.0E-7D) { +- if (shape2.max(axis) < shape1.min(axis) - 1.0E-7) { - return bl3 || bl4; - } - } - - IndexMerger indexMerger = createIndexMerger(1, shape1.getCoords(Direction.Axis.X), shape2.getCoords(Direction.Axis.X), bl3, bl4); -- IndexMerger indexMerger2 = createIndexMerger(indexMerger.size() - 1, shape1.getCoords(Direction.Axis.Y), shape2.getCoords(Direction.Axis.Y), bl3, bl4); -- IndexMerger indexMerger3 = createIndexMerger((indexMerger.size() - 1) * (indexMerger2.size() - 1), shape1.getCoords(Direction.Axis.Z), shape2.getCoords(Direction.Axis.Z), bl3, bl4); +- IndexMerger indexMerger2 = createIndexMerger( +- indexMerger.size() - 1, shape1.getCoords(Direction.Axis.Y), shape2.getCoords(Direction.Axis.Y), bl3, bl4 +- ); +- IndexMerger indexMerger3 = createIndexMerger( +- (indexMerger.size() - 1) * (indexMerger2.size() - 1), shape1.getCoords(Direction.Axis.Z), shape2.getCoords(Direction.Axis.Z), bl3, bl4 +- ); - return joinIsNotEmpty(indexMerger, indexMerger2, indexMerger3, shape1.shape, shape2.shape, predicate); - } - } else { @@ -3742,8 +3773,8 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 + return io.papermc.paper.util.CollisionUtil.isJoinNonEmpty(shape1, shape2, predicate); // Paper - optimise collisions } - private static boolean joinIsNotEmpty(IndexMerger mergedX, IndexMerger mergedY, IndexMerger mergedZ, DiscreteVoxelShape shape1, DiscreteVoxelShape shape2, BooleanOp predicate) { -@@ -181,69 +214,119 @@ public final class Shapes { + private static boolean joinIsNotEmpty( +@@ -220,69 +228,119 @@ public final class Shapes { } public static boolean blockOccudes(VoxelShape shape, VoxelShape neighbor, Direction direction) { @@ -3758,15 +3789,8 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 + } + + if (shape.isEmpty() | neighbor.isEmpty()) { - return false; -- } else { -- Direction.Axis axis = direction.getAxis(); -- Direction.AxisDirection axisDirection = direction.getAxisDirection(); -- VoxelShape voxelShape = axisDirection == Direction.AxisDirection.POSITIVE ? shape : neighbor; -- VoxelShape voxelShape2 = axisDirection == Direction.AxisDirection.POSITIVE ? neighbor : shape; -- BooleanOp booleanOp = axisDirection == Direction.AxisDirection.POSITIVE ? BooleanOp.ONLY_FIRST : BooleanOp.ONLY_SECOND; -- return DoubleMath.fuzzyEquals(voxelShape.max(axis), 1.0D, 1.0E-7D) && DoubleMath.fuzzyEquals(voxelShape2.min(axis), 0.0D, 1.0E-7D) && !joinIsNotEmpty(new SliceShape(voxelShape, axis, voxelShape.shape.getSize(axis) - 1), new SliceShape(voxelShape2, axis, 0), booleanOp); - } ++ return false; ++ } + + // we optimise getOpposite, so we can use it + // secondly, use our cache to retrieve sliced shape @@ -3776,8 +3800,17 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 + } + final VoxelShape newSecond = neighbor.getFaceShapeClamped(direction.getOpposite()); + if (newSecond.isEmpty()) { -+ return false; -+ } + return false; +- } else { +- Direction.Axis axis = direction.getAxis(); +- Direction.AxisDirection axisDirection = direction.getAxisDirection(); +- VoxelShape voxelShape = axisDirection == Direction.AxisDirection.POSITIVE ? shape : neighbor; +- VoxelShape voxelShape2 = axisDirection == Direction.AxisDirection.POSITIVE ? neighbor : shape; +- BooleanOp booleanOp = axisDirection == Direction.AxisDirection.POSITIVE ? BooleanOp.ONLY_FIRST : BooleanOp.ONLY_SECOND; +- return DoubleMath.fuzzyEquals(voxelShape.max(axis), 1.0, 1.0E-7) +- && DoubleMath.fuzzyEquals(voxelShape2.min(axis), 0.0, 1.0E-7) +- && !joinIsNotEmpty(new SliceShape(voxelShape, axis, voxelShape.shape.getSize(axis) - 1), new SliceShape(voxelShape2, axis, 0), booleanOp); + } + + return !joinIsNotEmpty(newFirst, newSecond, BooleanOp.ONLY_FIRST); + // Paper end - optimise collisions @@ -3791,10 +3824,10 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 - boolean bl; - int i; - if (direction.getAxisDirection() == Direction.AxisDirection.POSITIVE) { -- bl = DoubleMath.fuzzyEquals(shape.max(axis), 1.0D, 1.0E-7D); +- bl = DoubleMath.fuzzyEquals(shape.max(axis), 1.0, 1.0E-7); - i = shape.shape.getSize(axis) - 1; - } else { -- bl = DoubleMath.fuzzyEquals(shape.min(axis), 0.0D, 1.0E-7D); +- bl = DoubleMath.fuzzyEquals(shape.min(axis), 0.0, 1.0E-7); - i = 0; - } + return shape.getFaceShapeClamped(direction); // Paper - optimise collisions @@ -3828,7 +3861,7 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 - Direction.AxisDirection axisDirection = direction.getAxisDirection(); - VoxelShape voxelShape = axisDirection == Direction.AxisDirection.POSITIVE ? one : two; - VoxelShape voxelShape2 = axisDirection == Direction.AxisDirection.POSITIVE ? two : one; -- if (!DoubleMath.fuzzyEquals(voxelShape.max(axis), 1.0D, 1.0E-7D)) { +- if (!DoubleMath.fuzzyEquals(voxelShape.max(axis), 1.0, 1.0E-7)) { - voxelShape = empty(); - } + // Paper start - optimise collisions @@ -3837,14 +3870,18 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 + return true; + } -- if (!DoubleMath.fuzzyEquals(voxelShape2.min(axis), 0.0D, 1.0E-7D)) { +- if (!DoubleMath.fuzzyEquals(voxelShape2.min(axis), 0.0, 1.0E-7)) { - voxelShape2 = empty(); - } + if (one.isEmpty() & two.isEmpty()) { + return false; + } -- return !joinIsNotEmpty(block(), joinUnoptimized(new SliceShape(voxelShape, axis, voxelShape.shape.getSize(axis) - 1), new SliceShape(voxelShape2, axis, 0), BooleanOp.OR), BooleanOp.ONLY_FIRST); +- return !joinIsNotEmpty( +- block(), +- joinUnoptimized(new SliceShape(voxelShape, axis, voxelShape.shape.getSize(axis) - 1), new SliceShape(voxelShape2, axis, 0), BooleanOp.OR), +- BooleanOp.ONLY_FIRST +- ); - } else { + // we optimise getOpposite, so we can use it + // secondly, use our cache to retrieve sliced shape @@ -3876,17 +3913,13 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 } public static boolean faceShapeOccludes(VoxelShape one, VoxelShape two) { -- if (one != block() && two != block()) { -- if (one.isEmpty() && two.isEmpty()) { -- return false; -- } else { -- return !joinIsNotEmpty(block(), joinUnoptimized(one, two, BooleanOp.OR), BooleanOp.ONLY_FIRST); -- } -- } else { +- return one == block() +- || two == block() +- || (!one.isEmpty() || !two.isEmpty()) && !joinIsNotEmpty(block(), joinUnoptimized(one, two, BooleanOp.OR), BooleanOp.ONLY_FIRST); + // Paper start - optimise collisions + if (one.occludesFullBlockIfCached() || two.occludesFullBlockIfCached()) { - return true; - } ++ return true; ++ } + + final boolean s1Empty = one.isEmpty(); + final boolean s2Empty = two.isEmpty(); @@ -3908,7 +3941,7 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 @VisibleForTesting diff --git a/src/main/java/net/minecraft/world/phys/shapes/SliceShape.java b/src/main/java/net/minecraft/world/phys/shapes/SliceShape.java -index cf469f9daa81da8bc330c9cac7e813db87f9f9af..d9256710e815a5cb55409a80d59df2029b98c0d7 100644 +index 53aa193f33a1a15376a59b8d6dd8cbc6cbec168b..a745ff8d115e1d0da6138e4f06726e0737bb1600 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/SliceShape.java +++ b/src/main/java/net/minecraft/world/phys/shapes/SliceShape.java @@ -12,6 +12,7 @@ public class SliceShape extends VoxelShape { @@ -3920,10 +3953,10 @@ index cf469f9daa81da8bc330c9cac7e813db87f9f9af..d9256710e815a5cb55409a80d59df202 private static DiscreteVoxelShape makeSlice(DiscreteVoxelShape voxelSet, Direction.Axis axis, int sliceWidth) { diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java -index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd3744888fc34 100644 +index 80899dc599f05198cc58524355b66791dc418141..6ed187fa64dcbd01927c5180739dc8aaaf1fbe72 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java +++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java -@@ -16,30 +16,438 @@ import net.minecraft.world.phys.BlockHitResult; +@@ -16,37 +16,438 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; public abstract class VoxelShape { @@ -3937,7 +3970,7 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 + private double offsetX; + private double offsetY; + private double offsetZ; -+ private AABB singleAABBRepresentation; ++ @Nullable private AABB singleAABBRepresentation; + private double[] rootCoordinatesX; + private double[] rootCoordinatesY; + private double[] rootCoordinatesZ; @@ -4335,7 +4368,14 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 - if (this.isEmpty()) { - throw (UnsupportedOperationException)Util.pauseInIde(new UnsupportedOperationException("No bounds for empty shape.")); - } else { -- return new AABB(this.min(Direction.Axis.X), this.min(Direction.Axis.Y), this.min(Direction.Axis.Z), this.max(Direction.Axis.X), this.max(Direction.Axis.Y), this.max(Direction.Axis.Z)); +- return new AABB( +- this.min(Direction.Axis.X), +- this.min(Direction.Axis.Y), +- this.min(Direction.Axis.Z), +- this.max(Direction.Axis.X), +- this.max(Direction.Axis.Y), +- this.max(Direction.Axis.Z) +- ); + // Paper start - optimise collisions + if (this.isEmpty) { + throw Util.pauseInIde(new UnsupportedOperationException("No bounds for empty shape.")); @@ -4372,7 +4412,7 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 } public VoxelShape singleEncompassing() { -@@ -53,19 +461,106 @@ public abstract class VoxelShape { +@@ -69,26 +470,106 @@ public abstract class VoxelShape { protected abstract DoubleList getCoords(Direction.Axis axis); public boolean isEmpty() { @@ -4390,14 +4430,20 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 + // Paper end - optimise collisions + public VoxelShape move(double x, double y, double z) { -- return (VoxelShape)(this.isEmpty() ? Shapes.empty() : new ArrayVoxelShape(this.shape, (DoubleList)(new OffsetDoubleList(this.getCoords(Direction.Axis.X), x)), (DoubleList)(new OffsetDoubleList(this.getCoords(Direction.Axis.Y), y)), (DoubleList)(new OffsetDoubleList(this.getCoords(Direction.Axis.Z), z)))); +- return (VoxelShape)(this.isEmpty() +- ? Shapes.empty() +- : new ArrayVoxelShape( + // Paper start - optimise collisions + if (this.isEmpty) { + return Shapes.empty(); + } + + final ArrayVoxelShape ret = new ArrayVoxelShape( -+ this.shape, + this.shape, +- new OffsetDoubleList(this.getCoords(Direction.Axis.X), x), +- new OffsetDoubleList(this.getCoords(Direction.Axis.Y), y), +- new OffsetDoubleList(this.getCoords(Direction.Axis.Z), z) +- )); + offsetList(this.getCoords(Direction.Axis.X), x), + offsetList(this.getCoords(Direction.Axis.Y), y), + offsetList(this.getCoords(Direction.Axis.Z), z) @@ -4486,8 +4532,8 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 } public void forAllEdges(Shapes.DoubleLineConsumer consumer) { -@@ -83,12 +578,43 @@ public abstract class VoxelShape { - }, true); +@@ -128,12 +609,43 @@ public abstract class VoxelShape { + ); } + // Paper start - optimise collisions @@ -4535,7 +4581,7 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 } public double min(Direction.Axis axis, double from, double to) { -@@ -115,37 +641,85 @@ public abstract class VoxelShape { +@@ -160,43 +672,85 @@ public abstract class VoxelShape { }) - 1; } @@ -4568,11 +4614,18 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 return null; - } else { - Vec3 vec3 = end.subtract(start); -- if (vec3.lengthSqr() < 1.0E-7D) { +- if (vec3.lengthSqr() < 1.0E-7) { - return null; - } else { -- Vec3 vec32 = start.add(vec3.scale(0.001D)); -- return this.shape.isFullWide(this.findIndex(Direction.Axis.X, vec32.x - (double)pos.getX()), this.findIndex(Direction.Axis.Y, vec32.y - (double)pos.getY()), this.findIndex(Direction.Axis.Z, vec32.z - (double)pos.getZ())) ? new BlockHitResult(vec32, Direction.getNearest(vec3.x, vec3.y, vec3.z).getOpposite(), pos, true) : AABB.clip(this.toAabbs(), start, end, pos); +- Vec3 vec32 = start.add(vec3.scale(0.001)); +- return this.shape +- .isFullWide( +- this.findIndex(Direction.Axis.X, vec32.x - (double)pos.getX()), +- this.findIndex(Direction.Axis.Y, vec32.y - (double)pos.getY()), +- this.findIndex(Direction.Axis.Z, vec32.z - (double)pos.getZ()) +- ) +- ? new BlockHitResult(vec32, Direction.getNearest(vec3.x, vec3.y, vec3.z).getOpposite(), pos, true) +- : AABB.clip(this.toAabbs(), start, end, pos); + } + + final Vec3 directionOpposite = end.subtract(start); @@ -4615,10 +4668,10 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 - if (vec3s[0] == null || target.distanceToSqr(d, e, f) < target.distanceToSqr(vec3s[0])) { - vec3s[0] = new Vec3(d, e, f); - } -+ } - - }); - return Optional.of(vec3s[0]); + } ++ + Vec3 ret = null; + double retDistance = Double.MAX_VALUE; + @@ -4634,14 +4687,14 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 + ret = new Vec3(x, y, z); + retDistance = dist; + } - } ++ } + + return Optional.ofNullable(ret); + // Paper end - optimise collisions } public VoxelShape getFaceShape(Direction facing) { -@@ -180,7 +754,28 @@ public abstract class VoxelShape { +@@ -233,7 +787,28 @@ public abstract class VoxelShape { } public double collide(Direction.Axis axis, AABB box, double maxDist) { diff --git a/patches/server/1018-Fix-entity-type-tags-suggestions-in-selectors.patch b/patches/server/1018-Fix-entity-type-tags-suggestions-in-selectors.patch index 83872a3693..1a2f0de3d7 100644 --- a/patches/server/1018-Fix-entity-type-tags-suggestions-in-selectors.patch +++ b/patches/server/1018-Fix-entity-type-tags-suggestions-in-selectors.patch @@ -118,11 +118,11 @@ index 3d897ec6920eff6176ddac9f0442a997b9ef14fd..abaf1ea340c69c8bee80e64567b44b5c this.level = MinMaxBounds.Ints.ANY; this.rotX = WrappedMinMaxBounds.ANY; diff --git a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java -index 7863833c9a761a2b9364ff572ec909ec5a4538c3..36e26929306c04af7a44012fd7fc9902027e9ea2 100644 +index cb4c218eb06ada02824a0574b077b3f3f65e063b..2d6f92d4967fba88472057cfea020ac64ca1e9c8 100644 --- a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java +++ b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java -@@ -69,6 +69,19 @@ public class EntitySelectorOptions { - public static final DynamicCommandExceptionType ERROR_ENTITY_TYPE_INVALID = new DynamicCommandExceptionType((entity) -> { +@@ -75,6 +75,19 @@ public class EntitySelectorOptions { + public static final DynamicCommandExceptionType ERROR_ENTITY_TYPE_INVALID = new DynamicCommandExceptionType(entity -> { return Component.translatableEscape("argument.entity.options.type.invalid", entity); }); + // Paper start - tell clients to ask server for suggestions for EntityArguments @@ -141,16 +141,38 @@ index 7863833c9a761a2b9364ff572ec909ec5a4538c3..36e26929306c04af7a44012fd7fc9902 private static void register(String id, EntitySelectorOptions.Modifier handler, Predicate<EntitySelectorParser> condition, Component description) { OPTIONS.put(id, new EntitySelectorOptions.Option(handler, condition, description)); -@@ -316,6 +329,12 @@ public class EntitySelectorOptions { - - if (reader.isTag()) { - TagKey<EntityType<?>> tagKey = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.read(reader.getReader())); -+ // Paper start - tell clients to ask server for suggestions for EntityArguments; throw error if invalid entity tag (only on suggestions to keep cmd success behavior) -+ if (reader.parsingEntityArgumentSuggestions && io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getTag(tagKey).isEmpty()) { -+ reader.getReader().setCursor(i); -+ throw ERROR_ENTITY_TAG_INVALID.createWithContext(reader.getReader(), tagKey); -+ } -+ // Paper end - tell clients to ask server for suggestions for EntityArguments - reader.addPredicate((entity) -> { - return entity.getType().is(tagKey) != bl; - }); +@@ -301,7 +314,7 @@ public class EntitySelectorOptions { + BuiltInRegistries.ENTITY_TYPE.getTagNames().map(TagKey::location), builder, String.valueOf('#') + ); + } +- ++ + return builder.buildFuture(); + } + ); +@@ -314,9 +327,15 @@ public class EntitySelectorOptions { + if (bl) { + reader.setTypeLimitedInversely(); + } +- ++ + if (reader.isTag()) { + TagKey<EntityType<?>> tagKey = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.read(reader.getReader())); ++ // Paper start - tell clients to ask server for suggestions for EntityArguments; throw error if invalid entity tag (only on suggestions to keep cmd success behavior) ++ if (reader.parsingEntityArgumentSuggestions && io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getTag(tagKey).isEmpty()) { ++ reader.getReader().setCursor(i); ++ throw ERROR_ENTITY_TAG_INVALID.createWithContext(reader.getReader(), tagKey); ++ } ++ // Paper end - tell clients to ask server for suggestions for EntityArguments + reader.addPredicate(entity -> { + return entity.getType().is(tagKey) != bl; + }); +@@ -329,7 +348,7 @@ public class EntitySelectorOptions { + if (Objects.equals(EntityType.PLAYER, entityType) && !bl) { + reader.setIncludesEntities(false); + } +- ++ + reader.addPredicate(entity -> { + return Objects.equals(entityType, entity.getType()) != bl; + }); diff --git a/patches/server/1021-Properly-resend-entities.patch b/patches/server/1021-Properly-resend-entities.patch index 5966fb39a6..113d66e3b4 100644 --- a/patches/server/1021-Properly-resend-entities.patch +++ b/patches/server/1021-Properly-resend-entities.patch @@ -150,7 +150,7 @@ index 97b0119ac71284b3a223c089bec26d87a01d3b25..1e5f709115007ff19901c0a6c3cf884d this.sendLevelInfo(player, worldserver1); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index e35dd853bbffbf1771543d2a59878879cd09fb9c..22458154f36ebabb22368773f4e7f6d681c24960 100644 +index a9d549d1f35928b7e9220e1e2e4ac30f3199ba2d..28b4e9ebc35058c3e094c1f8bd87130e288cea33 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3844,6 +3844,11 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -180,7 +180,7 @@ index a1bfd700cd4c39e4bb1b9c140b54b7c82cd8b32c..205b52e486123aa23a1469de896ab1ec } entity.playSound(((Bucketable) entity).getPickupSound(), 1.0F, 1.0F); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 38c14e06bcada9678b64c6eacf351de10232ee56..7cd7912cecbbbe2c32bfd9b85181115c6d316eb8 100644 +index 76193067a21ff962cf2634b36d0ddf3eff8f85d7..e8e4489bcd64fde1b3226bdc7a7cc612508bda3f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -1000,7 +1000,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/1022-Optimize-Hoppers.patch b/patches/server/1022-Optimize-Hoppers.patch index 4502d0525f..fc971c77c0 100644 --- a/patches/server/1022-Optimize-Hoppers.patch +++ b/patches/server/1022-Optimize-Hoppers.patch @@ -723,13 +723,13 @@ index e3b6f2bf93710ea695b0c25c0b6968a8f24f0829..cdb739df2a285032d25d84f4464f202a @Override diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java -index e4e827a57c2913c719282cc0d5da33586607677b..f52ccd4f3e062af3c7cc6eaea5b074a3bbd21690 100644 +index f33c4633094002a3dd0c54353b62f7b358628be3..dfd1246b735fe64c5beae83567a013861eb00822 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java @@ -93,12 +93,19 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc @Override public boolean isEmpty() { - this.unpackLootTable((Player)null); + this.unpackLootTable(null); - return this.getItems().stream().allMatch(ItemStack::isEmpty); + // Paper start - Perf: Optimize Hoppers + for (final ItemStack itemStack : this.getItems()) { @@ -743,8 +743,8 @@ index e4e827a57c2913c719282cc0d5da33586607677b..f52ccd4f3e062af3c7cc6eaea5b074a3 @Override public ItemStack getItem(int slot) { -- this.unpackLootTable((Player)null); -+ if (slot == 0) this.unpackLootTable((Player) null); // Paper - Perf: Optimize Hoppers +- this.unpackLootTable(null); ++ if (slot == 0) this.unpackLootTable(null); // Paper - Perf: Optimize Hoppers return this.getItems().get(slot); } diff --git a/patches/server/1023-Improve-performance-of-mass-crafts.patch b/patches/server/1023-Improve-performance-of-mass-crafts.patch index 640d0204e2..3f69ae35b9 100644 --- a/patches/server/1023-Improve-performance-of-mass-crafts.patch +++ b/patches/server/1023-Improve-performance-of-mass-crafts.patch @@ -34,17 +34,17 @@ index 7a0c1a55a211035bbca7b97293e94b04ae308bae..c3800bdd5096cb06e085e28f6bf0f655 if (optional.isPresent()) { RecipeHolder<CraftingRecipe> recipeholder = (RecipeHolder) optional.get(); diff --git a/src/main/java/net/minecraft/world/inventory/ResultSlot.java b/src/main/java/net/minecraft/world/inventory/ResultSlot.java -index 7b2ac37e8bd305919f04ded043e50f13b3fe4253..245731757f2593c736916ac6ee59e2c91d179934 100644 +index 113460eff5121788fce44d6569ec07deb9701b20..accf752e7615f775483830f81bd0df30e40d3c7f 100644 --- a/src/main/java/net/minecraft/world/inventory/ResultSlot.java +++ b/src/main/java/net/minecraft/world/inventory/ResultSlot.java -@@ -59,7 +59,7 @@ public class ResultSlot extends Slot { +@@ -58,7 +58,7 @@ public class ResultSlot extends Slot { @Override public void onTake(Player player, ItemStack stack) { this.checkTakeAchievements(stack); - NonNullList<ItemStack> nonNullList = player.level().getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, this.craftSlots, player.level()); + NonNullList<ItemStack> nonNullList = player.level().getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, this.craftSlots, player.level(), this.craftSlots.getCurrentRecipe() != null ? this.craftSlots.getCurrentRecipe().id() : null); // Paper - Perf: Improve mass crafting; check last recipe used first - for(int i = 0; i < nonNullList.size(); ++i) { + for (int i = 0; i < nonNullList.size(); i++) { ItemStack itemStack = this.craftSlots.getItem(i); 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 a0ab3c55826af292d1cdac05648139b4d31f1376..d87124f5356180a37e581febc6141fdc5f1395a7 100644 diff --git a/patches/server/1024-Actually-optimise-explosions.patch b/patches/server/1024-Actually-optimise-explosions.patch index bcb01ef768..7a35803ac0 100644 --- a/patches/server/1024-Actually-optimise-explosions.patch +++ b/patches/server/1024-Actually-optimise-explosions.patch @@ -497,10 +497,10 @@ index 093c814d6835f20b1208236db96bb40b4611936c..b678da2cbb93cea7971bc3c4d324cfca } diff --git a/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java b/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java -index 24dba1eb6f5dc71e5d1ce2d150930eaefc83f811..f529f5d0f28533ec89f3ee712e59745991d068ee 100644 +index 4085949accf23728de9a2ff14249cd6ca9b71f8a..5b93c038331c1750260a42726f5bfb97998d93a9 100644 --- a/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java +++ b/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java -@@ -20,11 +20,17 @@ public class ExplosionDamageCalculator { +@@ -22,11 +22,17 @@ public class ExplosionDamageCalculator { return true; } @@ -514,8 +514,8 @@ index 24dba1eb6f5dc71e5d1ce2d150930eaefc83f811..f529f5d0f28533ec89f3ee712e597459 float f = explosion.radius() * 2.0F; Vec3 vec3 = explosion.center(); double d = Math.sqrt(entity.distanceToSqr(vec3)) / (double)f; -- double e = (1.0D - d) * (double)Explosion.getSeenPercent(vec3, entity); -+ double e = (1.0D - d) * seenPercent; // Paper - actually optimise explosions - return (float)((e * e + e) / 2.0D * 7.0D * (double)f + 1.0D); +- double e = (1.0 - d) * (double)Explosion.getSeenPercent(vec3, entity); ++ double e = (1.0 - d) * seenPercent; // Paper - actually optimise explosions + return (float)((e * e + e) / 2.0 * 7.0 * (double)f + 1.0); } } diff --git a/patches/server/1025-Optimise-chunk-tick-iteration.patch b/patches/server/1025-Optimise-chunk-tick-iteration.patch index 73a6088d00..da9130527c 100644 --- a/patches/server/1025-Optimise-chunk-tick-iteration.patch +++ b/patches/server/1025-Optimise-chunk-tick-iteration.patch @@ -365,7 +365,7 @@ index 2b33a3d8fdb86024acb2a3ee9d0a4a7dd4989c98..366c0c9b45a819f7f94ebe3e49b8ab7f gameprofilerfiller.pop(); } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index c99d2f2d64b73179e4e27b63030e26a07953041b..58591bf2f63b9c5e97d9ce4188dff3366968a178 100644 +index 17a6d43685f35a6978c2d941876a1f8a9a2c8b42..b3781efbd3edcf102fe1bda5d6149915dc1127c6 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -325,6 +325,9 @@ public class ServerPlayer extends Player { diff --git a/patches/server/1026-Lag-compensation-ticks.patch b/patches/server/1026-Lag-compensation-ticks.patch index 6a0a25899e..ffb279c55f 100644 --- a/patches/server/1026-Lag-compensation-ticks.patch +++ b/patches/server/1026-Lag-compensation-ticks.patch @@ -63,7 +63,7 @@ index ef3048a4748113538a0ee0af5b526b2cd51d5c29..a7b217ddbcbf92513bd38101fdfca207 if (this.hasDelayedDestroy) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 22458154f36ebabb22368773f4e7f6d681c24960..3c8740c421d756477306fc9af933bead8842f5e1 100644 +index 28b4e9ebc35058c3e094c1f8bd87130e288cea33..e9bb7feb591032904516d1b9374f486d8a7d066c 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3849,6 +3849,10 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/1027-Optimise-nearby-player-retrieval.patch b/patches/server/1027-Optimise-nearby-player-retrieval.patch index c73abc51ad..5607141705 100644 --- a/patches/server/1027-Optimise-nearby-player-retrieval.patch +++ b/patches/server/1027-Optimise-nearby-player-retrieval.patch @@ -128,15 +128,15 @@ index 8a5abc320137d045acba0c87cef9f2912d78b6fb..6907d1be36fbdf0856c0e11983218d2f // Add env and gen to constructor, IWorldDataServer -> WorldDataServer public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java -index ed1b95ec694b0fe8b647964b18b8c33707fc0b47..65cd42ce9f553e0aa5bf248bdbf902f9d1f55460 100644 +index 3e24da56fc57afa5d8fdcb3c32c60299272fa43e..65cd42ce9f553e0aa5bf248bdbf902f9d1f55460 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java @@ -21,18 +21,50 @@ public class PlayerSensor extends Sensor<LivingEntity> { @Override protected void doTick(ServerLevel world, LivingEntity entity) { -- List<Player> list = world.players().stream().filter(EntitySelector.NO_SPECTATORS).filter((player) -> { -- return entity.closerThan(player, 16.0D); +- List<Player> list = world.players().stream().filter(EntitySelector.NO_SPECTATORS).filter(player -> { +- return entity.closerThan(player, 16.0); - }).sorted(Comparator.comparingDouble(entity::distanceToSqr)).collect(Collectors.toList()); + // Paper start - Perf: optimise nearby player retrieval & remove streams from hot code + io.papermc.paper.util.player.NearbyPlayers nearbyPlayers = world.chunkSource.chunkMap.getNearbyPlayers(); @@ -164,11 +164,11 @@ index ed1b95ec694b0fe8b647964b18b8c33707fc0b47..65cd42ce9f553e0aa5bf248bdbf902f9 + players.sort(Comparator.comparingDouble(entity::distanceToSqr)); Brain<?> brain = entity.getBrain(); - brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, list); -- List<Player> list2 = list.stream().filter((player) -> { +- List<Player> list2 = list.stream().filter(player -> { - return isEntityTargetable(entity, player); - }).collect(Collectors.toList()); - brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_PLAYER, list2.isEmpty() ? null : list2.get(0)); -- Optional<Player> optional = list2.stream().filter((player) -> { +- Optional<Player> optional = list2.stream().filter(player -> { - return isEntityAttackable(entity, player); - }).findFirst(); - brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, optional); @@ -195,34 +195,34 @@ index ed1b95ec694b0fe8b647964b18b8c33707fc0b47..65cd42ce9f553e0aa5bf248bdbf902f9 } } diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java -index fae0dbfb6ac09a0c152c0f74a72583f44316def7..c8a80c1b2fedff22e8a877d466062375ffb2f0d7 100644 +index aecb0ad814586bfc5e56755ee14379a69388b38c..d2f0c3b26d4beedb49d86e0242d843590d469d02 100644 --- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java @@ -10,7 +10,7 @@ public class TargetingConditions { public static final TargetingConditions DEFAULT = forCombat(); - private static final double MIN_VISIBILITY_DISTANCE_FOR_INVISIBLE_TARGET = 2.0D; + private static final double MIN_VISIBILITY_DISTANCE_FOR_INVISIBLE_TARGET = 2.0; private final boolean isCombat; -- private double range = -1.0D; -+ public double range = -1.0D; // Paper - public +- private double range = -1.0; ++ public double range = -1.0; // Paper - public private boolean checkLineOfSight = true; private boolean testInvisible = true; @Nullable diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index f42dd9602805e9d538506ee4e3eac7e2811a3da6..ed84c87a3f76bc0254c1abb189e6b8b808823465 100644 +index 44cfa3821774f22ac05aa679fdee34d8d68b7d60..e6f7081450e129a72ac0b5031b474d14328a6d42 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -230,9 +230,13 @@ public interface EntityGetter { +@@ -235,9 +235,13 @@ public interface EntityGetter { T livingEntity = null; - for(T livingEntity2 : entityList) { + for (T livingEntity2 : entityList) { + // Paper start - optimise nearby player retrieval; move up + // don't check entities outside closest range + double e = livingEntity2.distanceToSqr(x, y, z); -+ if (d == -1.0D || e < d) { ++ if (d == -1.0 || e < d) { + // Paper end - move up if (targetPredicate.test(entity, livingEntity2)) { - double e = livingEntity2.distanceToSqr(x, y, z); -- if (d == -1.0D || e < d) { +- if (d == -1.0 || e < d) { + // Paper - optimise nearby player retrieval; move up d = e; livingEntity = livingEntity2; diff --git a/patches/server/1029-Handle-Oversized-block-entities-in-chunks.patch b/patches/server/1029-Handle-Oversized-block-entities-in-chunks.patch index 1bdb933b52..3705e1d295 100644 --- a/patches/server/1029-Handle-Oversized-block-entities-in-chunks.patch +++ b/patches/server/1029-Handle-Oversized-block-entities-in-chunks.patch @@ -9,7 +9,7 @@ creating too large of a packet to sed. Co-authored-by: Spottedleaf <[email protected]> diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java -index 74b5cec09d953a247bc5aba3c4232a4c28ea1046..998deae645b4497c3285bfba3260c636439f9ecf 100644 +index 9c51c4d12bac588002f530f484ee89b094269349..761a8d4fb47f9bffdf9ca76fbae1003e8ae46a02 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java @@ -24,6 +24,14 @@ public class ClientboundLevelChunkPacketData { @@ -33,7 +33,7 @@ index 74b5cec09d953a247bc5aba3c4232a4c28ea1046..998deae645b4497c3285bfba3260c636 this.blockEntitiesData = Lists.newArrayList(); + int totalTileEntities = 0; // Paper - Handle oversized block entities in chunks - for(Map.Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) { + for (Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) { + // Paper start - Handle oversized block entities in chunks + if (++totalTileEntities > TE_LIMIT) { + var packet = entry2.getValue().getUpdatePacket(); @@ -45,7 +45,7 @@ index 74b5cec09d953a247bc5aba3c4232a4c28ea1046..998deae645b4497c3285bfba3260c636 + // Paper end - Handle oversized block entities in chunks this.blockEntitiesData.add(ClientboundLevelChunkPacketData.BlockEntityInfo.create(entry2.getValue())); } - + } diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java index 6412dff5ed0505f62dd5b71ab9606257858a7317..fc230d835f9aa526a4b179d36d921f0fec348aa8 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java diff --git a/patches/server/1034-Improve-tag-parser-handling.patch b/patches/server/1034-Improve-tag-parser-handling.patch index e2c46e261e..b7c0892a46 100644 --- a/patches/server/1034-Improve-tag-parser-handling.patch +++ b/patches/server/1034-Improve-tag-parser-handling.patch @@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..a375ad4ba9db990b24a2b9ff366fcba6 + } +} diff --git a/src/main/java/net/minecraft/nbt/TagParser.java b/src/main/java/net/minecraft/nbt/TagParser.java -index 5bec54239a2b185284c10d58854e5a13e33daae5..ef970428fe9fe36c242ce6588bb6843eb6179d59 100644 +index c0a06ad138aede0bfd8f3a61f08d906ddda4780b..284a0904963eebc7284d8da601b00e4b4b2574cc 100644 --- a/src/main/java/net/minecraft/nbt/TagParser.java +++ b/src/main/java/net/minecraft/nbt/TagParser.java @@ -48,6 +48,7 @@ public class TagParser { @@ -64,8 +64,8 @@ index 5bec54239a2b185284c10d58854e5a13e33daae5..ef970428fe9fe36c242ce6588bb6843e + private int depth; // Paper public static CompoundTag parseTag(String string) throws CommandSyntaxException { - return (new TagParser(new StringReader(string))).readSingleStruct(); -@@ -156,6 +157,7 @@ public class TagParser { + return new TagParser(new StringReader(string)).readSingleStruct(); +@@ -158,6 +159,7 @@ public class TagParser { public CompoundTag readStruct() throws CommandSyntaxException { this.expect('{'); @@ -73,7 +73,7 @@ index 5bec54239a2b185284c10d58854e5a13e33daae5..ef970428fe9fe36c242ce6588bb6843e CompoundTag compoundTag = new CompoundTag(); this.reader.skipWhitespace(); -@@ -179,6 +181,7 @@ public class TagParser { +@@ -181,6 +183,7 @@ public class TagParser { } this.expect('}'); @@ -81,7 +81,7 @@ index 5bec54239a2b185284c10d58854e5a13e33daae5..ef970428fe9fe36c242ce6588bb6843e return compoundTag; } -@@ -188,6 +191,7 @@ public class TagParser { +@@ -190,6 +193,7 @@ public class TagParser { if (!this.reader.canRead()) { throw ERROR_EXPECTED_VALUE.createWithContext(this.reader); } else { @@ -89,7 +89,7 @@ index 5bec54239a2b185284c10d58854e5a13e33daae5..ef970428fe9fe36c242ce6588bb6843e ListTag listTag = new ListTag(); TagType<?> tagType = null; -@@ -213,6 +217,7 @@ public class TagParser { +@@ -215,6 +219,7 @@ public class TagParser { } this.expect(']'); @@ -97,22 +97,22 @@ index 5bec54239a2b185284c10d58854e5a13e33daae5..ef970428fe9fe36c242ce6588bb6843e return listTag; } } -@@ -251,11 +256,11 @@ public class TagParser { - } +@@ -252,11 +257,11 @@ public class TagParser { + } - if (typeReader == ByteTag.TYPE) { -- list.add((T)((NumericTag)tag).getAsByte()); -+ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix - } else if (typeReader == LongTag.TYPE) { -- list.add((T)((NumericTag)tag).getAsLong()); -+ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix - } else { -- list.add((T)((NumericTag)tag).getAsInt()); -+ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix - } + if (typeReader == ByteTag.TYPE) { +- list.add((T)((NumericTag)tag).getAsByte()); ++ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix + } else if (typeReader == LongTag.TYPE) { +- list.add((T)((NumericTag)tag).getAsLong()); ++ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix + } else { +- list.add((T)((NumericTag)tag).getAsInt()); ++ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix + } - if (this.hasElementSeparator()) { -@@ -286,4 +291,11 @@ public class TagParser { + if (!this.hasElementSeparator()) { +@@ -287,4 +292,11 @@ public class TagParser { this.reader.skipWhitespace(); this.reader.expect(c); } @@ -125,10 +125,10 @@ index 5bec54239a2b185284c10d58854e5a13e33daae5..ef970428fe9fe36c242ce6588bb6843e + } } diff --git a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java b/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java -index d45e39bc009281c298f3dfae113dc87f2b3b1fbd..981d34dd4cfbc0932b147688751b98552c8beea8 100644 +index 18ff39d166521355f1e7d39c1dbad3becb136753..92aeffbab3513e2e1d5ec15dc7fff04bbd445a2a 100644 --- a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java +++ b/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java -@@ -197,6 +197,15 @@ public class TranslatableContents implements ComponentContents { +@@ -190,6 +190,15 @@ public class TranslatableContents implements ComponentContents { @Override public <T> Optional<T> visit(FormattedText.ContentConsumer<T> visitor) { @@ -143,8 +143,8 @@ index d45e39bc009281c298f3dfae113dc87f2b3b1fbd..981d34dd4cfbc0932b147688751b9855 + // Paper end - Count visited parts this.decompose(); - for(FormattedText formattedText : this.decomposedParts) { -@@ -208,6 +217,25 @@ public class TranslatableContents implements ComponentContents { + for (FormattedText formattedText : this.decomposedParts) { +@@ -201,6 +210,25 @@ public class TranslatableContents implements ComponentContents { return Optional.empty(); } diff --git a/patches/server/1050-Add-onboarding-message-for-initial-server-start.patch b/patches/server/1050-Add-onboarding-message-for-initial-server-start.patch index 953a8aa931..7769ecafe8 100644 --- a/patches/server/1050-Add-onboarding-message-for-initial-server-start.patch +++ b/patches/server/1050-Add-onboarding-message-for-initial-server-start.patch @@ -17,7 +17,7 @@ index c01b4393439838976965823298f12e4762e72eff..218bf89fd7583d6db9f64754c4db8fcc node = loader.load(); this.verifyGlobalConfigVersion(node); diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index b53b6cc4463675096b061b3b65f14a4695c742e2..f2e30d8743a97c0541808dc5c03300c0d881b843 100644 +index d00fc39b19c02895553f40bf5f62daa1dd50d59c..0cc2307636279915c1f8529e62174cc696e185ee 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java @@ -25,6 +25,7 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/patches/server/1051-Fix-DamageSource-API.patch b/patches/server/1051-Fix-DamageSource-API.patch index 5e216b66e0..7d2ad02099 100644 --- a/patches/server/1051-Fix-DamageSource-API.patch +++ b/patches/server/1051-Fix-DamageSource-API.patch @@ -44,7 +44,7 @@ index 1561b85a45f52a8162f43553f8485bfe084b8f1f..b26e4d58ea1898a5e4b31c3d6ab33f38 } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6de971aca46caad091271d125a079a1b7a5f163d..b2eff51f1ad1e702525ef298807ea7d2083f6218 100644 +index 8c2c877a26af90dae6d083e12a51384755c7a1de..6407496ccd993839e4fda1858e2daa6e735511a8 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3462,7 +3462,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S |