Skip to content

Commit

Permalink
Simplify condition
Browse files Browse the repository at this point in the history
  • Loading branch information
HaHaWTH committed Oct 30, 2024
1 parent c0cae8a commit f86119b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
18 changes: 13 additions & 5 deletions patches/server/0008-Pufferfish-Dynamic-Activation-of-Brain.patch
Original file line number Diff line number Diff line change
Expand Up @@ -371,25 +371,33 @@ index 0000000000000000000000000000000000000000..a2e60c43074df560eb01f150bf52b8d0
+ }
+}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 0b2f2fbe462ed628ef3d640824d4162e79279089..fe1d053a703b6652485b24ba487d8ebfcbabf28b 100644
index 0b2f2fbe462ed628ef3d640824d4162e79279089..dce90b9c38ed5734bc3259c4de4387fa862b9c9f 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -38,7 +38,6 @@ import co.aikar.timings.MinecraftTimings;
@@ -3,6 +3,7 @@ package org.spigotmc;
import net.minecraft.core.BlockPos;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerChunkCache;
+import net.minecraft.tags.EntityTypeTags;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.ExperienceOrb;
import net.minecraft.world.entity.FlyingMob;
@@ -38,7 +39,6 @@ import co.aikar.timings.MinecraftTimings;
import net.minecraft.world.entity.schedule.Activity;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
-import org.galemc.gale.configuration.GaleGlobalConfiguration;
import org.galemc.gale.configuration.GaleWorldConfiguration;

public class ActivationRange
@@ -238,6 +237,26 @@ public class ActivationRange
@@ -238,6 +238,26 @@ public class ActivationRange
}
// Paper end - Configurable marker ticking
ActivationRange.activateEntity(entity);
+
+ // Pufferfish start
+ if (org.dreeam.leaf.config.modules.opt.DynamicActivationofBrain.enabled && entity.getType().dabEnabled &&
+ (!org.dreeam.leaf.config.modules.opt.DynamicActivationofBrain.dontEnableIfInWater || entity.getType().is(net.minecraft.tags.EntityTypeTags.AQUATIC) || entity.getType().is(net.minecraft.tags.EntityTypeTags.UNDEAD) || !entity.isInWaterOrBubble())) { // Leaf - Option for dontEnableIfInWater
+ (!org.dreeam.leaf.config.modules.opt.DynamicActivationofBrain.dontEnableIfInWater || entity.getType().is(EntityTypeTags.CAN_BREATHE_UNDER_WATER) || !entity.isInWaterOrBubble())) { // Leaf - Option for dontEnableIfInWater
+ if (!entity.activatedPriorityReset) {
+ entity.activatedPriorityReset = true;
+ entity.activatedPriority = org.dreeam.leaf.config.modules.opt.DynamicActivationofBrain.maximumActivationPrio;
Expand All @@ -409,7 +417,7 @@ index 0b2f2fbe462ed628ef3d640824d4162e79279089..fe1d053a703b6652485b24ba487d8ebf
}
// Paper end
}
@@ -254,12 +273,12 @@ public class ActivationRange
@@ -254,12 +274,12 @@ public class ActivationRange
if ( MinecraftServer.currentTick > entity.activatedTick )
{
if ( entity.defaultActivationState )
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0011-Purpur-Server-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -24824,10 +24824,10 @@ index 0000000000000000000000000000000000000000..129acb8ad139decc6b1c023cb10bc32d
+ // Paper end - lifecycle events
+}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index fe1d053a703b6652485b24ba487d8ebfcbabf28b..b16970195d560dba9d0b3a258961857008b3550c 100644
index dce90b9c38ed5734bc3259c4de4387fa862b9c9f..103571f5aa880b0118e1b946e166c86b1e7bf5b5 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -215,6 +215,8 @@ public class ActivationRange
@@ -216,6 +216,8 @@ public class ActivationRange
continue;
}

Expand All @@ -24836,7 +24836,7 @@ index fe1d053a703b6652485b24ba487d8ebfcbabf28b..b16970195d560dba9d0b3a2589618570
// Paper start
int worldHeight = world.getHeight();
ActivationRange.maxBB = player.getBoundingBox().inflate( maxRange, worldHeight, maxRange );
@@ -413,6 +415,7 @@ public class ActivationRange
@@ -414,6 +416,7 @@ public class ActivationRange
*/
public static boolean checkIfActive(Entity entity)
{
Expand Down
8 changes: 4 additions & 4 deletions patches/server/0015-Remove-Timings.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1838,26 +1838,26 @@ index 579c2e69d8f6ce8398eb1297d1d1ead98c9068a5..00000000000000000000000000000000
-
-}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index b16970195d560dba9d0b3a258961857008b3550c..0f8987d1fe6a9e4d8e9d984d242797215993a269 100644
index 103571f5aa880b0118e1b946e166c86b1e7bf5b5..7182d1e8746d094b5fb1e4aaa5ce3b3cb85ab1b5 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -34,7 +34,6 @@ import net.minecraft.world.entity.projectile.FireworkRocketEntity;
@@ -35,7 +35,6 @@ import net.minecraft.world.entity.projectile.FireworkRocketEntity;
import net.minecraft.world.entity.projectile.ThrowableProjectile;
import net.minecraft.world.entity.projectile.ThrownTrident;
import net.minecraft.world.entity.raid.Raider;
-import co.aikar.timings.MinecraftTimings;
import net.minecraft.world.entity.schedule.Activity;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
@@ -181,7 +180,6 @@ public class ActivationRange
@@ -182,7 +181,6 @@ public class ActivationRange
*/
public static void activateEntities(Level world)
{
- MinecraftTimings.entityActivationCheckTimer.startTiming();
final int miscActivationRange = world.spigotConfig.miscActivationRange;
final int raiderActivationRange = world.spigotConfig.raiderActivationRange;
final int animalActivationRange = world.spigotConfig.animalActivationRange;
@@ -262,7 +260,6 @@ public class ActivationRange
@@ -263,7 +261,6 @@ public class ActivationRange
}
// Paper end
}
Expand Down

0 comments on commit f86119b

Please sign in to comment.