aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authornmccullagh <narhanael64@gmail.com>2024-08-03 20:43:26 +0100
committernmccullagh <narhanael64@gmail.com>2024-08-03 20:43:26 +0100
commitfb398d98ea1084ebb4248877701bf50ca8abfeb2 (patch)
treecdaaf80f9ff9b795a9e2c8b6e68157ae0c7cf6cb /src/main/java
parentb3704a19b13ccd9a2283053f60248bc5b2ae113b (diff)
downloadSkyblocker-fb398d98ea1084ebb4248877701bf50ca8abfeb2.tar.gz
Skyblocker-fb398d98ea1084ebb4248877701bf50ca8abfeb2.tar.bz2
Skyblocker-fb398d98ea1084ebb4248877701bf50ca8abfeb2.zip
simplify a little
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java
index 7c980a04..83519c32 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java
@@ -47,22 +47,17 @@ public class MobGlow {
long currentTime = System.currentTimeMillis();
- boolean shouldGlow;
CacheEntry cachedGlow = glowCache.get(entity);
if (cachedGlow == null || (currentTime - cachedGlow.timestamp) > GLOW_CACHE_DURATION) {
- shouldGlow = computeShouldMobGlow(entity);
+ boolean shouldGlow = computeShouldMobGlow(entity);
glowCache.put(entity, new CacheEntry(shouldGlow, currentTime));
- } else {
- shouldGlow = cachedGlow.value;
+ cachedGlow = glowCache.get(entity);
}
- if (shouldGlow) {
- return playerCanSee(entity, currentTime);
- }
-
- return false;
+ return cachedGlow.value && playerCanSee(entity, currentTime);
}
+
/**
* Checks if the player can see the entity.
* Has "True sight" within an small aura, but since name tags exist I think this is fine...
@@ -83,7 +78,7 @@ public class MobGlow {
String name = entity.getName().getString();
// Dungeons
- if (Utils.isInDungeons() && !entity.isInvisible()) {
+ if (Utils.isInDungeons()) {
return switch (entity) {
// Minibosses
case PlayerEntity p when name.equals("Lost Adventurer") || name.equals("Shadow Assassin") || name.equals("Diamond Guy") ->
@@ -105,7 +100,7 @@ public class MobGlow {
return switch (entity) {
// Rift Blobbercyst
- case PlayerEntity p when Utils.isInTheRift() && !entity.isInvisible() && name.equals("Blobbercyst ") ->
+ case PlayerEntity p when Utils.isInTheRift() && name.equals("Blobbercyst ") ->
SkyblockerConfigManager.get().otherLocations.rift.blobbercystGlow;
// Dojo Helpers
@@ -117,7 +112,7 @@ public class MobGlow {
SkyblockerConfigManager.get().crimsonIsle.kuudra.kuudraGlow && magmaCube.getSize() == Kuudra.KUUDRA_MAGMA_CUBE_SIZE;
// Special Zealot && Slayer (Mini)Boss
- case EndermanEntity enderman when Utils.isInTheEnd() && !entity.isInvisible() ->
+ case EndermanEntity enderman when Utils.isInTheEnd() ->
TheEnd.isSpecialZealot(enderman) || SlayerEntitiesGlow.shouldGlow(enderman.getUuid());
case ZombieEntity zombie when !(zombie instanceof ZombifiedPiglinEntity) && SlayerUtils.isInSlayerQuestType(SlayerUtils.REVENANT) ->
SlayerEntitiesGlow.shouldGlow(zombie.getUuid());