summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/ftbsc/bscv/modules/hud/EntityList.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/bscv/modules/hud/EntityList.java b/src/main/java/ftbsc/bscv/modules/hud/EntityList.java
index 335aec5..c48b546 100644
--- a/src/main/java/ftbsc/bscv/modules/hud/EntityList.java
+++ b/src/main/java/ftbsc/bscv/modules/hud/EntityList.java
@@ -8,11 +8,15 @@ import java.util.List;
import java.util.stream.Collectors;
import com.mojang.brigadier.CommandDispatcher;
+import com.mojang.brigadier.arguments.StringArgumentType;
import ftbsc.bscv.ICommons;
import ftbsc.bscv.modules.HudModule;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity;
+import net.minecraft.util.text.Color;
+import net.minecraft.util.text.Style;
+import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.common.ForgeConfigSpec;
@@ -20,8 +24,16 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class EntityList extends HudModule implements ICommons {
+ public final ForgeConfigSpec.ConfigValue<String> search;
+
public EntityList(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
super("EntityList", builder, dispatcher);
+
+ this.search = this.option(
+ "search", "highlight names containing this text", "",
+ StringArgumentType.string(), String.class,
+ builder, dispatcher
+ );
}
@SubscribeEvent
@@ -52,6 +64,11 @@ public class EntityList extends HudModule implements ICommons {
.x(this.x.get())
.y(this.y.get() + offset)
.scale(this.scale.get())
+ .style(
+ this.search.get().length() > 0 && u.toLowerCase().contains(this.search.get().toLowerCase())
+ ? Style.EMPTY.withBold(true).withColor(Color.fromLegacyFormat(TextFormatting.GOLD))
+ : Style.EMPTY.withColor(Color.fromLegacyFormat(TextFormatting.WHITE))
+ )
.render(event.getMatrixStack(), event.getWindow());
offset += MC.font.lineHeight;
}