Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

NomNuggetNom

Members
  • Joined

  • Last visited

Everything posted by NomNuggetNom

  1. Here's a breakdown of the chat that I can change: TextComponent{text='', siblings=[TextComponent{text='Visit ', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null}}, TextComponent{text='---', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=ClickEvent{action=OPEN_URL, value='http://---.com'}, hoverEvent=null}}, TextComponent{text=' for more info!', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null}}], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null}} Which is rendered as just: "Visit --- for more info!" even though it's a bunch of stuff. The "---" was a link that I have replaced. The fact that it has a link in it could be a bad example... maybe I'll find another. And here's the text that I can't change: TextComponent{text='§f[§7TW§f] §6NomNuggetNom§9> §f§5/h §fHelp me!', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null}} The one I can format has a text component for every word, and it has a sibling for every word. EDIT Here's another interesting one. If I say something that spans two lines: TextComponent{text='§f[§7TW§f] §6NomNuggetNom§9> §ftest test test test test test test test test test test test test test test test test test test test', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null}} ^ Part of this actually appeared bold. I am so confused. If possible, I think the best approach would be to modify the string of the message. How can I do that? I'm not sure how to modify the text of an IComponentMessage.
  2. I had tried that but was getting an error. Then I noticed a missing parenthesis... *sigh*. But.. it's still not working :'(. @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { for (Object component : event.message.getSiblings()) { ((IChatComponent) component).getChatStyle().setBold(true); } } I don't know if this is possible, but I don't think it's getting processed by the ClientChatReceivedEvent.
  3. This is causing my game to crash. Should I just catch the error? Here's my code: for (IChatComponent component : event.message.getSiblings()) { component.getChatStyle().setBold(true); } And the obvious error: Caused by: java.lang.Error: Unresolved compilation problem: Type mismatch: cannot convert from element type Object to IChatComponent
  4. If getSiblings() is returning Objects, and I can't convert from Object to IChatComponent, how am I supposed to do that?
  5. Okay, so now I've made it so all incoming chat is transformed to bold. The server I'm using this client mod on has a strange chat system that I suspect is interfering. Like this: So, for example, the following doesn't get bolded: [16:15:43] [Client thread/INFO]: [CHAT] §c<§fvcvca§c> §f§r§6/a §f17 kills But this does: [16:15:43] [Client thread/INFO]: [CHAT] Visit --- for more info! So the pre-existing formatting of the chat is what's ruining it. Any ways around this? I couldn't figure out how to set the string like you mentioned earlier.
  6. Is it possible for the server to be stripping it? I don't understand how that would be possible, but I have no idea why it isn't working.
  7. Still no luck. Can you put together a quick example please? It's not as easy as just setting the string, because it needs to be an IChatCompenent. EDIT: Here's something interesting. In this code: System.out.println("1!"); event.message.getChatStyle().setBold(true); System.out.println("Set the style for \"" + event.message + "\" to bold."); Only the "1!" gets printed. EDIT 2: Even weirder, I managed to make it set to this: Set the style for "TextComponent{text='§f[§7TW§f] §6NomNuggetNom§9> §f§5/m §fMedic!', siblings=[], style=Style{hasParent=false, color=null, bold=true, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null}}" to bold. But it doesn't even show up bold in game.
  8. How would I do that?
  9. Yes, I am sure. I have a line printing out before it to verify.
  10. This isn't doing the trick: event.message.getChatStyle().setBold(true);
  11. How? Sorry for being slow. event.message.setChatStyle? Or should I do event.message.getChatStyle.setBold(true)?
  12. Ah, I just noticed the "setResult()" function. I'll give it a try.
  13. For example, I want to bold any message that contains the word "bold" in it. I have no trouble getting the chat message and such, but how can I bold the message?
  14. Actually, I'm still getting some crashes from grabbing the title . I'm working on it though . I'd also like to remove the scoreboard. I wonder if that's possible.
  15. I did it! . I even wrote some functions for it: Getting the title, in my case "[1/3] Ends in 19:03": /** * Returns the "title" of the scoreboard's display. */ public static String getBoardTitle(Scoreboard board) { // Grab the main objective of the scoreboard. ScoreObjective titleObjective = board.func_96539_a(1); // Null check. For some reason, sometimes _a(0) works and other times _a(1) works. if (board.func_96539_a(0) != null) { return board.func_96539_a(0).getDisplayName(); } else { return board.func_96539_a(1).getDisplayName(); } } In my example, I would just need to do: System.out.println(Stats.getBoardTitle(this.mc.theWorld.getScoreboard())); Getting the score of the teams: /** * Returns the score of the "team" (really a fake player) on the scoreboard. */ public static int getTeamScore(String team, Scoreboard board) { // Grab the main objective of the scoreboard. ScoreObjective objective = board.func_96539_a(1); // Collection of all scoreboard entries. Collection collection = board.func_96534_i(objective); // Iterate through the collection of entries. Iterator iterator1 = collection.iterator(); while (iterator1.hasNext()) { Score score = (Score)iterator1.next(); // Check if the name of the "team" (player) is what we're looking for. // In actuality, it would be better to use an equals check e.g.: // if (score1.getPlayerName().equals(team)) { if (score.getPlayerName().contains(team)) { // Get the score of the "team" (player) and return it. return score.getScorePoints(); } } return -1; } So, for my example, I could just do: System.out.println(Stats.getTeamScore("Blue", board)); System.out.println(Stats.getTeamScore("Red", board));
  16. Managed to get the title of the scoreboard like this: ScoreObjective scoreobjective = this.mc.theWorld.getScoreboard().func_96539_a(1); String scoreTitle = scoreobjective.getDisplayName(); EDIT: Actually this seems to be crashing sometimes :\. Changed it to this: if (this.mc.theWorld.getScoreboard().func_96539_a(0) != null) { boardTitle = this.mc.theWorld.getScoreboard().func_96539_a(0).getDisplayName(); } else { boardTitle = this.mc.theWorld.getScoreboard().func_96539_a(1).getDisplayName(); }
  17. Here's my example: So I want to strip the following information: - The title. In this case, "[1/3] Ends in 19:03" - The two teams, "Red" and "Blue" - The score of each team, 0 and 0 here. I was poking around in the scoreboard code and just could not figure it out. Any help is greatly appreciated. Here's what I've gotten so far: - The title. - Getting the objective names returns "§9Blue" and "§cRed" - Checking these values returns 0, even when Blue team has 1 point: ScoreObjective blueObjective = board.getObjective("§9Blue"); System.out.println(board.func_96529_a("§9Blue", blueObjective).getScorePoints());

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.