Compare commits
2 Commits
@@ -18,7 +18,7 @@ jobs:
|
|||||||
xmake repo -u
|
xmake repo -u
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
xmake f -a x64 -m release -p windows -v -y
|
xmake f -a x64 -m release -p windows -y
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
xmake -w -y
|
xmake -w -y
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ jobs:
|
|||||||
xmake repo -u
|
xmake repo -u
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
xmake f -a x64 -m release -p windows -v -y
|
xmake f -a x64 -m release -p windows -y
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
xmake -w -y
|
xmake -w -y
|
||||||
|
|||||||
+4
-3
@@ -326,7 +326,7 @@ const GMLIB_API = {
|
|||||||
getItemCategoryName: ll.imports("GMLIB_API", "getItemCategoryName"),
|
getItemCategoryName: ll.imports("GMLIB_API", "getItemCategoryName"),
|
||||||
/** 获取物品的命名 @type {function(Item):string} */
|
/** 获取物品的命名 @type {function(Item):string} */
|
||||||
getItemCustomName: ll.imports("GMLIB_API", "getItemCustomName"),
|
getItemCustomName: ll.imports("GMLIB_API", "getItemCustomName"),
|
||||||
/** 获取物品BUFF效果名称 @type {function(Item):string} */
|
/** 获取物品BUFF效果名称 @type {function(Item,boolean):string} */
|
||||||
getItemEffecName: ll.imports("GMLIB_API", "getItemEffecName"),
|
getItemEffecName: ll.imports("GMLIB_API", "getItemEffecName"),
|
||||||
/** 物品是否为食物 @type {function(Item):boolean} */
|
/** 物品是否为食物 @type {function(Item):boolean} */
|
||||||
itemIsFood: ll.imports("GMLIB_API", "itemIsFood"),
|
itemIsFood: ll.imports("GMLIB_API", "itemIsFood"),
|
||||||
@@ -3001,10 +3001,11 @@ LLSE_Item.prototype.getCustomName =
|
|||||||
LLSE_Item.prototype.getEffecName =
|
LLSE_Item.prototype.getEffecName =
|
||||||
/**
|
/**
|
||||||
* 获取物品的BUFF效果名称
|
* 获取物品的BUFF效果名称
|
||||||
|
* @param {boolean} playerIsCreative 玩家是否为创造模式
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function () {
|
function (playerIsCreative = false) {
|
||||||
return GMLIB_API.getItemEffecName(this);
|
return GMLIB_API.getItemEffecName(this, playerIsCreative);
|
||||||
};
|
};
|
||||||
|
|
||||||
LLSE_Item.prototype.isFood =
|
LLSE_Item.prototype.isFood =
|
||||||
|
|||||||
@@ -441,7 +441,30 @@ void Export_Compatibility_API() {
|
|||||||
return ll::service::getLevel()->fetchEntity(parseScriptUniqueID(uniqueId), false);
|
return ll::service::getLevel()->fetchEntity(parseScriptUniqueID(uniqueId), false);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getWorldSpawn", []() -> std::pair<BlockPos, int> {
|
RemoteCall::exportAs("GMLIB_API", "getWorldSpawn", []() -> std::pair<BlockPos, int> {
|
||||||
return {GMLevel::getInstance()->getLevelData().getSpawnPos(), 0};
|
constexpr static HashedString SPAWN_POS{"spawnPos"};
|
||||||
|
using mUnkfc867e = std::variant<
|
||||||
|
int,
|
||||||
|
bool,
|
||||||
|
float,
|
||||||
|
std::string,
|
||||||
|
GeneratorType,
|
||||||
|
GameType,
|
||||||
|
BlockPos,
|
||||||
|
LevelSeed64,
|
||||||
|
LevelDataValue::Tag,
|
||||||
|
DaylightCycle>;
|
||||||
|
auto& levelData = GMLevel::getInstance()->getLevelData();
|
||||||
|
if (auto it = levelData.mValues->find(SPAWN_POS); it != levelData.mValues->end()) {
|
||||||
|
if (auto value = std::get_if<BlockPos>(&it->second.mUnkfc867e.as<mUnkfc867e>()); value) {
|
||||||
|
return {*value, 0};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (auto it = levelData.mOverrides->find(SPAWN_POS); it != levelData.mOverrides->end()) {
|
||||||
|
if (auto value = std::get_if<BlockPos>(&it->second.mUnkfc867e.as<mUnkfc867e>()); value) {
|
||||||
|
return {*value, 0};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {BlockPos::ZERO(), 1};
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "setWorldSpawn", [](std::pair<BlockPos, int> pos) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "setWorldSpawn", [](std::pair<BlockPos, int> pos) -> bool {
|
||||||
if (pos.second != 0) return false;
|
if (pos.second != 0) return false;
|
||||||
@@ -628,21 +651,21 @@ void Export_Compatibility_API() {
|
|||||||
result.push_back({
|
result.push_back({
|
||||||
{"Name", gameRule.mName },
|
{"Name", gameRule.mName },
|
||||||
{"Type", "Bool" },
|
{"Type", "Bool" },
|
||||||
{"Value", std::to_string(gameRule.mValue->boolVal)}
|
{"Value", std::to_string(std::get<bool>(*gameRule.mValue))}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case GameRule::Type::Float:
|
case GameRule::Type::Float:
|
||||||
result.push_back({
|
result.push_back({
|
||||||
{"Name", gameRule.mName },
|
{"Name", gameRule.mName },
|
||||||
{"Type", "Float" },
|
{"Type", "Float" },
|
||||||
{"Value", std::to_string(gameRule.mValue->floatVal)}
|
{"Value", std::to_string(std::get<float>(*gameRule.mValue))}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case GameRule::Type::Int:
|
case GameRule::Type::Int:
|
||||||
result.push_back({
|
result.push_back({
|
||||||
{"Name", gameRule.mName },
|
{"Name", gameRule.mName },
|
||||||
{"Type", "Int" },
|
{"Type", "Int" },
|
||||||
{"Value", std::to_string(gameRule.mValue->intVal)}
|
{"Value", std::to_string(std::get<int>(*gameRule.mValue))}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case GameRule::Type::Invalid:
|
case GameRule::Type::Invalid:
|
||||||
@@ -670,7 +693,7 @@ void Export_Compatibility_API() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLIB_API", "removeEnchants", [](ItemStack* item) -> void { item->removeEnchants(); });
|
RemoteCall::exportAs("GMLIB_API", "removeEnchants", [](ItemStack* item) -> void { (void)item->removeEnchants(); });
|
||||||
RemoteCall::exportAs("GMLIB_API", "hasEnchant", [](ItemStack* item, std::string const& typeName) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "hasEnchant", [](ItemStack* item, std::string const& typeName) -> bool {
|
||||||
return EnchantUtils::hasEnchant(Enchant::mEnchantNameToType()[HashedString(typeName)], *item);
|
return EnchantUtils::hasEnchant(Enchant::mEnchantNameToType()[HashedString(typeName)], *item);
|
||||||
});
|
});
|
||||||
@@ -791,9 +814,9 @@ void Export_Compatibility_API() {
|
|||||||
RemoteCall::exportAs("GMLIB_API", "getItemCustomName", [](ItemStack const* item) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getItemCustomName", [](ItemStack const* item) -> std::string {
|
||||||
return item->getCustomName();
|
return item->getCustomName();
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getItemEffecName", [](ItemStack const* item) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getItemEffecName", [](ItemStack const* item, bool playerIsCreative) -> std::string {
|
||||||
if (auto item2 = item->mItem) {
|
if (auto item2 = item->mItem) {
|
||||||
return item2->buildEffectDescriptionName(*item);
|
return item2->buildEffectDescriptionName(*item, playerIsCreative);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
});
|
});
|
||||||
@@ -968,7 +991,10 @@ void Export_Compatibility_API() {
|
|||||||
return entity->isType((ActorType)type);
|
return entity->isType((ActorType)type);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "entityHasType", [](Actor* entity, int type) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "entityHasType", [](Actor* entity, int type) -> bool {
|
||||||
return entity->hasType((ActorType)type);
|
if (auto component = entity->mEntityContext->tryGetComponent<ActorTypeComponent>(); component) {
|
||||||
|
return (type & std::to_underlying(component->mType)) == type;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getEntityTypeId", [](Actor* entity) -> int {
|
RemoteCall::exportAs("GMLIB_API", "getEntityTypeId", [](Actor* entity) -> int {
|
||||||
return (int)entity->getEntityTypeId();
|
return (int)entity->getEntityTypeId();
|
||||||
|
|||||||
+4
-1
@@ -3,6 +3,9 @@
|
|||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4996)
|
#pragma warning(disable : 4996)
|
||||||
#pragma include_alias("mc/world/item/HumanoidArmorItem.h", "modapi/item/types/mc/HumanoidArmorItem.h")
|
#pragma include_alias("mc/world/item/HumanoidArmorItem.h", "modapi/item/types/mc/HumanoidArmorItem.h")
|
||||||
|
#pragma include_alias("mc/world/level/block/states/BuiltInBlockStateVariant.h", "mc/BuiltInBlockStateVariant.h")
|
||||||
|
#pragma include_alias("mc/world/events/EventCoordinatorPimpl.h", "mc/EventCoordinatorPimpl.h")
|
||||||
|
#pragma include_alias("mc/world/events/PlayerNotificationEvent.h", "mc/PlayerNotificationEvent.h")
|
||||||
#include <gmlib/include_ll.h>
|
#include <gmlib/include_ll.h>
|
||||||
#include <gmlib/include_lib.h>
|
#include <gmlib/include_lib.h>
|
||||||
#include <gmlib/include_mc.h>
|
#include <gmlib/include_mc.h>
|
||||||
@@ -22,7 +25,7 @@ using namespace modapi;
|
|||||||
#define PLUGIN_NAME fmt::format(fg(fmt::color::light_green), "GMLIB-LRCA")
|
#define PLUGIN_NAME fmt::format(fg(fmt::color::light_green), "GMLIB-LRCA")
|
||||||
|
|
||||||
#define LIB_VERSION_MAJOR 1
|
#define LIB_VERSION_MAJOR 1
|
||||||
#define LIB_VERSION_MINOR 0
|
#define LIB_VERSION_MINOR 6
|
||||||
#define LIB_VERSION_PATCH 0
|
#define LIB_VERSION_PATCH 0
|
||||||
#define LIB_VERSION_PRERELEASE std::nullopt
|
#define LIB_VERSION_PRERELEASE std::nullopt
|
||||||
|
|
||||||
|
|||||||
+39
-27
@@ -2,10 +2,12 @@
|
|||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
namespace PAPIRemoteCall {
|
namespace PAPIRemoteCall {
|
||||||
std::string GetValue(std::string const& from) { return PlaceholderAPI::getValue(from, std::nullopt).value_or(""); }
|
std::string GetValue(std::string const& from) {
|
||||||
|
return PlaceholderAPI::getInstance().getValue(from, std::nullopt).value_or("");
|
||||||
|
}
|
||||||
|
|
||||||
std::string GetValueWithPlayer(std::string const& key, Player* player) {
|
std::string GetValueWithPlayer(std::string const& key, Player* player) {
|
||||||
return PlaceholderAPI::getValue(key, (GMActor*)player).value_or("");
|
return PlaceholderAPI::getInstance().getValue(key, (GMActor*)player).value_or("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerPlayerPlaceholder(
|
void registerPlayerPlaceholder(
|
||||||
@@ -15,15 +17,15 @@ void registerPlayerPlaceholder(
|
|||||||
) {
|
) {
|
||||||
if (!RemoteCall::hasFunc(PluginName, FuncName)) return;
|
if (!RemoteCall::hasFunc(PluginName, FuncName)) return;
|
||||||
auto func = [=]() -> void {
|
auto func = [=]() -> void {
|
||||||
PlaceholderAPI::unregisterPlaceholder(PAPIName);
|
PlaceholderAPI::getInstance().unregisterPlaceholder(PAPIName);
|
||||||
std::weak_ptr mod = ll::mod::ModManagerRegistry::getInstance().getMod(PluginName);
|
std::weak_ptr mod = ll::mod::ModManagerRegistry::getInstance().getMod(PluginName);
|
||||||
if (mod.expired()) return;
|
if (mod.expired()) return;
|
||||||
PlaceholderAPI::registerPlaceholder(
|
PlaceholderAPI::getInstance().registerPlaceholder(
|
||||||
PAPIName,
|
PAPIName,
|
||||||
[Call = RemoteCall::importAs<std::string(Player * pl, std::unordered_map<std::string, std::string>)>(
|
[Call = RemoteCall::importAs<std::string(Player * pl, std::unordered_map<std::string, std::string>)>(
|
||||||
PluginName,
|
PluginName,
|
||||||
FuncName
|
FuncName
|
||||||
)](optional_ref<Actor> actor, ll::StringMap<std::string> const& params, auto&&...
|
)](optional_ref<Actor> actor, ll::SmallStringMap<std::string> const& params, auto&&...
|
||||||
) -> std::optional<std::string> {
|
) -> std::optional<std::string> {
|
||||||
if (actor.has_value() && ((Actor*)actor.as_ptr())->isPlayer()) {
|
if (actor.has_value() && ((Actor*)actor.as_ptr())->isPlayer()) {
|
||||||
std::unordered_map<std::string, std::string> paramMap;
|
std::unordered_map<std::string, std::string> paramMap;
|
||||||
@@ -34,6 +36,7 @@ void registerPlayerPlaceholder(
|
|||||||
}
|
}
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
},
|
},
|
||||||
|
false,
|
||||||
mod
|
mod
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -51,21 +54,22 @@ void registerServerPlaceholder(
|
|||||||
) {
|
) {
|
||||||
if (!RemoteCall::hasFunc(PluginName, FuncName)) return;
|
if (!RemoteCall::hasFunc(PluginName, FuncName)) return;
|
||||||
auto func = [=]() -> void {
|
auto func = [=]() -> void {
|
||||||
PlaceholderAPI::unregisterPlaceholder(PAPIName);
|
PlaceholderAPI::getInstance().unregisterPlaceholder(PAPIName);
|
||||||
std::weak_ptr mod = ll::mod::ModManagerRegistry::getInstance().getMod(PluginName);
|
std::weak_ptr mod = ll::mod::ModManagerRegistry::getInstance().getMod(PluginName);
|
||||||
if (mod.expired()) return;
|
if (mod.expired()) return;
|
||||||
PlaceholderAPI::registerPlaceholder(
|
PlaceholderAPI::getInstance().registerPlaceholder(
|
||||||
PAPIName,
|
PAPIName,
|
||||||
[Call = RemoteCall::importAs<std::string(std::unordered_map<std::string, std::string>)>(
|
[Call = RemoteCall::importAs<std::string(std::unordered_map<std::string, std::string>)>(
|
||||||
PluginName,
|
PluginName,
|
||||||
FuncName
|
FuncName
|
||||||
)](auto, ll::StringMap<std::string> const& params, auto&&...) -> std::optional<std::string> {
|
)](auto, ll::SmallStringMap<std::string> const& params, auto&&...) -> std::optional<std::string> {
|
||||||
std::unordered_map<std::string, std::string> paramMap;
|
std::unordered_map<std::string, std::string> paramMap;
|
||||||
for (auto& [key, val] : params) {
|
for (auto& [key, val] : params) {
|
||||||
paramMap[key] = val;
|
paramMap[key] = val;
|
||||||
}
|
}
|
||||||
return Call(paramMap);
|
return Call(paramMap);
|
||||||
},
|
},
|
||||||
|
false,
|
||||||
mod
|
mod
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -84,13 +88,14 @@ void registerStaticPlaceholder(
|
|||||||
) {
|
) {
|
||||||
if (!RemoteCall::hasFunc(PluginName, FuncName)) return;
|
if (!RemoteCall::hasFunc(PluginName, FuncName)) return;
|
||||||
auto func = [=]() -> void {
|
auto func = [=]() -> void {
|
||||||
PlaceholderAPI::unregisterPlaceholder(PAPIName);
|
PlaceholderAPI::getInstance().unregisterPlaceholder(PAPIName);
|
||||||
std::weak_ptr mod = ll::mod::ModManagerRegistry::getInstance().getMod(PluginName);
|
std::weak_ptr mod = ll::mod::ModManagerRegistry::getInstance().getMod(PluginName);
|
||||||
if (mod.expired()) return;
|
if (mod.expired()) return;
|
||||||
PlaceholderAPI::registerPlaceholder(
|
PlaceholderAPI::getInstance().registerPlaceholder(
|
||||||
PAPIName,
|
PAPIName,
|
||||||
[Call = RemoteCall::importAs<std::string()>(PluginName, FuncName)](auto&&...)
|
[Call = RemoteCall::importAs<std::string()>(PluginName, FuncName)](auto&&...
|
||||||
-> std::optional<std::string> { return Call(); },
|
) -> std::optional<std::string> { return Call(); },
|
||||||
|
false,
|
||||||
mod
|
mod
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -102,16 +107,18 @@ void registerStaticPlaceholder(
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string translateStringWithPlayer(std::string const& str, Player* pl) {
|
std::string translateStringWithPlayer(std::string const& str, Player* pl) {
|
||||||
return PlaceholderAPI::translate(str, (GMActor*)pl);
|
return PlaceholderAPI::getInstance().translate(str, (GMActor*)pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string translateString(std::string const& str) { return PlaceholderAPI::translate(str, std::nullopt); }
|
std::string translateString(std::string const& str) {
|
||||||
|
return PlaceholderAPI::getInstance().translate(str, std::nullopt);
|
||||||
|
}
|
||||||
|
|
||||||
bool unRegisterPlaceholder(std::string const& str) { return PlaceholderAPI::unregisterPlaceholder(str); }
|
bool unRegisterPlaceholder(std::string const& str) { return PlaceholderAPI::getInstance().unregisterPlaceholder(str); }
|
||||||
|
|
||||||
std::vector<std::string> getAllPAPI() {
|
std::vector<std::string> getAllPAPI() {
|
||||||
std::vector<std::string> result;
|
std::vector<std::string> result;
|
||||||
for (auto& papi : PlaceholderAPI::getAllPlaceholderData()) {
|
for (auto& papi : PlaceholderAPI::getInstance().getAllPlaceholderData()) {
|
||||||
result.push_back(papi.first);
|
result.push_back(papi.first);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -121,23 +128,23 @@ std::vector<std::string> getAllPAPI() {
|
|||||||
|
|
||||||
namespace NewPapiRemoteCall {
|
namespace NewPapiRemoteCall {
|
||||||
std::string translate(std::string const& value, std::string const& language) {
|
std::string translate(std::string const& value, std::string const& language) {
|
||||||
return PlaceholderAPI::translate(value, std::nullopt, language);
|
return PlaceholderAPI::getInstance().translate(value, std::nullopt, language);
|
||||||
}
|
}
|
||||||
std::string translateFromActor(std::string const& value, Actor* actor, std::string const& language) {
|
std::string translateFromActor(std::string const& value, Actor* actor, std::string const& language) {
|
||||||
return PlaceholderAPI::translate(value, (GMActor*)actor, language);
|
return PlaceholderAPI::getInstance().translate(value, (GMActor*)actor, language);
|
||||||
}
|
}
|
||||||
void registerPlaceholder(std::string const& placeholder, std::string const& funcName, std::string const& pluginName) {
|
void registerPlaceholder(std::string const& placeholder, std::string const& funcName, std::string const& pluginName) {
|
||||||
if (!RemoteCall::hasFunc(pluginName, funcName)) return;
|
if (!RemoteCall::hasFunc(pluginName, funcName)) return;
|
||||||
auto func = [=]() -> void {
|
auto func = [=]() -> void {
|
||||||
if (std::weak_ptr mod = ll::mod::ModManagerRegistry::getInstance().getMod(pluginName); !mod.expired()) {
|
if (std::weak_ptr mod = ll::mod::ModManagerRegistry::getInstance().getMod(pluginName); !mod.expired()) {
|
||||||
PlaceholderAPI::unregisterPlaceholder(placeholder);
|
PlaceholderAPI::getInstance().unregisterPlaceholder(placeholder);
|
||||||
PlaceholderAPI::registerPlaceholder(
|
PlaceholderAPI::getInstance().registerPlaceholder(
|
||||||
placeholder,
|
placeholder,
|
||||||
[Call = RemoteCall::importAs<
|
[Call = RemoteCall::importAs<
|
||||||
std::string(Actor*, std::unordered_map<std::string, std::string>, std::string)>(
|
std::string(Actor*, std::unordered_map<std::string, std::string>, std::string)>(
|
||||||
pluginName,
|
pluginName,
|
||||||
funcName
|
funcName
|
||||||
)](optional_ref<Actor> actor, ll::StringMap<std::string> const& params, std::string const& language
|
)](optional_ref<Actor> actor, ll::SmallStringMap<std::string> const& params, std::string const& language
|
||||||
) -> std::optional<std::string> {
|
) -> std::optional<std::string> {
|
||||||
std::unordered_map<std::string, std::string> paramMap;
|
std::unordered_map<std::string, std::string> paramMap;
|
||||||
for (auto& [key, val] : params) {
|
for (auto& [key, val] : params) {
|
||||||
@@ -146,6 +153,7 @@ void registerPlaceholder(std::string const& placeholder, std::string const& func
|
|||||||
auto result = Call((Actor*)actor.as_ptr(), paramMap, language);
|
auto result = Call((Actor*)actor.as_ptr(), paramMap, language);
|
||||||
return result == "<std::nullopt>" ? std::nullopt : std::optional(result);
|
return result == "<std::nullopt>" ? std::nullopt : std::optional(result);
|
||||||
},
|
},
|
||||||
|
false,
|
||||||
mod
|
mod
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -157,23 +165,25 @@ void registerPlaceholder(std::string const& placeholder, std::string const& func
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool unregisterPlaceholder(std::string const& placeholder) {
|
bool unregisterPlaceholder(std::string const& placeholder) {
|
||||||
return PlaceholderAPI::unregisterPlaceholder(placeholder);
|
return PlaceholderAPI::getInstance().unregisterPlaceholder(placeholder);
|
||||||
}
|
}
|
||||||
bool unregisterPlaceholderFromModName(std::string const& pluginName) {
|
bool unregisterPlaceholderFromModName(std::string const& pluginName) {
|
||||||
std::weak_ptr plugin = ll::mod::ModManagerRegistry::getInstance().getMod(pluginName);
|
std::weak_ptr plugin = ll::mod::ModManagerRegistry::getInstance().getMod(pluginName);
|
||||||
if (plugin.expired()) return false;
|
if (plugin.expired()) return false;
|
||||||
return PlaceholderAPI::unregisterPlaceholder(plugin);
|
return PlaceholderAPI::getInstance().unregisterPlaceholder(plugin);
|
||||||
}
|
}
|
||||||
std::string getValue(
|
std::string getValue(
|
||||||
std::string const& placeholder,
|
std::string const& placeholder,
|
||||||
std::unordered_map<std::string, std::string> params,
|
std::unordered_map<std::string, std::string> params,
|
||||||
std::string const& language
|
std::string const& language
|
||||||
) {
|
) {
|
||||||
ll::StringMap<std::string> paramMap;
|
ll::SmallStringMap<std::string> paramMap;
|
||||||
for (auto& [key, val] : params) {
|
for (auto& [key, val] : params) {
|
||||||
paramMap[key] = val;
|
paramMap[key] = val;
|
||||||
}
|
}
|
||||||
return PlaceholderAPI::getValue(placeholder, std::nullopt, paramMap, language).value_or("<std::nullopt>");
|
return PlaceholderAPI::getInstance()
|
||||||
|
.getValue(placeholder, std::nullopt, paramMap, language)
|
||||||
|
.value_or("<std::nullopt>");
|
||||||
}
|
}
|
||||||
std::string getValueFromActor(
|
std::string getValueFromActor(
|
||||||
std::string const& placeholder,
|
std::string const& placeholder,
|
||||||
@@ -181,11 +191,13 @@ std::string getValueFromActor(
|
|||||||
std::unordered_map<std::string, std::string> params,
|
std::unordered_map<std::string, std::string> params,
|
||||||
std::string const& language
|
std::string const& language
|
||||||
) {
|
) {
|
||||||
ll::StringMap<std::string> paramMap;
|
ll::SmallStringMap<std::string> paramMap;
|
||||||
for (auto& [key, val] : params) {
|
for (auto& [key, val] : params) {
|
||||||
paramMap[key] = val;
|
paramMap[key] = val;
|
||||||
}
|
}
|
||||||
return PlaceholderAPI::getValue(placeholder, (GMActor*)actor, paramMap, language).value_or("<std::nullopt>");
|
return PlaceholderAPI::getInstance()
|
||||||
|
.getValue(placeholder, (GMActor*)actor, paramMap, language)
|
||||||
|
.value_or("<std::nullopt>");
|
||||||
}
|
}
|
||||||
} // namespace NewPapiRemoteCall
|
} // namespace NewPapiRemoteCall
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "mc/_HeaderOutputPredefine.h"
|
||||||
|
#include "mc/world/level/block/states/BlockStateVariant.h"
|
||||||
|
|
||||||
|
template <typename T0>
|
||||||
|
class BuiltInBlockStateVariant : public ::BlockStateVariant<T0> {
|
||||||
|
public:
|
||||||
|
// virtual functions
|
||||||
|
// NOLINTBEGIN
|
||||||
|
// vIndex: 0
|
||||||
|
virtual ~BuiltInBlockStateVariant() /*override*/ = default;
|
||||||
|
// NOLINTEND
|
||||||
|
};
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "mc/_HeaderOutputPredefine.h"
|
||||||
|
#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
|
||||||
|
#include "mc/world/events/EventResult.h"
|
||||||
|
|
||||||
|
template <class T0>
|
||||||
|
class EventCoordinatorPimpl : Bedrock::EnableNonOwnerReferences {
|
||||||
|
public:
|
||||||
|
using EventFuncPtr = std::function<EventResult(T0&)>;
|
||||||
|
|
||||||
|
std::vector<T0*> mListeners;
|
||||||
|
std::vector<EventFuncPtr> mEventsToProcess;
|
||||||
|
std::vector<T0*> mPendingRegistrations;
|
||||||
|
bool mHasPendingRegistrations;
|
||||||
|
std::thread::id mThreadId;
|
||||||
|
bool mThreadIdInitialized;
|
||||||
|
uint mThreadCheckIndex;
|
||||||
|
|
||||||
|
// // ServerInstanceEventListener
|
||||||
|
// virtual ~EventCoordinatorPimpl();
|
||||||
|
|
||||||
|
// // ServerInstanceEventListener
|
||||||
|
// MCAPI bool registerListener(gsl::not_null<T0*>);
|
||||||
|
|
||||||
|
// // ScriptingEventListener
|
||||||
|
// MCAPI void processEvent(EventFuncPtr);
|
||||||
|
|
||||||
|
// // ActorEventListener
|
||||||
|
// MCAPI void unregisterListener(gsl::not_null<T0*>);
|
||||||
|
};
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "mc/_HeaderOutputPredefine.h"
|
||||||
|
#include "mc/world/events/PlayerAddEvent.h"
|
||||||
|
#include "mc/world/events/PlayerAddExpEvent.h"
|
||||||
|
#include "mc/world/events/PlayerAddLevelEvent.h"
|
||||||
|
#include "mc/world/events/PlayerArmorExchangeEvent.h"
|
||||||
|
#include "mc/world/events/PlayerDamageEvent.h"
|
||||||
|
#include "mc/world/events/PlayerDestroyBlockEvent.h"
|
||||||
|
#include "mc/world/events/PlayerDimensionChangeAfterEvent.h"
|
||||||
|
#include "mc/world/events/PlayerDimensionChangeBeforeEvent.h"
|
||||||
|
#include "mc/world/events/PlayerDisconnectEvent.h"
|
||||||
|
#include "mc/world/events/PlayerDropItemEvent.h"
|
||||||
|
#include "mc/world/events/PlayerEatFoodEvent.h"
|
||||||
|
#include "mc/world/events/PlayerEmoteEvent.h"
|
||||||
|
#include "mc/world/events/PlayerFormCloseEvent.h"
|
||||||
|
#include "mc/world/events/PlayerFormResponseEvent.h"
|
||||||
|
#include "mc/world/events/PlayerGameModeChangeEvent.h"
|
||||||
|
#include "mc/world/events/PlayerGetExperienceOrbEvent.h"
|
||||||
|
#include "mc/world/events/PlayerInitialSpawnEvent.h"
|
||||||
|
#include "mc/world/events/PlayerInputModeChangeEvent.h"
|
||||||
|
#include "mc/world/events/PlayerInputPermissionCategoryChangeEvent.h"
|
||||||
|
#include "mc/world/events/PlayerInteractEvent.h"
|
||||||
|
#include "mc/world/events/PlayerInteractWithBlockAfterEvent.h"
|
||||||
|
#include "mc/world/events/PlayerInteractWithBlockBeforeEvent.h"
|
||||||
|
#include "mc/world/events/PlayerInteractWithEntityAfterEvent.h"
|
||||||
|
#include "mc/world/events/PlayerInteractWithEntityBeforeEvent.h"
|
||||||
|
#include "mc/world/events/PlayerOpenContainerEvent.h"
|
||||||
|
#include "mc/world/events/PlayerRespawnEvent.h"
|
||||||
|
#include "mc/world/events/PlayerSayCommandEvent.h"
|
||||||
|
#include "mc/world/events/PlayerScriptInputEvent.h"
|
||||||
|
#include "mc/world/events/PlayerSelectedItemChangedEvent.h"
|
||||||
|
#include "mc/world/events/PlayerShootArrowEvent.h"
|
||||||
|
#include "mc/world/events/PlayerSkinLoadedClientEvent.h"
|
||||||
|
#include "mc/world/events/PlayerSleepStateChangeEvent.h"
|
||||||
|
#include "mc/world/events/PlayerStopLoadingEvent.h"
|
||||||
|
#include "mc/world/events/PlayerSwingStartEvent.h"
|
||||||
|
#include "mc/world/events/PlayerUpdateInteractionEvent.h"
|
||||||
|
#include "mc/world/events/PlayerUseNameTagEvent.h"
|
||||||
|
|
||||||
|
|
||||||
|
// auto generated inclusion list
|
||||||
|
#include "mc/world/events/EventVariantImpl.h"
|
||||||
|
|
||||||
|
// auto generated forward declare list
|
||||||
|
// clang-format off
|
||||||
|
struct PlayerAddEvent;
|
||||||
|
struct PlayerAddExpEvent;
|
||||||
|
struct PlayerAddLevelEvent;
|
||||||
|
struct PlayerArmorExchangeEvent;
|
||||||
|
struct PlayerCloseContainerEvent;
|
||||||
|
struct PlayerDamageEvent;
|
||||||
|
struct PlayerDestroyBlockEvent;
|
||||||
|
struct PlayerDimensionChangeAfterEvent;
|
||||||
|
struct PlayerDimensionChangeBeforeEvent;
|
||||||
|
struct PlayerDisconnectEvent;
|
||||||
|
struct PlayerDropItemEvent;
|
||||||
|
struct PlayerEatFoodEvent;
|
||||||
|
struct PlayerEmoteEvent;
|
||||||
|
struct PlayerFormCloseEvent;
|
||||||
|
struct PlayerFormResponseEvent;
|
||||||
|
struct PlayerGameModeChangeEvent;
|
||||||
|
struct PlayerGetExperienceOrbEvent;
|
||||||
|
struct PlayerHotbarSelectedSlotChangeEvent;
|
||||||
|
struct PlayerInitialSpawnEvent;
|
||||||
|
struct PlayerInputModeChangeEvent;
|
||||||
|
struct PlayerInputPermissionCategoryChangeEvent;
|
||||||
|
struct PlayerInteractEvent;
|
||||||
|
struct PlayerInteractWithBlockAfterEvent;
|
||||||
|
struct PlayerInteractWithBlockBeforeEvent;
|
||||||
|
struct PlayerInteractWithEntityAfterEvent;
|
||||||
|
struct PlayerInteractWithEntityBeforeEvent;
|
||||||
|
struct PlayerInventoryItemChangeEvent;
|
||||||
|
struct PlayerOpenContainerEvent;
|
||||||
|
struct PlayerRespawnEvent;
|
||||||
|
struct PlayerSayCommandEvent;
|
||||||
|
struct PlayerScriptInputEvent;
|
||||||
|
struct PlayerSelectedItemChangedEvent;
|
||||||
|
struct PlayerShootArrowEvent;
|
||||||
|
struct PlayerSkinLoadedClientEvent;
|
||||||
|
struct PlayerSleepStateChangeEvent;
|
||||||
|
struct PlayerStopLoadingEvent;
|
||||||
|
struct PlayerSwingStartEvent;
|
||||||
|
struct PlayerUpdateInteractionEvent;
|
||||||
|
struct PlayerUseNameTagEvent;
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
struct PlayerNotificationEvent : public ::EventVariantImpl<
|
||||||
|
::PlayerSkinLoadedClientEvent const,
|
||||||
|
::PlayerAddEvent const,
|
||||||
|
::PlayerAddExpEvent const,
|
||||||
|
::PlayerAddLevelEvent const,
|
||||||
|
::PlayerArmorExchangeEvent const,
|
||||||
|
::PlayerDestroyBlockEvent const,
|
||||||
|
::PlayerUseNameTagEvent const,
|
||||||
|
::PlayerDropItemEvent const,
|
||||||
|
::PlayerEatFoodEvent const,
|
||||||
|
::PlayerDamageEvent const,
|
||||||
|
::PlayerDisconnectEvent const,
|
||||||
|
::PlayerFormCloseEvent const,
|
||||||
|
::PlayerFormResponseEvent const,
|
||||||
|
::PlayerInputModeChangeEvent const,
|
||||||
|
::PlayerInitialSpawnEvent const,
|
||||||
|
::PlayerOpenContainerEvent const,
|
||||||
|
::PlayerCloseContainerEvent const,
|
||||||
|
::PlayerShootArrowEvent const,
|
||||||
|
::PlayerSwingStartEvent const,
|
||||||
|
::PlayerRespawnEvent const,
|
||||||
|
::PlayerSleepStateChangeEvent const,
|
||||||
|
::PlayerStopLoadingEvent const,
|
||||||
|
::PlayerUpdateInteractionEvent const,
|
||||||
|
::PlayerSelectedItemChangedEvent const,
|
||||||
|
::PlayerDimensionChangeBeforeEvent const,
|
||||||
|
::PlayerDimensionChangeAfterEvent const,
|
||||||
|
::PlayerInteractWithEntityAfterEvent const,
|
||||||
|
::PlayerInteractWithBlockAfterEvent const,
|
||||||
|
::PlayerEmoteEvent const,
|
||||||
|
::PlayerScriptInputEvent const,
|
||||||
|
::PlayerInventoryItemChangeEvent const,
|
||||||
|
::PlayerHotbarSelectedSlotChangeEvent const,
|
||||||
|
::PlayerInputPermissionCategoryChangeEvent const,
|
||||||
|
::PlayerSayCommandEvent const,
|
||||||
|
::PlayerGetExperienceOrbEvent const,
|
||||||
|
::PlayerInteractEvent const,
|
||||||
|
::PlayerInteractWithEntityBeforeEvent const,
|
||||||
|
::PlayerInteractWithBlockBeforeEvent const,
|
||||||
|
::PlayerGameModeChangeEvent const> {
|
||||||
|
public:
|
||||||
|
// member functions
|
||||||
|
// NOLINTBEGIN
|
||||||
|
MCAPI ~PlayerNotificationEvent();
|
||||||
|
// NOLINTEND
|
||||||
|
|
||||||
|
public:
|
||||||
|
// destructor thunk
|
||||||
|
// NOLINTBEGIN
|
||||||
|
MCAPI void $dtor();
|
||||||
|
// NOLINTEND
|
||||||
|
};
|
||||||
+5
-5
@@ -2,7 +2,7 @@
|
|||||||
"format_version": 3,
|
"format_version": 3,
|
||||||
"format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d",
|
"format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d",
|
||||||
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
|
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
|
||||||
"version": "1.5.1",
|
"version": "1.7.0",
|
||||||
"info": {
|
"info": {
|
||||||
"name": "GMLIB-LegacyRemoteCallApi",
|
"name": "GMLIB-LegacyRemoteCallApi",
|
||||||
"description": "Legacy RemoteCall API for GMLIB",
|
"description": "Legacy RemoteCall API for GMLIB",
|
||||||
@@ -19,10 +19,10 @@
|
|||||||
{
|
{
|
||||||
"platform": "win-x64",
|
"platform": "win-x64",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"github.com/LiteLDev/LeviLamina": ">=1.5.0",
|
"github.com/LiteLDev/LeviLamina": ">=1.7.0",
|
||||||
"github.com/GroupMountain/GMLIB-Release": ">=1.5.2",
|
"github.com/GroupMountain/GMLIB-Release": ">=1.7.0",
|
||||||
"github.com/GroupMountain/ModAPI-Release": ">=0.1.0",
|
"github.com/GroupMountain/ModAPI-Release": ">=0.3.0",
|
||||||
"github.com/MiracleForest/iListenAttentively-Release": ">=0.6.0"
|
"github.com/MiracleForest/iListenAttentively-Release": ">=0.10.0"
|
||||||
},
|
},
|
||||||
"assets": [
|
"assets": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ if not has_config("vs_runtime") then
|
|||||||
set_runtimes("MD")
|
set_runtimes("MD")
|
||||||
end
|
end
|
||||||
|
|
||||||
add_requires("levilamina 1.5.2", {configs = {target_type = "server"}})
|
add_requires("levilamina 1.7.1", {configs = {target_type = "server"}})
|
||||||
add_requires("legacyremotecall")
|
add_requires("legacyremotecall")
|
||||||
add_requires("levibuildscript 0.5.2")
|
add_requires("levibuildscript 0.5.2")
|
||||||
add_requires("ilistenattentively 0.8.0")
|
add_requires("ilistenattentively 0.10.0")
|
||||||
add_requires("gmlib 1.5.2")
|
add_requires("gmlib 1.7.00")
|
||||||
add_requires("modapi 0.1.1")
|
add_requires("modapi 0.3.0")
|
||||||
|
|
||||||
target("GMLIB-LegacyRemoteCallApi")
|
target("GMLIB-LegacyRemoteCallApi")
|
||||||
add_cxflags(
|
add_cxflags(
|
||||||
|
|||||||
Reference in New Issue
Block a user