Ignore minecart in activation range (#10359)

This commit is contained in:
Joseph Burton 2024-04-07 00:50:43 +01:00 committed by GitHub
parent 8e75001cb8
commit 241d8e26fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 13 deletions

View file

@ -1,18 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 2 Mar 2016 00:32:25 -0600
Subject: [PATCH] Always tick falling blocks
Subject: [PATCH] Add more entities to activation range ignore list
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index a5da6c1cae0afbde684be250e2fc3c0c32a1265b..e5ff35531a933268f2b8b6c15c234de4482931d5 100644
index a5da6c1cae0afbde684be250e2fc3c0c32a1265b..6d51464f6368151e8acc532414ee223714584e96 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -92,6 +92,7 @@ public class ActivationRange
@@ -92,6 +92,9 @@ public class ActivationRange
|| entity instanceof AbstractHurtingProjectile
|| entity instanceof LightningBolt
|| entity instanceof PrimedTnt
+ || entity instanceof net.minecraft.world.entity.item.FallingBlockEntity // Paper - Always tick falling blocks
+ || entity instanceof net.minecraft.world.entity.vehicle.AbstractMinecart // Paper
+ || entity instanceof net.minecraft.world.entity.vehicle.Boat // Paper
|| entity instanceof EndCrystal
|| entity instanceof FireworkRocketEntity
|| entity instanceof ThrownTrident )

View file

@ -28,10 +28,10 @@ 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 e5ff35531a933268f2b8b6c15c234de4482931d5..90df7e83d9166c22a56a31db22d843768229b9ab 100644
index 6d51464f6368151e8acc532414ee223714584e96..9fb9fa62c32445ac3c3883a6433759c86dcfc428 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -254,7 +254,7 @@ public class ActivationRange
@@ -256,7 +256,7 @@ public class ActivationRange
isActive = true;
}
// Add a little performance juice to active entities. Skip 1/4 if not immune.

View file

@ -111,7 +111,7 @@ index bd8c96e914b156284bdbb960f168e63e1f122920..abb4c32e8b35de332fa517523e8c598e
} else {
passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 3f620c4b8415f09a8d4664481b2d41d421ee836e..703b32362cf6a23dfe9326aa4e0ee74511e0d2cb 100644
index 3f620c4b8415f09a8d4664481b2d41d421ee836e..132ab49c02b83c37e1a64fc19f9bdfc04f52f2ed 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -412,6 +412,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -137,7 +137,7 @@ index 3f620c4b8415f09a8d4664481b2d41d421ee836e..703b32362cf6a23dfe9326aa4e0ee745
this.setDeltaMovement(Vec3.ZERO);
}
+ // Paper start - ignore movement changes while inactive.
+ if (isTemporarilyActive && !(this instanceof ItemEntity || this instanceof net.minecraft.world.entity.vehicle.AbstractMinecart) && movement == getDeltaMovement() && movementType == MoverType.SELF) {
+ if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && movementType == MoverType.SELF) {
+ setDeltaMovement(Vec3.ZERO);
+ this.level.getProfiler().pop();
+ return;
@ -371,7 +371,7 @@ index b1061db1d9b3bfde61d5016e10556c4320095827..c71690dbc3dc52803945f1608f0ee3ba
}
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 90df7e83d9166c22a56a31db22d843768229b9ab..c39894e824334f1dc52e0466cf9d84f7e219be70 100644
index 9fb9fa62c32445ac3c3883a6433759c86dcfc428..3283ed99c35ffed6805567705e0518d9f84feedc 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -1,33 +1,43 @@
@ -499,7 +499,7 @@ index 90df7e83d9166c22a56a31db22d843768229b9ab..c39894e824334f1dc52e0466cf9d84f7
|| entity instanceof Player
|| entity instanceof ThrowableProjectile
|| entity instanceof EnderDragon
@@ -116,10 +170,25 @@ public class ActivationRange
@@ -118,10 +172,25 @@ public class ActivationRange
final int raiderActivationRange = world.spigotConfig.raiderActivationRange;
final int animalActivationRange = world.spigotConfig.animalActivationRange;
final int monsterActivationRange = world.spigotConfig.monsterActivationRange;
@ -525,7 +525,7 @@ index 90df7e83d9166c22a56a31db22d843768229b9ab..c39894e824334f1dc52e0466cf9d84f7
maxRange = Math.min( ( world.spigotConfig.simulationDistance << 4 ) - 8, maxRange );
for ( Player player : world.players() )
@@ -130,13 +199,30 @@ public class ActivationRange
@@ -132,13 +201,30 @@ public class ActivationRange
continue;
}
@ -562,7 +562,7 @@ index 90df7e83d9166c22a56a31db22d843768229b9ab..c39894e824334f1dc52e0466cf9d84f7
}
MinecraftTimings.entityActivationCheckTimer.stopTiming();
}
@@ -169,60 +255,118 @@ public class ActivationRange
@@ -171,60 +257,118 @@ public class ActivationRange
* @param entity
* @return
*/
@ -698,7 +698,7 @@ index 90df7e83d9166c22a56a31db22d843768229b9ab..c39894e824334f1dc52e0466cf9d84f7
}
/**
@@ -237,8 +381,19 @@ public class ActivationRange
@@ -239,8 +383,19 @@ public class ActivationRange
if ( entity instanceof FireworkRocketEntity ) {
return true;
}
@ -719,7 +719,7 @@ index 90df7e83d9166c22a56a31db22d843768229b9ab..c39894e824334f1dc52e0466cf9d84f7
// Should this entity tick?
if ( !isActive )
@@ -246,15 +401,19 @@ public class ActivationRange
@@ -248,15 +403,19 @@ public class ActivationRange
if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 )
{
// Check immunities every 20 ticks.