public void tellChanges(EntityPlayer player) { if(changes.size() == 0) return; player.sendMessage(new TextComponentTranslation("botaniamisc.adaptativeConfigChanges").setStyle(new Style().setColor(TextFormatting.GOLD))); for(String change : changes) player.sendMessage(new TextComponentString(change).setStyle(new Style().setColor(TextFormatting.LIGHT_PURPLE))); }
/** * On Button click teleport to the colony.. * * @param button the clicked button. */ private void teleportToColony(@NotNull final Button button) { final int row = alliesList.getListElementIndexByPane(button); final ColonyView ally = allies.get(row); final ITextComponent teleport = new TextComponentString(LanguageHandler.format(DO_REALLY_WANNA_TP, ally.getName())) .setStyle(new Style().setBold(true).setColor(TextFormatting.GOLD).setClickEvent( new ClickEvent(ClickEvent.Action.RUN_COMMAND, TELEPORT_COMMAND + ally.getID()) )); Minecraft.getMinecraft().player.sendMessage(teleport); }
private void sendColorized(String msg, TextFormatting formatting) { for (String part : msg.split("\n")) { TextComponentString component = new TextComponentString(part); component.getStyle().setColor(formatting); this.player.sendMessage(component); } }
link.getStyle().setColor(TextFormatting.GOLD); link.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(url))); link.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url)); Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("ftbutilities.lang.uploaded_crash", link));
@Override public void sendLink(String url) { TextComponentString msg = new TextComponentString(url); Style style = msg.getStyle(); style.setColor(TextFormatting.GRAY); style.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url)); msg.setStyle(style); broadcast(msg); }
Style style = new Style(); chat.appendSibling(new TextComponentTranslation("alert.new_update")).setStyle(style.setColor(TextFormatting.WHITE)); player.sendMessage(chat); ITextComponent versionName = new TextComponentString(root.get("title").getAsString() + " " + fullVersion + " ").setStyle(new Style().setColor(TextFormatting.AQUA)); chat.appendSibling(versionName); chat.appendText(TextFormatting.WHITE + "["); style.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, Reference.DOWNLOAD_URL)); style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentTranslation("info." + Reference.MOD_ID + ".updater.hover").setStyle(new Style().setColor(TextFormatting.YELLOW)))); style.setColor(TextFormatting.GREEN); chat.appendSibling(new TextComponentTranslation("info." + Reference.MOD_ID + ".updater.download")).setStyle(style); chat.appendText(TextFormatting.WHITE + "]");
protected <T extends ITextComponent> T withStyle(final T component, final TextFormatting formatting, @Nullable final String command) { final Style style = new Style(); style.setColor(formatting); if (command != null) { style.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command)); } component.setStyle(style); return component; } }
TextComponentString text = new TextComponentString(this.txtBoxes.get(row).getText()); if (col <= 15) { style.setColor(TextFormatting.values()[col]); switch (font) { case BOLD: style.setBold(!style.getBold()); break; case OBFUSCATED: style.setObfuscated(!style.getObfuscated()); break; case STRIKETHROUGH: style.setStrikethrough(!style.getStrikethrough()); break; case UNDERLINE: style.setUnderlined(!style.getUnderlined()); break; case ITALIC: style.setItalic(!style.getItalic()); break;
public static ITextComponent getGroupComponent(String group) { if (group.equals(level0)) { ITextComponent nameComponent = new TextComponentString("[") .appendSibling(new TextComponentTranslation("psimisc.fakeLevel.psidust")) .appendText("]"); nameComponent.getStyle().setColor(TextFormatting.AQUA); nameComponent.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentTranslation("psimisc.levelDisplay", 0))); return nameComponent; } PieceGroup pieceGroup = PsiAPI.groupsForName.get(group); if (pieceGroup == null) { ITextComponent errorComponent = new TextComponentString("ERROR"); errorComponent.getStyle().setColor(TextFormatting.RED); return errorComponent; } ITextComponent nameComponent = new TextComponentString("[") .appendSibling(new TextComponentTranslation(pieceGroup.getUnlocalizedName())) .appendText("]"); nameComponent.getStyle().setColor(TextFormatting.AQUA); nameComponent.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentTranslation("psimisc.levelDisplay", pieceGroup.levelRequirement))); return nameComponent; }
private static ITextComponent makeChat(boolean tag) { ITextComponent chat = new TextComponentString(tag ? "[test] " : ""); chat.getStyle().setBold(true); { ITextComponent colored = new TextComponentString("This should be green. "); colored.getStyle().setColor(TextFormatting.GREEN); chat.appendSibling(colored); } chat.appendText(" "); { ITextComponent link = new TextComponentString("This is a link."); link.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://google.com/")); chat.appendSibling(link); } return chat; } }
message.getStyle().setColor(TextFormatting.GOLD); message.appendSibling(new TextComponentString(" ")); sibling.getStyle().setHoverEvent(hover); sibling.getStyle().setUnderlined(true); message.appendSibling(sibling);
text.getStyle().setColor(colortf); text.getStyle().setBold(true); text.getStyle().setItalic(true); text.getStyle().setUnderlined(true); text.getStyle().setStrikethrough(true); text.getStyle().setObfuscated(true);
public ITextComponent getDisplayName() { Team team = this.getTeam(); String s = this.getCustomNameTag(); if (s != null && !s.isEmpty()) { TextComponentString textcomponentstring = new TextComponentString(ScorePlayerTeam.formatPlayerName(team, s)); textcomponentstring.getStyle().setHoverEvent(this.getHoverEvent()); textcomponentstring.getStyle().setInsertion(this.getCachedUniqueIdString()); return textcomponentstring; } else { if (this.buyingList == null) { this.populateBuyingList(); } TextComponentString itextcomponent = new TextComponentString(this.getName()); itextcomponent.getStyle().setHoverEvent(this.getHoverEvent()); itextcomponent.getStyle().setInsertion(this.getCachedUniqueIdString()); if (team != null) { itextcomponent.getStyle().setColor(team.getColor()); } return itextcomponent; } }
@Override public void dump(Collection<NoteEntry> notes, ICommandSender sender) { int count = 0; for (NoteEntry note : notes) { ITextComponent level = new TextComponentTranslation(note.category.translated); level.getStyle().setColor(note.category.color); sender.sendMessage(new TextComponentTranslation("openeye.chat.note", count++, level)); ITextComponent title = note.title(); title.getStyle().setBold(true); sender.sendMessage(title); sender.sendMessage(note.content()); String url = note.url(); if (!Strings.isNullOrEmpty(url)) sender.sendMessage(new TextComponentString(note.url())); } } }
@SubscribeEvent public void load(EntityJoinWorldEvent event) { if(!displayed && event.getEntity() instanceof EntityPlayer && event.getWorld().isRemote) { Style style = new Style(); style.setClickEvent(new ClickEvent(Action.OPEN_URL, "https://www.patreon.com/mrcrayfish")); style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(TextFormatting.AQUA + "Open MrCrayfish's Patreon"))); event.getEntity().sendMessage(new TextComponentString(TextFormatting.RED.toString() + TextFormatting.BOLD.toString() + "MrCrayfish's Device Mod:")); event.getEntity().sendMessage(new TextComponentString("You are using a development version of the Device Mod.")); event.getEntity().sendMessage(new TextComponentString("Please be aware that not all features are finished")); event.getEntity().sendMessage(new TextComponentString("and may be completely changed in a future update!")); event.getEntity().sendMessage(new TextComponentString(TextFormatting.GOLD.toString() + TextFormatting.BOLD.toString() + "> Support MrCrayfish On Patreon <").setStyle(style)); } }
citizen.getName())).setStyle(new Style().setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format(COMMAND_CITIZEN_INFO, citizen.getColony().getID(), citizen.getId())))));
panoramaDirComponent.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, currentDir.getAbsolutePath())).setUnderlined(true); event.setResultMessage(new TextComponentTranslation("quarkmisc.panoramaSaved", panoramaDirComponent));
private static void saveFile(List<String> list, String file) { File f = new File(Minecraft.getMinecraft().gameDir, "local/client/ftbjanitor/" + file); FileUtils.saveSafe(f, list); ITextComponent component = new TextComponentString(file + " saved! Click here to open."); try { component.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, f.getCanonicalFile().getAbsolutePath())); } catch (Exception ex) { component.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, f.getAbsolutePath())); } Minecraft.getMinecraft().player.sendMessage(component); } }
@Override public ITextComponent processStack(ItemStack stack) { ITextComponent component = new TextComponentString(""); component.appendSibling(stack.getTextComponent()); if (stack.hasDisplayName()) { String s = stack.getItem().getUnlocalizedName(stack); if (!I18n.canTranslate(s)) { s += ".name"; } ITextComponent component2 = new TextComponentTranslation(s); component2.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(s))); component.appendText(" (").appendSibling(component2).appendText(")"); } return component; } }, Id {
@Override public ITextComponent getDisplayName() { if (hasCustomName()) { return super.getDisplayName(); } TextComponentString nameString = new TextComponentString(getName()); nameString.getStyle().setHoverEvent(getHoverEvent()); nameString.getStyle().setInsertion(getCachedUniqueIdString()); return nameString; }