@Override public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { String name = player.getDisplayName().getUnformattedText(); float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks; float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks; float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks; GlStateManager.pushMatrix(); GlStateManager.rotate(yawOffset, 0, -1, 0); GlStateManager.rotate(yaw - 270, 0, 1, 0); GlStateManager.rotate(pitch, 0, 0, 1); if(name.equals("haighyorkie")) renderGoldfish(player); firstStart(); name = name.toLowerCase(); if(player.isWearing(EnumPlayerModelParts.CAPE) && flowerMap.containsKey(name)) renderFlower(player, flowerMap.get(name)); GlStateManager.popMatrix(); }
public String replaceVariables(String text, EntityPlayer entityPlayer) { if (entityPlayer != null) { return text.replace("$player", entityPlayer.getDisplayName().getFormattedText()); } return text; }
@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 {
private ITextComponent getRequestMessage(@NotNull final IRequest request) { final ITextComponent component = new NonSiblingFormattingTextComponent(); component.appendSibling(request.getShortDisplayString()); component.getStyle().setColor(TextFormatting.WHITE); return component; }
/** * Send a message to chat regardless of chatDebug (should only be used for critically important messages, or as a direct response to a chat command) * * @param message The message to display in chat */ default void logDirect(String message) { ITextComponent component = MESSAGE_PREFIX.createCopy(); component.getStyle().setColor(TextFormatting.GRAY); component.appendSibling(new TextComponentString(" " + message)); Minecraft.getMinecraft().addScheduledTask(() -> Baritone.settings().logger.get().accept(component)); } }
public void notifyAll(MinecraftServer server, Function<ICommandSender, ITextComponent> function, boolean error) { for (EntityPlayerMP player : server.getPlayerList().getPlayers()) { ITextComponent component = function.apply(player); component.getStyle().setColor(error ? TextFormatting.DARK_RED : TextFormatting.LIGHT_PURPLE); Notification.of(NOTIFICATION_ID, component).setImportant(true).send(server, null); } FTBUtilities.LOGGER.info(function.apply(null).getUnformattedText()); }
RankNone(Ranks r, String id) { super(r, id); displayName.getStyle().setColor(TextFormatting.DARK_GRAY); }
@NotNull @Override public ITextComponent getShortDisplayString() { final ITextComponent result = new NonSiblingFormattingTextComponent(); result.appendSibling(new TextComponentTranslation(TranslationConstants.COM_MINECOLONIES_REQUESTS_FOOD)); return result; }
component.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, StringUtils.color(FTBLib.lang(sender, "click_here"), TextFormatting.GOLD))); boolean first = true; component.appendText(", "); ITextComponent component1 = leaderboard.getTitle().createCopy(); component1.getStyle().setColor(TextFormatting.GOLD); component1.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/leaderboards " + leaderboard.id)); component.appendSibling(component1); 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)); component.getStyle().setColor(TextFormatting.DARK_GREEN); component.getStyle().setColor(TextFormatting.DARK_GRAY); component.getStyle().setColor(TextFormatting.GOLD);
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))))); }
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; }
@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") {
public Rank(Ranks r, String id) { super(id); displayName = new TextComponentString(getID()); displayName.getStyle().setColor(TextFormatting.DARK_GREEN); ranks = r; parent = ranks.none; tags = new LinkedHashSet<>(); permissions = new ArrayList<>(); cachedPermissions = new HashMap<>(); cachedConfig = new HashMap<>(); }
@NotNull @Override public ITextComponent getShortDisplayString() { final ITextComponent result = new NonSiblingFormattingTextComponent(); result.appendSibling(new TextComponentTranslation(TranslationConstants.COM_MINECOLONIES_REQUESTS_BURNABLE)); return result; }
@NotNull @Override public ITextComponent getShortDisplayString() { final ITextComponent combined = new NonSiblingFormattingTextComponent(); combined.appendSibling(new TextComponentString(getRequest().getCount() + " ")); combined.appendSibling(getRequest().getStack().getTextComponent()); combined.getStyle().setColor(TextFormatting.BLACK); return combined; } }
@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 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; } }
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); } } }
public static Map<Object, Object> getSignLines(TileEntitySign sign) { ITextComponent[] lines = sign.signText; Map<Object, Object> text = Maps.newHashMapWithExpectedSize(lines.length); for (int i = 0; i < lines.length; i++) { text.put(i + 1, lines[i].getUnformattedText()); } return text; }
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; } }