MLS (Minecraft Lua Scripts)
Minecraft Lua Scripts (MLS) 是一款 Forge 模组,允许你在 Minecraft 中编写和运行 Lua 脚本,而无需创建模组项目。
MLS 本质上是 Forge API 的 Lua 适配器。你无需搭建模组项目并在每次更改时重新编译,只需编写 .lua 文件,将其放入 <game_dir>/luascripts/ 文件夹中,然后在游戏内通过 /script run 执行即可。脚本在命名线程中运行,可以单独或全部停止,并通过一个直观的 API 访问游戏内容——包括世界、实体、玩家、红石、命令等。
它主要面向地图和小游戏开发。复杂的序列事件、玩家检测区域、分数追踪、多系统协调逻辑——这些仅靠命令方块难以构建甚至完全无法实现的功能,现在可以快速编写并轻松迭代。
-- 检测玩家进入区域并触发命令
local corner1 = {x = 100, y = 64, z = 100}
local corner2 = {x = 120, y = 70, z = 120}
while true do
local players = world.getPlayersInSquare(corner1, corner2)
if #players > 0 then
world.executeCommand("say Welcome to the arena!")
end
local t = os.time() + 1
while os.time() < t do end
end
无需构建工具。无需 Java。只需脚本。
如需查看 API 文档,请参阅 官网。
警告
本项目目前处于 ALPHA(测试) 阶段,可能包含错误或不完整的功能。如果遇到任何问题,请通过 GitHub 上的 Issues 标签页进行报告。
欢迎贡献!欢迎提交拉取请求或提出改进建议。
MLS (Minecraft Lua Scripts)
Minecraft Lua Scripts (MLS) is a Forge mod that lets you write and run Lua scripts in Minecraft without creating a mod.
MLS is essentially a Lua adapter for the Forge API. Instead of setting up a mod project and recompiling on every change, you write .lua files, put them in the <game_dir>/luascripts/ folder, and execute them in-game with /script run. Scripts run in named threads, can be stopped individually or all at once, and have access to the game through a straightforward API — worlds, entities, players, redstone, commands, and more.
It's primarily aimed at map and minigame development. Complex event sequences, player detection zones, score tracking, coordinated multi-system logic — things that are painful or outright impossible to build with command blocks alone become quick to write and easy to iterate on.
-- detect players entering an area and trigger a command
local corner1 = {x = 100, y = 64, z = 100}
local corner2 = {x = 120, y = 70, z = 120}
while true do
local players = world.getPlayersInSquare(corner1, corner2)
if #players > 0 then
world.executeCommand("say Welcome to the arena!")
end
local t = os.time() + 1
while os.time() < t do end
end
No build tools. No Java. Just scripts.
For API documentation, please refer to the Website.
WARNING
This project is currently in its ALPHA stage, meaning it may contain bugs or incomplete features. If you encounter any issues, please report them via the Issues tab on GitHub.
Contributions are welcome! Feel free to submit pull requests or suggest improvements.
评论 0
登录后参与评分
还没有评论,来抢沙发吧