LiveScript
In-game JavaScript and Lua scripting for NeoForge with a built-in live code editor, hot-reload, autocomplete, and runtime event APIs.
介绍
LiveScript
LiveScript is an in-game JavaScript and Lua scripting mod for NeoForge 1.21.1.
It combines the flexibility of KubeJS with the live editing experience of ComputerCraft — but with a modern fullscreen editor directly inside Minecraft.
Security & Sandboxing
LiveScript embeds Mozilla Rhino (JavaScript) and LuaJ (Lua) as sandboxed scripting engines. Scripts cannot:
- Access the filesystem (
java.io.File,java.nio.file.*blocked) - Start subprocesses (
java.lang.Runtime,java.lang.ProcessBuilderblocked) - Use reflection (
java.lang.reflect.*blocked) - Make network requests (
java.net.*blocked)
Each script has a 5-second CPU timeout. Only server operators (permission level 2, i.e. /op) can open the editor or execute scripts. The /scripteditor command uses the same permission gate as /give or /setblock.
This is the same security model as KubeJS, GroovyScript, CraftTweaker, and ComputerCraft.
Full source code: https://github.com/GrafKakashi/livescript — verify the sandbox in JsEngine.java and LuaEngine.java.
Features
- Fullscreen in-game code editor
- JavaScript (Rhino) and Lua (LuaJ) support
- Live script execution and hot-reload
- Syntax highlighting
- Autocomplete
- Undo / Redo
- Code folding
- Find & Replace
- Runtime event APIs
- Recipe manipulation APIs
- Custom item registration via
items.jsonwith runtime textures - Tag and item utilities
- Startup scripts with priority ordering
- Built-in script console
- Sandbox and timeout protection
- CurseForge update notifications for operators
Included APIs
Events
Listen to gameplay events like:
player.join,player.leave,player.chat,player.death,player.respawn,player.dimension_changeblock.break,block.placeitem.craft,item.smelt,item.use,item.use_block,item.pickupentity.spawn,entity.death,entity.damagemob.targetexplosion.start,explosion.detonateserver.tick
Recipes
Add or remove recipes at runtime — all 5 cooking types (smelting, smoking, blasting, campfire, stonecutting) plus shaped/shapeless crafting:
“`javascript
recipe.shapedAdd({
id: ‘livescript:magic_diamond’,
pattern: [‘DDD’, ‘DND’, ‘DDD’],
key: { D: ‘minecraft:diamond’, N: ‘minecraft:nether_star’ },
result: {
item: ‘minecraft:diamond’,
name: ‘§bMagic Diamond’,
lore: [‘§7Pulsates with arcane energy’],
glow: true
}
});
recipe.removeByOutput(‘minecraft:torch’);
“`
Custom Items
Define custom items in config/livescript/items.json, drop PNG textures in config/livescript/textures/, restart server:
“`json
{
"items": {
"magic_dust": {
"display_name": "Magic Dust",
"max_stack_size": 64,
"rarity": "rare"
}
}
}
“`
Tags & Items
tag.itemsIn('minecraft:logs'), tag.itemHas(itemStack, 'minecraft:logs'), item.byId('minecraft:diamond'), and more.
Quick Start
- Install the mod (NeoForge 1.21.1)
- Start your world / server
- As operator, run
/scripteditor - Press the + button, create
example.js, write some code, click Save & Run
Links
- Source: https://github.com/GrafKakashi/livescript
- Issues: https://github.com/GrafKakashi/livescript/issues
- License: MIT
Compatibility
- Minecraft 1.21.1 only
- NeoForge 21.1+
- Works alongside KubeJS, CC: Tweaked, and other scripting mods (no classpath conflicts thanks to shaded Rhino/LuaJ)
常见问题
LiveScript 支持哪些 Minecraft 版本?
LiveScript 支持 Minecraft Java 版 1.21.1,可用的加载器:NeoForge。下载时注意选择和你游戏版本一致的文件。
LiveScript 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。
Graf_Kakashi 的其他作品
查看全部 →Sophisticated ATM Tiers
为 Sophisticated Backpacks 和 Storage 添加 Allthemodium、Vibranium 与 Unobtainium 等级,以及更大容量和对应的堆叠升级。
PrismTorch
PrismTorch adds colored torches that each stop a specific category of mobs — hostiles, animals, phantoms, guardians, the Warden and more — from spawning within a configurable radius, plus a rainbow Master Torch that blocks them all.
评论
登录后评论和评分