Update: subsequent updates will be available on https://github.com/commandblock2/minecraft-LBNG-types
and the generated script was reverted to a state where it was not as readable as the following example (for correctness) but still largely remained the same.
Now it can kinda generate a working script, but the ts file has a few squiggles.
[image: 1738243517052-e3e18814-1645-4bd5-8244-7b8f44663aff-image.png]
template.ts
// imports
import {
Setting,
Vec3i,
Vec3d,
MathHelper,
BlockPos,
Hand,
RotationAxis,
mc,
Client,
RotationUtil,
ItemUtil,
NetworkUtil,
InteractionUtil,
BlockUtil,
MovementUtil,
ReflectionUtil,
ParameterValidator,
UnsafeThread,
registerScript
} from "@embedded";
import { ScriptModule } from "@minecraft-yarn-definitions/types/net/ccbluex/liquidbounce/script/bindings/features/ScriptModule";
import { Matrix2d } from "@minecraft-yarn-definitions/types/org/joml/Matrix2d";
const script = registerScript.apply({
name: "template",
version: "1.0.0",
authors: ["commandblock2"]
});
script.registerModule({
// @ts-ignore
name: "example-from-template",
// @ts-ignore
description: "Ths is an example module generated in ts",
// @ts-ignore
category: "Client"
}, (mod: ScriptModule) => {
mod.on("enable", () => {
Client.displayChatMessage(`${mc.player}`)
Client.displayChatMessage(`${new Vec3i(1, 2, 3)}`)
Client.displayChatMessage(`${new Matrix2d(1.2, 1.3, 1.4, 15)}`)
Client.displayChatMessage("enabled")
})
mod.on("disable", () => Client.displayChatMessage("disabled"))
})
compiled template.js
function __require(path) {
if (path.startsWith("@embedded")) {
return {
_embedded: globalThis
}
}
if (path.startsWith("@minecraft-yarn-definitions/types/")) {
return {
[path.substring(path.lastIndexOf("/") + 1)]: Java.type(path
.replaceAll("@minecraft-yarn-definitions/types/", "")
.replaceAll("/", ".")
)
}
}
return require(path);
}
var exports = {}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const { _embedded } = __require("@embedded");
const { Matrix2d } = __require("@minecraft-yarn-definitions/types/org/joml/Matrix2d");
const script = _embedded.registerScript.apply({
name: "template",
version: "1.0.0",
authors: ["commandblock2"]
});
script.registerModule({
// @ts-ignore
name: "example-from-template",
// @ts-ignore
description: "Ths is an example module generated in ts",
// @ts-ignore
category: "Client"
}, (mod) => {
mod.on("enable", () => {
_embedded.Client.displayChatMessage(`${_embedded.mc.player}`);
_embedded.Client.displayChatMessage(`${new Vec3i(1, 2, 3)}`);
_embedded.Client.displayChatMessage(`${new Matrix2d(1.2, 1.3, 1.4, 15)}`);
_embedded.Client.displayChatMessage("enabled");
});
mod.on("disable", () => _embedded.Client.displayChatMessage("disabled"));
});
[image: 1738243717904-1cb70c51-cc7f-4a90-a122-eff6ab0ad68f-image.png]