adapt: adapt GMLIB v0.11.0

This commit is contained in:
Tsubasa6848
2024-04-15 17:20:57 +08:00
Unverified
parent 5404b112d3
commit 620ba0a464
6 changed files with 21 additions and 6 deletions
+15
View File
@@ -174,6 +174,21 @@ void Export_Event_API() {
);
return true;
}
case doHash("onEndermanTake"): {
auto Call = RemoteCall::importAs<bool(Actor * mob)>(eventName, eventId);
eventBus->emplaceListener<GMLIB::Event::EntityEvent::EndermanTakeBlockBeforeEvent>(
[Call](GMLIB::Event::EntityEvent::EndermanTakeBlockBeforeEvent& ev) {
bool result = true;
try {
result = Call(&ev.self());
} catch (...) {}
if (!result) {
ev.cancel();
}
}
);
return true;
}
default:
return false;
}