Skip to content

Commit

Permalink
add glow based on class color option (#197, backport)
Browse files Browse the repository at this point in the history
* add glow based on class color option
* resolve requested changes

(cherry picked from commit 4ca0f22)
  • Loading branch information
GrahamKracker authored and Morazzer committed Nov 18, 2024
1 parent 5fd46d6 commit 16641bc
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ private void addDungeonConfig(CookiesTranslationBuilder translationBuilder) {
translationBuilder.addConfig(CONFIG_DUNGEON_USE_BACKEND,
"Relay to backend",
"Whether information should be exchanged with the backend or not");

translationBuilder.add(CONFIG_DUNGEON_RENDER, "Render");
translationBuilder.addConfig(CONFIG_DUNGEON_RENDER_MAP,
"Enable map",
Expand Down Expand Up @@ -581,6 +582,9 @@ private void addDungeonConfig(CookiesTranslationBuilder translationBuilder) {
translationBuilder.addConfig(CONFIG_DUNGEON_SPIRIT_LEAP_USE_CLASS_COLOR,
"Use class colors",
"Uses the class colors instead of the default color.");
translationBuilder.addConfig(CONFIG_DUNGEON_GLOW_CLASS_COLOR,
"Glow teammates by class colors",
"Overrides the default hypixel glowing by rank to glow by class color.");
translationBuilder.addConfig(CONFIG_DUNGEON_CLASS_COLOR,
"Class colors",
"The colors used for every class");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21.3 2024-11-16T22:32:03.1774701 cookies-mod/Language (en_us)
08ea4fd6d417ef0e218b4493907edb3d8c2141df assets\cookies-mod\lang\en_us.json
// 1.21.3 2024-11-17T04:44:52.8413631 cookies-mod/Language (en_us)
797bce4c50d9925c668cd130d03a622e7ac4e1c2 assets\cookies-mod\lang\en_us.json
2 changes: 2 additions & 0 deletions src/main/generated/assets/cookies-mod/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@
"cookies.config.dev.show_plot_price_breakdown.tooltip": "Shows a breakdown of how much compost you need to unlock all plots.",
"cookies.config.dev.tooltip": "Development related config entries.",
"cookies.config.dungeon.name": "Dungeon Config",
"cookies.config.dungeon.player_glow_by_class_color.name": "Glow teammates by class colors",
"cookies.config.dungeon.player_glow_by_class_color.tooltip": "Overrides the default hypixel glowing by rank to glow by class color.",
"cookies.config.dungeon.puzzle.creeper_beams.name": "Creeper Beams",
"cookies.config.dungeon.puzzle.creeper_beams.tooltip": "Enables the creeper beams puzzle solver.",
"cookies.config.dungeon.puzzle.higher_or_lower.name": "Higher/Lower",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public DungeonConfig() {
public SpiritLeapFoldable spiritLeapFoldable = new SpiritLeapFoldable();
public PuzzleFoldable puzzleFoldable = new PuzzleFoldable();
public ClassColorFoldable classColorFoldable = new ClassColorFoldable();
public BooleanOption glowClassColor = new BooleanOption(CONFIG_DUNGEON_GLOW_CLASS_COLOR, true);

public TextDisplayOption render = new TextDisplayOption(CONFIG_DUNGEON_RENDER);
public ButtonOption repositionMap = new ButtonOption(CONFIG_DUNGEON_RENDER_MAP_REPOSITION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import codes.cookies.mod.config.categories.DungeonConfig;
import codes.cookies.mod.utils.Result;
import codes.cookies.mod.utils.accessors.GlowingEntityAccessor;
import codes.cookies.mod.utils.cookies.CookiesBackendUtils;
import codes.cookies.mod.utils.maths.InterpolatedInteger;
import codes.cookies.mod.utils.maths.LinearInterpolatedInteger;
Expand Down Expand Up @@ -60,6 +61,7 @@ public DungeonPlayer(DungeonInstance dungeonInstance, String name, String clazz,
this.dungeonClass = clazz;
this.setClassLevel(clazzLevel);
this.position = new DungeonPosition(0, 0, dungeonInstance);
this.updateGlowColor();
}

/**
Expand All @@ -81,6 +83,13 @@ private void findUuid() {
}
}

private void updateGlowColor() {
if (player != null && DungeonConfig.getInstance().glowClassColor.getValue() && this.getColor().isPresent()) {
GlowingEntityAccessor.setGlowing(this.player, true);
GlowingEntityAccessor.setGlowColor(this.player, this.getColor().getAsInt());
}
}

/**
* Sets the class level of the current player.
*
Expand Down Expand Up @@ -315,6 +324,7 @@ public void update(String name, String clazz, String clazzLevel) {
this.skip = false;
this.dungeonClass = clazz;
this.setClassLevel(clazzLevel);
this.updateGlowColor();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ public interface TranslationKeys {
String CONFIG_DUNGEON_SPIRIT_LEAP_SORT_BY_CLASS_NAME = CONFIG_DUNGEON_SPIRIT_LEAP + ".sort_by_class_name";
String CONFIG_DUNGEON_SPIRIT_LEAP_USE_CLASS_COLOR = CONFIG_DUNGEON_SPIRIT_LEAP + ".use_class_color";
String CONFIG_DUNGEON_SPIRIT_LEAP_COLOR = CONFIG_DUNGEON_SPIRIT_LEAP + ".color";
String CONFIG_DUNGEON_GLOW_CLASS_COLOR = CONFIG_DUNGEON + ".player_glow_by_class_color";

String CONFIG_DUNGEON_CLASS_COLOR = CONFIG_DUNGEON_SPIRIT_LEAP + ".class_color";
String CONFIG_DUNGEON_CLASS_COLOR_HEALER = CONFIG_DUNGEON_CLASS_COLOR + ".healer";
Expand Down

0 comments on commit 16641bc

Please sign in to comment.