feat: add getBlockTranslateKeyFromName
This commit is contained in:
+6
-1
@@ -126,7 +126,8 @@ const GMLIB_API = {
|
|||||||
blockIsAlwaysDestroyable: ll.import("GMLIB_API", "blockIsAlwaysDestroyable"),
|
blockIsAlwaysDestroyable: ll.import("GMLIB_API", "blockIsAlwaysDestroyable"),
|
||||||
blockPlayerWillDestroy: ll.import("GMLIB_API", "blockPlayerWillDestroy"),
|
blockPlayerWillDestroy: ll.import("GMLIB_API", "blockPlayerWillDestroy"),
|
||||||
playerAttack: ll.import("GMLIB_API", "playerAttack"),
|
playerAttack: ll.import("GMLIB_API", "playerAttack"),
|
||||||
playerPullInEntity: ll.import("GMLIB_API", "playerPullInEntity")
|
playerPullInEntity: ll.import("GMLIB_API", "playerPullInEntity"),
|
||||||
|
getBlockTranslateKeyFromName: ll.import("GMLIB_API", "getBlockTranslateKeyFromName")
|
||||||
}
|
}
|
||||||
|
|
||||||
const FloatingTextList = [];
|
const FloatingTextList = [];
|
||||||
@@ -451,6 +452,10 @@ 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 getBlockTranslateKeyFromName(name) {
|
||||||
|
return GMLIB_API.getBlockTranslateKeyFromName(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Recipes {
|
class Recipes {
|
||||||
|
|||||||
@@ -671,4 +671,10 @@ void Export_Compatibility_API() {
|
|||||||
RemoteCall::exportAs("GMLIB_API", "playerPullInEntity", [](Player* player, Actor* entity) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "playerPullInEntity", [](Player* player, Actor* entity) -> bool {
|
||||||
return player->pullInEntity(*entity);
|
return player->pullInEntity(*entity);
|
||||||
});
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "getBlockTranslateKeyFromName", [](std::string const& blockName) -> std::string {
|
||||||
|
if (auto block = Block::tryGetFromRegistry(blockName)) {
|
||||||
|
return block->buildDescriptionId();
|
||||||
|
}
|
||||||
|
return blockName;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user