adapt: adapt GMLIB v0.9.6

This commit is contained in:
Tsubasa6848
2024-03-18 18:33:42 +08:00
Unverified
parent aab3c154c3
commit b7098b6750
3 changed files with 18 additions and 18 deletions
+9 -9
View File
@@ -8,8 +8,8 @@ void Export_Event_API() {
"callCustomEvent", "callCustomEvent",
[eventBus](std::string eventName, std::string eventId) -> bool { [eventBus](std::string eventName, std::string eventId) -> bool {
if (RemoteCall::hasFunc(eventName, eventId)) { if (RemoteCall::hasFunc(eventName, eventId)) {
switch (do_hash(eventName)) { switch (doHash(eventName)) {
case do_hash("onClientLogin"): { case doHash("onClientLogin"): {
auto Call = RemoteCall::importAs< auto Call = RemoteCall::importAs<
bool(std::string realName, std::string uuid, std::string serverXuid, std::string clientXuid)>( bool(std::string realName, std::string uuid, std::string serverXuid, std::string clientXuid)>(
eventName, eventName,
@@ -29,7 +29,7 @@ void Export_Event_API() {
); );
return true; return true;
} }
case do_hash("onWeatherChange"): { case doHash("onWeatherChange"): {
auto Call = auto Call =
RemoteCall::importAs<bool(int lightningLevel, int rainLevel, int lightningLast, int rainLast)>( RemoteCall::importAs<bool(int lightningLevel, int rainLevel, int lightningLast, int rainLast)>(
eventName, eventName,
@@ -53,7 +53,7 @@ void Export_Event_API() {
); );
return true; return true;
} }
case do_hash("onMobPick"): { case doHash("onMobPick"): {
auto Call = RemoteCall::importAs<bool(Actor * mob, Actor * item)>(eventName, eventId); auto Call = RemoteCall::importAs<bool(Actor * mob, Actor * item)>(eventName, eventId);
eventBus->emplaceListener<GMLIB::Event::EntityEvent::MobPickupItemBeforeEvent>( eventBus->emplaceListener<GMLIB::Event::EntityEvent::MobPickupItemBeforeEvent>(
[Call](GMLIB::Event::EntityEvent::MobPickupItemBeforeEvent& ev) { [Call](GMLIB::Event::EntityEvent::MobPickupItemBeforeEvent& ev) {
@@ -68,7 +68,7 @@ void Export_Event_API() {
); );
return true; return true;
} }
case do_hash("onItemTrySpawn"): { case doHash("onItemTrySpawn"): {
auto Call = RemoteCall::importAs< auto Call = RemoteCall::importAs<
bool(const ItemStack* item, std::pair<Vec3, int> position, Actor* spawner)>(eventName, eventId); bool(const ItemStack* item, std::pair<Vec3, int> position, Actor* spawner)>(eventName, eventId);
eventBus->emplaceListener<GMLIB::Event::EntityEvent::ItemActorSpawnBeforeEvent>( eventBus->emplaceListener<GMLIB::Event::EntityEvent::ItemActorSpawnBeforeEvent>(
@@ -87,7 +87,7 @@ void Export_Event_API() {
); );
return true; return true;
} }
case do_hash("onItemSpawned"): { case doHash("onItemSpawned"): {
auto Call = RemoteCall::importAs< auto Call = RemoteCall::importAs<
bool(const ItemStack* item, Actor* itemActor, std::pair<Vec3, int> position, Actor* spawner)>( bool(const ItemStack* item, Actor* itemActor, std::pair<Vec3, int> position, Actor* spawner)>(
eventName, eventName,
@@ -105,7 +105,7 @@ void Export_Event_API() {
); );
return true; return true;
} }
case do_hash("onTextSend"): { case doHash("onTextSend"): {
auto Call = RemoteCall::importAs<bool(std::string author, std::string message)>(eventName, eventId); auto Call = RemoteCall::importAs<bool(std::string author, std::string message)>(eventName, eventId);
eventBus->emplaceListener<GMLIB::Event::PacketEvent::TextPacketSendBeforeEvent>( eventBus->emplaceListener<GMLIB::Event::PacketEvent::TextPacketSendBeforeEvent>(
[Call](GMLIB::Event::PacketEvent::TextPacketSendBeforeEvent& ev) { [Call](GMLIB::Event::PacketEvent::TextPacketSendBeforeEvent& ev) {
@@ -121,7 +121,7 @@ void Export_Event_API() {
); );
return true; return true;
} }
case do_hash("onLeaveBed"): { case doHash("onLeaveBed"): {
auto Call = RemoteCall::importAs<bool(Player * pl)>(eventName, eventId); auto Call = RemoteCall::importAs<bool(Player * pl)>(eventName, eventId);
eventBus->emplaceListener<GMLIB::Event::PlayerEvent::PlayerStopSleepBeforeEvent>( eventBus->emplaceListener<GMLIB::Event::PlayerEvent::PlayerStopSleepBeforeEvent>(
[Call](GMLIB::Event::PlayerEvent::PlayerStopSleepBeforeEvent& ev) { [Call](GMLIB::Event::PlayerEvent::PlayerStopSleepBeforeEvent& ev) {
@@ -136,7 +136,7 @@ void Export_Event_API() {
); );
return true; return true;
} }
case do_hash("onDeathMessage"): { case doHash("onDeathMessage"): {
auto Call = RemoteCall::importAs<bool(std::string message, std::vector<std::string>, Actor * dead)>( auto Call = RemoteCall::importAs<bool(std::string message, std::vector<std::string>, Actor * dead)>(
eventName, eventName,
eventId eventId
+8 -8
View File
@@ -33,7 +33,7 @@ void Export_Legacy_GMLib_ModAPI() {
} }
auto res = RecipeIngredient(result, 0, count); auto res = RecipeIngredient(result, 0, count);
auto unl = makeRecipeUnlockingKey(unlock); auto unl = makeRecipeUnlockingKey(unlock);
GMLIB::Mod::CustomRecipe::registerShapelessCraftingTableRecipe(recipe_id, types, res, unl); GMLIB::Mod::JsonRecipe::registerShapelessCraftingTableRecipe(recipe_id, types, res, unl);
} }
); );
RemoteCall::exportAs( RemoteCall::exportAs(
@@ -56,7 +56,7 @@ void Export_Legacy_GMLib_ModAPI() {
} }
auto res = RecipeIngredient(result, 0, count); auto res = RecipeIngredient(result, 0, count);
auto unl = makeRecipeUnlockingKey(unlock); auto unl = makeRecipeUnlockingKey(unlock);
GMLIB::Mod::CustomRecipe::registerShapedCraftingTableRecipe(recipe_id, shape, types, res, unl); GMLIB::Mod::JsonRecipe::registerShapedCraftingTableRecipe(recipe_id, shape, types, res, unl);
} }
); );
RemoteCall::exportAs( RemoteCall::exportAs(
@@ -69,7 +69,7 @@ void Export_Legacy_GMLib_ModAPI() {
} }
auto inp = RecipeIngredient(input, 0, 1); auto inp = RecipeIngredient(input, 0, 1);
auto outp = RecipeIngredient(output, 0, 1); auto outp = RecipeIngredient(output, 0, 1);
GMLIB::Mod::CustomRecipe::registerFurnaceRecipe(recipe_id, inp, outp, tags); GMLIB::Mod::JsonRecipe::registerFurnaceRecipe(recipe_id, inp, outp, tags);
} }
); );
RemoteCall::exportAs( RemoteCall::exportAs(
@@ -81,7 +81,7 @@ void Export_Legacy_GMLib_ModAPI() {
return; return;
} }
auto rea = RecipeIngredient(reagent, 0, 1); auto rea = RecipeIngredient(reagent, 0, 1);
GMLIB::Mod::CustomRecipe::registerBrewingMixRecipe(recipe_id, input, output, rea); GMLIB::Mod::JsonRecipe::registerBrewingMixRecipe(recipe_id, input, output, rea);
} }
); );
RemoteCall::exportAs( RemoteCall::exportAs(
@@ -95,7 +95,7 @@ void Export_Legacy_GMLib_ModAPI() {
auto inp = RecipeIngredient(input, 0, 1); auto inp = RecipeIngredient(input, 0, 1);
auto outp = RecipeIngredient(output, 0, 1); auto outp = RecipeIngredient(output, 0, 1);
auto rea = RecipeIngredient(reagent, 0, 1); auto rea = RecipeIngredient(reagent, 0, 1);
GMLIB::Mod::CustomRecipe::registerBrewingContainerRecipe(recipe_id, inp, outp, rea); GMLIB::Mod::JsonRecipe::registerBrewingContainerRecipe(recipe_id, inp, outp, rea);
} }
); );
RemoteCall::exportAs( RemoteCall::exportAs(
@@ -110,7 +110,7 @@ void Export_Legacy_GMLib_ModAPI() {
if (!level) { if (!level) {
return; return;
} }
GMLIB::Mod::CustomRecipe::registerSmithingTransformRecipe( GMLIB::Mod::JsonRecipe::registerSmithingTransformRecipe(
recipe_id, recipe_id,
smithing_template, smithing_template,
base, base,
@@ -127,7 +127,7 @@ void Export_Legacy_GMLib_ModAPI() {
if (!level) { if (!level) {
return; return;
} }
GMLIB::Mod::CustomRecipe::registerSmithingTrimRecipe(recipe_id, smithing_template, base, addition); GMLIB::Mod::JsonRecipe::registerSmithingTrimRecipe(recipe_id, smithing_template, base, addition);
} }
); );
RemoteCall::exportAs( RemoteCall::exportAs(
@@ -145,7 +145,7 @@ void Export_Legacy_GMLib_ModAPI() {
} }
auto inp = RecipeIngredient(input, 0, 1); auto inp = RecipeIngredient(input, 0, 1);
auto outp = RecipeIngredient(output, 0, 1); auto outp = RecipeIngredient(output, 0, 1);
GMLIB::Mod::CustomRecipe::registerStoneCutterRecipe(recipe_id, inp, outp); GMLIB::Mod::JsonRecipe::registerStoneCutterRecipe(recipe_id, inp, outp);
} }
); );
// 错误方块清理 // 错误方块清理