PxIgnis

模组

· 作者 PyXiion

一个面向 Minecraft Fabric 服务器的 Lua 框架,支持即时热重载。使用为人类设计的 API,在 Lua 中定义聊天命令、事件和服务器逻辑,无需 Java/Kotlin。

0 本站下载 0 关注 更新于 3 天前

需要前置:Fabric Language Kotlin、Fabric API

最新 0.20.0 · 26.3 · Fabric

一键开服(送7天)

适用于 Fabric 服务器的 Lua 运行时,支持热重载。在 config/ignis/ 中编辑脚本,运行 /ignis reload,更改即可即时生效。

完整文档请访问 ignis.pyxiion.ru。


关于

PxIgnis 是与一个完全原版的自定义 Roguelike 服务器同步开发的。其 API 反映了该项目本身的需求。


主要功能

  • Lua 热重载运行时 — /ignis reload 可在毫秒级内重新运行脚本。命令会被重新注册到实时的 Brigadier 分发器中,无需重启服务器。
  • 命令注册 — register("cmd <name:type> [<name:type>]", handler, permission?)。内置参数类型:int、double、float、bool、text、word、player、block_pos、choice=...。Tab 补全和权限(如 admin.cmd)均包含在 API 中。
  • 事件与取消机制 — 15+ 个钩子:player_block_break、player_chat、player_attack_entity、entity_hurt、entity_death 等。返回 false 即可取消事件。
  • 区域与脚本化生物 AI — 具有进入/离开/移动/死亡事件的 spatial areas(空间区域),以及用于自定义生物 AI 的 API。
  • 协程、持久化存储、UI — mc.fetch / mc.sleep 用于顺序异步代码,player.data / mc.data / 存储后端用于持久化状态,此外还包括全息图、侧边栏以及用于自定义容器的 chestgui 库。

还有更多……


示例

1. 区域 + 异步

local arena = world:createRegion(vec(-50, 64, -50), vec(50, 80, 50))

arena:on("entity_enter", function(entity)
    if entity:isPlayer() then
        mc.broadcast(entity.name .. " entered the arena")
        
        coroutine.wrap(function()
            local res = mc.fetch("https://api.example.com/arena/log")
            if not res.ok then
                mc.broadcast("log failed: " .. res.error, true)
            end
        end)()
    end
end)

2. 生物 AI

--# nova 语法
-- 启用尾随 lambda 的酷炫自定义语法(类似于 Kotlin)
mc.registerBehaviour("zombie_chase") \{ self, mob ->
    local p = mc.players[1]
    if p then
        local pos = p.pos
        mob:navigateTo(pos.x, pos.y, pos.z, 1.0)
    end
}

mc.on("entity_spawn", function(entity)
    if entity:isMob() and entity.type == "minecraft:zombie" then
        entity:setAI("zombie_chase")
    end
end)

3. 带权限的命令

register("pay <amount:int> <target:player>", function(ctx, amount, target)
    ctx.player.data.balance = (ctx.player.data.balance or 0) - amount
    target.data.balance     = (target.data.balance or 0) + amount
    
    target:sendMessage("Received " .. amount .. " from " .. ctx.player.name)
end, "pxrp.economy")

安装与要求

  1. 安装 Fabric Loader ≥0.19.2、Fabric API ≥0.141.4+1.21.11 以及 Fabric Language Kotlin ≥1.10.8。
  2. 将 pxignis-*.jar 放入服务器的 mods/ 文件夹中。
  3. 启动服务器。首次启动时会创建 config/ignis/demo.lua。
  4. 编辑 config/ignis/ 下的脚本,然后运行 /ignis reload。

许可证

GNU Lesser General Public License v3.0

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源