This commit is contained in:
Chayapak 2023-07-04 16:26:38 +07:00
parent 0af580f804
commit 49327ce22e

View file

@ -6,8 +6,6 @@ import land.chipmunk.chipmunkmod.listeners.Listener;
import land.chipmunk.chipmunkmod.listeners.ListenerManager;
import land.chipmunk.chipmunkmod.modules.ChatInputGlobals;
import land.chipmunk.chipmunkmod.modules.RainbowName;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.MessageIndicator;
import net.minecraft.client.gui.screen.ChatScreen;
@ -45,19 +43,17 @@ public class ChatHudMixin {
}
try {
final Component component = message.asComponent();
final List<Component> children = component.children();
final List<Text> children = message.getSiblings();
if (children.size() == 0) return;
if (!((TextComponent) children.get(0)).content().equals("chomens_bot_command_suggestion")) return;
if (!children.get(0).getString().equals("chomens_bot_command_suggestion")) return;
ci.cancel();
final String[] matches = children.subList(2, children.size())
.stream()
.map((each) -> ((TextComponent) each).content())
.map(Text::getString)
.toArray(String[]::new);
if (!(MinecraftClient.getInstance().currentScreen instanceof ChatScreen chatScreen)) return;