<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[JS][1.8.9][1.12.2]新手模板|避坑|排错|水影脚本编写中文教程|LiquidBounce Script]]></title><description><![CDATA[<pre><code>/// api_version=2
// 第一行三个斜杠的注释不要动，是脚本版本2的固定标识
// 下面是固定写法
var script = registerScript({
    name: "MyScript",
    version: "1.0.0",
    authors: ["My Name"]
})
// 玩家在游戏内发送消息
// mc.thePlayer.sendChatMessage()
// 让文本显示在游戏聊天框里（不会发送聊天消息）
// 支持原版颜色符号§，不支持&amp;
// Chat.print()

script.registerModule(
    {
        name: "MyModule",//模块名称
        category: "Misc", //分类 Movement, Misc, Combat, Fun, Player, Exploit, World, Render
        description: "An example module created with LiquidBounce's script API."//描述
    },
    function (module) {
        Chat.print("Module registered.")//模块已注册
        module.on(
            "enable",
            function () {
                Chat.print("Module enabled.")//模块已启用
            }
        )
        module.on(
            "disable",
            function () {
                Chat.print("Module disabled.")//模块已禁用
            }
        )
        module.on(
            "update",
            function () {
                //Minecraft游戏每秒有20 tick
                //此function每一个tick就运行一次
                //所以每秒执行20次
                //不要在这里写for、while循环，否则Windows电脑的内存会立刻升高，
                //而且会把虚拟内存也占满，电脑马上就会蓝屏，写循环要去script.registerModule的外面写，也就是和script.registerModule并列。
            }
        )
    })
// 如果要定义变量名，直接写，前面好像只能加var
// js代码会被编译成java字节码，所以如果是从网上复制的js代码，需要把let,const这些去掉
// 不然的话，游戏里不会出现你写的功能
// 如果js代码在浏览器上正常运行，不代表在这里能运行，多用Chat.print()，一步一测试
</code></pre>
<p dir="auto">参考 <a href="https://liquidbounce.net/docs/ScriptAPI/Getting%20Started" target="_blank" rel="noopener noreferrer nofollow ugc">https://liquidbounce.net/docs/ScriptAPI/Getting Started</a></p>
]]></description><link>https://forum.liquidbounce.net/topic/7446/js-1-8-9-1-12-2-新手模板-避坑-排错-水影脚本编写中文教程-liquidbounce-script</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Mar 2026 18:04:59 GMT</lastBuildDate><atom:link href="https://forum.liquidbounce.net/topic/7446.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 16 Feb 2023 12:12:16 GMT</pubDate><ttl>60</ttl></channel></rss>