Start Minecraft with the Minescript mod installed. This will automatically create a minescript folder within the Minecraft folder. Create a file named example.py in the minescript folder with the following contents:
from minescript import (echo, execute, getblock, player)
import sys
# Get the player's position, rounded to the nearest integer:
x, y, z = [round(p) for p in player().position]
# Get the type of block directly beneath the player:
block_type = getblock(x, y - 1, z)
block_type = block_type.replace("minecraft:", "").split("[")[0]
sign_text = (
"""{Text1:'{"text":"%s"}',Text2:'{"text":"at"}',Text3:'{"text":"%d %d %d"}'}""" %
(block_type, x, y - 1, z))
# Script argument, passed from Minecraft like "example 5"
rotation = int(sys.argv[1]) if len(sys.argv) > 1 else 0
if rotation < 0 or rotation > 15:
raise ValueError(f"Param not an integer between 0 and 15: {rotation}")
# Create a sign then set text on it:
execute(f"/setblock {x} {y} {z} minecraft:birch_sign[rotation={rotation}]")
execute(f"/data merge block {x} {y} {z} {sign_text}")
# Write a message to the chat that
echo(f"Created sign at {x} {y} {z} over {block_type}")
Save your changes to example.py. Unlike regular Minecraft commands that start with a slash (“/”), Minescript commands start with a backslash (“”). From within Minecraft bring up the in-game chat console and type the following then press enter:
example 5
This should create a sign at your player’s location with the position and type of block beneath it printed on the sign, with a rotation of 5 (the rotation can be an integer from 0 to 15).