From e7133938d7e6e04ae5162b6f34e218dd48fd8e30 Mon Sep 17 00:00:00 2001 From: ZXMushroom63 Date: Mon, 20 Jan 2025 23:14:25 +0800 Subject: [PATCH] add js class to java class operator --- docs/apidoc/utils.md | 5 ++++- postinit.js | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/apidoc/utils.md b/docs/apidoc/utils.md index 054469e..cead964 100644 --- a/docs/apidoc/utils.md +++ b/docs/apidoc/utils.md @@ -81,4 +81,7 @@ Methods: - `ModAPI.util.getBlockById(id: number) : Block` - Gets a block by it's ID - `ModAPI.util.getBlockFromItem(item: Item) : Block` - - Gets a block from an ItemBlock instance. \ No newline at end of file + - Gets a block from an ItemBlock instance. +- `ModAPI.util.asClass(class: Class) : Class` + - Converts a javascript class to a java class. + - Equivalent of using `MyClass.class` in java. \ No newline at end of file diff --git a/postinit.js b/postinit.js index bb3ffa6..f745446 100644 --- a/postinit.js +++ b/postinit.js @@ -166,6 +166,8 @@ globalThis.modapi_postinit = "(" + (() => { return name; } + ModAPI.util.asClass = ModAPI.util.asClass = ModAPI.hooks._teavm.$rt_cls; + ModAPI.util.wrap = function (outputValue, target, corrective, disableFunctions) { target ||= {}; corrective ||= false;