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

Hello, what code do I need to add to make the custom message appear lime in chat? The code is below!

-------------------------------------------------------------------------------------------------------------------------------------

super.onFoodEaten(item, world, player);

if(!world.isRemote){

player.dropItem(Items.emerald, 1);

MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText(player.getDisplayName() + " successfully completed the 'Poop Eating Challenge' and was rewarded an emerald!!"));

If you plan on doing this sort of thing often, I would suggest making a custom function that takes the desired message and inserts the formatting before every word, because multiple line messages will stop the formatting as of the second line.

 

Some of the code would look like this:

 

String msg="This is the message you want to format correctly so it displays the formatting on multiple lines.";

String[] tmp =  msg.split(" ");
String formatted = "";
for(int x = 0; x < tmp.length; x++){
    formatted += EnumChatFormatting.AQUA.toString();
    formatted += tmp[x];
    formatted += " ";
} 

 

You would have to mess around with that, and would have to be more creative to use multiple formats in one message, but that's the idea.

I'll need help, and I'll give help. Just ask, you know I will!

I would suggest using the nice method already given to you. Use ChatComponentTranslation (or ChatComponentText) and add in the ChatStyle set the color to lime.

 

(I'm not going to give you any code because I want you to learn)

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information

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.