use of cc.hyperium.mixins.client.gui.IMixinGuiScreenBook in project Hyperium by HyperiumClient.
the class NickHider method bookCheck.
@InvokeEvent
public void bookCheck(TickEvent event) {
GuiScreen currentScreen = Minecraft.getMinecraft().currentScreen;
if (currentScreen == null)
return;
if (currentScreen instanceof GuiScreenBook) {
NBTTagList bookPages = ((IMixinGuiScreenBook) currentScreen).getBookPages();
int currPage = ((IMixinGuiScreenBook) currentScreen).getCurrPage();
if (currPage < bookPages.tagCount()) {
try {
String textWithoutFormattingCodes = EnumChatFormatting.getTextWithoutFormattingCodes(IChatComponent.Serializer.jsonToComponent(bookPages.getStringTagAt(currPage)).getUnformattedText().replace("\n", " "));
Matcher matcher = newNick.matcher(textWithoutFormattingCodes);
if (matcher.find()) {
String nick = matcher.group("nick");
remap(nick, override == null ? Minecraft.getMinecraft().getSession().getProfile().getName() : override);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
Aggregations