Backport small fixes

This commit is contained in:
Nassim Jahnke 2024-10-30 19:40:07 +01:00
parent ba31f41282
commit 9de3f75fa2
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
3 changed files with 29 additions and 19 deletions

View File

@ -28,15 +28,22 @@ index bfbbb9382cf483a23acf35c17250f6f9223f7507..5994cb69575d365f435f5ef6da5fa61e
float f1 = 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;
}
}

View File

@ -50,7 +50,7 @@ index a65a1466dab52fca75cda16a4b22fef03b6207a0..0306771b8f90dcdd77f151c19c6c2d75
MinecraftServer minecraftserver = this.server;
Connection networkmanager = this.connection;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index bce87f55ad85837a17f783b5341ef5b64ab0ede0..42c24ed58fab0f7ff9f58b2a65818f45a5b7cc06 100644
index de6b8af2f586469cd97ad796ee9a841a83f8f068..cb7d038b902c326d2ebec61f1dc40849c3cfbc63 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1882,6 +1882,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -96,7 +96,7 @@ index bce87f55ad85837a17f783b5341ef5b64ab0ede0..42c24ed58fab0f7ff9f58b2a65818f45
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 dcb8de1c28b767068aa10f044bd8cf72ef6cfcaf..57e7ce227666a2e273c9e61a102152efd2c0ebd9 100644
index dcb8de1c28b767068aa10f044bd8cf72ef6cfcaf..5d3f2bcdd830568b75ac05e32cec5b5cd72ce8c7 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -569,6 +569,11 @@ public abstract class PlayerList {
@ -111,3 +111,12 @@ index dcb8de1c28b767068aa10f044bd8cf72ef6cfcaf..57e7ce227666a2e273c9e61a102152ef
ServerLevel worldserver = entityplayer.serverLevel();
entityplayer.awardStat(Stats.LEAVE_GAME);
@@ -579,7 +584,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());

View File

@ -147,7 +147,7 @@ index b108f779abe3d9798c0bcbc983f41d48b33aa153..a66fe080ee73171090abec48352ad0bd
movement = this.maybeBackOffFromEdge(movement, movementType);
Vec3 vec3d1 = this.collide(movement);
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index d2f5d959d3b67f7c20d0c0de462a18d667f3a84b..2439f8d48daca7329049436414f06a36b4b79029 100644
index 11c933a662c2275e2ef239cb0b5dd2480cc55490..d2c92df28475f0a32a0134324eb0a5609a9afb99 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -222,6 +222,19 @@ public abstract class Mob extends LivingEntity implements Targeting {
@ -372,7 +372,7 @@ index 0e15da7cae105196d444b924b8e0db190583ba30..9f45dda6ff45ac1ffb7ac99575b7d09b
}
}
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 5485df1a1b59e81f4dcedd21dd972e1fd2759573..1cf6d4f854d89c515e48e1fb365eb95ff9340765 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java