Use Worldheight for Activation Ranges (#8061)

This commit is contained in:
Owen 2022-07-30 12:47:35 -04:00 committed by GitHub
parent 8a08b86f4b
commit 6ecdbc09c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 16 deletions

View File

@ -335,7 +335,7 @@ index 4b55b667eebfe50dfeda89015112e275e71b9777..dda0b32a4989bbead35a2219a969a30b
}
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 7bae24598218dcf0012dd21e619e6f5f984bd6f0..c9a032c5331a918453de5e8c6a6d13f5c9f415ee 100644
index 7bae24598218dcf0012dd21e619e6f5f984bd6f0..0508f43ad396679d3372ae4caf029086a1524109 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -1,39 +1,52 @@
@ -498,19 +498,30 @@ index 7bae24598218dcf0012dd21e619e6f5f984bd6f0..c9a032c5331a918453de5e8c6a6d13f5
maxRange = Math.min( ( world.spigotConfig.simulationDistance << 4 ) - 8, maxRange );
for ( Player player : world.players() )
@@ -132,6 +204,11 @@ public class ActivationRange
ActivationType.RAIDER.boundingBox = player.getBoundingBox().inflate( raiderActivationRange, 256, raiderActivationRange );
ActivationType.ANIMAL.boundingBox = player.getBoundingBox().inflate( animalActivationRange, 256, animalActivationRange );
ActivationType.MONSTER.boundingBox = player.getBoundingBox().inflate( monsterActivationRange, 256, monsterActivationRange );
@@ -127,11 +199,17 @@ public class ActivationRange
continue;
}
- ActivationRange.maxBB = player.getBoundingBox().inflate( maxRange, 256, maxRange );
- ActivationType.MISC.boundingBox = player.getBoundingBox().inflate( miscActivationRange, 256, miscActivationRange );
- ActivationType.RAIDER.boundingBox = player.getBoundingBox().inflate( raiderActivationRange, 256, raiderActivationRange );
- ActivationType.ANIMAL.boundingBox = player.getBoundingBox().inflate( animalActivationRange, 256, animalActivationRange );
- ActivationType.MONSTER.boundingBox = player.getBoundingBox().inflate( monsterActivationRange, 256, monsterActivationRange );
+ // Paper start
+ ActivationType.WATER.boundingBox = player.getBoundingBox().inflate( waterActivationRange, 256, waterActivationRange );
+ ActivationType.FLYING_MONSTER.boundingBox = player.getBoundingBox().inflate( flyingActivationRange, 256, flyingActivationRange );
+ ActivationType.VILLAGER.boundingBox = player.getBoundingBox().inflate( villagerActivationRange, 256, villagerActivationRange );
+ int worldHeight = world.getHeight();
+ ActivationRange.maxBB = player.getBoundingBox().inflate( maxRange, worldHeight, maxRange );
+ ActivationType.MISC.boundingBox = player.getBoundingBox().inflate( miscActivationRange, worldHeight, miscActivationRange );
+ ActivationType.RAIDER.boundingBox = player.getBoundingBox().inflate( raiderActivationRange, worldHeight, raiderActivationRange );
+ ActivationType.ANIMAL.boundingBox = player.getBoundingBox().inflate( animalActivationRange, worldHeight, animalActivationRange );
+ ActivationType.MONSTER.boundingBox = player.getBoundingBox().inflate( monsterActivationRange, worldHeight, monsterActivationRange );
+ ActivationType.WATER.boundingBox = player.getBoundingBox().inflate( waterActivationRange, worldHeight, waterActivationRange );
+ ActivationType.FLYING_MONSTER.boundingBox = player.getBoundingBox().inflate( flyingActivationRange, worldHeight, flyingActivationRange );
+ ActivationType.VILLAGER.boundingBox = player.getBoundingBox().inflate( villagerActivationRange, worldHeight, villagerActivationRange );
+ // Paper end
world.getEntities().get(maxBB, ActivationRange::activateEntity);
}
@@ -166,60 +243,118 @@ public class ActivationRange
@@ -166,60 +244,118 @@ public class ActivationRange
* @param entity
* @return
*/
@ -646,7 +657,7 @@ index 7bae24598218dcf0012dd21e619e6f5f984bd6f0..c9a032c5331a918453de5e8c6a6d13f5
}
/**
@@ -234,8 +369,19 @@ public class ActivationRange
@@ -234,8 +370,19 @@ public class ActivationRange
if ( entity instanceof FireworkRocketEntity ) {
return true;
}
@ -667,7 +678,7 @@ index 7bae24598218dcf0012dd21e619e6f5f984bd6f0..c9a032c5331a918453de5e8c6a6d13f5
// Should this entity tick?
if ( !isActive )
@@ -243,15 +389,19 @@ public class ActivationRange
@@ -243,15 +390,19 @@ public class ActivationRange
if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 )
{
// Check immunities every 20 ticks.

View File

@ -1280,11 +1280,11 @@ index 3bedc22c253c3632b5624c05e78ed3671e5d30ce..fbd82b6be6604bf854e01ed5718e4e07
+ // Paper end
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index c9a032c5331a918453de5e8c6a6d13f5c9f415ee..5bffc9a0f6ef9d54abb359565d07509b177c2b82 100644
index 5ee798f5ba59339419c2dd38b32e766692c1428c..3cc3eb9acada64ea108db15cbfbd67d69df3401c 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -210,7 +210,13 @@ public class ActivationRange
ActivationType.VILLAGER.boundingBox = player.getBoundingBox().inflate( villagerActivationRange, 256, villagerActivationRange );
@@ -211,7 +211,13 @@ public class ActivationRange
ActivationType.VILLAGER.boundingBox = player.getBoundingBox().inflate( villagerActivationRange, worldHeight, villagerActivationRange );
// Paper end
- world.getEntities().get(maxBB, ActivationRange::activateEntity);

View File

@ -34,10 +34,10 @@ index 802b929a16b6a8aeee608caeb524e268f8df53bd..5b3a7626579ff6bcf3ad32f7193bf905
ServerLevel.this.entityManager.addNavigatorsIfPathingToRegion(entity); // Paper - optimise notify
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 5bffc9a0f6ef9d54abb359565d07509b177c2b82..1a1a1f4d0ac025daccc2d3f84faf6592819f4d5c 100644
index 3cc3eb9acada64ea108db15cbfbd67d69df3401c..8d9a3925308d3141d3ec19d101bbe445db5302c8 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -211,7 +211,7 @@ public class ActivationRange
@@ -212,7 +212,7 @@ public class ActivationRange
// Paper end
// Paper start