aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de
diff options
context:
space:
mode:
authornmccullagh <narhanael64@gmail.com>2024-08-11 14:22:51 +0100
committernmccullagh <narhanael64@gmail.com>2024-08-11 14:22:51 +0100
commitafd61e061d6e4b0cfe0c0cd5594e77fbbf14a9a1 (patch)
treea4c057894b2e8ce90db3daf8b38f7ae65fde1c23 /src/main/java/de
parentc4a83d81c16dc1ee9f4d643b178842355d7903cf (diff)
downloadSkyblocker-afd61e061d6e4b0cfe0c0cd5594e77fbbf14a9a1.tar.gz
Skyblocker-afd61e061d6e4b0cfe0c0cd5594e77fbbf14a9a1.tar.bz2
Skyblocker-afd61e061d6e4b0cfe0c0cd5594e77fbbf14a9a1.zip
pr feedback
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/hysky/skyblocker/config/configs/SlayersConfig.java51
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/crimson/slayer/AttunementColors.java (renamed from src/main/java/de/hysky/skyblocker/skyblock/crimson/slayer/AttunementColours.java)8
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/crimson/slayer/FirePillarAnnouncer.java3
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java67
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/slayers/SlayerEntitiesGlow.java24
5 files changed, 70 insertions, 83 deletions
diff --git a/src/main/java/de/hysky/skyblocker/config/configs/SlayersConfig.java b/src/main/java/de/hysky/skyblocker/config/configs/SlayersConfig.java
index 522c5b52..85866360 100644
--- a/src/main/java/de/hysky/skyblocker/config/configs/SlayersConfig.java
+++ b/src/main/java/de/hysky/skyblocker/config/configs/SlayersConfig.java
@@ -33,32 +33,6 @@ public class SlayersConfig {
public boolean highlightNukekubiHeads = true;
}
- public static class BlazeSlayer {
- @SerialEntry
- public FirePillar firePillarCountdown = FirePillar.SOUND_AND_VISUAL;
-
- @SerialEntry
- public Boolean attunementHighlights = true;
-
- public enum FirePillar {
- OFF("Off"),
- VISUAL("Visual Indicator"),
- SOUND_AND_VISUAL("Sound and Visual Indicator");
-
- private final String description;
-
- FirePillar(String description) {
- this.description = description;
- }
-
- @Override
- public String toString() {
- return description;
- }
- }
-
- }
-
public static class VampireSlayer {
@SerialEntry
public boolean enableEffigyWaypoints = true;
@@ -96,4 +70,29 @@ public class SlayersConfig {
@SerialEntry
public int maniaUpdateFrequency = 5;
}
+
+ public static class BlazeSlayer {
+ @SerialEntry
+ public FirePillar firePillarCountdown = FirePillar.SOUND_AND_VISUAL;
+
+ @SerialEntry
+ public Boolean attunementHighlights = true;
+
+ public enum FirePillar {
+ OFF("Off"),
+ VISUAL("Visual Indicator"),
+ SOUND_AND_VISUAL("Sound and Visual Indicator");
+
+ private final String description;
+
+ FirePillar(String description) {
+ this.description = description;
+ }
+
+ @Override
+ public String toString() {
+ return description;
+ }
+ }
+ }
}
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/crimson/slayer/AttunementColours.java b/src/main/java/de/hysky/skyblocker/skyblock/crimson/slayer/AttunementColors.java
index 9c38f775..ba94812a 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/crimson/slayer/AttunementColours.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/crimson/slayer/AttunementColors.java
@@ -9,16 +9,16 @@ import java.awt.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-public class AttunementColours {
- private static final Pattern COLOUR_PATTERN = Pattern.compile("ASHEN|SPIRIT|CRYSTAL|AURIC");
+public class AttunementColors {
+ private static final Pattern COLOR_PATTERN = Pattern.compile("ASHEN|SPIRIT|CRYSTAL|AURIC");
/**
* Fetches highlight colour based on the Inferno Demonlord, or its demons', Hellion Shield Attunement
*/
- public static int getColour(LivingEntity e) {
+ public static int getColor(LivingEntity e) {
if (!SkyblockerConfigManager.get().slayers.blazeSlayer.attunementHighlights) return 0xf57738;
for (Entity entity : SlayerUtils.getEntityArmorStands(e)) {
- Matcher matcher = COLOUR_PATTERN.matcher(entity.getDisplayName().getString());
+ Matcher matcher = COLOR_PATTERN.matcher(entity.getDisplayName().getString());
if (matcher.find()) {
String matchedColour = matcher.group();
return switch (matchedColour) {
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/crimson/slayer/FirePillarAnnouncer.java b/src/main/java/de/hysky/skyblocker/skyblock/crimson/slayer/FirePillarAnnouncer.java
index 534d7a2f..d2328096 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/crimson/slayer/FirePillarAnnouncer.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/crimson/slayer/FirePillarAnnouncer.java
@@ -12,6 +12,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.text.MutableText;
import net.minecraft.text.PlainTextContent;
+import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -49,7 +50,7 @@ public class FirePillarAnnouncer {
}
private static void announceFirePillarDetails(String entityName) {
- Title title = new Title(MutableText.of(new PlainTextContent.Literal(entityName)).formatted(Formatting.BOLD, Formatting.DARK_PURPLE));
+ Title title = new Title(Text.literal(entityName).formatted(Formatting.BOLD, Formatting.DARK_PURPLE));
if (SkyblockerConfigManager.get().slayers.blazeSlayer.firePillarCountdown == SlayersConfig.BlazeSlayer.FirePillar.SOUND_AND_VISUAL) {
RenderHelper.displayInTitleContainerAndPlaySound(title, 15);
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 174f3260..3a5b025b 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java
@@ -5,7 +5,7 @@ import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.config.configs.SlayersConfig;
import de.hysky.skyblocker.skyblock.crimson.dojo.DojoManager;
import de.hysky.skyblocker.skyblock.crimson.kuudra.Kuudra;
-import de.hysky.skyblocker.skyblock.crimson.slayer.AttunementColours;
+import de.hysky.skyblocker.skyblock.crimson.slayer.AttunementColors;
import de.hysky.skyblocker.skyblock.dungeon.LividColor;
import de.hysky.skyblocker.skyblock.end.TheEnd;
import de.hysky.skyblocker.skyblock.slayers.SlayerEntitiesGlow;
@@ -40,11 +40,10 @@ public class MobGlow {
private static final ConcurrentHashMap<Entity, CacheEntry> canSeeCache = new ConcurrentHashMap<>();
public static void init() {
- Scheduler.INSTANCE.scheduleCyclic(MobGlow::clearCache, 100*20);
+ Scheduler.INSTANCE.scheduleCyclic(MobGlow::clearCache, 300*20);
}
public static boolean shouldMobGlow(Entity entity) {
- if (entity.isInvisible()) return false;
long currentTime = System.currentTimeMillis();
@@ -76,19 +75,27 @@ public class MobGlow {
}
private static boolean computeShouldMobGlow(Entity entity) {
+
+ if (entity.isInvisible()) {
+ return switch (entity) {
+ case ArmorStandEntity armorStand when Utils.isInTheEnd() && SlayerUtils.isInSlayer() && isNukekubiHead(armorStand) ->
+ SkyblockerConfigManager.get().slayers.endermanSlayer.highlightNukekubiHeads;
+ default -> false;
+ };
+ }
+
String name = entity.getName().getString();
// Dungeons
if (Utils.isInDungeons()) {
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.getCorrectLividId() ->
- LividColor.shouldGlow(name);
+ 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.getCorrectLividId() -> LividColor.shouldGlow(name);
+
// Bats
- case BatEntity b ->
- SkyblockerConfigManager.get().dungeons.starredMobGlow || SkyblockerConfigManager.get().dungeons.starredMobBoundingBoxes;
+ case BatEntity b -> SkyblockerConfigManager.get().dungeons.starredMobGlow || SkyblockerConfigManager.get().dungeons.starredMobBoundingBoxes;
// Armor Stands
case ArmorStandEntity _armorStand -> false;
@@ -101,38 +108,24 @@ public class MobGlow {
return switch (entity) {
// Rift Blobbercyst
- case PlayerEntity p when Utils.isInTheRift() && name.equals("Blobbercyst ") ->
- SkyblockerConfigManager.get().otherLocations.rift.blobbercystGlow;
+ case PlayerEntity p when Utils.isInTheRift() && name.equals("Blobbercyst ") -> SkyblockerConfigManager.get().otherLocations.rift.blobbercystGlow;
// Dojo Helpers
- case ZombieEntity zombie when Utils.isInCrimson() && DojoManager.inArena ->
- DojoManager.shouldGlow(getArmorStandName(zombie));
+ case ZombieEntity zombie when Utils.isInCrimson() && DojoManager.inArena -> DojoManager.shouldGlow(getArmorStandName(zombie));
//Kuudra
- case MagmaCubeEntity magmaCube when Utils.isInKuudra() ->
- SkyblockerConfigManager.get().crimsonIsle.kuudra.kuudraGlow && magmaCube.getSize() == Kuudra.KUUDRA_MAGMA_CUBE_SIZE;
+ case MagmaCubeEntity magmaCube when Utils.isInKuudra() -> SkyblockerConfigManager.get().crimsonIsle.kuudra.kuudraGlow && magmaCube.getSize() == Kuudra.KUUDRA_MAGMA_CUBE_SIZE;
// Special Zealot && Slayer (Mini)Boss
- 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());
- case SpiderEntity spider when SlayerUtils.isInSlayerQuestType(SlayerUtils.TARA) ->
- SlayerEntitiesGlow.shouldGlow(spider.getUuid());
- case WolfEntity wolf when SlayerUtils.isInSlayerQuestType(SlayerUtils.SVEN) ->
- SlayerEntitiesGlow.shouldGlow(wolf.getUuid());
- case BlazeEntity blaze when SlayerUtils.isInSlayerQuestType(SlayerUtils.DEMONLORD) ->
- SlayerEntitiesGlow.shouldGlow(blaze.getUuid());
-
- // Enderman Slayer's Nukekubi Skulls
- case ArmorStandEntity armorStand when Utils.isInTheEnd() && SlayerUtils.isInSlayer() && isNukekubiHead(armorStand) ->
- SkyblockerConfigManager.get().slayers.endermanSlayer.highlightNukekubiHeads;
+ 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());
+ case SpiderEntity spider when SlayerUtils.isInSlayerQuestType(SlayerUtils.TARA) -> SlayerEntitiesGlow.shouldGlow(spider.getUuid());
+ case WolfEntity wolf when SlayerUtils.isInSlayerQuestType(SlayerUtils.SVEN) -> SlayerEntitiesGlow.shouldGlow(wolf.getUuid());
+ case BlazeEntity blaze when SlayerUtils.isInSlayerQuestType(SlayerUtils.DEMONLORD) -> SlayerEntitiesGlow.shouldGlow(blaze.getUuid());
// Blaze Slayer's Demonic minions
- case WitherSkeletonEntity e when SkyblockerConfigManager.get().slayers.highlightBosses == SlayersConfig.HighlightSlayerEntities.GLOW ->
- SlayerUtils.isInSlayerType(SlayerUtils.DEMONLORD) && e.distanceTo(MinecraftClient.getInstance().player) <= 14;
- case ZombifiedPiglinEntity e when SkyblockerConfigManager.get().slayers.highlightBosses == SlayersConfig.HighlightSlayerEntities.GLOW ->
- SlayerUtils.isInSlayerType(SlayerUtils.DEMONLORD) && e.distanceTo(MinecraftClient.getInstance().player) <= 14;
+ case WitherSkeletonEntity e when SkyblockerConfigManager.get().slayers.highlightBosses == SlayersConfig.HighlightSlayerEntities.GLOW -> SlayerUtils.isInSlayerType(SlayerUtils.DEMONLORD) && e.distanceTo(MinecraftClient.getInstance().player) <= 14;
+ case ZombifiedPiglinEntity e when SkyblockerConfigManager.get().slayers.highlightBosses == SlayersConfig.HighlightSlayerEntities.GLOW -> SlayerUtils.isInSlayerType(SlayerUtils.DEMONLORD) && e.distanceTo(MinecraftClient.getInstance().player) <= 14;
default -> false;
};
@@ -187,10 +180,10 @@ public class MobGlow {
case MagmaCubeEntity magmaCube when Utils.isInKuudra() -> 0xf7510f;
// Blaze Slayer Attunement Colours
- case ArmorStandEntity armorStand when SlayerUtils.isInSlayerQuestType(SlayerUtils.DEMONLORD) -> AttunementColours.getColour(armorStand);
- case BlazeEntity blaze when SlayerUtils.isInSlayer() -> AttunementColours.getColour(blaze);
- case ZombifiedPiglinEntity piglin when SlayerUtils.isInSlayer() -> AttunementColours.getColour(piglin);
- case WitherSkeletonEntity wSkelly when SlayerUtils.isInSlayer() -> AttunementColours.getColour(wSkelly);
+ case ArmorStandEntity armorStand when SlayerUtils.isInSlayerQuestType(SlayerUtils.DEMONLORD) -> AttunementColors.getColor(armorStand);
+ case BlazeEntity blaze when SlayerUtils.isInSlayer() -> AttunementColors.getColor(blaze);
+ case ZombifiedPiglinEntity piglin when SlayerUtils.isInSlayer() -> AttunementColors.getColor(piglin);
+ case WitherSkeletonEntity wSkelly when SlayerUtils.isInSlayer() -> AttunementColors.getColor(wSkelly);
default -> 0xf57738;
};
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/slayers/SlayerEntitiesGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/slayers/SlayerEntitiesGlow.java
index 0ba3223d..5868e55b 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/slayers/SlayerEntitiesGlow.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/slayers/SlayerEntitiesGlow.java
@@ -3,6 +3,7 @@ package de.hysky.skyblocker.skyblock.slayers;
import de.hysky.skyblocker.events.SkyblockEvents;
import de.hysky.skyblocker.utils.Location;
import de.hysky.skyblocker.utils.SlayerUtils;
+import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
@@ -36,7 +37,7 @@ public class SlayerEntitiesGlow {
);
public static void init() {
- SkyblockEvents.LOCATION_CHANGE.register(SlayerEntitiesGlow::clearGlow);
+ ClientPlayConnectionEvents.JOIN.register((ignore, ignore2, ignore3) -> clearGlow());
}
private static final Map<String, Class<? extends MobEntity>> SLAYER_MOB_TYPE = Map.of(
SlayerUtils.REVENANT, ZombieEntity.class,
@@ -60,22 +61,16 @@ public class SlayerEntitiesGlow {
public static boolean isSlayerMiniMob(LivingEntity entity) {
if (entity.getCustomName() == null) return false;
String entityName = entity.getCustomName().getString();
- return SLAYER_MINI_NAMES.keySet().stream().anyMatch(slayerMobName ->
- entityName.contains(slayerMobName) && SlayerUtils.isInSlayerQuestType(SLAYER_MINI_NAMES.get(slayerMobName)));
+ return SLAYER_MINI_NAMES.keySet().stream().anyMatch(slayerMobName -> entityName.contains(slayerMobName) && SlayerUtils.isInSlayerQuestType(SLAYER_MINI_NAMES.get(slayerMobName)));
}
public static Box getSlayerMobBoundingBox(LivingEntity entity) {
return switch (SlayerUtils.getSlayerType()) {
- case SlayerUtils.REVENANT ->
- new Box(entity.getX() - 0.4, entity.getY() - 0.1, entity.getZ() - 0.4, entity.getX() + 0.4, entity.getY() - 2.2, entity.getZ() + 0.4);
- case SlayerUtils.TARA ->
- new Box(entity.getX() - 0.9, entity.getY() - 0.2, entity.getZ() - 0.9, entity.getX() + 0.9, entity.getY() - 1.2, entity.getZ() + 0.9);
- case SlayerUtils.VOIDGLOOM ->
- new Box(entity.getX() - 0.4, entity.getY() - 0.2, entity.getZ() - 0.4, entity.getX() + 0.4, entity.getY() - 3, entity.getZ() + 0.4);
- case SlayerUtils.SVEN ->
- new Box(entity.getX() - 0.5, entity.getY() - 0.1, entity.getZ() - 0.5, entity.getX() + 0.5, entity.getY() - 1, entity.getZ() + 0.5);
- default ->
- new Box(entity.getX() - 0.5, entity.getY() + 0.1, entity.getZ() - 0.5, entity.getX() + 0.5, entity.getY() - 2.2, entity.getZ() + 0.5);
+ case SlayerUtils.REVENANT -> new Box(entity.getX() - 0.4, entity.getY() - 0.1, entity.getZ() - 0.4, entity.getX() + 0.4, entity.getY() - 2.2, entity.getZ() + 0.4);
+ case SlayerUtils.TARA -> new Box(entity.getX() - 0.9, entity.getY() - 0.2, entity.getZ() - 0.9, entity.getX() + 0.9, entity.getY() - 1.2, entity.getZ() + 0.9);
+ case SlayerUtils.VOIDGLOOM -> new Box(entity.getX() - 0.4, entity.getY() - 0.2, entity.getZ() - 0.4, entity.getX() + 0.4, entity.getY() - 3, entity.getZ() + 0.4);
+ case SlayerUtils.SVEN -> new Box(entity.getX() - 0.5, entity.getY() - 0.1, entity.getZ() - 0.5, entity.getX() + 0.5, entity.getY() - 1, entity.getZ() + 0.5);
+ default -> entity.getBoundingBox();
};
}
@@ -91,7 +86,6 @@ public class SlayerEntitiesGlow {
.getBoxAt(armorStand.getPos()).expand(1.5), entity ->
!entity.isDead() && entity.age > armorStand.age - 4 && entity.age < armorStand.age + 4)
.stream()
- .filter(entity -> !(entity instanceof CaveSpiderEntity))
.filter(SlayerEntitiesGlow::isValidSlayerMob)
.min(Comparator.comparingDouble((MobEntity e) -> e.distanceTo(armorStand)))
.orElse(null);
@@ -123,7 +117,7 @@ public class SlayerEntitiesGlow {
if (entity != null && entity.getUuid() != null) MOBS_TO_GLOW.remove(entity.getUuid());
}
- private static void clearGlow(Location location) {
+ private static void clearGlow() {
MOBS_TO_GLOW.clear();
}