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.

Featured Replies

Posted

Hi everyone, i'm trying to update an 1.8.9 mod to 1.15.2. For now, i'm blocked on this component.

Old code was:

ManageKeys.mc.thePlayer.addChatMessage((IChatComponent)new ChatComponentText(ChatFormatting.RED + "*string*"));

New code (actually) is:

ManageKeys.mc.player.sendMessage((ITextComponent)new ChatComponentText(ChatFormatting.RED + "*string*"));

I don't now if i'm doing right but i'm blocked here. Appreciating your help.
Best regards, Slart.

  • Author
7 minutes ago, diesieben07 said:

The point of the chat component system is to NOT use TextFormatting (old name EnumChatFormatting) with string concatenation. Use Style#setColor (from ITextComponent#getStyle).

ChatComponentText is StringTextComponent now.

 

Also: Do not store the Minecraft instance somewhere. Use Minecraft#getInstance.

Firstly, thanks for the answer.
Now, i've never used this type of.. istruction? What should be the type "Class#method" ?

  • Author
11 minutes ago, diesieben07 said:

It's just a notation for instance methods, meaning you need an instance of the class to call the method.

Okay.. maybe i've understood... So....

Style cs = new Style();

Then

cs.setStyle(/*Color?*/);
// Now output of the chat message:
mc.player.sendMessage((ITextComponent)new StringTextComponent("*String*");

And what goes inside setStyle?

  • Author
9 minutes ago, diesieben07 said:

Nowhere in my post did I say to do that.

I said to use ITextComponent#getStyle.

Mhhh....

If i declare an object

ITextComponent style;
// Then
style.getStyle();

Where i set the style?

p.s. if it is all wrong excuse me but i've not understood so much..

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.