Skip to content

Instantly share code, notes, and snippets.

@home-gihub
Last active April 18, 2025 20:04
generates blocks from text and uses commands to put them into classicube
import os
import pyautogui
import time
# txtblockgen
# generates blocks from text and uses commands to put them into classicube
# BEFORE RUNNING THIS SCRIPT:
# run: pip install pyautogui
# in the terminal
if __name__ == '__main__':
print("--- txtblockgen ---")
print("--- input ---")
lookup = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.!/?"
base = 484
space = 45
text = input("what text?: ").upper()
pointing = input("what direction? (x,y,z,-x,-y or -z):")
blocks = []
cmds = []
offset = "0 0 0"
if pointing == 'x':
offset = "~1 ~ ~"
elif pointing == 'y':
offset = "~ ~1 ~"
elif pointing == 'z':
offset = "~ ~ ~1"
elif pointing == '-x':
offset = "~-1 ~ ~"
elif pointing == '-y':
offset = "~ ~-1 ~"
elif pointing == '-z':
offset = "~ ~ ~-1"
else:
print("That is not in the list.")
exit(1)
for i in range(0,len(text)):
if text[i] == ' ':
blocks.append(space)
else:
if text[i] in lookup:
blocks.append(base + lookup.index(text[i]))
else:
blocks.append(base + lookup.index('?'))
for block in blocks:
cmds.append(f"/place {block}")
cmds.append(f"/tp {offset}")
print("--- input ---")
print("--- running ---")
print("Switch to classicube and position yourself where you want the text to go and then come back here and press enter.")
input()
print("SWITCH TO CLASSICUBE WINDOW, UNPAUSE AND TURN ON NOCLIP NOW!")
i=0
for i in range(0,9):
print(f"INPUT IN {10-i}")
time.sleep(1)
print("COMMANDS ARE RUNNING")
for cmd in cmds:
pyautogui.write('t'+cmd, interval=0.007)
pyautogui.press('enter')
print("--- running FINISHED ---")
print("--- txtblockgen FINISHED ---")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment