Posted June 25, 201411 yr Hello everyone. I started learning java and soon started working in forge. I have 1 question. How can I send a message to a player when he loggins on the world? In 1.6, I think this worked: NetworkRegistry.instance().registerConnectionHandler(new ConnectionHandler()); (and that i could create the class ConnectionHandler and everything is easy), but now I get an error when I write this part. Any help, please?
June 25, 201411 yr you need to create and register an event handler for your mod and then you can use the following in said event handler. @SubscribeEvent public void loginEvent(EntityJoinWorldEvent event){ if (event.entity instanceof EntityPlayer && event.world.isRemote) ((EntityPlayer)event.entity).addChatComponentMessage(new ChatComponentText("Welcome to the world!!!!")); } if you dont know how to setup an event handler i can give you instructions. I am the author of Draconic Evolution
June 25, 201411 yr If you want a global message then I think this will work: FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Welcom" + player)); But if you want it to just be sent to the specific person I am not sure sorry.
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.