From 9596c37668c48289ed384fb3f42c5b2550003d02 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 7 Jun 2022 22:02:19 -0700 Subject: [PATCH] a bunch more patches done --- ...implement-PlayerRecipeBookClickEvent.patch | 0 ...n-for-console-having-all-permissions.patch | 0 .../Add-permission-for-command-blocks.patch | 8 +-- .../server/Add-villager-reputation-API.patch | 0 ...unk-Unloads-based-on-Player-Movement.patch | 0 ...ktraces-in-log-messages-crash-report.patch | 2 +- ...sure-Entity-AABB-s-are-never-invalid.patch | 2 +- ...der-respects-game-and-entity-rules-f.patch | 0 .../server/Ensure-safe-gateway-teleport.patch | 0 .../server/ExperienceOrbMergeEvent.patch | 0 .../server/Expose-game-version.patch | 0 ...er-runTaskTimerAsynchronously-Plugin.patch | 0 ...ld-Difficulty-Remembering-Difficulty.patch | 8 +-- .../Fix-PotionEffect-ignores-icon-flag.patch | 0 ...ston-physics-inconsistency-MC-188840.patch | 0 .../server/Fix-sand-duping.patch | 0 ...ix-villager-trading-demand-MC-163962.patch | 0 .../Hide-sync-chunk-writes-behind-flag.patch | 0 .../server/Implement-Mob-Goal-API.patch | 0 .../server/Improve-Arrow-API.patch | 0 ...Holder-method-without-block-snapshot.patch | 0 .../server/Maps-shouldn-t-load-chunks.patch | 0 ...rLevels-chunk-level-checking-methods.patch | 0 .../server/Optimize-Voxel-Shape-Merging.patch | 0 ...erCloseEnoughForSpawning-to-use-dist.patch | 2 +- ...-brigadier-child-sorting-performance.patch | 0 ...-maximum-exp-value-when-merging-orbs.patch | 0 .../server/Paper-dumpitem-command.patch | 0 .../server/Potential-bed-API.patch | 0 ...-desync-in-playerconnection-causing-.patch | 0 .../Prevent-teleporting-dead-entities.patch | 0 ...and-End-Portal-Frames-from-being-des.patch | 6 +- ...bleInt-allocations-from-light-engine.patch | 0 ...llocation-of-Vec3D-by-entity-tracker.patch | 26 ++++++++ ...-per-thread-native-byte-buffer-cache.patch | 0 ...tance-map-to-optimise-entity-tracker.patch | 2 +- ...ookup-for-Treasure-Maps-Fixes-lag-fr.patch | 6 +- ...Wait-for-Async-Tasks-during-shutdown.patch | 0 .../server/misc-debugging-dumps.patch | 6 +- ...ssing-chunks-due-to-integer-overflow.patch | 27 --------- ...llocation-of-Vec3D-by-entity-tracker.patch | 60 ------------------- 41 files changed, 47 insertions(+), 108 deletions(-) rename patches/{unapplied => }/server/Add-and-implement-PlayerRecipeBookClickEvent.patch (100%) rename patches/{unapplied => }/server/Add-option-for-console-having-all-permissions.patch (100%) rename patches/{unapplied => }/server/Add-permission-for-command-blocks.patch (94%) rename patches/{unapplied => }/server/Add-villager-reputation-API.patch (100%) rename patches/{unapplied => }/server/Delay-Chunk-Unloads-based-on-Player-Movement.patch (100%) rename patches/{unapplied => }/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch (99%) rename patches/{unapplied => }/server/Ensure-Entity-AABB-s-are-never-invalid.patch (98%) rename patches/{unapplied => }/server/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch (100%) rename patches/{unapplied => }/server/Ensure-safe-gateway-teleport.patch (100%) rename patches/{unapplied => }/server/ExperienceOrbMergeEvent.patch (100%) rename patches/{unapplied => }/server/Expose-game-version.patch (100%) rename patches/{unapplied => }/server/Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch (100%) rename patches/{unapplied => }/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch (92%) rename patches/{unapplied => }/server/Fix-PotionEffect-ignores-icon-flag.patch (100%) rename patches/{unapplied => }/server/Fix-piston-physics-inconsistency-MC-188840.patch (100%) rename patches/{unapplied => }/server/Fix-sand-duping.patch (100%) rename patches/{unapplied => }/server/Fix-villager-trading-demand-MC-163962.patch (100%) rename patches/{unapplied => }/server/Hide-sync-chunk-writes-behind-flag.patch (100%) rename patches/{unapplied => }/server/Implement-Mob-Goal-API.patch (100%) rename patches/{unapplied => }/server/Improve-Arrow-API.patch (100%) rename patches/{unapplied => }/server/Inventory-getHolder-method-without-block-snapshot.patch (100%) rename patches/{unapplied => }/server/Maps-shouldn-t-load-chunks.patch (100%) rename patches/{unapplied => }/server/Optimize-ServerLevels-chunk-level-checking-methods.patch (100%) rename patches/{unapplied => }/server/Optimize-Voxel-Shape-Merging.patch (100%) rename patches/{unapplied => }/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch (99%) rename patches/{unapplied => }/server/Optimize-brigadier-child-sorting-performance.patch (100%) rename patches/{unapplied => }/server/Option-for-maximum-exp-value-when-merging-orbs.patch (100%) rename patches/{unapplied => }/server/Paper-dumpitem-command.patch (100%) rename patches/{unapplied => }/server/Potential-bed-API.patch (100%) rename patches/{unapplied => }/server/Prevent-position-desync-in-playerconnection-causing-.patch (100%) rename patches/{unapplied => }/server/Prevent-teleporting-dead-entities.patch (100%) rename patches/{unapplied => }/server/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch (99%) rename patches/{unapplied => }/server/Reduce-MutableInt-allocations-from-light-engine.patch (100%) create mode 100644 patches/server/Reduce-allocation-of-Vec3D-by-entity-tracker.patch rename patches/{unapplied => }/server/Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch (100%) rename patches/{unapplied => }/server/Use-distance-map-to-optimise-entity-tracker.patch (99%) rename patches/{unapplied => }/server/Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch (65%) rename patches/{unapplied => }/server/Wait-for-Async-Tasks-during-shutdown.patch (100%) rename patches/{unapplied => }/server/misc-debugging-dumps.patch (95%) delete mode 100644 patches/unapplied/server/Fix-missing-chunks-due-to-integer-overflow.patch delete mode 100644 patches/unapplied/server/Reduce-allocation-of-Vec3D-by-entity-tracker.patch diff --git a/patches/unapplied/server/Add-and-implement-PlayerRecipeBookClickEvent.patch b/patches/server/Add-and-implement-PlayerRecipeBookClickEvent.patch similarity index 100% rename from patches/unapplied/server/Add-and-implement-PlayerRecipeBookClickEvent.patch rename to patches/server/Add-and-implement-PlayerRecipeBookClickEvent.patch diff --git a/patches/unapplied/server/Add-option-for-console-having-all-permissions.patch b/patches/server/Add-option-for-console-having-all-permissions.patch similarity index 100% rename from patches/unapplied/server/Add-option-for-console-having-all-permissions.patch rename to patches/server/Add-option-for-console-having-all-permissions.patch diff --git a/patches/unapplied/server/Add-permission-for-command-blocks.patch b/patches/server/Add-permission-for-command-blocks.patch similarity index 94% rename from patches/unapplied/server/Add-permission-for-command-blocks.patch rename to patches/server/Add-permission-for-command-blocks.patch index 5a649ed47c..8c88a0e629 100644 --- a/patches/unapplied/server/Add-permission-for-command-blocks.patch +++ b/patches/server/Add-permission-for-command-blocks.patch @@ -24,19 +24,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (!this.server.isCommandBlockEnabled()) { - this.player.sendMessage(new TranslatableComponent("advMode.notEnabled"), Util.NIL_UUID); + this.player.sendSystemMessage(Component.translatable("advMode.notEnabled")); - } else if (!this.player.canUseGameMasterBlocks()) { + } else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission - this.player.sendMessage(new TranslatableComponent("advMode.notAllowed"), Util.NIL_UUID); + this.player.sendSystemMessage(Component.translatable("advMode.notAllowed")); } else { BaseCommandBlock commandblocklistenerabstract = null; @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (!this.server.isCommandBlockEnabled()) { - this.player.sendMessage(new TranslatableComponent("advMode.notEnabled"), Util.NIL_UUID); + this.player.sendSystemMessage(Component.translatable("advMode.notEnabled")); - } else if (!this.player.canUseGameMasterBlocks()) { + } else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission - this.player.sendMessage(new TranslatableComponent("advMode.notAllowed"), Util.NIL_UUID); + this.player.sendSystemMessage(Component.translatable("advMode.notAllowed")); } else { BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level); diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java diff --git a/patches/unapplied/server/Add-villager-reputation-API.patch b/patches/server/Add-villager-reputation-API.patch similarity index 100% rename from patches/unapplied/server/Add-villager-reputation-API.patch rename to patches/server/Add-villager-reputation-API.patch diff --git a/patches/unapplied/server/Delay-Chunk-Unloads-based-on-Player-Movement.patch b/patches/server/Delay-Chunk-Unloads-based-on-Player-Movement.patch similarity index 100% rename from patches/unapplied/server/Delay-Chunk-Unloads-based-on-Player-Movement.patch rename to patches/server/Delay-Chunk-Unloads-based-on-Player-Movement.patch diff --git a/patches/unapplied/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch b/patches/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch similarity index 99% rename from patches/unapplied/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch rename to patches/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch index be0736664b..a6bff87a69 100644 --- a/patches/unapplied/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch +++ b/patches/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + annotationProcessor("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - Needed to generate meta for our Log4j plugins // Paper end implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper - implementation("org.ow2.asm:asm:9.2") + implementation("org.ow2.asm:asm:9.3") @@ -0,0 +0,0 @@ dependencies { runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.2") runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.2") diff --git a/patches/unapplied/server/Ensure-Entity-AABB-s-are-never-invalid.patch b/patches/server/Ensure-Entity-AABB-s-are-never-invalid.patch similarity index 98% rename from patches/unapplied/server/Ensure-Entity-AABB-s-are-never-invalid.patch rename to patches/server/Ensure-Entity-AABB-s-are-never-invalid.patch index a13b940c12..d76f58368c 100644 --- a/patches/unapplied/server/Ensure-Entity-AABB-s-are-never-invalid.patch +++ b/patches/server/Ensure-Entity-AABB-s-are-never-invalid.patch @@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.position = new Vec3(x, y, z); int i = Mth.floor(x); @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { - } + this.levelCallback.onMove(); } + // Paper start - never allow AABB to become desynced from position diff --git a/patches/unapplied/server/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch b/patches/server/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch similarity index 100% rename from patches/unapplied/server/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch rename to patches/server/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch diff --git a/patches/unapplied/server/Ensure-safe-gateway-teleport.patch b/patches/server/Ensure-safe-gateway-teleport.patch similarity index 100% rename from patches/unapplied/server/Ensure-safe-gateway-teleport.patch rename to patches/server/Ensure-safe-gateway-teleport.patch diff --git a/patches/unapplied/server/ExperienceOrbMergeEvent.patch b/patches/server/ExperienceOrbMergeEvent.patch similarity index 100% rename from patches/unapplied/server/ExperienceOrbMergeEvent.patch rename to patches/server/ExperienceOrbMergeEvent.patch diff --git a/patches/unapplied/server/Expose-game-version.patch b/patches/server/Expose-game-version.patch similarity index 100% rename from patches/unapplied/server/Expose-game-version.patch rename to patches/server/Expose-game-version.patch diff --git a/patches/unapplied/server/Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch b/patches/server/Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch similarity index 100% rename from patches/unapplied/server/Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch rename to patches/server/Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch diff --git a/patches/unapplied/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch similarity index 92% rename from patches/unapplied/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch rename to patches/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch index c1976d7317..15240ec894 100644 --- a/patches/unapplied/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/patches/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { - worldServer.serverLevelData.setDifficulty(difficulty); // CraftBukkit + minecraftserver.setDifficulty(worldServer, difficulty, true); // Paper - don't skip other difficulty-changing logic (fix upstream's fix) - source.sendSuccess(new TranslatableComponent("commands.difficulty.success", new Object[]{difficulty.getDisplayName()}), true); + source.sendSuccess(Component.translatable("commands.difficulty.success", difficulty.getDisplayName()), true); return 0; } diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -71,7 +71,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void forceDifficulty() { - this.setDifficulty(this.getProperties().difficulty, true); -+ //this.a(this.getDedicatedServerProperties().difficulty, true); // Paper - Don't overwrite level.dat's difficulty, keep current ++ // this.setDifficulty(this.getProperties().difficulty, true); // Paper - Don't overwrite level.dat's difficulty, keep current } @Override @@ -82,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerPlayer extends Player { this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds - this.connection.send(new ClientboundRespawnPacket(worldserver.dimensionTypeRegistration(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true)); + this.connection.send(new ClientboundRespawnPacket(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true, this.getLastDeathLocation())); - this.connection.send(new ClientboundChangeDifficultyPacket(this.level.getDifficulty(), this.level.getLevelData().isDifficultyLocked())); + this.connection.send(new ClientboundChangeDifficultyPacket(worldserver.getDifficulty(), this.level.getLevelData().isDifficultyLocked())); // Paper - fix difficulty sync issue PlayerList playerlist = this.server.getPlayerList(); @@ -97,7 +97,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) { - this.server.setDifficulty(packet.getDifficulty(), false); -+ //this.minecraftServer.a(packetplayindifficultychange.b(), false); // Paper - don't allow clients to change this ++ // this.server.setDifficulty(packet.getDifficulty(), false); // Paper - don't allow clients to change this } } diff --git a/patches/unapplied/server/Fix-PotionEffect-ignores-icon-flag.patch b/patches/server/Fix-PotionEffect-ignores-icon-flag.patch similarity index 100% rename from patches/unapplied/server/Fix-PotionEffect-ignores-icon-flag.patch rename to patches/server/Fix-PotionEffect-ignores-icon-flag.patch diff --git a/patches/unapplied/server/Fix-piston-physics-inconsistency-MC-188840.patch b/patches/server/Fix-piston-physics-inconsistency-MC-188840.patch similarity index 100% rename from patches/unapplied/server/Fix-piston-physics-inconsistency-MC-188840.patch rename to patches/server/Fix-piston-physics-inconsistency-MC-188840.patch diff --git a/patches/unapplied/server/Fix-sand-duping.patch b/patches/server/Fix-sand-duping.patch similarity index 100% rename from patches/unapplied/server/Fix-sand-duping.patch rename to patches/server/Fix-sand-duping.patch diff --git a/patches/unapplied/server/Fix-villager-trading-demand-MC-163962.patch b/patches/server/Fix-villager-trading-demand-MC-163962.patch similarity index 100% rename from patches/unapplied/server/Fix-villager-trading-demand-MC-163962.patch rename to patches/server/Fix-villager-trading-demand-MC-163962.patch diff --git a/patches/unapplied/server/Hide-sync-chunk-writes-behind-flag.patch b/patches/server/Hide-sync-chunk-writes-behind-flag.patch similarity index 100% rename from patches/unapplied/server/Hide-sync-chunk-writes-behind-flag.patch rename to patches/server/Hide-sync-chunk-writes-behind-flag.patch diff --git a/patches/unapplied/server/Implement-Mob-Goal-API.patch b/patches/server/Implement-Mob-Goal-API.patch similarity index 100% rename from patches/unapplied/server/Implement-Mob-Goal-API.patch rename to patches/server/Implement-Mob-Goal-API.patch diff --git a/patches/unapplied/server/Improve-Arrow-API.patch b/patches/server/Improve-Arrow-API.patch similarity index 100% rename from patches/unapplied/server/Improve-Arrow-API.patch rename to patches/server/Improve-Arrow-API.patch diff --git a/patches/unapplied/server/Inventory-getHolder-method-without-block-snapshot.patch b/patches/server/Inventory-getHolder-method-without-block-snapshot.patch similarity index 100% rename from patches/unapplied/server/Inventory-getHolder-method-without-block-snapshot.patch rename to patches/server/Inventory-getHolder-method-without-block-snapshot.patch diff --git a/patches/unapplied/server/Maps-shouldn-t-load-chunks.patch b/patches/server/Maps-shouldn-t-load-chunks.patch similarity index 100% rename from patches/unapplied/server/Maps-shouldn-t-load-chunks.patch rename to patches/server/Maps-shouldn-t-load-chunks.patch diff --git a/patches/unapplied/server/Optimize-ServerLevels-chunk-level-checking-methods.patch b/patches/server/Optimize-ServerLevels-chunk-level-checking-methods.patch similarity index 100% rename from patches/unapplied/server/Optimize-ServerLevels-chunk-level-checking-methods.patch rename to patches/server/Optimize-ServerLevels-chunk-level-checking-methods.patch diff --git a/patches/unapplied/server/Optimize-Voxel-Shape-Merging.patch b/patches/server/Optimize-Voxel-Shape-Merging.patch similarity index 100% rename from patches/unapplied/server/Optimize-Voxel-Shape-Merging.patch rename to patches/server/Optimize-Voxel-Shape-Merging.patch diff --git a/patches/unapplied/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch b/patches/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch similarity index 99% rename from patches/unapplied/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch rename to patches/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch index 6089b348c7..3fd3f2e17c 100644 --- a/patches/unapplied/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch +++ b/patches/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch @@ -367,4 +367,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper - public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) { + public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, @Nullable ProfilePublicKey publicKey) { diff --git a/patches/unapplied/server/Optimize-brigadier-child-sorting-performance.patch b/patches/server/Optimize-brigadier-child-sorting-performance.patch similarity index 100% rename from patches/unapplied/server/Optimize-brigadier-child-sorting-performance.patch rename to patches/server/Optimize-brigadier-child-sorting-performance.patch diff --git a/patches/unapplied/server/Option-for-maximum-exp-value-when-merging-orbs.patch b/patches/server/Option-for-maximum-exp-value-when-merging-orbs.patch similarity index 100% rename from patches/unapplied/server/Option-for-maximum-exp-value-when-merging-orbs.patch rename to patches/server/Option-for-maximum-exp-value-when-merging-orbs.patch diff --git a/patches/unapplied/server/Paper-dumpitem-command.patch b/patches/server/Paper-dumpitem-command.patch similarity index 100% rename from patches/unapplied/server/Paper-dumpitem-command.patch rename to patches/server/Paper-dumpitem-command.patch diff --git a/patches/unapplied/server/Potential-bed-API.patch b/patches/server/Potential-bed-API.patch similarity index 100% rename from patches/unapplied/server/Potential-bed-API.patch rename to patches/server/Potential-bed-API.patch diff --git a/patches/unapplied/server/Prevent-position-desync-in-playerconnection-causing-.patch b/patches/server/Prevent-position-desync-in-playerconnection-causing-.patch similarity index 100% rename from patches/unapplied/server/Prevent-position-desync-in-playerconnection-causing-.patch rename to patches/server/Prevent-position-desync-in-playerconnection-causing-.patch diff --git a/patches/unapplied/server/Prevent-teleporting-dead-entities.patch b/patches/server/Prevent-teleporting-dead-entities.patch similarity index 100% rename from patches/unapplied/server/Prevent-teleporting-dead-entities.patch rename to patches/server/Prevent-teleporting-dead-entities.patch diff --git a/patches/unapplied/server/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/patches/server/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch similarity index 99% rename from patches/unapplied/server/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch rename to patches/server/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch index 21e1ed04bf..cdae389a24 100644 --- a/patches/unapplied/server/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch +++ b/patches/server/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch @@ -148,15 +148,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** @deprecated */ @@ -0,0 +0,0 @@ public abstract class BlockBehaviour { - public Block getBlock() { - return (Block) this.owner; + return ((Block) this.owner).builtInRegistryHolder(); } -- + + // Paper start + public final boolean isDestroyable() { + return getBlock().isDestroyable(); + } + // Paper end ++ public Material getMaterial() { return this.material; } diff --git a/patches/unapplied/server/Reduce-MutableInt-allocations-from-light-engine.patch b/patches/server/Reduce-MutableInt-allocations-from-light-engine.patch similarity index 100% rename from patches/unapplied/server/Reduce-MutableInt-allocations-from-light-engine.patch rename to patches/server/Reduce-MutableInt-allocations-from-light-engine.patch diff --git a/patches/server/Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/server/Reduce-allocation-of-Vec3D-by-entity-tracker.patch new file mode 100644 index 0000000000..1becdd4de5 --- /dev/null +++ b/patches/server/Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Mon, 27 Apr 2020 00:04:16 -0700 +Subject: [PATCH] Reduce allocation of Vec3D by entity tracker + + +diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + public void updatePlayer(ServerPlayer player) { + org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot + if (player != this.entity) { +- Vec3 vec3d = player.position().subtract(this.entity.position()); ++ // Paper start - remove allocation of Vec3D here ++ // Vec3 vec3d = player.position().subtract(this.entity.position()); ++ double vec3d_dx = player.getX() - this.entity.getX(); ++ double vec3d_dz = player.getZ() - this.entity.getZ(); ++ // Paper end - remove allocation of Vec3D here + double d0 = (double) Math.min(this.getEffectiveRange(), (ChunkMap.this.viewDistance - 1) * 16); +- double d1 = vec3d.x * vec3d.x + vec3d.z * vec3d.z; ++ double d1 = vec3d_dx * vec3d_dx + vec3d_dz * vec3d_dz; // Paper + double d2 = d0 * d0; + boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player); + diff --git a/patches/unapplied/server/Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch b/patches/server/Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch similarity index 100% rename from patches/unapplied/server/Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch rename to patches/server/Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch diff --git a/patches/unapplied/server/Use-distance-map-to-optimise-entity-tracker.patch b/patches/server/Use-distance-map-to-optimise-entity-tracker.patch similarity index 99% rename from patches/unapplied/server/Use-distance-map-to-optimise-entity-tracker.patch rename to patches/server/Use-distance-map-to-optimise-entity-tracker.patch index d8f18064d2..b555c147d7 100644 --- a/patches/unapplied/server/Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/server/Use-distance-map-to-optimise-entity-tracker.patch @@ -237,7 +237,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Iterator iterator; Entity entity1; @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - this.lastSectionPos = SectionPos.of(entity); + this.lastSectionPos = SectionPos.of((EntityAccess) entity); } + // Paper start - use distance map to optimise tracker diff --git a/patches/unapplied/server/Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch b/patches/server/Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch similarity index 65% rename from patches/unapplied/server/Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch rename to patches/server/Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch index 5a674d34c1..81719fe157 100644 --- a/patches/unapplied/server/Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch +++ b/patches/server/Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch @@ -20,8 +20,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (j1 = 0; j1 < 128; ++j1) { for (k1 = 0; k1 < 128; ++k1) { -- Biome.BiomeCategory biomebase_geography = Biome.getBiomeCategory(world.getBiome(blockposition_mutableblockposition.set((l + k1) * i, 0, (i1 + j1) * i))); -+ Biome.BiomeCategory biomebase_geography = Biome.getBiomeCategory(world.getUncachedNoiseBiome((l + k1) * i, 0, (i1 + j1) * i)); // Paper +- Holder holder = world.getBiome(blockposition_mutableblockposition.set((l + k1) * i, 0, (i1 + j1) * i)); ++ Holder holder = world.getUncachedNoiseBiome((l + k1) * i, 0, (i1 + j1) * i); // Paper - aboolean[j1 * 128 + k1] = biomebase_geography == Biome.BiomeCategory.OCEAN || biomebase_geography == Biome.BiomeCategory.RIVER || biomebase_geography == Biome.BiomeCategory.SWAMP; + aboolean[j1 * 128 + k1] = holder.is(BiomeTags.WATER_ON_MAP_OUTLINES); } diff --git a/patches/unapplied/server/Wait-for-Async-Tasks-during-shutdown.patch b/patches/server/Wait-for-Async-Tasks-during-shutdown.patch similarity index 100% rename from patches/unapplied/server/Wait-for-Async-Tasks-during-shutdown.patch rename to patches/server/Wait-for-Async-Tasks-during-shutdown.patch diff --git a/patches/unapplied/server/misc-debugging-dumps.patch b/patches/server/misc-debugging-dumps.patch similarity index 95% rename from patches/unapplied/server/misc-debugging-dumps.patch rename to patches/server/misc-debugging-dumps.patch index d8d1bbbf7a..fcf6b25b85 100644 --- a/patches/unapplied/server/misc-debugging-dumps.patch +++ b/patches/server/misc-debugging-dumps.patch @@ -64,15 +64,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } catch (Exception exception) { ServerLoginPacketListenerImpl.LOGGER.error("Couldn't place player in world", exception); - TranslatableComponent chatmessage = new TranslatableComponent("multiplayer.disconnect.invalid_player_data"); + MutableComponent ichatmutablecomponent = Component.translatable("multiplayer.disconnect.invalid_player_data"); + // Paper start + if (MinecraftServer.getServer().isDebugging()) { + exception.printStackTrace(); + } + // Paper end - this.connection.send(new ClientboundDisconnectPacket(chatmessage)); - this.connection.disconnect(chatmessage); + this.connection.send(new ClientboundDisconnectPacket(ichatmutablecomponent)); + this.connection.disconnect(ichatmutablecomponent); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/patches/unapplied/server/Fix-missing-chunks-due-to-integer-overflow.patch b/patches/unapplied/server/Fix-missing-chunks-due-to-integer-overflow.patch deleted file mode 100644 index 83c39000f2..0000000000 --- a/patches/unapplied/server/Fix-missing-chunks-due-to-integer-overflow.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: David Slovikosky -Date: Tue, 9 Jun 2020 00:10:03 -0700 -Subject: [PATCH] Fix missing chunks due to integer overflow - -This patch fixes a bug in the WorldChunkManagerTheEnd class where the distance -from 0,0 squared overflows the maximum size of an integer. The overflow leads -to hard chunk borders around 370,000 blocks from 0,0. After this cutoff there -is a few hundred thousand block gap before end land resuming to generate at -530,000 blocks from spawn. This is due to the integer flipping back and forth. - -The fix for the issue is quite simple, casting chunk coordinates to longs -allows the distance calculation to avoid overflow and work as intended. - -diff --git a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java -+++ b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java -@@ -0,0 +0,0 @@ public class TheEndBiomeSource extends BiomeSource { - int l = j / 2; - int m = i % 2; - int n = j % 2; -- float f = 100.0F - Mth.sqrt((float)(i * i + j * j)) * 8.0F; -+ float f = 100.0F - Mth.sqrt((long) i * (long) i + (long) j * (long) j) * 8.0F; // Paper - cast ints to long to avoid integer overflow - f = Mth.clamp(f, -100.0F, 80.0F); - - for(int o = -12; o <= 12; ++o) { diff --git a/patches/unapplied/server/Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/unapplied/server/Reduce-allocation-of-Vec3D-by-entity-tracker.patch deleted file mode 100644 index 2439ae5328..0000000000 --- a/patches/unapplied/server/Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Mon, 27 Apr 2020 00:04:16 -0700 -Subject: [PATCH] Reduce allocation of Vec3D by entity tracker - - -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - public void updatePlayer(ServerPlayer player) { - org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot - if (player != this.entity) { -- Vec3 vec3d = player.position().subtract(this.entity.position()); // MC-155077, SPIGOT-5113 -+ // Paper start - remove allocation of Vec3D here -+ //Vec3 vec3d = player.position().subtract(this.entity.position()); // MC-155077, SPIGOT-5113 -+ double vec3d_dx = player.getX() - this.entity.getX(); -+ double vec3d_dz = player.getZ() - this.entity.getZ(); -+ // Paper end - remove allocation of Vec3D here - double d0 = (double) Math.min(this.getEffectiveRange(), (ChunkMap.this.viewDistance - 1) * 16); -- double d1 = vec3d.x * vec3d.x + vec3d.z * vec3d.z; -+ double d1 = vec3d_dx * vec3d_dx + vec3d_dz * vec3d_dz; // Paper - double d2 = d0 * d0; - boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player); - -diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/level/ServerEntity.java -+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -0,0 +0,0 @@ public class ServerEntity { - ++this.teleportDelay; - i = Mth.floor(this.entity.getYRot() * 256.0F / 360.0F); - j = Mth.floor(this.entity.getXRot() * 256.0F / 360.0F); -- Vec3 vec3d = this.entity.position().subtract(ClientboundMoveEntityPacket.packetToEntity(this.xp, this.yp, this.zp)); -- boolean flag1 = vec3d.lengthSqr() >= 7.62939453125E-6D; -+ // Paper start - reduce allocation of Vec3D here -+ double vec3d_dx = this.entity.getX() - 2.44140625E-4D*(this.xp); -+ double vec3d_dy = this.entity.getY() - 2.44140625E-4D*(this.yp); -+ double vec3d_dz = this.entity.getZ() - 2.44140625E-4D*(this.zp); -+ boolean flag1 = (vec3d_dx * vec3d_dx + vec3d_dy * vec3d_dy + vec3d_dz * vec3d_dz) >= 7.62939453125E-6D; -+ // Paper end - reduce allocation of Vec3D here - Packet packet1 = null; - boolean flag2 = flag1 || this.tickCount % 60 == 0; - boolean flag3 = Math.abs(i - this.yRotp) >= 1 || Math.abs(j - this.xRotp) >= 1; -@@ -0,0 +0,0 @@ public class ServerEntity { - // CraftBukkit end - - if (this.tickCount > 0 || this.entity instanceof AbstractArrow) { -- long k = ClientboundMoveEntityPacket.entityToPacket(vec3d.x); -- long l = ClientboundMoveEntityPacket.entityToPacket(vec3d.y); -- long i1 = ClientboundMoveEntityPacket.entityToPacket(vec3d.z); -+ // Paper start - remove allocation of Vec3D here -+ long k = ClientboundMoveEntityPacket.entityToPacket(vec3d_dx); -+ long l = ClientboundMoveEntityPacket.entityToPacket(vec3d_dy); -+ long i1 = ClientboundMoveEntityPacket.entityToPacket(vec3d_dz); -+ // Paper end - remove allocation of Vec3D here - boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L; - - if (!flag4 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.isOnGround()) {