Talk:Protocol FAQ: Difference between revisions
imported>ConnerGDavis No edit summary |
imported>ConnerGDavis No edit summary |
(No difference)
| |
Revision as of 01:52, 28 November 2011
Hey, I have a different problem. Whenever I attempt to log-in to my server, I receive an IOException entitled "Received string length is less than zero! Weird string!"
Currently all my server is doing after the login request is successful is (in this order): - Streaming relevant 49 chunks - Sending the Compass packet - Sending the inventory slot packets - Sending the player position & look packet
It gets stuck on the chunk packets, so I know it's a problem there. I am not sending pre-chunks, because the protocol said it wasn't necessarily obligatory. I'm going to try sending those now, and see if it fixes it. Aside from that, anyone have any ideas? :/
UPDATE: I've fixed this, but now, it gets stuck on the byte which sends 16 - 1 (15) and it's telling me Bad packet id 15, as if it is trying to make that byte a packet itself, rather than part of the chunk packet. Removing this causes another error, telling me that the string is over the max limit (this is part of the compressed data being sent to the client.) I don't really know what is wrong. Here's my code for writing the 0x33 packet message from S->C
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
buf.writeInt(x); buf.writeShort(y); buf.writeInt(z); buf.writeByte(Chunk.WIDTH - 1); buf.writeByte(Chunk.HEIGHT - 1); buf.writeByte(Chunk.LENGTH - 1);
byte[] compressedData = new byte[(Chunk.WIDTH * Chunk.LENGTH * Chunk.HEIGHT * 5) / 2]; // 81,920
Deflater deflater = new Deflater(Deflater.BEST_SPEED); deflater.setInput(data); deflater.finish();
int compressed = deflater.deflate(compressedData); deflater.end();
buf.writeInt(compressed); buf.writeBytes(compressedData, 0, compressed);
return buf;