Vswe's Summer Courses | You're not logged in. Sign up or log in | Server time: | Donate
One can now see other persons' badge hunts. Simply head over to their profiles to access them.

Go back to course page

Forging a Minecraft mod

Basic Minecraft modding with Minecraft Forge

Chat Messages

  • 2013-08-29 05:20:42
    Hi, I was working on sending a chat message to players, when they attempt to use an item it sends a message to their client. I saw that EntityPlayer has a method called sendChatToPlayer(), but this requires a ChatMessageComponent, which has no constructors, and has many un-named methods, so can anyone point me in the right direction on what I need to do?,
    cheers
    JB567
  • 2013-08-29 05:42:17
    In the course vswe used:
    Minecraft.getMinecraft().thePlayer.addChatMessage("msg");

    You shoud only send it on client side, or you'll get it twice.
  • 2013-08-29 05:47:09
    Also, ChatMessageComponents have a few functions that take String, they seem to work as well, eg:

    player.sendChatToPlayer(new ChatMessageComponent().func_111072_b("Hello"));
  • 2013-08-29 06:56:06
    Ok Thanks Kocyk :)
  • Log in or sign up to reply to this thread