feat: add some methods to block

This commit is contained in:
Kobe Bryant
2024-05-29 09:07:47 +08:00
committed by GitHub
Unverified
2 changed files with 45 additions and 1 deletions
+26 -1
View File
@@ -117,7 +117,12 @@ const GMLIB_API = {
readNbtFromFile: ll.import("GMLIB_API", "readNbtFromFile"),
saveNbtToFile: ll.import("GMLIB_API", "saveNbtToFile"),
getBlockDestroySpeed: ll.import("GMLIB_API", "getBlockDestroySpeed"),
getDestroyBlockSpeed: ll.import("GMLIB_API", "getDestroyBlockSpeed")
getDestroyBlockSpeed: ll.import("GMLIB_API", "getDestroyBlockSpeed"),
playerDestroyBlock: ll.import("GMLIB_API", "playerDestroyBlock"),
itemCanDestroyBlock: ll.import("GMLIB_API", "itemCanDestroyBlock"),
itemCanDestroyInCreative: ll.import("GMLIB_API", "itemCanDestroyInCreative"),
itemCanDestroySpecial: ll.import("GMLIB_API", "itemCanDestroySpecial"),
blockCanDropWithAnyTool: ll.import("GMLIB_API", "blockCanDropWithAnyTool")
}
const mStaticFloatingTextMap = new Map();
@@ -960,6 +965,26 @@ LLSE_Item.prototype.getDestroyBlockSpeed = function (block) {
return GMLIB_API.getDestroyBlockSpeed(this, block);
}
LLSE_Block.prototype.playerDestroy = function (player) {
GMLIB_API.playerDestroyBlock(this, this.pos, player);
}
LLSE_Item.prototype.canDestroy = function (block) {
return GMLIB_API.itemCanDestroyBlock(this, block);
}
LLSE_Item.prototype.canDestroyInCreative = function () {
return GMLIB_API.itemCanDestroyInCreative(this);
}
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,