导出canDropWithAnyTool接口和删除多余include

This commit is contained in:
子沐呀
2024-05-29 07:02:23 +08:00
Unverified
parent 78721df3f0
commit ade132c8b2
2 changed files with 9 additions and 4 deletions
+6 -1
View File
@@ -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,
+3 -3
View File
@@ -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 <regex>
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();
});
}