Posted May 6, 201510 yr Hi, i'm developing a client mod i'm searching for a event that is called when the player join the server and after he joins automatically send a chat message, i tried this code, but throw a NullPointerException when getting the player @SubscribeEvent public void onConnectedToServerEvent(ClientConnectedToServerEvent event) { EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; player.sendChatMessage("Hello!"); // <-- NullPointerException }
May 6, 201510 yr Author i want to send chat message to the server so all other players can read it like a normal message Thank you
May 7, 201510 yr Author The method sendPacket(C01PacketChatMessage) is undefined for the type NetworkManager @SubscribeEvent public void onConnectedToServerEvent(ClientConnectedToServerEvent event) { event.manager.sendPacket(new C01PacketChatMessage("Hi!")); }
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.