* player join now sends a bogus eid for.. reasons

meow
Dominika 2022-02-14 12:25:51 +01:00
parent 3af6c0fcdb
commit 99f3942274
2 changed files with 13 additions and 8 deletions

View File

@ -88,6 +88,9 @@ function timer() {
sleep 10
time_left=$((time_left-10))
fi
if [[ ! -a $TEMP/players/$nick ]]; then # die if disconnected
break
fi
pkt_chatmessage "§aTime left: §r${time_left}s" "00000000000000000000000000000000"
done
pkt_disconnect "Time's up! Your final score: §a$(cat $TEMP/players/$nick/score)"
@ -118,18 +121,21 @@ function score() {
}
function dig_async() {
if [[ $block == 01 ]]; then
d=0.03
else
if [[ $block == 01 || $block == 02 || $block == 03 ]]; then # stone, granite...
d=0.015
elif [[ $block == 9a8b01 || $block == 49 ]]; then # copper, coal
d=0.04
else # everything else
d=0.07
fi
for i in {1..9}; do
pkt_blockbreak $x $y $z 0$i
sleep $d
if [[ $(cat $TEMP/players/$nick/mining) != "$x,$y,$z" ]]; then
pkt_blockbreak $x $y $z ff
break
else
pkt_blockbreak $x $y $z 0$i
fi
sleep $d
done
if [[ $(cat $TEMP/players/$nick/mining) == "$x,$y,$z" ]]; then

5
mc.sh
View File

@ -4,6 +4,7 @@ dyed=0
keepalive=0
pos=(0 0 0)
players=()
time=18000
TEMP=/dev/shm/witchcraft/
mkdir -p $TEMP $TEMP/players $TEMP/world
@ -137,7 +138,7 @@ while true; do
log "$(hexpacket_len "$res")02$res"
echo -n "$(hexpacket_len "$res")02$res" | xxd -p -r
res="0000$eid" # entity id
res="0100$eid" # entity id
res+="00" # not hardcore
res+="$gamemode" # survival mode
res+="01" # ... as previously seen on Creative Mode (ignored)
@ -163,8 +164,6 @@ while true; do
#echo -n "$(hexpacket_len "$res")26$res" | xxd -p -r
#log "sent 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"