@Override public ITextComponent processStack(ItemStack stack) { EnumAction action = stack.getItemUseAction(); ITextComponent component = new TextComponentString(action.name()); if (action != EnumAction.NONE) { component.appendText(" | Duration: " + stack.getMaxItemUseDuration()); } return component; } }, Lore("flavorText") {
private static void addInfo(NBTTagList list, ITextComponent key, ITextComponent value) { list.appendTag(new NBTTagString(ITextComponent.Serializer.componentToJson(StringUtils.color(key, TextFormatting.BLUE).appendText(": ").appendSibling(StringUtils.color(value, TextFormatting.GOLD))))); }
final ITextComponent removeLink = withStyle(new TextComponentTranslation(Names.Command.List.Message.REMOVE), TextFormatting.RED, removeCommand); chatComponent.appendSibling(removeLink); chatComponent.appendText("]["); chatComponent.appendText("]");
public void teleport(EntityPlayerMP player, Function<EntityPlayerMP, TeleporterDimPos> pos, @Nullable IScheduledTask extraTask) { Universe universe = Universe.get(); int seconds = (int) RankConfigAPI.get(player, warmup).getTimer().seconds(); if (seconds > 0) { player.sendStatusMessage(StringUtils.color(FTBLib.lang(player, "stand_still", seconds).appendText(" [" + seconds + "]"), TextFormatting.GOLD), true); universe.scheduleTask(TimeType.MILLIS, System.currentTimeMillis() + 1000L, new TeleportTask(player, this, seconds, seconds, pos, extraTask)); } else { new TeleportTask(player, this, 0, 0, pos, extraTask).execute(universe); } } }
@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 {
public ITextComponent getNameForChat() { if (cachedNameForChat != null) { return cachedNameForChat; } String text = player.getRankConfig(FTBUtilitiesPermissions.CHAT_NAME_FORMAT).getString(); try { cachedNameForChat = TextComponentParser.parse(text, FTBLibCommon.chatFormattingSubstituteFunction(player)); } catch (Exception ex) { String s = "Error parsing " + text + ": " + ex.getLocalizedMessage(); FTBUtilities.LOGGER.error(s); cachedNameForChat = new TextComponentString("BrokenFormatting"); cachedNameForChat.getStyle().setColor(TextFormatting.RED); cachedNameForChat.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(s))); } cachedNameForChat.appendText(" "); return cachedNameForChat; } }
@NotNull @Override public ITextComponent getLongDisplayString() { final ITextComponent result = new NonSiblingFormattingTextComponent(); final ITextComponent preType = new TextComponentTranslation(TranslationConstants.COM_MINECOLONIES_REQUESTS_TOOL_PRETYPE); result.appendSibling(preType); result.appendSibling(getRequest().getToolClass().getDisplayName()); if (getRequest().getMinLevel() > ToolLevelConstants.TOOL_LEVEL_HAND) { result.appendText(" "); result.appendSibling(new TextComponentTranslation(TranslationConstants.COM_MINECOLONIES_REQUESTS_TOOL_PREMINLEVEL)); result.appendText(getRequest().isArmor() ? ItemStackUtils.swapArmorGrade(getRequest().getMinLevel()) : ItemStackUtils.swapToolGrade(getRequest().getMinLevel())); } if (getRequest().getMaxLevel() < ToolLevelConstants.TOOL_LEVEL_MAXIMUM) { if (getRequest().getMinLevel() > ToolLevelConstants.TOOL_LEVEL_HAND) { result.appendText(" "); result.appendSibling(new TextComponentTranslation(TranslationConstants.COM_MINECOLONIES_GENERAL_AND)); } result.appendText(" "); result.appendSibling(new TextComponentTranslation(TranslationConstants.COM_MINECOLONIES_REQUESTS_TOOL_PREMAXLEVEL)); result.appendText(getRequest().isArmor() ? ItemStackUtils.swapArmorGrade(getRequest().getMaxLevel()) : ItemStackUtils.swapToolGrade(getRequest().getMaxLevel())); } return result; }
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; }
component.appendText(", "); sender.sendMessage(leaderboard.getTitle().createCopy().appendText(":")); ITextComponent component = new TextComponentString("#" + StringUtils.add0s(i + 1, players.size()) + " ").appendSibling(p.getDisplayName()).appendText(": "); component.appendSibling(leaderboard.createValue(p));
c1.appendText(": "); c1.getStyle().setColor((TextFormatting.GREEN)); TextComponentBase c2;
player.sendStatusMessage(StringUtils.color(FTBLib.lang(player, "stand_still", startSeconds).appendText(" [" + (secondsLeft - 1) + "]"), TextFormatting.GOLD), true);
citizenDescription.appendText(citizen.getCustomNameTag()).appendText(": "); if (citizen.getCitizenColonyHandler().getColony() != null)
player.sendMessage(new TextComponentTranslation("wizardry.misc.update_checker1") .setStyle(new Style().setColor(TextFormatting.GREEN)) .appendText(" ") .appendSibling(new TextComponentString(clientBuild).setStyle(new Style().setColor(TextFormatting.RED)))); player.sendMessage(new TextComponentTranslation("wizardry.misc.update_checker2") .setStyle(new Style().setColor(TextFormatting.GREEN)) .appendText(" ") .appendSibling(new TextComponentString(onlineVersion).setStyle(new Style().setColor(TextFormatting.YELLOW))));
ITextComponent msg = p.getDisplayName().appendText(": " + list.size() + " / " + p.getRankConfig(FTBUtilitiesPermissions.HOMES_MAX).getInt() + ": "); msg.appendText(", ");
@Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (!Ranks.isActive()) { throw FTBLib.error(sender, "feature_disabled_server"); } ForgePlayer p = CommandUtils.getSelfOrOther(sender, args, 0); Rank rank = Ranks.INSTANCE.getRank(p.team.universe.server, p.getProfile(), p.getContext()); ITextComponent component = new TextComponentString("").appendSibling(StringUtils.color(p.getDisplayName(), TextFormatting.BLUE)).appendText(" - "); if (rank != Ranks.INSTANCE.getSetRank(p.getProfile())) { component = component.appendSibling(StringUtils.color(rank.getDisplayName(), TextFormatting.DARK_GRAY)); } else { component = component.appendSibling(rank.getDisplayName()); } sender.sendMessage(component); } }
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; } }