导出获取方块硬度接口和或破坏方块速度接口
This commit is contained in:
+11
-1
@@ -115,7 +115,9 @@ const GMLIB_API = {
|
|||||||
getItemTranslateKey: ll.import("GMLIB_API", "getItemTranslateKey"),
|
getItemTranslateKey: ll.import("GMLIB_API", "getItemTranslateKey"),
|
||||||
getEntityTranslateKey: ll.import("GMLIB_API", "getEntityTranslateKey"),
|
getEntityTranslateKey: ll.import("GMLIB_API", "getEntityTranslateKey"),
|
||||||
readNbtFromFile: ll.import("GMLIB_API", "readNbtFromFile"),
|
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 = [];
|
const FloatingTextList = [];
|
||||||
@@ -440,6 +442,14 @@ class Minecraft {
|
|||||||
static readNbtFromFile(path, isBinary = true) {
|
static readNbtFromFile(path, isBinary = true) {
|
||||||
return GMLIB_API.readNbtFromFile(path, isBinary);
|
return GMLIB_API.readNbtFromFile(path, isBinary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getBlockDestroySpeed(block) {
|
||||||
|
return GMLIB_API.getBlockDestroySpeed(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
static getDestroyBlockSpeed(item,block) {
|
||||||
|
return GMLIB_API.getDestroyBlockSpeed(item,block);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Recipes {
|
class Recipes {
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
|
#include "RemoteCallAPI.h"
|
||||||
|
#include "mc/world/actor/Actor.h"
|
||||||
|
#include "mc/world/item/registry/ItemStack.h"
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
bool isInteger(const std::string& str) {
|
bool isInteger(const std::string& str) {
|
||||||
@@ -630,4 +633,10 @@ void Export_Compatibility_API() {
|
|||||||
return GMLIB_CompoundTag::saveToFile(path, *nbt, isBinary);
|
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);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user