This is so confusing... I tried using LUBE but the tutorials are outdated.. I try the normal luasocket but its documentation sucks (the ones I found).
It's so frustrating. Please if someone knows how to send a package to a minecraft server please leak that knowledge.
I can't even get how to make the luasocket to get a website or anything (and I am avoiding the socket.http).
Minecraft packets
- jag_e_nummer_ett
- Citizen
- Posts: 52
- Joined: Thu May 16, 2013 6:31 pm
- Location: Stockholm, Sweden
- jag_e_nummer_ett
- Citizen
- Posts: 52
- Joined: Thu May 16, 2013 6:31 pm
- Location: Stockholm, Sweden
Re: Minecraft packets
Good to know, so I don't try to glue myself to LUBE.szensk wrote:You're going to want to use LuaSocket.
That's not what I meant.szensk wrote:It's TCP?
I meant how to send a packet.
Ex the handshake (taken from here):
- Packet ID: 0x00
Protocol version: (VarInt) 4 as of 1.7.2
Server address: (String) ex localhost
Server port: (Unsigned Short) 25565
Next state: (VarInt) 1 for status, 2 for login
My first idea was something like this:
Code: Select all
connection:send(0x00)
connection:send(4)
connection:send(ip)
connection:send(port)
connection:send(2)
What to do here?
- jag_e_nummer_ett
- Citizen
- Posts: 52
- Joined: Thu May 16, 2013 6:31 pm
- Location: Stockholm, Sweden
Re: Minecraft packets
Now just to confirm, is it done by combining the fields? Shouldn't there be something separating them, like a space or comma?bekey wrote:Code: Select all
connection:setHandshake("0x00" .. "4" .. "localhost" .. "25565" .. "2")
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Minecraft packets
I would definitely go with luasocket instead of lube, because lube does add a tiny bit of "structure", that's not necessarily compatible with minecraft's protocol.
I took a look at the protocol, and considering you're asking these questions, you're going to be in for a lot of fun..
Anyway, you'd want something like string.char(0x00, 0x04, 0x09).."localhost", string.char(0xDD, 0xC7, 0x01, 0x01), to do the status message for localhost and on port 25565.
The hard parts here are that the string is preceded by a varint containing the length, and then the varint containing the port. Now this is a varint, and yes, it's not that easy.
I took a look at the protocol, and considering you're asking these questions, you're going to be in for a lot of fun..
Anyway, you'd want something like string.char(0x00, 0x04, 0x09).."localhost", string.char(0xDD, 0xC7, 0x01, 0x01), to do the status message for localhost and on port 25565.
The hard parts here are that the string is preceded by a varint containing the length, and then the varint containing the port. Now this is a varint, and yes, it's not that easy.
Who is online
Users browsing this forum: No registered users and 0 guests