Posted February 19, 201411 yr Hello everyone, I just have a question. Is there a way to write a String to a ByteBuf object when sending a packet? I don't see a ByteBuf.writeString() method, so i don't think so, but i thought i make sure. Do you know of a alternate way to do this? I'm following this packet handler tutorial: http://www.minecraftforge.net/wiki/Netty_Packet_Handling Thanks for reading! ~Geforce Potato's have skin. I have skin. Therefore, i am a potato. Follow me on Twitter! http://www.twitter.com/I_Mod_Minecraft
February 19, 201411 yr I'm not sure if you have a method to write an array of bytes, but here's a way to convert a String to a byte array: new String("Hello World!").getBytes(); Kain
February 19, 201411 yr I use this method to write Strings as UTF: ByteBufUtils.writeUTF8String(buffer, String); http://i.imgur.com/NdrFdld.png[/img]
February 19, 201411 yr Author It worked! Thanks to both of you. Potato's have skin. I have skin. Therefore, i am a potato. Follow me on Twitter! http://www.twitter.com/I_Mod_Minecraft
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.