From ade132c8b2bb0dff5e9e8cf8b2d5e019783a3dce 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: Wed, 29 May 2024 07:02:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BAcanDropWithAnyTool=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=92=8C=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99include?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/GMLIB_API-JS.js | 7 ++++++- src/CompatibilityApi.cpp | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/GMLIB_API-JS.js b/lib/GMLIB_API-JS.js index 3c410e3..5715391 100644 --- a/lib/GMLIB_API-JS.js +++ b/lib/GMLIB_API-JS.js @@ -121,7 +121,8 @@ const GMLIB_API = { playerDestroyBlock: ll.import("GMLIB_API", "playerDestroyBlock"), itemCanDestroyBlock: ll.import("GMLIB_API", "itemCanDestroyBlock"), itemCanDestroyInCreative: ll.import("GMLIB_API", "itemCanDestroyInCreative"), - itemCanDestroySpecial: ll.import("GMLIB_API", "itemCanDestroySpecial") + itemCanDestroySpecial: ll.import("GMLIB_API", "itemCanDestroySpecial"), + blockCanDropWithAnyTool: ll.import("GMLIB_API", "blockCanDropWithAnyTool") } const FloatingTextList = []; @@ -993,6 +994,10 @@ LLSE_Item.prototype.canDestroySpecial = function (block) { return GMLIB_API.itemCanDestroySpecial(this, block); } +LLSE_Block.prototype.canDropWithAnyTool = function () { + return GMLIB_API.blockCanDropWithAnyTool(this); +} + module.exports = { StaticFloatingText, DynamicFloatingText, diff --git a/src/CompatibilityApi.cpp b/src/CompatibilityApi.cpp index 95f6e82..5ea496b 100644 --- a/src/CompatibilityApi.cpp +++ b/src/CompatibilityApi.cpp @@ -1,7 +1,4 @@ #include "Global.h" -#include "mc/world/Pos.h" -#include "mc/world/level/BlockPos.h" -#include "mc/world/level/BlockSource.h" #include bool isInteger(const std::string& str) { @@ -655,4 +652,7 @@ void Export_Compatibility_API() { RemoteCall::exportAs("GMLIB_API", "itemCanDestroySpecial", [](ItemStack const* item, Block const* block) -> bool { return item->canDestroySpecial(*block); }); + RemoteCall::exportAs("GMLIB_API", "blockCanDropWithAnyTool", [](Block const* block) -> bool { + return block->canDropWithAnyTool(); + }); } \ No newline at end of file