Peripheral
使用 Python 编写 Minecraft 脚本。
编写 .py 脚本来读取实时游戏数据、控制你的玩家、构建自定义 GUI,并渲染始终显示的 HUD 覆盖层——无需触碰 Java。将脚本放入文件夹,点击运行,即可见证其运行效果。
功能说明
Peripheral 在 Minecraft 内部运行一个轻量级 HTTP 服务器(localhost:25585),并向每个脚本注入一个名为 mc 的辅助模块。脚本会在你游玩时于后台运行——读取你的生命值、发送聊天消息、在屏幕上绘图,或通过脚本移动角色。
无需额外依赖。无需手动编辑配置文件。一切均通过简洁的游戏内 GUI(按 G 键)进行管理。
特性
Python 脚本编写
- 脚本位于
config/peripheral/scripts/目录中——可使用任何文本编辑器或游戏内进行编辑 mc模块会自动注入。只需from mc import *即可开始使用- 脚本在后台运行——可同时启动多个,并独立停止它们
AI 脚本构建器
打开 Build 选项卡,输入脚本名称,描述你想要实现的功能,AI 会直接将代码写入文件。支持使用你自己的 Claude 或 OpenAI API 密钥。聊天记录会被保存,以便你可以从断点处继续;可通过将日志发回给 AI 来修复错误,并通过会话菜单管理多个脚本。
玩家控制
say() · look() · use_item() · equip() · jump() · sprint() · sneak() · move() · click_block() · attack() · drop_item()
游戏数据
state() · pos() · health() · inventory() · chat_log()
HUD 覆盖层
在游戏过程中直接在屏幕上渲染持久元素:
- Labels(标签) — 带颜色和阴影的文本
- Bars(条形图) — 进度条(生命值、耐久度、经验值等)
- Rects(矩形) — 可选边框的背景面板
- Item sprites(物品精灵) — 通过 ID 渲染任意 Minecraft 物品图标
- 可锚定到屏幕任意角落或中心——位置随分辨率缩放
自定义游戏内界面
open_gui() 可从 Python 构建真实的 Minecraft 界面——按钮、文本框、标签、滑块、复选框。在游戏中按 H 键显示/隐藏。界面打开期间,脚本会保持数据实时更新。
`
导航
goto(x, z) · nav_status()
HTTP API
mc 模块使用的每个端点也都在 localhost:25585 上对外部可用。连接浏览器仪表盘或本地工具——完全无需触碰游戏客户端。
包含的示例脚本

| 脚本 | 功能说明 |
|---|---|
hello_world.py |
显示位置、生命值、附近实体——验证一切正常工作 |
armor_hud.py |
在屏幕右侧显示垂直排列的物品图标 + 耐久度 HUD |
auto_eat.py |
饥饿值下降时自动进食 |
auto_mine.py |
控制玩家自动挖掘目标矿石 |
welcome_bot.py |
玩家加入时向其打招呼 |
follow_on_command.py |
当玩家在聊天中说“follow me”时跟随该玩家 |
custom_gui.py |
完整交互式 GUI 示例——按钮、输入框、实时更新 |
api_server.py |
启动本地 HTTP 服务器,使外部应用可读取游戏状态 |
openai_chat.py |
玩家向配置好的 AI API 提问,AI 在聊天中回答 |
server_status.py |
ping Minecraft 服务器并显示玩家数量和 MOTD |
weather_display.py |
获取真实世界天气并在游戏中显示 |
web_dashboard.py |
浏览器仪表盘——在局域网内的任意标签页查看游戏状态 |
clickable_links.py |
展示如何发送带有可点击 URL 和悬停文本的富文本消息 |
仍在开发中
此模组正在积极开发中。如果遇到任何错误、问题或有建议,请在 github.com/Sl0oth/peripheral/issues 提交 Issue。
快速入门
- 安装模组(Fabric,1.21.11 - 26.1)
- 启动 Minecraft——示例脚本和
PERIPHERAL_API.md会自动写入config/peripheral/scripts/ - 按 G 键打开 Peripheral 面板
- 点击任意示例脚本旁边的 Run 按钮
- 使用 AI 构建自己的脚本:打开 Build 选项卡,输入脚本名称并开始对话
外部连接
Peripheral 的 HTTP 服务器仅监听 localhost,且自身绝不会主动连接任何远程服务器。Build 选项卡会使用你自己的密钥向 Anthropic 或 OpenAI API 发送消息——在你主动发起之前,不会发送任何内容。部分示例脚本会向第三方 API 发起出站 HTTP 请求;这仅在你显式运行这些脚本时发生,且端点在脚本源码中清晰可见。
多人游戏
Peripheral 提供了可自动化玩家操作的工具。确保你运行的任何脚本符合你所玩服务器的规则是你的责任。 许多服务器禁止使用自动化模组。如有疑问,请在多人游戏中运行自动化脚本前咨询服务器管理员。
要求
- Minecraft 1.21.11 - 26.1
- Fabric Loader 0.18.4+
- Fabric API
仅限客户端
Peripheral 完全在客户端运行。无需安装服务端。适用于单人游戏、多人游戏和 Realms。
免责声明
本模组按“原样”提供,不提供任何担保。作者不对物品丢失、游戏进度损失、存档损坏、服务器封禁、因你编写或运行脚本造成的损害,或因将模组连接到外部服务而产生的任何后果承担责任。你对自己创建或执行的脚本负全部责任。在多人服务器上使用该模组风险自负——请务必先检查服务器规则。完整条款请参阅 github.com/Sl0oth/peripheral。
本模组的 100% 代码由 Claude Code(Anthropic 的 AI 编程助手)编写,由 Sl0oth 指导完成。
Peripheral
Script Minecraft with Python.
Write .py scripts that read live game data, control your player, build custom GUIs, and render always-on HUD overlays — all without touching Java. Drop a script in a folder, hit run, and watch it go.
What it does
Peripheral runs a lightweight HTTP server inside Minecraft (localhost:25585) and injects a helper module called mc into every script. Scripts run in the background as you play — reading your health, sending chat messages, drawing on your screen, or moving with scripts.
No extra dependencies. No config files to hand-edit. Everything is managed through a clean in-game GUI (press G).
Features
Python scripting
- Scripts live in
config/peripheral/scripts/— edit them in any text editor or in-game - The
mcmodule is injected automatically. Justfrom mc import *and go. - Scripts run in the background — start several at once, stop them independently
AI script builder
Open the Build tab, type a script name, describe what you want, and the AI writes it directly to the file. Uses your own Claude or OpenAI API key. Chat history is saved so you can pick up where you left off, fix errors by sending logs back to the AI, and manage multiple scripts from the sessions menu.
Player control
say() · look() · use_item() · equip() · jump() · sprint() · sneak() · move() · click_block() · attack() · drop_item()
Game data
state() · pos() · health() · inventory() · chat_log()
HUD overlays
Render persistent elements directly on the game screen while you play:
- Labels — text with color and shadow
- Bars — progress bars (health, durability, XP, anything)
- Rects — background panels with optional border
- Item sprites — render any Minecraft item icon by ID
- Anchored to any screen corner or center — positions scale with resolution
Custom in-game screens
open_gui() builds real Minecraft screens from Python — buttons, text fields, labels, sliders, checkboxes. Press H in-game to show/hide. Scripts keep data live while the screen is open.
`
Navigation
goto(x, z) · nav_status()
HTTP API
Every endpoint the mc module uses is also available externally on localhost:25585. Wire up a browser dashboard or a local tool — all without touching the game.
Included example scripts

