From 0cbe8e8ddf0f5c17900d3d972adaeace824c8260 Mon Sep 17 00:00:00 2001 From: Dominika Date: Mon, 14 Feb 2022 11:28:39 +0100 Subject: [PATCH] * structured more of Join Game packet --- mc.sh | 43 +++++++++++++++++++++---------------- nbt_ => src/biome_blob.nbt | Bin 23991 -> 23974 bytes src/packet.sh | 8 +++++++ 3 files changed, 33 insertions(+), 18 deletions(-) rename nbt_ => src/biome_blob.nbt (99%) diff --git a/mc.sh b/mc.sh index e75b282..da8475b 100755 --- a/mc.sh +++ b/mc.sh @@ -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 diff --git a/nbt_ b/src/biome_blob.nbt similarity index 99% rename from nbt_ rename to src/biome_blob.nbt index 87d7a55d5b5e9fbca78016db78f75880b052a661..f6449e729b5e87d93127e1072c758f3c523c7244 100644 GIT binary patch delta 10 RcmdnKn{nB0#*N&|VgVaU1eE{) delta 28 kcmZ3sn{oSYM(!=U8PymV7-Jb2nKvwpWs~4yU}Rtb0Dy%CwEzGB diff --git a/src/packet.sh b/src/packet.sh index 2c8b750..3ea1491 100644 --- a/src/packet.sh +++ b/src/packet.sh @@ -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"'"}'