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.4.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.4-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: minescript-1.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 db080581e3d9298b0e1dd3348bcaae89c6cf63f0a0d04e5e7cede4f151b7d168
MD5 57f2722d19a3fa3741e2ec2abd786ca4
BLAKE2b-256 23be7a141ae5dd6361078e31f0a855e156330c536875d29284b726b905dc2bd6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: minescript-1.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ca31ae13aaa7beaff914c7d7ba161b6c44a651189cf2764c8e6af7799c3f541e
MD5 d8a296d45f4fcf6818a9d5af1eaa5e77
BLAKE2b-256 ee8d5d0281e6699787c872e6b918d1c76fe2c963aa6854591a96ca69a0fe5307

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