From 28be308aba6e7686743e3c54310633333674856a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E6=B2=90=E5=91=80?= <163636894+zimuya4153@users.noreply.github.com> Date: Thu, 30 May 2024 19:44:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BAisAlwaysDestroyable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/GMLIB_API-JS.js | 7 ++++++- src/CompatibilityApi.cpp | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/GMLIB_API-JS.js b/lib/GMLIB_API-JS.js index 5715391..b42d52d 100644 --- a/lib/GMLIB_API-JS.js +++ b/lib/GMLIB_API-JS.js @@ -122,7 +122,8 @@ const GMLIB_API = { itemCanDestroyBlock: ll.import("GMLIB_API", "itemCanDestroyBlock"), itemCanDestroyInCreative: ll.import("GMLIB_API", "itemCanDestroyInCreative"), itemCanDestroySpecial: ll.import("GMLIB_API", "itemCanDestroySpecial"), - blockCanDropWithAnyTool: ll.import("GMLIB_API", "blockCanDropWithAnyTool") + blockCanDropWithAnyTool: ll.import("GMLIB_API", "blockCanDropWithAnyTool"), + blockIsAlwaysDestroyable: ll.import("GMLIB_API", "blockIsAlwaysDestroyable") } const FloatingTextList = []; @@ -998,6 +999,10 @@ LLSE_Block.prototype.canDropWithAnyTool = function () { return GMLIB_API.blockCanDropWithAnyTool(this); } +LLSE_Block.prototype.isAlwaysDestroyable = function () { + return GMLIB_API.blockIsAlwaysDestroyable(this); +} + module.exports = { StaticFloatingText, DynamicFloatingText, diff --git a/src/CompatibilityApi.cpp b/src/CompatibilityApi.cpp index 5ea496b..3e1da76 100644 --- a/src/CompatibilityApi.cpp +++ b/src/CompatibilityApi.cpp @@ -655,4 +655,7 @@ void Export_Compatibility_API() { RemoteCall::exportAs("GMLIB_API", "blockCanDropWithAnyTool", [](Block const* block) -> bool { return block->canDropWithAnyTool(); }); + RemoteCall::exportAs("GMLIB_API", "blockIsAlwaysDestroyable", [](Block const* block) -> bool { + return block->getMaterial().isAlwaysDestroyable(); + }); } \ No newline at end of file