From 9ffb4e1b63bf54f469e8e157269a1784d3098350 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 7 Jun 2023 21:37:42 +0200 Subject: [PATCH] More more more more work --- ...to-get-a-BlockState-without-a-snapshot.patch | 0 .../Ability-to-apply-mending-to-XP-API.patch | 0 .../server/Add-ArmorStand-Item-Meta.patch | 0 .../server/Add-PlayerArmorChangeEvent.patch | 0 .../server/Add-PlayerJumpEvent.patch | 4 ++-- .../server/Add-UnknownCommandEvent.patch | 0 .../Add-setPlayerProfile-API-for-Skulls.patch | 0 ...ng-a-custom-authentication-servers-dow.patch | 0 .../server/AsyncTabCompleteEvent.patch | 8 ++------ .../server/Basic-PlayerProfile-API.patch | 8 ++++---- ...k-player-logins-during-server-shutdown.patch | 0 ...it-profile-lookups-to-worldgen-threads.patch | 0 .../server/Entity-fromMobSpawner.patch | 0 ...ient-protocol-version-and-virtual-host.patch | 6 +++--- .../Extend-Player-Interact-cancellation.patch | 0 .../server/Fill-Profile-Property-Events.patch | 0 .../Fix-MC-117075-TE-Unload-Lag-Spike.patch | 0 .../server/Fix-this-stupid-bullshit.patch | 4 ++-- ...gin-prefixes-using-Log4J-configuration.patch | 0 .../Implement-ensureServerConversions-API.patch | 0 .../server/Implement-getI18NDisplayName.patch | 0 ...ove-Log4J-Configuration-Plugin-Loggers.patch | 0 .../Improve-the-Saddle-API-for-Horses.patch | 0 .../server/LivingEntity-setKiller.patch | 0 ...spawns-should-honor-nametags-and-leash.patch | 0 .../PlayerAdvancementCriterionGrantEvent.patch | 0 .../PlayerNaturallySpawnCreaturesEvent.patch | 0 .../server/PlayerPickupExperienceEvent.patch | 2 +- .../server/PreCreatureSpawnEvent.patch | 0 ...-from-being-processed-when-the-player-.patch | 0 .../server/Profile-Lookup-Events.patch | 0 .../server/ProfileWhitelistVerifyEvent.patch | 0 ...-timer-when-spawner-event-is-cancelled.patch | 0 ...undEffects-only-to-players-who-can-see.patch | 14 +++++++------- .../server/Shoulder-Entities-Release-API.patch | 17 +++++++++-------- .../server/Tameable-getOwnerUniqueId-API.patch | 0 ...yer-crits-helps-mitigate-hacked-client.patch | 2 +- ...andle-ServerboundKeepAlivePacket-async.patch | 4 ++-- ...vert-serverside-behavior-of-keepalives.patch | 11 ++++++----- ...ate-implementations-for-captured-block.patch | 0 40 files changed, 39 insertions(+), 41 deletions(-) rename patches/{unapplied => }/server/API-to-get-a-BlockState-without-a-snapshot.patch (100%) rename patches/{unapplied => }/server/Ability-to-apply-mending-to-XP-API.patch (100%) rename patches/{unapplied => }/server/Add-ArmorStand-Item-Meta.patch (100%) rename patches/{unapplied => }/server/Add-PlayerArmorChangeEvent.patch (100%) rename patches/{unapplied => }/server/Add-PlayerJumpEvent.patch (94%) rename patches/{unapplied => }/server/Add-UnknownCommandEvent.patch (100%) rename patches/{unapplied => }/server/Add-setPlayerProfile-API-for-Skulls.patch (100%) rename patches/{unapplied => }/server/Allow-specifying-a-custom-authentication-servers-dow.patch (100%) rename patches/{unapplied => }/server/AsyncTabCompleteEvent.patch (98%) rename patches/{unapplied => }/server/Basic-PlayerProfile-API.patch (99%) rename patches/{unapplied => }/server/Block-player-logins-during-server-shutdown.patch (100%) rename patches/{unapplied => }/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch (100%) rename patches/{unapplied => }/server/Entity-fromMobSpawner.patch (100%) rename patches/{unapplied => }/server/Expose-client-protocol-version-and-virtual-host.patch (97%) rename patches/{unapplied => }/server/Extend-Player-Interact-cancellation.patch (100%) rename patches/{unapplied => }/server/Fill-Profile-Property-Events.patch (100%) rename patches/{unapplied => }/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch (100%) rename patches/{unapplied => }/server/Fix-this-stupid-bullshit.patch (95%) rename patches/{unapplied => }/server/Handle-plugin-prefixes-using-Log4J-configuration.patch (100%) rename patches/{unapplied => }/server/Implement-ensureServerConversions-API.patch (100%) rename patches/{unapplied => }/server/Implement-getI18NDisplayName.patch (100%) rename patches/{unapplied => }/server/Improve-Log4J-Configuration-Plugin-Loggers.patch (100%) rename patches/{unapplied => }/server/Improve-the-Saddle-API-for-Horses.patch (100%) rename patches/{unapplied => }/server/LivingEntity-setKiller.patch (100%) rename patches/{unapplied => }/server/Ocelot-despawns-should-honor-nametags-and-leash.patch (100%) rename patches/{unapplied => }/server/PlayerAdvancementCriterionGrantEvent.patch (100%) rename patches/{unapplied => }/server/PlayerNaturallySpawnCreaturesEvent.patch (100%) rename patches/{unapplied => }/server/PlayerPickupExperienceEvent.patch (96%) rename patches/{unapplied => }/server/PreCreatureSpawnEvent.patch (100%) rename patches/{unapplied => }/server/Prevent-logins-from-being-processed-when-the-player-.patch (100%) rename patches/{unapplied => }/server/Profile-Lookup-Events.patch (100%) rename patches/{unapplied => }/server/ProfileWhitelistVerifyEvent.patch (100%) rename patches/{unapplied => }/server/Reset-spawner-timer-when-spawner-event-is-cancelled.patch (100%) rename patches/{unapplied => }/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch (76%) rename patches/{unapplied => }/server/Shoulder-Entities-Release-API.patch (83%) rename patches/{unapplied => }/server/Tameable-getOwnerUniqueId-API.patch (100%) rename patches/{unapplied => }/server/Toggleable-player-crits-helps-mitigate-hacked-client.patch (85%) rename patches/{unapplied => }/server/handle-ServerboundKeepAlivePacket-async.patch (94%) rename patches/{unapplied => }/server/revert-serverside-behavior-of-keepalives.patch (99%) rename patches/{unapplied => }/server/use-CB-BlockState-implementations-for-captured-block.patch (100%) diff --git a/patches/unapplied/server/API-to-get-a-BlockState-without-a-snapshot.patch b/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch similarity index 100% rename from patches/unapplied/server/API-to-get-a-BlockState-without-a-snapshot.patch rename to patches/server/API-to-get-a-BlockState-without-a-snapshot.patch diff --git a/patches/unapplied/server/Ability-to-apply-mending-to-XP-API.patch b/patches/server/Ability-to-apply-mending-to-XP-API.patch similarity index 100% rename from patches/unapplied/server/Ability-to-apply-mending-to-XP-API.patch rename to patches/server/Ability-to-apply-mending-to-XP-API.patch diff --git a/patches/unapplied/server/Add-ArmorStand-Item-Meta.patch b/patches/server/Add-ArmorStand-Item-Meta.patch similarity index 100% rename from patches/unapplied/server/Add-ArmorStand-Item-Meta.patch rename to patches/server/Add-ArmorStand-Item-Meta.patch diff --git a/patches/unapplied/server/Add-PlayerArmorChangeEvent.patch b/patches/server/Add-PlayerArmorChangeEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerArmorChangeEvent.patch rename to patches/server/Add-PlayerArmorChangeEvent.patch diff --git a/patches/unapplied/server/Add-PlayerJumpEvent.patch b/patches/server/Add-PlayerJumpEvent.patch similarity index 94% rename from patches/unapplied/server/Add-PlayerJumpEvent.patch rename to patches/server/Add-PlayerJumpEvent.patch index 940607b197..74dd174c76 100644 --- a/patches/unapplied/server/Add-PlayerJumpEvent.patch +++ b/patches/server/Add-PlayerJumpEvent.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - boolean flag = d8 > 0.0D; + boolean flag = d7 > 0.0D; - if (this.player.isOnGround() && !packet.isOnGround() && flag) { + if (this.player.onGround() && !packet.isOnGround() && flag) { - this.player.jumpFromGround(); + // Paper start - Add player jump event + Player player = this.getCraftPlayer(); diff --git a/patches/unapplied/server/Add-UnknownCommandEvent.patch b/patches/server/Add-UnknownCommandEvent.patch similarity index 100% rename from patches/unapplied/server/Add-UnknownCommandEvent.patch rename to patches/server/Add-UnknownCommandEvent.patch diff --git a/patches/unapplied/server/Add-setPlayerProfile-API-for-Skulls.patch b/patches/server/Add-setPlayerProfile-API-for-Skulls.patch similarity index 100% rename from patches/unapplied/server/Add-setPlayerProfile-API-for-Skulls.patch rename to patches/server/Add-setPlayerProfile-API-for-Skulls.patch diff --git a/patches/unapplied/server/Allow-specifying-a-custom-authentication-servers-dow.patch b/patches/server/Allow-specifying-a-custom-authentication-servers-dow.patch similarity index 100% rename from patches/unapplied/server/Allow-specifying-a-custom-authentication-servers-dow.patch rename to patches/server/Allow-specifying-a-custom-authentication-servers-dow.patch diff --git a/patches/unapplied/server/AsyncTabCompleteEvent.patch b/patches/server/AsyncTabCompleteEvent.patch similarity index 98% rename from patches/unapplied/server/AsyncTabCompleteEvent.patch rename to patches/server/AsyncTabCompleteEvent.patch index d88698d78a..a169afa574 100644 --- a/patches/unapplied/server/AsyncTabCompleteEvent.patch +++ b/patches/server/AsyncTabCompleteEvent.patch @@ -29,18 +29,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end @Override public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) { -- PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); -+ // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async +- PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); ++ // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - run this async // CraftBukkit start if (this.chatSpamTickCount.addAndGet(1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { - this.disconnect(Component.translatable("disconnect.spam")); + server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper return; } - // Paper start -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - } - // Paper end // CraftBukkit end + // Paper start - async tab completion + TAB_COMPLETE_EXECUTOR.execute(() -> { diff --git a/patches/unapplied/server/Basic-PlayerProfile-API.patch b/patches/server/Basic-PlayerProfile-API.patch similarity index 99% rename from patches/unapplied/server/Basic-PlayerProfile-API.patch rename to patches/server/Basic-PlayerProfile-API.patch index 4b558d5ec1..c01cd66cfe 100644 --- a/patches/unapplied/server/Basic-PlayerProfile-API.patch +++ b/patches/server/Basic-PlayerProfile-API.patch @@ -575,10 +575,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import com.destroystokyo.paper.profile.PlayerProfile; import com.google.common.util.concurrent.ThreadFactoryBuilder; import io.papermc.paper.math.Position; - import com.google.gson.JsonArray; -@@ -0,0 +0,0 @@ import net.minecraft.world.level.Level; - import net.minecraft.world.level.chunk.ChunkAccess; - import net.minecraft.world.level.chunk.ChunkStatus; + import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; +@@ -0,0 +0,0 @@ import net.minecraft.world.level.ChunkPos; + import net.minecraft.world.level.ClipContext; + import net.minecraft.world.level.Level; import org.apache.commons.lang.exception.ExceptionUtils; +import com.mojang.authlib.GameProfile; import org.bukkit.Location; diff --git a/patches/unapplied/server/Block-player-logins-during-server-shutdown.patch b/patches/server/Block-player-logins-during-server-shutdown.patch similarity index 100% rename from patches/unapplied/server/Block-player-logins-during-server-shutdown.patch rename to patches/server/Block-player-logins-during-server-shutdown.patch diff --git a/patches/unapplied/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch similarity index 100% rename from patches/unapplied/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch rename to patches/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch diff --git a/patches/unapplied/server/Entity-fromMobSpawner.patch b/patches/server/Entity-fromMobSpawner.patch similarity index 100% rename from patches/unapplied/server/Entity-fromMobSpawner.patch rename to patches/server/Entity-fromMobSpawner.patch diff --git a/patches/unapplied/server/Expose-client-protocol-version-and-virtual-host.patch b/patches/server/Expose-client-protocol-version-and-virtual-host.patch similarity index 97% rename from patches/unapplied/server/Expose-client-protocol-version-and-virtual-host.patch rename to patches/server/Expose-client-protocol-version-and-virtual-host.patch index fe848be9b2..c5752368ca 100644 --- a/patches/unapplied/server/Expose-client-protocol-version-and-virtual-host.patch +++ b/patches/server/Expose-client-protocol-version-and-virtual-host.patch @@ -64,9 +64,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { - } - } - // Paper end - add pending task queue + private int tickCount; + private boolean handlingFault; + public String hostname = ""; // CraftBukkit - add field + // Paper start - NetworkClient implementation + public int protocolVersion; + public java.net.InetSocketAddress virtualHost; diff --git a/patches/unapplied/server/Extend-Player-Interact-cancellation.patch b/patches/server/Extend-Player-Interact-cancellation.patch similarity index 100% rename from patches/unapplied/server/Extend-Player-Interact-cancellation.patch rename to patches/server/Extend-Player-Interact-cancellation.patch diff --git a/patches/unapplied/server/Fill-Profile-Property-Events.patch b/patches/server/Fill-Profile-Property-Events.patch similarity index 100% rename from patches/unapplied/server/Fill-Profile-Property-Events.patch rename to patches/server/Fill-Profile-Property-Events.patch diff --git a/patches/unapplied/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch b/patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch similarity index 100% rename from patches/unapplied/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch rename to patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch diff --git a/patches/unapplied/server/Fix-this-stupid-bullshit.patch b/patches/server/Fix-this-stupid-bullshit.patch similarity index 95% rename from patches/unapplied/server/Fix-this-stupid-bullshit.patch rename to patches/server/Fix-this-stupid-bullshit.patch index 2e8b1ad818..997faaa22d 100644 --- a/patches/unapplied/server/Fix-this-stupid-bullshit.patch +++ b/patches/server/Fix-this-stupid-bullshit.patch @@ -29,14 +29,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }*/ // Paper // CraftBukkit end Bootstrap.isBootstrapped = true; - if (BuiltInRegistries.REGISTRY.keySet().isEmpty()) { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -21); + deadline.add(Calendar.DAY_OF_YEAR, -3); if (buildDate.before(deadline.getTime())) { - System.err.println("*** Error, this build is outdated ***"); + // Paper start - This is some stupid bullshit diff --git a/patches/unapplied/server/Handle-plugin-prefixes-using-Log4J-configuration.patch b/patches/server/Handle-plugin-prefixes-using-Log4J-configuration.patch similarity index 100% rename from patches/unapplied/server/Handle-plugin-prefixes-using-Log4J-configuration.patch rename to patches/server/Handle-plugin-prefixes-using-Log4J-configuration.patch diff --git a/patches/unapplied/server/Implement-ensureServerConversions-API.patch b/patches/server/Implement-ensureServerConversions-API.patch similarity index 100% rename from patches/unapplied/server/Implement-ensureServerConversions-API.patch rename to patches/server/Implement-ensureServerConversions-API.patch diff --git a/patches/unapplied/server/Implement-getI18NDisplayName.patch b/patches/server/Implement-getI18NDisplayName.patch similarity index 100% rename from patches/unapplied/server/Implement-getI18NDisplayName.patch rename to patches/server/Implement-getI18NDisplayName.patch diff --git a/patches/unapplied/server/Improve-Log4J-Configuration-Plugin-Loggers.patch b/patches/server/Improve-Log4J-Configuration-Plugin-Loggers.patch similarity index 100% rename from patches/unapplied/server/Improve-Log4J-Configuration-Plugin-Loggers.patch rename to patches/server/Improve-Log4J-Configuration-Plugin-Loggers.patch diff --git a/patches/unapplied/server/Improve-the-Saddle-API-for-Horses.patch b/patches/server/Improve-the-Saddle-API-for-Horses.patch similarity index 100% rename from patches/unapplied/server/Improve-the-Saddle-API-for-Horses.patch rename to patches/server/Improve-the-Saddle-API-for-Horses.patch diff --git a/patches/unapplied/server/LivingEntity-setKiller.patch b/patches/server/LivingEntity-setKiller.patch similarity index 100% rename from patches/unapplied/server/LivingEntity-setKiller.patch rename to patches/server/LivingEntity-setKiller.patch diff --git a/patches/unapplied/server/Ocelot-despawns-should-honor-nametags-and-leash.patch b/patches/server/Ocelot-despawns-should-honor-nametags-and-leash.patch similarity index 100% rename from patches/unapplied/server/Ocelot-despawns-should-honor-nametags-and-leash.patch rename to patches/server/Ocelot-despawns-should-honor-nametags-and-leash.patch diff --git a/patches/unapplied/server/PlayerAdvancementCriterionGrantEvent.patch b/patches/server/PlayerAdvancementCriterionGrantEvent.patch similarity index 100% rename from patches/unapplied/server/PlayerAdvancementCriterionGrantEvent.patch rename to patches/server/PlayerAdvancementCriterionGrantEvent.patch diff --git a/patches/unapplied/server/PlayerNaturallySpawnCreaturesEvent.patch b/patches/server/PlayerNaturallySpawnCreaturesEvent.patch similarity index 100% rename from patches/unapplied/server/PlayerNaturallySpawnCreaturesEvent.patch rename to patches/server/PlayerNaturallySpawnCreaturesEvent.patch diff --git a/patches/unapplied/server/PlayerPickupExperienceEvent.patch b/patches/server/PlayerPickupExperienceEvent.patch similarity index 96% rename from patches/unapplied/server/PlayerPickupExperienceEvent.patch rename to patches/server/PlayerPickupExperienceEvent.patch index 215d48097b..bba1bc73cf 100644 --- a/patches/unapplied/server/PlayerPickupExperienceEvent.patch +++ b/patches/server/PlayerPickupExperienceEvent.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ExperienceOrb extends Entity { @Override public void playerTouch(Player player) { - if (!this.level.isClientSide) { + if (!this.level().isClientSide) { - if (player.takeXpDelay == 0) { + if (player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper player.takeXpDelay = CraftEventFactory.callPlayerXpCooldownEvent(player, 2, PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entityhuman.takeXpDelay = 2; diff --git a/patches/unapplied/server/PreCreatureSpawnEvent.patch b/patches/server/PreCreatureSpawnEvent.patch similarity index 100% rename from patches/unapplied/server/PreCreatureSpawnEvent.patch rename to patches/server/PreCreatureSpawnEvent.patch diff --git a/patches/unapplied/server/Prevent-logins-from-being-processed-when-the-player-.patch b/patches/server/Prevent-logins-from-being-processed-when-the-player-.patch similarity index 100% rename from patches/unapplied/server/Prevent-logins-from-being-processed-when-the-player-.patch rename to patches/server/Prevent-logins-from-being-processed-when-the-player-.patch diff --git a/patches/unapplied/server/Profile-Lookup-Events.patch b/patches/server/Profile-Lookup-Events.patch similarity index 100% rename from patches/unapplied/server/Profile-Lookup-Events.patch rename to patches/server/Profile-Lookup-Events.patch diff --git a/patches/unapplied/server/ProfileWhitelistVerifyEvent.patch b/patches/server/ProfileWhitelistVerifyEvent.patch similarity index 100% rename from patches/unapplied/server/ProfileWhitelistVerifyEvent.patch rename to patches/server/ProfileWhitelistVerifyEvent.patch diff --git a/patches/unapplied/server/Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/patches/server/Reset-spawner-timer-when-spawner-event-is-cancelled.patch similarity index 100% rename from patches/unapplied/server/Reset-spawner-timer-when-spawner-event-is-cancelled.patch rename to patches/server/Reset-spawner-timer-when-spawner-event-is-cancelled.patch diff --git a/patches/unapplied/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch b/patches/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch similarity index 76% rename from patches/unapplied/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch rename to patches/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch index f716603825..f29a4231b4 100644 --- a/patches/unapplied/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/patches/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int i = b0 + EnchantmentHelper.getKnockbackBonus(this); if (this.isSprinting() && flag) { -- this.level.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); + sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility ++i; flag1 = true; @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -- this.level.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_SWEEP, this.getSoundSource(), 1.0F, 1.0F); +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_SWEEP, this.getSoundSource(), 1.0F, 1.0F); + sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_SWEEP, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility this.sweepAttack(); } @@ -31,26 +31,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } if (flag2) { -- this.level.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_CRIT, this.getSoundSource(), 1.0F, 1.0F); +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_CRIT, this.getSoundSource(), 1.0F, 1.0F); + sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_CRIT, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility this.crit(target); } if (!flag2 && !flag3) { if (flag) { -- this.level.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_STRONG, this.getSoundSource(), 1.0F, 1.0F); +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_STRONG, this.getSoundSource(), 1.0F, 1.0F); + sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_STRONG, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility } else { -- this.level.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_WEAK, this.getSoundSource(), 1.0F, 1.0F); +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_WEAK, this.getSoundSource(), 1.0F, 1.0F); + sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_WEAK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility } } @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { - this.causeFoodExhaustion(level.spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value + this.causeFoodExhaustion(this.level().spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value } else { -- this.level.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F); +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F); + sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility if (flag4) { target.clearFire(); diff --git a/patches/unapplied/server/Shoulder-Entities-Release-API.patch b/patches/server/Shoulder-Entities-Release-API.patch similarity index 83% rename from patches/unapplied/server/Shoulder-Entities-Release-API.patch rename to patches/server/Shoulder-Entities-Release-API.patch index 40d6023288..8133a715f5 100644 --- a/patches/unapplied/server/Shoulder-Entities-Release-API.patch +++ b/patches/server/Shoulder-Entities-Release-API.patch @@ -29,23 +29,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return entity; + } + // Paper - maintain old signature - private boolean spawnEntityFromShoulder(CompoundTag nbttagcompound) { // CraftBukkit void->boolean -- if (!this.level.isClientSide && !nbttagcompound.isEmpty()) { -+ return spawnEntityFromShoulder0(nbttagcompound) != null; ++ + private boolean respawnEntityOnShoulder(CompoundTag nbttagcompound) { // CraftBukkit void->boolean +- if (!this.level().isClientSide && !nbttagcompound.isEmpty()) { ++ return this.spawnEntityFromShoulder0(nbttagcompound) != null; + } + + // Paper - return entity -+ private Entity spawnEntityFromShoulder0(@Nullable CompoundTag nbttagcompound) { -+ if (!this.level.isClientSide && nbttagcompound != null && !nbttagcompound.isEmpty()) { - return EntityType.create(nbttagcompound, this.level).map((entity) -> { // CraftBukkit ++ private Entity respawnEntityOnShoulder0(CompoundTag nbttagcompound) { // CraftBukkit void->boolean ++ if (!this.level().isClientSide && nbttagcompound != null && !nbttagcompound.isEmpty()) { + return EntityType.create(nbttagcompound, this.level()).map((entity) -> { // CraftBukkit if (entity instanceof TamableAnimal) { ((TamableAnimal) entity).setOwnerUUID(this.uuid); } entity.setPos(this.getX(), this.getY() + 0.699999988079071D, this.getZ()); -- return ((ServerLevel) this.level).addWithUUID(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit +- return ((ServerLevel) this.level()).addWithUUID(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit - }).orElse(true); // CraftBukkit -+ boolean addedToWorld = ((ServerLevel) this.level).addWithUUID(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit ++ boolean addedToWorld = ((ServerLevel) this.level()).addWithUUID(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit + return addedToWorld ? entity : null; + }).orElse(null); // CraftBukkit // Paper - true -> null } diff --git a/patches/unapplied/server/Tameable-getOwnerUniqueId-API.patch b/patches/server/Tameable-getOwnerUniqueId-API.patch similarity index 100% rename from patches/unapplied/server/Tameable-getOwnerUniqueId-API.patch rename to patches/server/Tameable-getOwnerUniqueId-API.patch diff --git a/patches/unapplied/server/Toggleable-player-crits-helps-mitigate-hacked-client.patch b/patches/server/Toggleable-player-crits-helps-mitigate-hacked-client.patch similarity index 85% rename from patches/unapplied/server/Toggleable-player-crits-helps-mitigate-hacked-client.patch rename to patches/server/Toggleable-player-crits-helps-mitigate-hacked-client.patch index e619d3e3e7..a78a5418e0 100644 --- a/patches/unapplied/server/Toggleable-player-crits-helps-mitigate-hacked-client.patch +++ b/patches/server/Toggleable-player-crits-helps-mitigate-hacked-client.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { - boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; + boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; + flag2 = flag2 && !level.paperConfig().entities.behavior.disablePlayerCrits; // Paper flag2 = flag2 && !this.isSprinting(); diff --git a/patches/unapplied/server/handle-ServerboundKeepAlivePacket-async.patch b/patches/server/handle-ServerboundKeepAlivePacket-async.patch similarity index 94% rename from patches/unapplied/server/handle-ServerboundKeepAlivePacket-async.patch rename to patches/server/handle-ServerboundKeepAlivePacket-async.patch index 45e07b0d2a..84fd5bbdf3 100644 --- a/patches/unapplied/server/handle-ServerboundKeepAlivePacket-async.patch +++ b/patches/server/handle-ServerboundKeepAlivePacket-async.patch @@ -22,8 +22,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void handleKeepAlive(ServerboundKeepAlivePacket packet) { -- PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // CraftBukkit -+ //PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // CraftBukkit // Paper - This shouldn't be on the main thread +- PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // CraftBukkit ++ //PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // CraftBukkit // Paper - This shouldn't be on the main thread if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) { int i = (int) (Util.getMillis() - this.keepAliveTime); diff --git a/patches/unapplied/server/revert-serverside-behavior-of-keepalives.patch b/patches/server/revert-serverside-behavior-of-keepalives.patch similarity index 99% rename from patches/unapplied/server/revert-serverside-behavior-of-keepalives.patch rename to patches/server/revert-serverside-behavior-of-keepalives.patch index e881934b0b..df66e1d6c9 100644 --- a/patches/unapplied/server/revert-serverside-behavior-of-keepalives.patch +++ b/patches/server/revert-serverside-behavior-of-keepalives.patch @@ -42,15 +42,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.server.getProfiler().push("keepAlive"); - long i = Util.getMillis(); -+ // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings -+ // This should effectively place the keepalive handling back to "as it was" before 1.12.2 -+ long currentTime = Util.getMillis(); -+ long elapsedTime = currentTime - this.keepAliveTime; - +- - if (i - this.keepAliveTime >= 25000L) { // CraftBukkit - if (this.keepAlivePending) { - this.disconnect(Component.translatable("disconnect.timeout")); - } else { ++ // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings ++ // This should effectively place the keepalive handling back to "as it was" before 1.12.2 ++ long currentTime = Util.getMillis(); ++ long elapsedTime = currentTime - this.keepAliveTime; ++ + if (this.keepAlivePending) { + if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected + ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info diff --git a/patches/unapplied/server/use-CB-BlockState-implementations-for-captured-block.patch b/patches/server/use-CB-BlockState-implementations-for-captured-block.patch similarity index 100% rename from patches/unapplied/server/use-CB-BlockState-implementations-for-captured-block.patch rename to patches/server/use-CB-BlockState-implementations-for-captured-block.patch