Last active
February 21, 2022 16:11
-
-
Save radstevee/9e5b51e9e958585645884a7087cec284 to your computer and use it in GitHub Desktop.
A MCSR resetting script for Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# MCSR Reset Script for Linux | |
# made by radsteve.sh#8033 | |
delay="0.020" # Delay between key presses | |
mcwindow=$(xdotool search --class minecraft) # Window ID from minecraft | |
mcwindowname=$(xdotool getwindowname "$mcwindow") # Window name from minecraft | |
mode="ssg" # Options: ssg and rsg | |
ssgseed="3294725893620991126" # If the seed contains a - please remove it. If not, remove line 51. | |
mcversion="1.17.1" # Your minecraft version. Used to switch windows | |
xdotool version &>/dev/null || { echo >&2 "XDOTool is not installed, please install it."; exit; } | |
xdotool windowactivate "$mcwindow" | |
wid="$(xdotool getwindowfocus)" | |
if [ "$wid" != "$mcwindow" ] | |
then | |
echo "The current window is not minecraft. This may have happened because you tabbed out at the exact moment where the script will start. If youre having issues, dm me on Discord: radsteve.sh#8033" | |
exit | |
fi | |
function leave_world () { | |
xdotool key --window "$wid" Escape; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Enter; sleep "$delay" | |
} | |
function create_world_ssg () { | |
xdotool key --window "$wid" Tab; sleep "$delay" | |
xdotool key --window "$wid" Return; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Return; sleep "$delay" | |
xdotool key --window "$wid" Tab; sleep "$delay" | |
xdotool key --window "$wid" Tab; sleep "$delay" | |
xdotool key --window "$wid" Return; sleep "$delay" | |
xdotool key --window "$wid" Return; sleep "$delay" | |
xdotool key --window "$wid" Return; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Return; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool type --window "$wid" -; sleep "$delay" | |
xdotool type --window "$wid" $ssgseed; sleep "$delay" | |
xdotool key --window "$wid" Return; | |
} | |
function create_world_rsg () { | |
xdotool key --window "$wid" Tab; sleep "$delay" | |
xdotool key --window "$wid" Return; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Return; sleep "$delay" | |
xdotool key --window "$wid" Tab; sleep "$delay" | |
xdotool key --window "$wid" Tab; sleep "$delay" | |
xdotool key --window "$wid" Return; sleep "$delay" | |
xdotool key --window "$wid" Return; sleep "$delay" | |
xdotool key --window "$wid" Return; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Return; sleep "$delay" | |
} | |
function createworldstuff () { | |
if [ "$mode" = "ssg" ] | |
then | |
create_world_ssg | |
fi | |
if [ "$mode" = "rsg" ] | |
then | |
create_world_rsg | |
fi | |
} | |
if [ "$mcwindowname" = "Minecraft* $mcversion - Singleplayer" ] | |
then | |
#if not in menu | |
if [ "$(xwd -root -silent | convert xwd:- -depth 8 -crop "1x1+1044+326" txt:- | grep -om1 '#\w\+')" != "#FCFCFC" ] | |
then | |
leave_world; sleep 0.2 | |
fi | |
#if in menu | |
if [ "$(xwd -root -silent | convert xwd:- -depth 8 -crop "1x1+1044+326" txt:- | grep -om1 '#\w\+')" = "#FCFCFC" ] | |
then | |
xdotool key --window "$wid" Shift+Tab; sleep "$delay" | |
xdotool key --window "$wid" Return; sleep 0.2 | |
fi | |
createworldstuff | |
fi | |
if [ "$mcwindowname" = "Minecraft* $mcversion" ] | |
then | |
createworldstuff | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment