use of net.minecraft.event.HoverEvent in project ct.js by ChatTriggers.
the class TextComponent method reInstanceHover.
// helper method to re-instance the hover-able part of the component
private void reInstanceHover() {
if (this.hoverValue == null)
return;
String hoverValue = this.hoverValue;
if (this.formatted)
hoverValue = ChatLib.addColor(hoverValue);
chatComponentText.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.getValueByCanonicalName(this.hoverAction), new ChatComponentText(hoverValue)));
}
use of net.minecraft.event.HoverEvent in project Armourers-Workshop by RiskyKen.
the class RehostedJarHandler method onPlayerTick.
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
if (validJar) {
return;
}
if (event.side != Side.CLIENT) {
return;
}
if (event.type != Type.PLAYER) {
return;
}
if (event.phase != Phase.END) {
return;
}
if (lastMessagePost + messagePostRate > System.currentTimeMillis()) {
return;
}
lastMessagePost = System.currentTimeMillis();
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
ChatComponentTranslation downloadLink = new ChatComponentTranslation("chat.armourersworkshop:invalidJarDownload", (Object) null);
downloadLink.getChatStyle().setUnderlined(true);
downloadLink.getChatStyle().setColor(EnumChatFormatting.BLUE);
downloadLink.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentTranslation("chat.armourersworkshop:invalidJarDownloadTooltip", (Object) null)));
downloadLink.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, LibModInfo.DOWNLOAD_URL));
ChatComponentTranslation stopModRepostsLink = new ChatComponentTranslation("chat.armourersworkshop:invalidJarStopModReposts", (Object) null);
stopModRepostsLink.getChatStyle().setUnderlined(true);
stopModRepostsLink.getChatStyle().setColor(EnumChatFormatting.BLUE);
stopModRepostsLink.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentTranslation("chat.armourersworkshop:invalidJarStopModRepostsTooltip", (Object) null)));
stopModRepostsLink.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, STOP_MOD_REPOSTS_URL));
ChatComponentTranslation updateMessage = new ChatComponentTranslation("chat.armourersworkshop:invalidJar", downloadLink, stopModRepostsLink);
updateMessage.getChatStyle().setColor(EnumChatFormatting.RED);
player.addChatMessage(updateMessage);
}
Aggregations