Skip to content

Instantly share code, notes, and snippets.

@Artoria2e5
Created March 15, 2023 17:42
Show Gist options
  • Save Artoria2e5/deafa5c4da21bb62437820444124ef48 to your computer and use it in GitHub Desktop.
Save Artoria2e5/deafa5c4da21bb62437820444124ef48 to your computer and use it in GitHub Desktop.
Make fishingbot turn. Lol.
#!/bin/bash
# companion script to fishingbot -- automatically turn
# Use the MiniHUD mod to get the yaw and pitch values
# Yaw wraps around at -180
YAW_MIN=135
YAW_MAX=-135
YAW_STEP=5
PITCH_MIN=-1
PITCH_MAX=1
SLEEP=15
((PITCH_AVG = (PITCH_MIN + PITCH_MAX) / 2))
((PITCH_DEV = PITCH_MAX - PITCH_MIN))
if ((YAW_MAX < YAW_MIN)); then
((YAW_MAX += 360))
fi
get_random_pitch() {
echo $((PITCH_AVG + RANDOM % PITCH_DEV - PITCH_DEV / 2))
}
normalize_yaw() {
local yaw=$1
while ((yaw < -180)); do
((yaw += 360))
done
while ((yaw > 180)); do
((yaw -= 360))
done
echo $yaw
}
command_stream() {
local yaw=$YAW_MIN
echo "/look $yaw $PITCH_AVG"
while sleep $SLEEP; do
((yaw += YAW_STEP))
if ((yaw > YAW_MAX)); then
yaw=$YAW_MIN
fi
echo "/look $(normalize_yaw $yaw) $(get_random_pitch)"
done
}
touch ~/.fishbot_history
{
command_stream &
rlwrap -s 30000 -S: -f ~/.fishbot_history -H ~/.fishbot_history cat
} | java -jar fishingbot.jar -nogui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment