Skip to content

Instantly share code, notes, and snippets.

@aimerneige
Last active August 17, 2024 22:32
Show Gist options
  • Save aimerneige/d8083c87b043e804cc260bb606b95a9c to your computer and use it in GitHub Desktop.
Save aimerneige/d8083c87b043e804cc260bb606b95a9c to your computer and use it in GitHub Desktop.
Minecraft Auto TP / auto load your minecraft map with tp command

Minecraft Auto TP

How to use

  1. Make sure your are the administration of the minecraft server.
  2. Make sure your minecraft server runs under a tmux session.
  3. Make sure your minecraft has map mod installed.
  4. Start your server and login on your client.
  5. Change your gamemode to spectator (or creative) mode.
  6. Change PLAYER_NAME with your player name.
  7. Change TMUX_SESSION_NAME with your tmux session name.
  8. Change SLEEP_DURATION deepend on your load speed.
  9. Change VIEW_DISTANCE to match your server and client settings.
  10. Change WORLD_SIZE to set size limit.
  11. Run this script and have a cup of tea.
import os
import time
PLAYER_NAME = "Notch"
TMUX_SESSION_NAME = "minecraft"
SLEEP_DURATION = 6
CHUNK_SIZE = 16
VIEW_DISTANCE = 24
WORLD_SIZE = 4096
TP_STEP = CHUNK_SIZE * VIEW_DISTANCE
START_COORDINATE = WORLD_SIZE // 2
xz = [
(x, z)
for x in range(-START_COORDINATE, START_COORDINATE, TP_STEP)
for z in range(-START_COORDINATE, START_COORDINATE, TP_STEP)
]
total = len(xz)
for i, v in enumerate(xz):
x, z = v
mc_commands = f"/tp {PLAYER_NAME} {x} ~100 {z}"
tmux_commands = f'tmux send-keys -t {TMUX_SESSION_NAME} "{mc_commands}" Enter'
print(tmux_commands)
os.system(tmux_commands)
print(f"{i}/{total} {x}/{z} done. {SLEEP_DURATION*(total-i)//60} minute remaining")
time.sleep(SLEEP_DURATION)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment