Skip to content

Commit

Permalink
adapt: adapt GMLIB v0.9.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsubasa6848 committed Mar 18, 2024
1 parent aab3c15 commit b7098b6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions src/EventAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ void Export_Event_API() {
"callCustomEvent",
[eventBus](std::string eventName, std::string eventId) -> bool {
if (RemoteCall::hasFunc(eventName, eventId)) {
switch (do_hash(eventName)) {
case do_hash("onClientLogin"): {
switch (doHash(eventName)) {
case doHash("onClientLogin"): {
auto Call = RemoteCall::importAs<
bool(std::string realName, std::string uuid, std::string serverXuid, std::string clientXuid)>(
eventName,
Expand All @@ -29,7 +29,7 @@ void Export_Event_API() {
);
return true;
}
case do_hash("onWeatherChange"): {
case doHash("onWeatherChange"): {
auto Call =
RemoteCall::importAs<bool(int lightningLevel, int rainLevel, int lightningLast, int rainLast)>(
eventName,
Expand All @@ -53,7 +53,7 @@ void Export_Event_API() {
);
return true;
}
case do_hash("onMobPick"): {
case doHash("onMobPick"): {
auto Call = RemoteCall::importAs<bool(Actor * mob, Actor * item)>(eventName, eventId);
eventBus->emplaceListener<GMLIB::Event::EntityEvent::MobPickupItemBeforeEvent>(
[Call](GMLIB::Event::EntityEvent::MobPickupItemBeforeEvent& ev) {
Expand All @@ -68,7 +68,7 @@ void Export_Event_API() {
);
return true;
}
case do_hash("onItemTrySpawn"): {
case doHash("onItemTrySpawn"): {
auto Call = RemoteCall::importAs<
bool(const ItemStack* item, std::pair<Vec3, int> position, Actor* spawner)>(eventName, eventId);
eventBus->emplaceListener<GMLIB::Event::EntityEvent::ItemActorSpawnBeforeEvent>(
Expand All @@ -87,7 +87,7 @@ void Export_Event_API() {
);
return true;
}
case do_hash("onItemSpawned"): {
case doHash("onItemSpawned"): {
auto Call = RemoteCall::importAs<
bool(const ItemStack* item, Actor* itemActor, std::pair<Vec3, int> position, Actor* spawner)>(
eventName,
Expand All @@ -105,7 +105,7 @@ void Export_Event_API() {
);
return true;
}
case do_hash("onTextSend"): {
case doHash("onTextSend"): {
auto Call = RemoteCall::importAs<bool(std::string author, std::string message)>(eventName, eventId);
eventBus->emplaceListener<GMLIB::Event::PacketEvent::TextPacketSendBeforeEvent>(
[Call](GMLIB::Event::PacketEvent::TextPacketSendBeforeEvent& ev) {
Expand All @@ -121,7 +121,7 @@ void Export_Event_API() {
);
return true;
}
case do_hash("onLeaveBed"): {
case doHash("onLeaveBed"): {
auto Call = RemoteCall::importAs<bool(Player * pl)>(eventName, eventId);
eventBus->emplaceListener<GMLIB::Event::PlayerEvent::PlayerStopSleepBeforeEvent>(
[Call](GMLIB::Event::PlayerEvent::PlayerStopSleepBeforeEvent& ev) {
Expand All @@ -136,7 +136,7 @@ void Export_Event_API() {
);
return true;
}
case do_hash("onDeathMessage"): {
case doHash("onDeathMessage"): {
auto Call = RemoteCall::importAs<bool(std::string message, std::vector<std::string>, Actor * dead)>(
eventName,
eventId
Expand Down
16 changes: 8 additions & 8 deletions src/LegacyModApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void Export_Legacy_GMLib_ModAPI() {
}
auto res = RecipeIngredient(result, 0, count);
auto unl = makeRecipeUnlockingKey(unlock);
GMLIB::Mod::CustomRecipe::registerShapelessCraftingTableRecipe(recipe_id, types, res, unl);
GMLIB::Mod::JsonRecipe::registerShapelessCraftingTableRecipe(recipe_id, types, res, unl);
}
);
RemoteCall::exportAs(
Expand All @@ -56,7 +56,7 @@ void Export_Legacy_GMLib_ModAPI() {
}
auto res = RecipeIngredient(result, 0, count);
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(
Expand All @@ -69,7 +69,7 @@ void Export_Legacy_GMLib_ModAPI() {
}
auto inp = RecipeIngredient(input, 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(
Expand All @@ -81,7 +81,7 @@ void Export_Legacy_GMLib_ModAPI() {
return;
}
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(
Expand All @@ -95,7 +95,7 @@ void Export_Legacy_GMLib_ModAPI() {
auto inp = RecipeIngredient(input, 0, 1);
auto outp = RecipeIngredient(output, 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(
Expand All @@ -110,7 +110,7 @@ void Export_Legacy_GMLib_ModAPI() {
if (!level) {
return;
}
GMLIB::Mod::CustomRecipe::registerSmithingTransformRecipe(
GMLIB::Mod::JsonRecipe::registerSmithingTransformRecipe(
recipe_id,
smithing_template,
base,
Expand All @@ -127,7 +127,7 @@ void Export_Legacy_GMLib_ModAPI() {
if (!level) {
return;
}
GMLIB::Mod::CustomRecipe::registerSmithingTrimRecipe(recipe_id, smithing_template, base, addition);
GMLIB::Mod::JsonRecipe::registerSmithingTrimRecipe(recipe_id, smithing_template, base, addition);
}
);
RemoteCall::exportAs(
Expand All @@ -145,7 +145,7 @@ void Export_Legacy_GMLib_ModAPI() {
}
auto inp = RecipeIngredient(input, 0, 1);
auto outp = RecipeIngredient(output, 0, 1);
GMLIB::Mod::CustomRecipe::registerStoneCutterRecipe(recipe_id, inp, outp);
GMLIB::Mod::JsonRecipe::registerStoneCutterRecipe(recipe_id, inp, outp);
}
);
// 错误方块清理
Expand Down

0 comments on commit b7098b6

Please sign in to comment.