增加3个接口
- getPlayerRuntimeId - getEntityRuntimeId - getEntityNameTag
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "mc/deps/core/string/HashedString.h"
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
bool isInteger(const std::string& str) {
|
bool isInteger(const std::string& str) {
|
||||||
@@ -732,7 +731,7 @@ void Export_Compatibility_API() {
|
|||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getEnchantTypeNameFromId", [](int id) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getEnchantTypeNameFromId", [](int id) -> std::string {
|
||||||
if (auto enchant = Enchant::getEnchant((Enchant::Type)id)) {
|
if (auto enchant = Enchant::getEnchant((Enchant::Type)id)) {
|
||||||
return enchant->getStringId();
|
return std::string(enchant->getStringId());
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
});
|
});
|
||||||
@@ -772,4 +771,13 @@ void Export_Compatibility_API() {
|
|||||||
"dropPlayerItem",
|
"dropPlayerItem",
|
||||||
[](Player* player, ItemStack const* item, bool randomly) -> bool { return player->drop(*item, randomly); }
|
[](Player* player, ItemStack const* item, bool randomly) -> bool { return player->drop(*item, randomly); }
|
||||||
);
|
);
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "getPlayerRuntimeId", [](Player* player) -> uint64 {
|
||||||
|
return player->getRuntimeID().id;
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "getEntityRuntimeId", [](Actor* entity) -> uint64 {
|
||||||
|
return entity->getRuntimeID().id;
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "getEntityNameTag", [](Actor* entity) -> std::string {
|
||||||
|
return entity->getNameTag();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "mc/world/ActorUniqueID.h"
|
|
||||||
using namespace ll::hash_utils;
|
using namespace ll::hash_utils;
|
||||||
|
|
||||||
void Export_Event_API() {
|
void Export_Event_API() {
|
||||||
|
|||||||
Reference in New Issue
Block a user