aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java
diff options
context:
space:
mode:
authorKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2024-07-26 14:53:46 +0800
committerKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2024-07-26 15:09:20 +0800
commit8f27eb76273fe8424d44c2a1e08e45454e76b77c (patch)
tree300bef4c49905a4c2c439c8471e6a68ade4e526c /src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java
parent9f7fdb2a5e37907e7e4a5dd2400748b4a8e5f991 (diff)
downloadSkyblocker-8f27eb76273fe8424d44c2a1e08e45454e76b77c.tar.gz
Skyblocker-8f27eb76273fe8424d44c2a1e08e45454e76b77c.tar.bz2
Skyblocker-8f27eb76273fe8424d44c2a1e08e45454e76b77c.zip
Refactor LividColor and Nukekubi head detection
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java24
1 files changed, 11 insertions, 13 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 1322004e..0438a8ce 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java
@@ -1,5 +1,6 @@
package de.hysky.skyblocker.skyblock.entity;
+import com.google.common.collect.Streams;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.skyblock.crimson.dojo.DojoManager;
import de.hysky.skyblocker.skyblock.dungeon.LividColor;
@@ -14,7 +15,6 @@ import net.minecraft.entity.mob.EndermanEntity;
import net.minecraft.entity.mob.ZombieEntity;
import net.minecraft.entity.passive.BatEntity;
import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.item.ItemStack;
import net.minecraft.predicate.entity.EntityPredicates;
import net.minecraft.util.Formatting;
import net.minecraft.util.math.Box;
@@ -23,6 +23,10 @@ import net.minecraft.world.World;
import java.util.List;
public class MobGlow {
+ /**
+ * The Nukekubi head texture id is eb07594e2df273921a77c101d0bfdfa1115abed5b9b2029eb496ceba9bdbb4b3.
+ */
+ public static final String NUKEKUBI_HEAD_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0=";
public static boolean shouldMobGlow(Entity entity) {
Box box = entity.getBoundingBox();
@@ -36,7 +40,7 @@ public class MobGlow {
return switch (entity) {
// Minibosses
case PlayerEntity p when name.equals("Lost Adventurer") || name.equals("Shadow Assassin") || name.equals("Diamond Guy") -> SkyblockerConfigManager.get().dungeons.starredMobGlow;
- case PlayerEntity p when entity.getId() == LividColor.getLividID() -> LividColor.shouldGlow(name);
+ case PlayerEntity p when entity.getId() == LividColor.getCorrectLividId() -> LividColor.shouldGlow(name);
// Bats
case BatEntity b -> SkyblockerConfigManager.get().dungeons.starredMobGlow || SkyblockerConfigManager.get().dungeons.starredMobBoundingBoxes;
@@ -110,7 +114,7 @@ public class MobGlow {
case PlayerEntity p when name.equals("Lost Adventurer") -> 0xfee15c;
case PlayerEntity p when name.equals("Shadow Assassin") -> 0x5b2cb2;
case PlayerEntity p when name.equals("Diamond Guy") -> 0x57c2f7;
- case PlayerEntity p when entity.getId() == LividColor.getLividID() -> LividColor.getGlowColor(name);
+ case PlayerEntity p when entity.getId() == LividColor.getCorrectLividId() -> LividColor.getGlowColor(name);
case PlayerEntity p when name.equals("Blobbercyst ") -> Formatting.GREEN.getColorValue();
case EndermanEntity enderman when TheEnd.isSpecialZealot(enderman) -> Formatting.RED.getColorValue();
@@ -121,16 +125,10 @@ public class MobGlow {
};
}
+ /**
+ * Compares the armor items of an armor stand to the Nukekubi head texture to determine if it is a Nukekubi head.
+ */
private static boolean isNukekubiHead(ArmorStandEntity entity) {
- boolean armorfound = false;
- for (ItemStack armorItem : entity.getArmorItems()) {
- // eb07594e2df273921a77c101d0bfdfa1115abed5b9b2029eb496ceba9bdbb4b3 is texture id for the nukekubi head,
- // compare against it to exclusively find armorstands that are nukekubi heads
- // get the texture of the nukekubi head item itself and compare it
- String texture = ItemUtils.getHeadTexture(armorItem);
-
- armorfound |= texture.contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0=");
- }
- return armorfound;
+ return Streams.stream(entity.getArmorItems()).map(ItemUtils::getHeadTexture).anyMatch(headTexture -> headTexture.contains(NUKEKUBI_HEAD_TEXTURE));
}
}