Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Revert "feat: add 'RaidMobSpawnEvent' event (LiteLDev#1229)"
Browse files Browse the repository at this point in the history
This reverts commit 43328f3.
  • Loading branch information
ShrBox committed May 6, 2023
1 parent 165ad7a commit 1cef4e6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 64 deletions.
33 changes: 0 additions & 33 deletions LiteLoader/include/llapi/EventAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class BlockLegacy;
class ArmorStand;
class Objective;
struct ScoreboardId;
class Village;

/**
* @brief The event system.
Expand Down Expand Up @@ -714,38 +713,6 @@ class MobSpawnedEvent : public EventTemplate<MobSpawnedEvent> {
Vec3 mPos;
int mDimensionId = -1;
};
/**
* @brief An event that Raid mob spawn.
*
* @note This event cannot be suppressed.
*/
class RaidMobSpawnEvent : public EventTemplate<RaidMobSpawnEvent> {
public:

/**
* @brief Village Center generated by which village raid
*
*/
Vec3 mVillageCenter;

/**
* @brief Spawn Pos;
*
*/
Vec3 mPos;

/**
* @brief Raid spawn wave number
*
*/
int mWaveNum;

/**
* @brief Spawn Entity IDs;
*
*/
int mActorNum;
};

/* endregion */

Expand Down
20 changes: 0 additions & 20 deletions LiteLoader/src/llapi/EventAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ DECLARE_EVENT_DATA(PlayerBedEnterEvent);
DECLARE_EVENT_DATA(ScriptPluginManagerEvent);
DECLARE_EVENT_DATA(MobTrySpawnEvent);
DECLARE_EVENT_DATA(MobSpawnedEvent);
DECLARE_EVENT_DATA(RaidMobSpawnEvent);
DECLARE_EVENT_DATA(FormResponsePacketEvent);
DECLARE_EVENT_DATA(ResourcePackInitEvent);
DECLARE_EVENT_DATA(PlayerOpenInventoryEvent);
Expand Down Expand Up @@ -2125,25 +2124,6 @@ TClasslessInstanceHook(void, "?_setRespawnStage@EndDragonFight@@AEAAXW4RespawnAn
}
}

#include "llapi/mc/Village.hpp"

TInstanceHook(void,
"?_spawnRaidGroup@Village@@AEBA_NVVec3@@EAEAV?$unordered_set@UActorUniqueID@@U?$hash@UActorUniqueID@@@"
"std@@U?$equal_to@UActorUniqueID@@@3@V?$allocator@UActorUniqueID@@@3@@std@@@Z",
Village, Vec3 pos, unsigned char num, std::unordered_set<long long>& actorIDs) {
// actorIDs其实是std::unordered_set<ActorUniqueID>,懒得写hash函数
original(this, pos, num, actorIDs);
IF_LISTENED(RaidMobSpawnEvent) {
RaidMobSpawnEvent ev{};
ev.mVillageCenter = this->getCenter();
ev.mPos = pos;
ev.mWaveNum = num;
ev.mActorNum = actorIDs.size();
ev.call();
}
IF_LISTENED_END(RaidMobSpawnEvent)
}

#include "llapi/impl/FormPacketHelper.h"
#include "llapi/mc/Json.hpp"

Expand Down
11 changes: 0 additions & 11 deletions ScriptEngine/src/api/EventAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ enum class EVENT_TYPES : int {
/* Entity Events */
onMobDie,
onMobHurt,
onRaidMobSpawn,
onEntityExplode,
onProjectileHitEntity,
onWitherBossDestroy,
Expand Down Expand Up @@ -840,16 +839,6 @@ void EnableEventListener(int eventId) {
});
break;

case EVENT_TYPES::onRaidMobSpawn:
Event::RaidMobSpawnEvent::subscribe([](const RaidMobSpawnEvent& ev) {
IF_LISTENED(EVENT_TYPES::onRaidMobSpawn) {
CallEvent(EVENT_TYPES::onRaidMobSpawn, IntPos::newPos(ev.mVillageCenter), IntPos::newPos(ev.mPos),
Number::newNumber(ev.mWaveNum), Number::newNumber(ev.mActorNum));
}
IF_LISTENED_END(EVENT_TYPES::onRaidMobSpawn)
});
break;

case EVENT_TYPES::onStepOnPressurePlate:
Event::EntityStepOnPressurePlateEvent::subscribe([](const EntityStepOnPressurePlateEvent& ev) {
IF_LISTENED(EVENT_TYPES::onStepOnPressurePlate) {
Expand Down

0 comments on commit 1cef4e6

Please sign in to comment.