mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: 1dc7c308 Optimize Collision Chunk lookup and avoid loading far chunks d5c6dbee Prevent Double PlayerChunkMap adds crashing server a2a9ffe3 Fix issues with Activation Range causing large chunk lookups. 017297cd Improve entity.getCurrentChunk() and use it for entity.isChunkLoaded() 52cf8906 Remove some old removed 1.14 patches that are never going to be needed (fixed/already applied)
108 lines
5.5 KiB
Diff
108 lines
5.5 KiB
Diff
From 4c1ab3425c237f7e8fba3d2bebdaf3491f417f09 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Sun, 8 Mar 2020 20:54:44 -0500
|
|
Subject: [PATCH] Add flying mobs to entity activation range settings
|
|
|
|
---
|
|
src/main/java/org/spigotmc/ActivationRange.java | 16 +++++++++++++++-
|
|
.../java/org/spigotmc/SpigotWorldConfig.java | 2 ++
|
|
2 files changed, 17 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
|
index a0ac98ede2..ba10e811f1 100644
|
|
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
|
@@ -12,6 +12,9 @@ import net.minecraft.server.EntityAmbient;
|
|
import net.minecraft.server.EntityAnimal;
|
|
import net.minecraft.server.EntityArrow;
|
|
import net.minecraft.server.EntityBee;
|
|
+import net.minecraft.server.EntityBat; // Purpur
|
|
+import net.minecraft.server.EntityBird; // Purpur
|
|
+import net.minecraft.server.EntityBlaze; // Purpur
|
|
import net.minecraft.server.EntityComplexPart;
|
|
import net.minecraft.server.EntityCreature;
|
|
import net.minecraft.server.EntityCreeper;
|
|
@@ -34,6 +37,7 @@ import net.minecraft.server.EntitySlice;
|
|
import net.minecraft.server.EntitySlime;
|
|
import net.minecraft.server.EntityTNTPrimed;
|
|
import net.minecraft.server.EntityThrownTrident;
|
|
+import net.minecraft.server.EntityVex; // Purpur
|
|
import net.minecraft.server.EntityVillager;
|
|
import net.minecraft.server.EntityWither;
|
|
import net.minecraft.server.MathHelper;
|
|
@@ -52,6 +56,7 @@ public class ActivationRange
|
|
|
|
public enum ActivationType
|
|
{
|
|
+ FLYING, // Purpur
|
|
WATER, // Paper
|
|
MONSTER,
|
|
ANIMAL,
|
|
@@ -72,6 +77,7 @@ public class ActivationRange
|
|
*/
|
|
public static ActivationType initializeEntityActivationType(Entity entity)
|
|
{
|
|
+ if (isFlyingMob(entity)) { return ActivationType.FLYING; } // Purpur
|
|
if (entity instanceof EntityWaterAnimal) { return ActivationType.WATER; } // Paper
|
|
if ( entity instanceof EntityRaider )
|
|
{
|
|
@@ -135,6 +141,7 @@ public class ActivationRange
|
|
final int animalActivationRange = world.spigotConfig.animalActivationRange;
|
|
final int monsterActivationRange = world.spigotConfig.monsterActivationRange;
|
|
final int waterActivationRange = world.spigotConfig.waterActivationRange; // Paper
|
|
+ final int flyingActivationRange = world.spigotConfig.flyingActivationRange; // Purpur
|
|
final ChunkProviderServer chunkProvider = (ChunkProviderServer) world.getChunkProvider(); // Paper
|
|
|
|
int maxRange = Math.max( monsterActivationRange, animalActivationRange );
|
|
@@ -153,6 +160,7 @@ public class ActivationRange
|
|
ActivationType.ANIMAL.boundingBox = player.getBoundingBox().grow( animalActivationRange, 256, animalActivationRange );
|
|
ActivationType.MONSTER.boundingBox = player.getBoundingBox().grow( monsterActivationRange, 256, monsterActivationRange );
|
|
ActivationType.WATER.boundingBox = player.getBoundingBox().grow( waterActivationRange, 256, waterActivationRange ); // Paper
|
|
+ ActivationType.FLYING.boundingBox = player.getBoundingBox().grow( flyingActivationRange, 256, flyingActivationRange ); // Purpur
|
|
|
|
|
|
int i = MathHelper.floor( maxBB.minX / 16.0D );
|
|
@@ -214,7 +222,7 @@ public class ActivationRange
|
|
}
|
|
if ( !( entity instanceof EntityArrow ) )
|
|
{
|
|
- if ( (!entity.onGround && !(entity instanceof EntityFlying)) || !entity.passengers.isEmpty() || entity.isPassenger() ) // Paper
|
|
+ if ( (!entity.onGround && !isFlyingMob(entity)) || !entity.passengers.isEmpty() || entity.isPassenger() ) // Paper // Purpur
|
|
{
|
|
return 10; // Paper
|
|
}
|
|
@@ -327,4 +335,10 @@ public class ActivationRange
|
|
}
|
|
return isActive;
|
|
}
|
|
+
|
|
+ // Purpur start
|
|
+ public static boolean isFlyingMob(Entity entity) {
|
|
+ return entity instanceof EntityBat || entity instanceof EntityBird || entity instanceof EntityFlying || entity instanceof EntityBlaze || entity instanceof EntityVex;
|
|
+ }
|
|
+ // Purpur end
|
|
}
|
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
index 3ceeed3f99..9a3f566a93 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
@@ -181,6 +181,7 @@ public class SpigotWorldConfig
|
|
public int raiderActivationRange = 48;
|
|
public int miscActivationRange = 16;
|
|
public int waterActivationRange = 16; // Paper
|
|
+ public int flyingActivationRange = 128; // Purpur
|
|
public boolean tickInactiveVillagers = true;
|
|
private void activationRange()
|
|
{
|
|
@@ -189,6 +190,7 @@ public class SpigotWorldConfig
|
|
raiderActivationRange = getInt( "entity-activation-range.raiders", raiderActivationRange );
|
|
miscActivationRange = getInt( "entity-activation-range.misc", miscActivationRange );
|
|
waterActivationRange = getInt( "entity-activation-range.water", waterActivationRange ); // Paper
|
|
+ flyingActivationRange = getInt( "entity-activation-range.flying", flyingActivationRange ); // Purpur
|
|
tickInactiveVillagers = getBoolean( "entity-activation-range.tick-inactive-villagers", tickInactiveVillagers );
|
|
log( "Entity Activation Range: An " + animalActivationRange + " / Mo " + monsterActivationRange + " / Ra " + raiderActivationRange + " / Mi " + miscActivationRange + " / Tiv " + tickInactiveVillagers );
|
|
}
|
|
--
|
|
2.24.0
|
|
|