diff options
author | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2023-11-11 02:31:36 -0500 |
---|---|---|
committer | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2023-11-11 02:31:36 -0500 |
commit | d07ad6a62ae84e361b3723017fc173f616f49d0e (patch) | |
tree | f78e0dfd315e76ca03b47379b378217833e35332 /src/main/java/de/hysky/skyblocker/entity | |
parent | 7a94d9380acb69006340e53db12faad8f13ab828 (diff) | |
download | Skyblocker-d07ad6a62ae84e361b3723017fc173f616f49d0e.tar.gz Skyblocker-d07ad6a62ae84e361b3723017fc173f616f49d0e.tar.bz2 Skyblocker-d07ad6a62ae84e361b3723017fc173f616f49d0e.zip |
Refactor MobGlow
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/entity')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/entity/MobGlow.java | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/main/java/de/hysky/skyblocker/entity/MobGlow.java b/src/main/java/de/hysky/skyblocker/entity/MobGlow.java new file mode 100644 index 00000000..f60a1bfe --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/entity/MobGlow.java @@ -0,0 +1,67 @@ +package de.hysky.skyblocker.entity; + +import java.util.List; + +import de.hysky.skyblocker.config.SkyblockerConfigManager; +import de.hysky.skyblocker.skyblock.dungeon.LividColor; +import de.hysky.skyblocker.utils.Utils; +import de.hysky.skyblocker.utils.render.culling.OcclusionCulling; +import net.minecraft.entity.Entity; +import net.minecraft.entity.decoration.ArmorStandEntity; +import net.minecraft.entity.passive.BatEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.predicate.entity.EntityPredicates; +import net.minecraft.util.math.Box; +import net.minecraft.world.World; + +public class MobGlow { + public static boolean shouldMobGlow(Entity entity) { + Box box = entity.getBoundingBox(); + + if (Utils.isInDungeons() && !entity.isInvisible() && OcclusionCulling.isVisible(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ)) { + String name = entity.getName().getString(); + + // Minibosses + if (entity instanceof PlayerEntity) { + switch (name) { + case "Lost Adventurer", "Shadow Assassin", "Diamond Guy": return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; + case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", + "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid": return LividColor.shouldGlow(name); + } + } + + // Regular Mobs + if (!(entity instanceof ArmorStandEntity)) { + List<ArmorStandEntity> armorStands = getArmorStands(entity.getWorld(), box); + + if (!armorStands.isEmpty() && armorStands.get(0).getName().getString().contains("✯")) return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; + } + + // Bats + return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow && entity instanceof BatEntity; + } + + return false; + } + + private static List<ArmorStandEntity> getArmorStands(World world, Box box) { + return world.getEntitiesByClass(ArmorStandEntity.class, box.expand(0, 2, 0), EntityPredicates.NOT_MOUNTED); + } + + public static int getGlowColor(Entity entity) { + String name = entity.getName().getString(); + + if (entity instanceof PlayerEntity) { + return switch (name) { + case "Lost Adventurer" -> 0xfee15c; + case "Shadow Assassin" -> 0x5b2cb2; + case "Diamond Guy" -> 0x57c2f7; + case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", + "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid" -> LividColor.getGlowColor(name); + default -> 0xf57738; + }; + } + + return 0xf57738; + } +} |