Everything posted by LEGOlord208
-
[1.8.9] [SOLVED] Packet too long..?
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.
-
[1.8.9] [SOLVED] Packet too long..?
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)
-
[1.8.9] [SOLVED] Packet too long..?
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
-
[1.8.9] [SOLVED] Packet too long..?
I was worried about that but I had no clue what else to use... What do I do then?
-
[1.8.9] [SOLVED] Packet too long..?
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();
-
[1.7.10] I want to make an automatic crafting table, where do I start?
I guess you could look in the Crafting Table (obviously), and also see if you could loop through recipies, and match the ingredients...
-
[1.8.9] Problem building with API
- [1.8.9] [SOLVED] Packet too long..?
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.....- [1.8.9] [SOLVED] Packet too long..?
Sorry, but nope- [1.8.9] [SOLVED] Packet too long..?
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.- [1.8.9] [SOLVED] Packet too long..?
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.- [1.8.9] [SOLVED] Packet too long..?
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- [1.8.9] [SOLVED] Packet too long..?
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...- [1.8.9] [SOLVED] Packet too 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.- Error in Forge (Not my mod's fault)?
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(); }- Error in Forge (Not my mod's fault)?
I got an exception when loading a string list. The string list is written in the GUI, and it has no problem saving. But when it loads it says the list is not valid. The reason is probably because I used a "<" and a ">" in the config, but it was written in the GUI, so basically is it the GUI's fault for this behaviour? Stack trace: This is com.legolord208.pistoncraft.ConfigLoader.init(ConfigLoader.java:16): And the pc.cfg_20160108_165622.errored file says: If this is my fault in any way, let me know. If you know where I'm actually supposed to report stuff like this, let me know. Thanks in advance! Gotta go! I mean, I really got to go Gotta go fast! Wait... If i got to go, why am I taking time spamming? Sorry, See you! //LEGOlord208 I'm out of here- Kill entity from one side?
Do you mean packets? I bet Google knows... Trust me, I found nothing.- Kill entity from one side?
And now we're back from the beginning! I have no clue how to send packages.- Kill entity from one side?
That depends - if you are using a KeyBinding, then Minecraft.getMinecraft().thePlayer is the player pressing the key, so I don't see how that is helpful to you. At the very least, if you really do want to attack from a KeyBinding, you will need some way to send a packet to the server so it can perform the attack. There are built-in ways, but again, the solution depends on your actual code. Show your code. I will- When I get access.s I guess I can show it a bit from my memories: @SubscribeEvent public void onKeyInput(KeyInputEvent e){ EntityPlayer player = Minecraft.getMinecraft().thePlayer; WorldClient world = Minecraft.getMinecraft().theWorld; if(Keypress.homing.isPressed){ /* Code to target the closest Entity and output it to "closest" */ if(closest != null){ BlockPos pos = closest.getPosition(); player.setPosition(pos.getX(), pos.getY(), pos.getZ()); closest.setHealth(0F); world.removeEntity(closest); closest.attackEntityFrom(DamageSource.generic, closest.getMaxHealth()); } } } Phew! Is that enough?- Kill entity from one side?
Yes! That's exactly what's going on: I have no other way to target the player- as there is no player variable While I do not have the code right here, I'm using a Keybinding to execute this, with the KeyInput event from FML. From the Minecraft class I get World and Player. How would I target the right player?- Kill entity from one side?
However- How do I call it from that side then?- Kill entity from one side?
I'm creating a homing attack in Minecraft for my new started Ultimate Sonic Mod. I want to kill an entity when landing on him, but that doesn't really work. I tried setHealth, setDead, World.removeEntity, attackEntityFrom, EVERYTHING. But all happens is an invisible entity: Obviously is only one side calling it. How do I update both sides? Thanks [move]LEGOlord208[/move]- [CLOSED] [UNSOLVED] [1.8] Item issues everywhere :/
Guys, I'm sorry. I give up, since this mod is private, I'm just gonna downgrade to 1.7.10 Sorry- [CLOSED] [UNSOLVED] [1.8] Item issues everywhere :/
Thanks, I'll give it a go- [CLOSED] [UNSOLVED] [1.8] Item issues everywhere :/
Yes, as soon as I get access to my coomputer. Thanks - [1.8.9] [SOLVED] Packet too long..?
IPS spam blocked by CleanTalk.
Important Information
By using this site, you agree to our Terms of Use.