
LEGOlord208
Forge Modder-
Posts
90 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
URL
http://krake.one/
-
Personal Text
Hello
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
LEGOlord208's Achievements

Stone Miner (3/8)
-1
Reputation
-
Just look at what writeUTF8String does, it is pretty straightforward 1. I was just gonna post that I fixed it lol 2. I did a bunch of times. while ((toWrite & -128) != 0) { to.writeByte(toWrite & 127 | 128); toWrite >>>= 7; } That is not what I call "Straight Forward". FIX: 1. Sendning. From Bukkit, send ByteArrayDataOutput b = ByteStreams.newDataOutput(); b.writeUTF(str); return b.toByteArray(); 2. Recieving. In forge, break the rules and make up your own: ByteArrayDataInput input = ByteStreams.newDataInput(buf.array()); message = input.readUTF(); If somebody thinks "Hey lego why not String.getBytes and new String() instead?? Stopid lego guy" Answer: I tried. Forge complains when recieving because the discriminator is missing.
-
So now the filesize is too long ByteBufInputStream i = new ByteBufInputStream(buf); try{ message = i.readUTF(); } catch(IOException e){ e.printStackTrace(); } finally{ try{ i.close(); } catch(IOException e){ e.printStackTrace(); } } Gives the error messages omBytes:27]: java.io.EOFException: fieldSize is too long! Length is 35939, but maximum is 139 at io.netty.buffer.ByteBufInputStream.checkAvailable(ByteBufInputStream.java:253) at io.netty.buffer.ByteBufInputStream.readFully(ByteBufInputStream.java:174) at java.io.DataInputStream.readUTF(Unknown Source) at io.netty.buffer.ByteBufInputStream.readUTF(ByteBufInputStream.java:228) at com.legolord208.pistoncraft.connection.StringPacket.fromBytes(StringPacket.java:24) at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:17) at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.decodeInto(SimpleIndexedCodec.java:7) at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:85) at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:21) at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:90) at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:158) at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:54) at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:389) at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:255) at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:53) at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:150) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) at java.lang.Thread.run(Unknown Source)
-
LOLOLOL writeUTF8String doesn't exist in Bukkit, so I guess I'll have to change the client. EDIT: I don't see any way to read UTF-16 yet though EDIT #2: I found one, but it doesn't seem to work. I gotta go too. I'll mark this as solved when I find something
-
I was worried about that but I had no clue what else to use... What do I do then?
-
I am the one writing the messages. Either way that sounds like a plan! Is it better to change the server side? From 1.8 to 1.8.9 EDIT: Removed irrelevant parts EDIT #2: Bukkit encoding code: http://pastebin.com/SDZ5615S EDIT #3: MUCH easier way (still giving errors on long strings though) ByteArrayDataOutput bytes = ByteStreams.newDataOutput(); bytes.writeUTF(str); return bytes.toByteArray();
-
-
I am sorry for the incovenience. It looks like it's a problem with the encoding on the server side, which isn't Forge. (You are the one spotting it, when I gave up on that idea before even posting) Theoratically I should close this thread and open one on Bukkit instead. I am using Bukkit on the server because the mod is optional. I have tried to instead of sending from Java Byte Array Output Stream, send from String.getBytes() and explored ByteBuf. The problem is that Bukkit seems to only have some of the Netty IO functions, not ByteBufUtils. That makes me forced to use another system. I have, just a very silly attempt, tried to convert the String to UTF-8. Though, it doesn't work on the long string. It's really weird, because I have no problems unless the encoded String is too long. (You also gave an explaintion on this part) The encoded String is not longer than double of the current URL in your browser. (Assuming it's on the Minecraft Forge websites, which have pretty long URL's) EDIT: Sorry for the very late answer. I got a 503 error for 10 minutes and had to wait for MinecraftForge to fix it EDIT #2: When I first added this to the mod it worked like a charm... If I'm not mistaken it could have something to do with me updating it to 1.8.9 instead of 1.8, which pretty much proofs it's not a server error.....
-
Sorry, but nope
-
Hmmmm true! Myself I had that idea a while ago, but I stopped because it wokedmwith small messages. From Bukkit, I use the Java buffer, because Bukkit does not have ByeByfUtils. I also tried String.getBytes() which was a failure. I have not clue what else to use in Bukkit.
-
Sorry, but I did say why in the main post: It was an ATTEMPT, and I thought it didn't hurt to leave it there until the bug was fixed.
-
Hmmmm I wanted to avoid this, but ok! Trust me, I've coded Java for two years, it's not some magical error by registering the methods wrong. I am using eclipse also which tells me (Eclipse, I am probably the first one to use it.... right.... lel #Irony). I am only goin to paste the long things on pastebin. Variable: public static SimpleNetworkWrapper network; On init: network = NetworkRegistry.INSTANCE.newSimpleChannel(/*CENSORED CHANNEL*/); Now registering the packet: network.registerMessage(Handler.class, StringPacket.class, 0, Side.CLIENT); StringPacket: http://pastebin.com/6hk9i1Kb The error should be on line 20, ByteBufUtils.readUTF8String(buf) I removed the debugging lines though. Handler- onMessage: public IMessage onMessage(StringPacket message, MessageContext ctx){ Minecraft.getMinecraft().addScheduledTask(() -> { 15253786530th time's EDIT: I am using the latest, 1.8.9 - 11.15.1.1763
-
Erm.. I did not fully understand that I read data when they were sent by the server. When player join: - Send secret joining message - Send info about players When I do a command - Send data And that last bit is the error. If the data sent when I do the command is a little bit smaller everything works. For example I removing ONE CHARACTER... And that worked, but then... I do need that character and also the size of the text varies. I guess I could try to send them in different sets but that would require some heavy code from me. Feels like this shouldn't be a problem. The string isn't more than around 50 - 100 characters long...
-
I have done tons of research based on this error: It seems to come when I send a too long packet from the server. If I shorten it it works. Also I tried "shortening" it (just an attempt) by converting to Base64. Code for getting packet: public void fromBytes(ByteBuf buf){ System.out.println("Error...?"); message = new String(Base64.getDecoder().decode(ByteBufUtils.readUTF8String(buf)), StandardCharsets.UTF_; System.out.println("Finished the creepy code"); } In the console, I of course get the first packets sent: :36]: Error...? [09:22:54] [Netty Client IO #1/INFO] [sTDOUT]: [com.legolord208.pistoncraft.connection.StringPacket:fromBytes:39]: Finished the creepy code [09:22:54] [Netty Client IO #1/INFO] [sTDOUT]: [com.legolord208.pistoncraft.connection.StringPacket:fromBytes:36]: Error...? [09:22:54] [Netty Client IO #1/INFO] [sTDOUT]: [com.legolord208.pistoncraft.connection.StringPacket:fromBytes:39]: Finished the creepy code No problems there. Then the big beast comes (it's really not that long though) fromBytes:36]: Error...? [09:23:04] [Netty Client IO #1/ERROR] [FML]: FMLIndexedMessageCodec exception caught io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: index: 2, length: 11452 (expected: range(0, 189)) Whole error message is pasted here: And if you prefer pastebin: http://pastebin.com/yAipirFJ Notice that the "Finished the Creepy code" is (obviously) never printed at last.
-
Ok. But I just thought Forge should escape < and > in the GUI by default. Also the other lines are not at all important. This is more of a forge issue. public static Configuration config; public static final String GENERAL = Configuration.CATEGORY_GENERAL; public static void syncConfig(){ overrideMainMenu = config.getBoolean("Enhanced main menu", GENERAL, true, "Override Minecraft's main menu?"); splashAnimated = config.getBoolean("Animate splash screen?", GENERAL, true, "Do you want to animate the splash screen?"); splashKeyframes = config.getStringList("Splash Keyframes", GENERAL, new String[]{"A","An","Ani","Anim","Anima","Animat","Animate","Animated","Animated", "Animate","Animat","Anima","Anim","Ani","An"}, "Create an animated splash menu by filling in keyframes."); if(config.hasChanged()) config.save(); }