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!

 

I was wondering how can you send a chat message, for example how can a mod type Hello(in chat you will see this as "Your_Nickname: Hello").

I already tried few things like

Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Hello"));

but that just ends up showing the message to the client, which is not what i need.

 

I tried player.addChatMessage(newChatComponentText("Hello")); but eclipse tells me that player can not be resolved, my friend also mentioned I needed to use

EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;

which would tell me the player nickname, but this doesn't work. Anyone knows how do I do it?

Thank you in advance, Erol

 

Damn... your problem is simple: You don't know Java. You seem like don't even know objective coding... learn basics before modding.

 

EntityPlayer#addChatMessage is good approach.

Minecraft#thePlayer is client-only player (the one you control), you can't use it in common/server code. Only Proxy can call it (client only class).

Saying that - you need common EntityPlayer instance.

What I am saying - when do you want to print this message of yours? You can print it from event, from Item/Block methods, from anywhere actually.

1.7.10 is no longer supported by forge, you are on your own.

If you wanted to send chat messages from the mod to the server(Without the server handling the message. All client sided), I think the method is sendChatMessage instead of addChatMessage.

Ernio is right. You need to learn some basics before modding.

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.