| Script | What it does |
|---|---|
hello_world.py |
Shows position, health, nearby entities — verify everything works |
armor_hud.py |
Vertical item-icon + durability HUD on the right side of the screen |
auto_eat.py |
Automatically eats food when hunger drops |
auto_mine.py |
Scripts the player to mine a target ore automatically |
welcome_bot.py |
Greets players when they join |
follow_on_command.py |
Follows a player when they say "follow me" in chat |
custom_gui.py |
Full interactive GUI example — buttons, inputs, live updates |
api_server.py |
Starts a local HTTP server so external apps can read game state |
openai_chat.py |
Players whisper questions to a configured AI API, it answers in chat |
server_status.py |
Pings Minecraft servers and shows player counts and MOTD |
weather_display.py |
Fetches real-world weather and displays it in-game |
web_dashboard.py |
Browser dashboard — view game state from any tab on your local network |
clickable_links.py |
Shows how to send rich messages with clickable URLs and hover text |
Still in development
This mod is actively being worked on. If you run into any bugs, issues, or have suggestions, please open an issue at github.com/Sl0oth/peripheral/issues.
Getting started
- Install the mod (Fabric, 1.21.11 - 26.1)
- Launch Minecraft — example scripts and
PERIPHERAL_API.mdare written toconfig/peripheral/scripts/automatically - Press G to open the Peripheral panel
- Hit Run next to any example script
- To build your own with AI: open the Build tab, type a script name, and start chatting
External connections
Peripheral's HTTP server only listens on localhost and never connects to any remote server on its own. The Build tab sends messages to the Anthropic or OpenAI API using your own key — nothing is sent without you initiating it. Some example scripts make outbound HTTP requests to third-party APIs; this only happens when you explicitly run them, and the endpoints are clearly visible in the script source.
Multiplayer
Peripheral gives you tools that can automate player actions. It is your responsibility to ensure any scripts you run comply with the rules of the server you are playing on. Many servers prohibit automation mods. When in doubt, check with the server owner before running automation scripts in multiplayer.
Requirements
- Minecraft 1.21.11 - 26.1
- Fabric Loader 0.18.4+
- Fabric API
Client-side only
Peripheral runs entirely on the client. No server installation needed. Works on singleplayer, multiplayer, and Realms.
Disclaimer
This mod is provided as-is with no warranty. The author is not liable for loss of items or game progress, save file corruption, server bans, damages caused by scripts you write or run, or any consequences from connecting the mod to external services. You are solely responsible for any scripts you create or execute. Use of this mod on multiplayer servers is at your own risk — always check server rules first. Full terms at github.com/Sl0oth/peripheral.
100% of the mod code was written by Claude Code (Anthropic's AI coding assistant), directed by Sl0oth.
下载 Peripheral
下载 Peripheral
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Peripheral
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Peripheral
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Peripheral
下载 Peripheral
下载 Peripheral
下载 Peripheral
下载 Peripheral
暂无更新日志
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
添加区块认领和玩家组队功能,并与 Xaero's Minimap 和 World Map 集成
评论 0
登录后参与评分
还没有评论,来抢沙发吧