Jump to content

1.8 Sending chat messages by the mod


Recommended Posts



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


Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

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