forked from mirrors/kolyah35-minecraft-pe-0.6.1
- Infinite world: streamed chunk cache, multi-region storage (old chunks.dat still loads), per-chunk entity/tile entity persistence, client chunk streaming, protocol version 10, view-distance server property - LuaJIT mod host (mods/, lua/prelude.lua) with events, commands, world and player API; WorldEdit command set ported to it (mods/worldedit) - /skin command, SetSkinPacket and bundled skins - OGG music player (data/music is ignored, tools/convert-music.ps1) - package-windows.ps1 builds client and dedicated server for Windows Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
22 lines
989 B
Lua
22 lines
989 B
Lua
-- The smallest mod: greets players and adds /hello and /where.
|
|
|
|
mc.on("join", function(player)
|
|
player:say("Welcome, " .. player.name .. "! Lua mods are running on this world.")
|
|
end)
|
|
|
|
mc.command("hello", { description = "Say hello" }, function(ctx)
|
|
return "Hello, " .. ctx.player.name .. "!"
|
|
end)
|
|
|
|
mc.command("where", { description = "Show your coordinates" }, function(ctx)
|
|
local x, y, z = ctx.player:block_pos()
|
|
return string.format("You are at %d, %d, %d", x, y, z)
|
|
end)
|
|
|
|
mc.command("tp", { description = "Teleport: /tp <x> <y> <z>", usage = "/tp <x> <y> <z>", op = true }, function(ctx)
|
|
local x, y, z = tonumber(ctx.args[1]), tonumber(ctx.args[2]), tonumber(ctx.args[3])
|
|
if not (x and y and z) then return "Usage: /tp <x> <y> <z> (y = 0 puts you on the ground)" end
|
|
if y <= 0 then mc.world.ensure_loaded(x, z, 1); y = mc.world.height(math.floor(x), math.floor(z)) + 1 end
|
|
ctx.player:teleport(x + 0.5, y, z + 0.5)
|
|
return string.format("Teleported to %d, %d, %d", x, y, z)
|
|
end)
|