Skip to main content

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_PORT if the bridge is not using the default port 47641.

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-placement bridge methods, the package now provides nearby-placement helpers:

import minescript

print(minescript.litematicamethods())
print(minescript.getnearestschematicplacement(radius=24))
print(minescript.getnearbyschematicplacements(radius=48, limit=8))

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.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minescript-1.1.5.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

minescript-1.1.5-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file minescript-1.1.5.tar.gz.

File metadata

  • Download URL: minescript-1.1.5.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for minescript-1.1.5.tar.gz
Algorithm Hash digest
SHA256 886f185575b396a1a6925af76f1c214bb31be9c237a83f133514284ee642a2fa
MD5 daadb9d85b26a83a2777ba72a0fedbf3
BLAKE2b-256 58a01b60f5a375294459fb3e6caa32c3e17e6413d9ecfa403360c3f8b405645b

See more details on using hashes here.

File details

Details for the file minescript-1.1.5-py3-none-any.whl.

File metadata

  • Download URL: minescript-1.1.5-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for minescript-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3bd135c36fe3c89582949f2235594cb20e18acad95fa2ecaad40584c1221590e
MD5 ad13fc805baa0b3d80427992404cc281
BLAKE2b-256 98f7eb5a4c18712a2acad74816fcd4ad41889f024501e64e3ad1292d22b3f2c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page