Python helper module for the local Minescript Fabric bridge
Project description
MinePyScript
Installable Python package for the Minescript client bridge.
Install
py -m pip install .
Build
py -m build
Notes
- This package talks to a local Minescript Fabric bridge over HTTP.
- It requires the Minecraft mod to be installed and running.
- Set
MINESCRIPT_PORTif the bridge is not using the default port47641.
Example
import minescript
print(minescript.methods())
print(minescript.getplayerpos())
minescript.sendchat("Hello from Python")
minescript.closecurrentmenu()
Litematica Compatibility
If your installed Minescript mod exposes Litematica or schematic bridge methods, the package now provides nearby-placement helpers, schematic block helpers, verifier helpers, and direct reflection access:
import minescript
print(minescript.litematicamethods())
print(minescript.getnearestschematicplacement(radius=24))
print(minescript.getnearbyschematicplacements(radius=48, limit=8))
print(minescript.getnearestschematicblock(radius=16))
print(minescript.getnearestmissingblock())
print(minescript.getnearestwrongblock())
print(minescript.getschematicblocksonlayer())
print(minescript.raiselitematicalayer())
print(minescript.getlitematicarenderlayer())
litematicamethods() returns the related runtime bridge methods advertised by the connected mod.
The nearby helpers resolve the best matching bridge method dynamically so they can work across compatible mod versions that use slightly different RPC names.
getnearestmissingblock(), getnearestwrongblock(), and getnearestschematicmismatch() read the selected placement verifier, so they require a selected placement with verification data available in-game.
getschematicblocksonlayer() enumerates the selected placement box on the current render layer by default. If Litematica is in ALL render mode, pass an explicit layer=.
The generic bridge is also exposed directly:
import minescript
placement = minescript.getselectedschematicplacementhandle()
print(minescript.litematicainspect(handle=placement))
print(minescript.litematicacall(placement, "getName"))
minescript.litematicarelease(placement)
Use litematicahandle(handle) when you need to pass one reflected handle as an argument to another reflected call.
Timed Use Helpers
Use the timed helpers when you want to hold left or right item use for a duration:
import minescript
minescript.useitemfor(2.0)
minescript.useitemrightfor(1.5)
minescript.useitemleftfor(0.75)
useitemfor() and useitemrightfor() hold the use-item input.
useitemleftfor() holds the attack input for mining or attacking.
Menu Close Fallback
If your running Minescript mod does not expose closecurrentmenu or closemenu, minescript.closemenu() uses fallback behavior automatically:
import minescript
minescript.closemenu()
On Windows, it sends a native Esc keypress.
On other runners, the default stdout control payload is:
{"command": "close_menu"}
Set MINESCRIPT_MENU_CLOSE_COMMAND if your Java runner expects a different command name.
If you want full Python-side control, you can still register a custom fallback and route it to your own Java injection path:
import minescript
def close_menu_via_java():
minescript.emitcontrol({"command": "close_menu_via_java"})
minescript.set_menu_close_handler(close_menu_via_java)
minescript.closemenu()
emitcontrol() sends a custom control payload to the Java runner over stdout.
set_menu_close_handler() overrides the built-in fallback when the HTTP bridge does not advertise a native menu-close method.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file minescript-1.1.6.tar.gz.
File metadata
- Download URL: minescript-1.1.6.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8816e992bfaebd1cc956e3ea5598c6da4feecc25046104c665feb198ae6694ad
|
|
| MD5 |
593ad719c04425cd3dd080ffdc1ee140
|
|
| BLAKE2b-256 |
df3c68a84eec40fc4e9c1bca22216085d1b1f03d4ba25a093f87b368f2e49acc
|
File details
Details for the file minescript-1.1.6-py3-none-any.whl.
File metadata
- Download URL: minescript-1.1.6-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ffcbe646b4eeece153011f68acf6e35996ae73ca0cf58fbd21109975a24cf09
|
|
| MD5 |
6c338597f794c169ec372493fcddd883
|
|
| BLAKE2b-256 |
5984bcbb9e98a99191238dec3e5db733a09c0fd7ed514c906376bf33ed59f5bc
|