Minescript 是一个平台,允许使用 Python 编程语言编写的脚本来控制和与 Minecraft 进行交互。
在使用 Minescript 之前,请查阅 使用条款。
加入 Minescript Discord 服务器 以获取公告并与 Minescript 社区互动。
查看 Minescript 文档 了解有关命令和 API 的详细信息。
下载 Python 脚本,这些脚本专为与 Minescript 配合使用而开发。
设置
-
下载并安装适用于 Fabric(需要 Fabric API)或 Forge 的 Minescript 模组。
-
如果您尚未安装 Python 3,请下载并安装:(或在 Windows 上从 Microsoft Store 获取)
-
运行已安装 Minescript 模组的 Minecraft。首次运行 Minescript 模组时,它会自动在 minecraft 文件夹内创建一个 minescript 文件夹。
-
在 minescript 文件夹中创建 Python 脚本。
-
通过在 Minecraft 游戏内的聊天栏中输入反斜杠 (""") 后跟脚本名称(不带 ".py" 扩展名),来运行 Python 脚本。
Minescript 期望 Python 安装在以下位置:
- Windows:
%userprofile%\AppData\Local\Microsoft\WindowsApps\python3.exe - Mac、Linux 等:
/usr/bin/python3
如果 Python 安装在系统中的其他位置,您可以通过更改 minescript 文件夹中的 config.txt 文件里的 python 变量来指向该位置。
示例
请参阅此 示例脚本,它展示了如何从 Python 脚本中访问玩家坐标、读取指定位置的方块,以及创建带有自定义文本的告示牌等方块。
兼容性 已在以下平台上测试:
- Fabric、Forge 和 NeoForge 加载器
- Python 3.7 至 3.10
- macOS(最高至 Sonoma)
- Linux(Pop!_OS、NixOS、Bazzite 和 SteamOS)
- Windows 10 和 11(x86)
Minescript is a platform for controlling and interacting with Minecraft using scripts written in the Python programming language.
Before using Minescript, please review the Terms of Use.
Join the Minescript Discord Server for announcements and to engage with the Minescript community.
Check out Minescript documentation for details about commands and APIs.
Download Python scripts developed for use with Minescript.
Setup
-
Download and install the Minescript mod for either Fabric (requires Fabric API) or Forge.
-
Download and install Python 3 if you don't already have it: (or from the Microsoft Store on Windows)
-
Run Minecraft with the Minescript mod installed. The first time the Minescript mod runs, it will automatically create a minescript folder inside the minecraft folder.
-
Create Python scripts in the minescript folder.
-
Run Python scripts from the Minecraft in-game chat by entering backslash ("\") followed by the script name without the ".py" extension.
Minescript expects Python to be installed at the following location:
- on Windows:
%userprofile%\AppData\Local\Microsoft\WindowsApps\python3.exe - on Mac, Linux, etc:
/usr/bin/python3
If Python is installed somewhere else on your system, you can point Minescript at it by changing the python variable in the file config.txt in the minescript folder.
Example
See this example script that demonstrates how to access the player's coordinates, read blocks at a given location, and create blocks like signs with custom text all from a Python script.
Compatibility Tested on the following platforms:
- Fabric, Forge, and NeoForge mod loaders
- Python 3.7 through 3.10
- macOS up to Sonoma
- Linux (Pop!_OS, NixOS, Bazzite, and SteamOS)
- Windows 10 and 11 (x86)
下载 Minescript
下载 Minescript
下载 Minescript
下载 Minescript
下载 Minescript
下载 Minescript
下载 Minescript
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Minescript
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Minescript
下载 Minescript
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
文档
- 有关 Pyjinn 与 Java 的集成以及 Python 语言兼容性,请参阅 minescript.net/pyjinn
- 要为 Minecraft 1.21.x 设置 Fabric 映射以用于 Python 和 Pyjinn 脚本,请参阅 minescript.net/mappings
Minescript 5.0
- 内置 Pyjinn 解释器:可直接在游戏内运行使用 Python 语法编写的
.pyj脚本(无需外部安装 Python)(eff8e22, 393d74c) - 内置基于 Pyjinn 的 REPL 解释器(
\interpreter),支持 Tab 键补全 (59a46aa) - 支持在 Pyjinn 脚本中使用
async/await和EventLoop类进行异步编程 (d680374) - 通过
serverbound_packet和clientbound_packet事件,支持在 Pyjinn 脚本中拦截和取消数据包 (77412bb) - 支持为多个渲染通道添加 Pyjinn 脚本事件 (c24f8ee, 55aa5d8)
- 新增记分板查询函数
get_scoreboard()(a574c95) - 在
world_info()中新增当前维度信息 (2211c43) - 新增
get_block_region()用于获取三维体积内的方块 (8b69e2a) - 新增
install_mappings脚本用于安装 Mojang 官方映射(游戏版本 26.x 及以上不再需要映射文件)(418afa3) - 支持通过内置
java.py在 Python 中运行嵌入式 Pyjinn 脚本 (fc2eb1b, ab6bfb5, 9bc3a71) - Pyjinn 支持 JavaScript 风格的定时器:
set_timeout()、set_interval()和remove_event_listener()(8849da8) - 支持
"world"事件,使持久化脚本在连接/断开连接时保持运行 (0c2d139) - 支持在
command_path中使用通配符 bce4a43) - 跟踪并列出子作业,使用
\jobs all命令显示它们,同时将其从默认的\jobs列表中隐藏 (fdeab5f)
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
添加区块认领和玩家组队功能,并与 Xaero's Minimap 和 World Map 集成
评论 0
登录后参与评分
还没有评论,来抢沙发吧