diff --git a/lib/GMLIB_API-JS.js b/lib/GMLIB_API-JS.js index 4596cd7..1b6df03 100644 --- a/lib/GMLIB_API-JS.js +++ b/lib/GMLIB_API-JS.js @@ -115,7 +115,9 @@ const GMLIB_API = { getItemTranslateKey: ll.import("GMLIB_API", "getItemTranslateKey"), getEntityTranslateKey: ll.import("GMLIB_API", "getEntityTranslateKey"), readNbtFromFile: ll.import("GMLIB_API", "readNbtFromFile"), - saveNbtToFile: ll.import("GMLIB_API", "saveNbtToFile") + saveNbtToFile: ll.import("GMLIB_API", "saveNbtToFile"), + getBlockDestroySpeed : ll.import("GMLIB_API","getBlockDestroySpeed"), + getDestroyBlockSpeed : ll.import("GMLIB_API","getDestroyBlockSpeed") } const FloatingTextList = []; @@ -963,6 +965,14 @@ LLSE_Item.prototype.getTranslateName = function (language) { return I18nAPI.get(this.getTranslateKey(), [], language); } +LLSE_Block.prototype.getBlockDestroySpeed = function () { + return GMLIB_API.getBlockDestroySpeed(this); +} + +LLSE_Item.prototype.getDestroyBlockSpeed = function (block) { + return GMLIB_API.getDestroyBlockSpeed(this,block); +} + module.exports = { StaticFloatingText, DynamicFloatingText, diff --git a/src/CompatibilityApi.cpp b/src/CompatibilityApi.cpp index 7eb2c3f..9ed1fe6 100644 --- a/src/CompatibilityApi.cpp +++ b/src/CompatibilityApi.cpp @@ -630,4 +630,10 @@ void Export_Compatibility_API() { return GMLIB_CompoundTag::saveToFile(path, *nbt, isBinary); } ); + RemoteCall::exportAs("GMLIB_API", "getBlockDestroySpeed", [](Block const* block) -> float { + return block->getDestroySpeed(); + }); + RemoteCall::exportAs("GMLIB_API", "getDestroyBlockSpeed", [](ItemStack const* item,Block const* block) -> float { + return item->getDestroySpeed(*block); + }); } \ No newline at end of file