Release 0.8.0

This commit is contained in:
Caixukun1919810
2024-02-15 17:07:50 +08:00
committed by GitHub
Unverified
5 changed files with 145 additions and 37 deletions
+25 -3
View File
@@ -2,15 +2,37 @@
void Export_Compatibility_API() {
RemoteCall::exportAs("GMLIB_API", "getServerMspt", []() -> float {
return GMLIB_Level::getLevel()->getServerMspt();
auto level = GMLIB_Level::getLevel();
if (!level) {
return 0.0f;
}
return level->getServerMspt();
});
RemoteCall::exportAs("GMLIB_API", "getServerCurrentTps", []() -> float {
return GMLIB_Level::getLevel()->getServerCurrentTps();
auto level = GMLIB_Level::getLevel();
if (!level) {
return 0.0f;
}
return level->getServerCurrentTps();
});
RemoteCall::exportAs("GMLIB_API", "getServerAverageTps", []() -> float {
return GMLIB_Level::getLevel()->getServerAverageTps();
auto level = GMLIB_Level::getLevel();
if (!level) {
return 0.0f;
}
return level->getServerAverageTps();
});
RemoteCall::exportAs("GMLIB_API", "getAllPlayerUuids", []() -> std::vector<std::string> {
return GMLIB_Player::getAllUuids();
});
RemoteCall::exportAs("GMLIB_API", "getAllExperiments", []() -> std::vector<int> {
return {6, 7, 8, 9, 10, 13, 16, 17, 18};
});
RemoteCall::exportAs("GMLIB_API", "getExperimentTranslatedName", [](int id) -> std::string {
auto map = GMLIB_Level::getAllExperimentsTranslateKeys();
if (map.count(id)) {
return map[id];
}
return "";
});
}
+40
View File
@@ -23,6 +23,10 @@ void Export_Legacy_GMLib_ModAPI() {
std::string result,
int count,
std::string unlock) -> void {
auto level = GMLIB_Level::getLevel();
if (!level) {
return;
}
std::vector<RecipeIngredient> types;
for (auto ing : ingredients) {
auto key = RecipeIngredient(ing, 0, 1);
@@ -42,6 +46,10 @@ void Export_Legacy_GMLib_ModAPI() {
std::string result,
int count,
std::string unlock) -> void {
auto level = GMLIB_Level::getLevel();
if (!level) {
return;
}
std::vector<RecipeIngredient> types;
for (auto ing : ingredients) {
auto key = RecipeIngredient(ing, 0, 1);
@@ -56,6 +64,10 @@ void Export_Legacy_GMLib_ModAPI() {
"GMLib_ModAPI",
"registerFurnaceRecipe",
[](std::string recipe_id, std::string input, std::string output, std::vector<std::string> tags) -> void {
auto level = GMLIB_Level::getLevel();
if (!level) {
return;
}
auto inp = RecipeIngredient(input, 0, 1);
auto outp = RecipeIngredient(output, 0, 1);
GMLIB::Mod::CustomRecipe::registerFurnaceRecipe(recipe_id, inp, outp, tags);
@@ -65,6 +77,10 @@ void Export_Legacy_GMLib_ModAPI() {
"GMLib_ModAPI",
"registerBrewingMixRecipe",
[](std::string recipe_id, std::string input, std::string output, std::string reagent) -> void {
auto level = GMLIB_Level::getLevel();
if (!level) {
return;
}
auto rea = RecipeIngredient(reagent, 0, 1);
GMLIB::Mod::CustomRecipe::registerBrewingMixRecipe(recipe_id, input, output, rea);
}
@@ -73,6 +89,10 @@ void Export_Legacy_GMLib_ModAPI() {
"GMLib_ModAPI",
"registerBrewingContainerRecipe",
[](std::string recipe_id, std::string input, std::string output, std::string reagent) -> void {
auto level = GMLIB_Level::getLevel();
if (!level) {
return;
}
auto inp = RecipeIngredient(input, 0, 1);
auto outp = RecipeIngredient(output, 0, 1);
auto rea = RecipeIngredient(reagent, 0, 1);
@@ -87,6 +107,10 @@ void Export_Legacy_GMLib_ModAPI() {
std::string base,
std::string addition,
std::string result) -> void {
auto level = GMLIB_Level::getLevel();
if (!level) {
return;
}
GMLIB::Mod::CustomRecipe::registerSmithingTransformRecipe(
recipe_id,
smithing_template,
@@ -100,6 +124,10 @@ void Export_Legacy_GMLib_ModAPI() {
"GMLib_ModAPI",
"registerSmithingTrimRecipe",
[](std::string recipe_id, std::string smithing_template, std::string base, std::string addition) -> void {
auto level = GMLIB_Level::getLevel();
if (!level) {
return;
}
GMLIB::Mod::CustomRecipe::registerSmithingTrimRecipe(recipe_id, smithing_template, base, addition);
}
);
@@ -112,6 +140,10 @@ void Export_Legacy_GMLib_ModAPI() {
std::string output,
int output_data,
int output_count) -> void {
auto level = GMLIB_Level::getLevel();
if (!level) {
return;
}
auto inp = RecipeIngredient(input, 0, 1);
auto outp = RecipeIngredient(output, 0, 1);
GMLIB::Mod::CustomRecipe::registerStoneCutterRecipe(recipe_id, inp, outp);
@@ -130,11 +162,19 @@ void Export_Legacy_GMLib_ModAPI() {
}
});
RemoteCall::exportAs("GMLib_ModAPI", "setExperimentEnabled", [](int experiment_id, bool value) -> void {
auto level = GMLIB_Level::getLevel();
if (!level) {
return;
}
if (ExperimentsList.count(experiment_id)) {
GMLIB_Level::getLevel()->setExperimentEnabled(((AllExperiments)experiment_id), value);
} else ll::Logger("Server").error("Experiment ID '{}' does not exist!", experiment_id);
});
RemoteCall::exportAs("GMLib_ModAPI", "getExperimentEnabled", [](int experiment_id) -> bool {
auto level = GMLIB_Level::getLevel();
if (!level) {
return false;
}
if (ExperimentsList.count(experiment_id)) {
return GMLIB_Level::getLevel()->getExperimentEnabled(((AllExperiments)experiment_id));
} else {
+43 -25
View File
@@ -7,43 +7,61 @@ void Export_Legacy_GMLib_ServerAPI() {
RemoteCall::exportAs("GMLib_ServerAPI", "registerAbilityCommand", []() -> void {
GMLIB_Level::forceEnableAbilityCommand();
});
RemoteCall::exportAs("GMLib_ServerAPI", "addFloatingTextPacket", [](std::string text, std::pair<Vec3, int> pos, int dimid) -> int {
auto ft = new FloatingText(text, pos.first, pos.second);
return ft->mRuntimeId;
});
RemoteCall::exportAs(
"GMLib_ServerAPI",
"addFloatingTextPacket",
[](std::string text, std::pair<Vec3, int> pos, int dimid) -> int {
auto ft = new GMLIB::Server::FloatingText(text, pos.first, pos.second);
return ft->getRuntimeID();
}
);
RemoteCall::exportAs("GMLib_ServerAPI", "deleteFloatingTextPacket", [](int id) -> void {
FloatingText::deleteFloatingText(id);
GMLIB::Server::FloatingText::deleteFloatingText(id);
});
RemoteCall::exportAs("GMLib_ServerAPI", "setEnableAchievement", []() -> void {
GMLIB_Level::setForceAchievementsEnabled();
});
RemoteCall::exportAs("GMLib_ServerAPI", "setForceTrustSkins", []() -> void {
GMLIB_Level::setForceTrustSkin();
});
RemoteCall::exportAs("GMLib_ServerAPI", "enableCoResourcePack", []() -> void {
GMLIB_Level::setCoResourcePack();
});
RemoteCall::exportAs("GMLib_ServerAPI", "setForceTrustSkins", []() -> void { GMLIB_Level::setForceTrustSkin(); });
RemoteCall::exportAs("GMLib_ServerAPI", "enableCoResourcePack", []() -> void { GMLIB_Level::setCoResourcePack(); });
RemoteCall::exportAs("GMLib_ServerAPI", "getLevelName", []() -> std::string {
return GMLIB_Level::getLevel()->getLevelName();
auto level = GMLIB_Level::getLevel();
if (!level) {
return "";
}
return level->getLevelName();
});
RemoteCall::exportAs("GMLib_ServerAPI", "setLevelName", [](std::string name) -> void {
GMLIB_Level::getLevel()->setLevelName(name);
auto level = GMLIB_Level::getLevel();
if (!level) {
return;
}
return level->setLevelName(name);
});
RemoteCall::exportAs("GMLib_ServerAPI", "setFakeSeed", [](int64_t seed) -> void {
GMLIB_Level::getLevel()->setFakeSeed(seed);
auto level = GMLIB_Level::getLevel();
if (!level) {
return;
}
return level->setFakeSeed(seed);
});
RemoteCall::exportAs("GMLib_ServerAPI", "spawnEntity", [](std::pair<Vec3, int> pos, std::string name) -> Actor* {
return GMLIB_Spawner::spawnEntity(pos.first, pos.second, name);
});
RemoteCall::exportAs("GMLib_ServerAPI", "shootProjectile", [](Actor* owner, std::string name, float speed, float offset) -> Actor* {
auto ac = (GMLIB_Actor*)owner;
return ac->shootProjectile(name, speed, offset);
});
RemoteCall::exportAs("GMLib_ServerAPI", "throwEntity", [](Actor* owner, Actor* actor, float speed, float offset) -> bool {
auto ac = (GMLIB_Actor*)owner;
return ac->throwEntity(actor, speed, offset);
});
RemoteCall::exportAs("GMLib_ServerAPI", "PlayerToEntity", [](Player* player) -> Actor* {
return (Actor*)player;
});
RemoteCall::exportAs(
"GMLib_ServerAPI",
"shootProjectile",
[](Actor* owner, std::string name, float speed, float offset) -> Actor* {
auto ac = (GMLIB_Actor*)owner;
return ac->shootProjectile(name, speed, offset);
}
);
RemoteCall::exportAs(
"GMLib_ServerAPI",
"throwEntity",
[](Actor* owner, Actor* actor, float speed, float offset) -> bool {
auto ac = (GMLIB_Actor*)owner;
return ac->throwEntity(actor, speed, offset);
}
);
RemoteCall::exportAs("GMLib_ServerAPI", "PlayerToEntity", [](Player* player) -> Actor* { return (Actor*)player; });
}
+28
View File
@@ -0,0 +1,28 @@
{
"format_version": 2,
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
"version": "0.8.0",
"info": {
"name": "GMLIB-LegacyRemoteCallApi",
"description": "Legacy RemoteCall API for GMLIB",
"author": "GroupMountain Team",
"tags": [
"LeviLamina",
"GMLIB",
"GMLIB-LegacyRemoteCallApi",
"Library"
]
},
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.8.0/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
"dependencies": {
"github.com/GroupMountain/GMLIB": ">=0.8.0"
},
"files": {
"place": [
{
"src": "GMLIB-LegacyRemoteCallApi/*",
"dest": "plugins/GMLIB-LegacyRemoteCallApi"
}
]
}
}