@@ -123,66 +123,74 @@ public class ESP extends Module {
123123
124124 // Colors
125125
126- public final Setting <Boolean > distance = sgColors .add (new BoolSetting .Builder ()
127- .name ("distance-colors " )
128- .description ("Changes the color of tracers depending on distance ." )
129- .defaultValue (false )
126+ public final Setting <ESPColorMode > colorMode = sgColors .add (new EnumSetting .Builder < ESPColorMode > ()
127+ .name ("color-mode " )
128+ .description ("Determines the colors used for entities ." )
129+ .defaultValue (ESPColorMode . EntityType )
130130 .build ()
131131 );
132132
133133 public final Setting <Boolean > friendOverride = sgColors .add (new BoolSetting .Builder ()
134134 .name ("show-friend-colors" )
135- .description ("Whether or not to override the distance color of friends with the friend color." )
135+ .description ("Whether or not to override the distance/health color of friends with the friend color." )
136136 .defaultValue (true )
137- .visible (distance ::get )
137+ .visible (() -> colorMode .get () == ESPColorMode .Distance || colorMode .get () == ESPColorMode .Health )
138+ .build ()
139+ );
140+
141+ private final Setting <SettingColor > nonLivingEntityColor = sgColors .add (new ColorSetting .Builder ()
142+ .name ("non-living-entity-color" )
143+ .description ("The color used for non living entities such as dropped items." )
144+ .defaultValue (new SettingColor (25 , 25 , 25 ))
145+ .visible (() -> colorMode .get () == ESPColorMode .Health )
138146 .build ()
139147 );
140148
141149 private final Setting <SettingColor > playersColor = sgColors .add (new ColorSetting .Builder ()
142150 .name ("players-color" )
143151 .description ("The other player's color." )
144152 .defaultValue (new SettingColor (255 , 255 , 255 ))
145- .visible (() -> ! distance .get ())
153+ .visible (() -> colorMode .get () == ESPColorMode . EntityType )
146154 .build ()
147155 );
148156
149157 private final Setting <SettingColor > animalsColor = sgColors .add (new ColorSetting .Builder ()
150158 .name ("animals-color" )
151159 .description ("The animal's color." )
152160 .defaultValue (new SettingColor (25 , 255 , 25 , 255 ))
153- .visible (() -> ! distance .get ())
161+ .visible (() -> colorMode .get () == ESPColorMode . EntityType )
154162 .build ()
155163 );
156164
157165 private final Setting <SettingColor > waterAnimalsColor = sgColors .add (new ColorSetting .Builder ()
158166 .name ("water-animals-color" )
159167 .description ("The water animal's color." )
160168 .defaultValue (new SettingColor (25 , 25 , 255 , 255 ))
161- .visible (() -> ! distance .get ())
169+ .visible (() -> colorMode .get () == ESPColorMode . EntityType )
162170 .build ()
163171 );
164172
165173 private final Setting <SettingColor > monstersColor = sgColors .add (new ColorSetting .Builder ()
166174 .name ("monsters-color" )
167175 .description ("The monster's color." )
168176 .defaultValue (new SettingColor (255 , 25 , 25 , 255 ))
169- .visible (() -> ! distance .get ())
177+ .visible (() -> colorMode .get () == ESPColorMode . EntityType )
170178 .build ()
171179 );
172180
173181 private final Setting <SettingColor > ambientColor = sgColors .add (new ColorSetting .Builder ()
174182 .name ("ambient-color" )
175183 .description ("The ambient's color." )
176184 .defaultValue (new SettingColor (25 , 25 , 25 , 255 ))
177- .visible (() -> ! distance .get ())
185+ .visible (() -> colorMode .get () == ESPColorMode . EntityType )
178186 .build ()
179187 );
180188
181189 private final Setting <SettingColor > miscColor = sgColors .add (new ColorSetting .Builder ()
182190 .name ("misc-color" )
183191 .description ("The misc color." )
184192 .defaultValue (new SettingColor (175 , 175 , 175 , 255 ))
185- .visible (() -> ! distance .get ())
193+ .visible (() -> colorMode .get () == ESPColorMode . EntityType )
186194 .build ()
187195 );
188196
@@ -387,21 +395,27 @@ private double getFadeAlpha(Entity entity) {
387395 }
388396
389397 public Color getEntityTypeColor (Entity entity ) {
390- if (distance .get ()) {
391- if (friendOverride .get () && entity instanceof PlayerEntity && Friends .get ().isFriend ((PlayerEntity ) entity )) {
392- return Config .get ().friendColor .get ();
393- } else return EntityUtils .getColorFromDistance (entity );
394- } else if (entity instanceof PlayerEntity ) {
395- return PlayerUtils .getPlayerColor (((PlayerEntity ) entity ), playersColor .get ());
396- } else {
397- return switch (entity .getType ().getSpawnGroup ()) {
398- case CREATURE -> animalsColor .get ();
399- case WATER_AMBIENT , WATER_CREATURE , UNDERGROUND_WATER_CREATURE , AXOLOTLS -> waterAnimalsColor .get ();
400- case MONSTER -> monstersColor .get ();
401- case AMBIENT -> ambientColor .get ();
402- default -> miscColor .get ();
403- };
398+ if (colorMode .get () == ESPColorMode .EntityType ) {
399+ if (entity instanceof PlayerEntity player ) {
400+ return PlayerUtils .getPlayerColor (player , playersColor .get ());
401+ } else {
402+ return switch (entity .getType ().getSpawnGroup ()) {
403+ case CREATURE -> animalsColor .get ();
404+ case WATER_AMBIENT , WATER_CREATURE , UNDERGROUND_WATER_CREATURE , AXOLOTLS -> waterAnimalsColor .get ();
405+ case MONSTER -> monstersColor .get ();
406+ case AMBIENT -> ambientColor .get ();
407+ default -> miscColor .get ();
408+ };
409+ }
410+ }
411+
412+ if (friendOverride .get () && entity instanceof PlayerEntity player
413+ && Friends .get ().isFriend (player )) {
414+ return Config .get ().friendColor .get ();
404415 }
416+
417+ if (colorMode .get () == ESPColorMode .Health ) return EntityUtils .getColorFromHealth (entity , nonLivingEntityColor .get ());
418+ else return EntityUtils .getColorFromDistance (entity );
405419 }
406420
407421 @ Override
@@ -417,6 +431,17 @@ public boolean isGlow() {
417431 return isActive () && mode .get () == Mode .Glow ;
418432 }
419433
434+ public enum ESPColorMode {
435+ EntityType ,
436+ Distance ,
437+ Health ;
438+
439+ @ Override
440+ public String toString () {
441+ return this == EntityType ? "Entity Type" : super .toString ();
442+ }
443+ }
444+
420445 public enum Mode {
421446 Box ,
422447 Wireframe ,
0 commit comments