* structured more of Join Game packet

meow
Dominika 2022-02-14 11:28:39 +01:00
parent d4e8f2c82e
commit 0cbe8e8ddf
3 changed files with 33 additions and 18 deletions

43
mc.sh
View File

@ -28,11 +28,11 @@ function keep_alive() {
echo '092100000000000000ff' | xxd -p -r
# random data
res=$(printf '%016x' $time)
res=$res$res
log time: $res
time=$((time+240))
echo -n "$(hexpacket_len "$res")59$res" | xxd -p -r
#res=$(printf '%016x' $time)
#res=$res$res
#log time: $res
#time=$((time+240))
#echo -n "$(hexpacket_len "$res")59$res" | xxd -p -r
done
}
@ -138,30 +138,37 @@ while true; do
log "$(hexpacket_len "$res")02$res"
echo -n "$(hexpacket_len "$res")02$res" | xxd -p -r
#res="$eid" # entity id
#res+="00" # not hardcore
#res+="00" # survival mode
#res+="01" # ... as previously seen on Creative Mode (ignored)
res="0000$eid" # entity id
res+="00" # not hardcore
res+="00" # survival mode
res+="01" # ... as previously seen on Creative Mode (ignored)
# I am *not* recreating the biome codecs
res+="$(cat src/biome_blob.nbt | xxd -p)
"
#res+="01" # one dimension
#res+="13$(echo -n "minecraft:overworld" | xxd -p)"
#res+="0a000000" # dimension codec
#res+="0a000000" # dimension
#res+="13$(echo -n "minecraft:overworld" | xxd -p)" # dimension being spawned into
#res+="0000000000000000" # beginning of sha256 of seed
#res+="0f" # max players (ignored)
#res+="02" # view distance (min 2 chunks)
#res+="02" # simulation distance
#res+="00" # reduced debug info? (false)
#res+="00" # enable respawn screen
#res+="00" # is debug (surprisingly, no)
#res+="01" # is flat (yeah, sure)
#res+="00" # max players (ignored)
res+="0a" # view distance (min 2 chunks)
res+="0a" # simulation distance
res+="00" # reduced debug info? (false)
res+="00" # enable respawn screen
res+="00" # is debug (surprisingly, no)
res+="01" # is flat (yeah, sure)
#rhexlog "$(hexpacket_len "$res")26$res"
#echo -n "$(hexpacket_len "$res")26$res" | xxd -p -r
#log "sent join game"
cat nbt_
log "sent (hardcoded) join game"
log "$(echo $(hexpacket_len "$res")26$res | cut -c 1-5000)"
echo -n "$(hexpacket_len "$res")26$res" | xxd -p -r
log "sent join game"
#res="$(encode_position 10 10 10)"
#res+="00000000" # angle as float

Binary file not shown.

View File

@ -211,6 +211,14 @@ function pkt_title() {
echo -n "$(hexpacket_len "$res")5a$res" | xxd -p -r
}
# pkt_subtitle(msg)
function pkt_subtitle() {
local txt
txt='{"text":"'"$1"'"}'
res="$(str_len "$txt")$(echo -n "$txt" | xxd -p)"
echo -n "$(hexpacket_len "$res")58$res" | xxd -p -r
}
# pkt_disconnect(reason)
function pkt_disconnect() {
txt='{"text":"'"$1"'"}'