From a4f0f5ccd05592dc9be040d8c17d6795baa7b1b8 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 30 Oct 2024 19:57:33 +0100 Subject: [PATCH] Backport small fixes --- ...0311-Fix-items-not-falling-correctly.patch | 19 +++++++++++++------ ...k-event-leave-message-not-being-sent.patch | 11 ++++++++++- .../0984-Entity-Activation-Range-2.0.patch | 14 ++++---------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/patches/server/0311-Fix-items-not-falling-correctly.patch b/patches/server/0311-Fix-items-not-falling-correctly.patch index a9746d7d4e..77353dc037 100644 --- a/patches/server/0311-Fix-items-not-falling-correctly.patch +++ b/patches/server/0311-Fix-items-not-falling-correctly.patch @@ -28,15 +28,22 @@ index f0e6375236d61f32235ed23c3bae49db1545d1a2..5782033cbe408f60340833ddb49dbca3 float f = 0.98F; diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 6d51464f6368151e8acc532414ee223714584e96..9fb9fa62c32445ac3c3883a6433759c86dcfc428 100644 +index 6d51464f6368151e8acc532414ee223714584e96..00242230e327fb9dd99109398aa7c013bea8af8d 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -256,7 +256,7 @@ public class ActivationRange +@@ -254,12 +254,11 @@ public class ActivationRange + entity.activatedTick = MinecraftServer.currentTick + 20; + } isActive = true; ++ } else if (entity instanceof net.minecraft.world.entity.item.ItemEntity && (entity.tickCount + 1 + entity.getId()) % 4 == 0) { // Paper - Needed for item gravity, see ItemEntity tick. +1 since the entity tick counter is increased AFTER... ++ isActive = true; } - // Add a little performance juice to active entities. Skip 1/4 if not immune. +- // Add a little performance juice to active entities. Skip 1/4 if not immune. - } else if ( !entity.defaultActivationState && entity.tickCount % 4 == 0 && !ActivationRange.checkEntityImmunities( entity ) ) -+ } else if ( !entity.defaultActivationState && (entity.tickCount + entity.getId()) % 4 == 0 && !ActivationRange.checkEntityImmunities( entity ) ) // Paper - Ensure checking item movement is offset from Spigot's entity activation range check - { - isActive = false; +- { +- isActive = false; } ++ // Paper - remove dumb active tick skipping + return isActive; + } + } diff --git a/patches/server/0574-Fix-kick-event-leave-message-not-being-sent.patch b/patches/server/0574-Fix-kick-event-leave-message-not-being-sent.patch index 312e25e58e..d3af97d48d 100644 --- a/patches/server/0574-Fix-kick-event-leave-message-not-being-sent.patch +++ b/patches/server/0574-Fix-kick-event-leave-message-not-being-sent.patch @@ -96,7 +96,7 @@ index 5544ba7a5f61f24d081373f56f82e4ef0ef1f3f0..2722d22a9204554c1b52aa853b50f1ce this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false); // Paper end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 709cf6655e5ccb17caf0b8a735ae957cb0509f2c..2b7ad2b9cd525814c9f91d22606c42aa82ce9f94 100644 +index 709cf6655e5ccb17caf0b8a735ae957cb0509f2c..c1e172a39af88b98383f00eb88d82eb26efcac84 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -567,6 +567,11 @@ public abstract class PlayerList { @@ -111,3 +111,12 @@ index 709cf6655e5ccb17caf0b8a735ae957cb0509f2c..2b7ad2b9cd525814c9f91d22606c42aa ServerLevel worldserver = entityplayer.serverLevel(); entityplayer.awardStat(Stats.LEAVE_GAME); +@@ -577,7 +582,7 @@ public abstract class PlayerList { + entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper - Inventory close reason + } + +- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName())), entityplayer.quitReason); // Paper - Adventure & Add API for quit reason ++ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), leaveMessage, entityplayer.quitReason); // Paper - Adventure & Add API for quit reason + this.cserver.getPluginManager().callEvent(playerQuitEvent); + entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); + diff --git a/patches/server/0984-Entity-Activation-Range-2.0.patch b/patches/server/0984-Entity-Activation-Range-2.0.patch index 9502ae49bc..b477be2263 100644 --- a/patches/server/0984-Entity-Activation-Range-2.0.patch +++ b/patches/server/0984-Entity-Activation-Range-2.0.patch @@ -372,7 +372,7 @@ index d7b963571c900f0f68005d6954bcd9ef1d9e0b7c..b35f476e26a020cf75e53a5eb488717d } } diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 9fb9fa62c32445ac3c3883a6433759c86dcfc428..3283ed99c35ffed6805567705e0518d9f84feedc 100644 +index 00242230e327fb9dd99109398aa7c013bea8af8d..08bae79a7e2bd592f032c154e8c8016b68fa93c4 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -1,33 +1,43 @@ @@ -720,7 +720,7 @@ index 9fb9fa62c32445ac3c3883a6433759c86dcfc428..3283ed99c35ffed6805567705e0518d9 // Should this entity tick? if ( !isActive ) -@@ -248,15 +403,19 @@ public class ActivationRange +@@ -248,11 +403,14 @@ public class ActivationRange if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 ) { // Check immunities every 20 ticks. @@ -737,14 +737,8 @@ index 9fb9fa62c32445ac3c3883a6433759c86dcfc428..3283ed99c35ffed6805567705e0518d9 } + // Paper end isActive = true; -+ - } - // Add a little performance juice to active entities. Skip 1/4 if not immune. -- } else if ( !entity.defaultActivationState && (entity.tickCount + entity.getId()) % 4 == 0 && !ActivationRange.checkEntityImmunities( entity ) ) // Paper - Ensure checking item movement is offset from Spigot's entity activation range check -+ } else if ( (entity.tickCount + entity.getId()) % 4 == 0 && ActivationRange.checkEntityImmunities( entity ) < 0 ) // Paper - { - isActive = false; - } + } else if (entity instanceof net.minecraft.world.entity.item.ItemEntity && (entity.tickCount + 1 + entity.getId()) % 4 == 0) { // Paper - Needed for item gravity, see ItemEntity tick. +1 since the entity tick counter is increased AFTER... + isActive = true; diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 37bbda040bd6f8a92295d2f32affbb53ea2d369b..dbfe355221fb2ee66b79442a749412d9288afc0d 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java