Skip to content

Commit 2ff8d9d

Browse files
committed
chore: remove useless include in events
1 parent 2f025d3 commit 2ff8d9d

File tree

4 files changed

+35
-94
lines changed

4 files changed

+35
-94
lines changed

src/lse/events/BlockEvents.cpp

+5-30
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,19 @@
44
#include "legacy/api/EventAPI.h"
55
#include "legacy/api/ItemAPI.h"
66
#include "legacy/api/PlayerAPI.h"
7+
#include "ll/api/memory/Hook.h"
8+
#include "ll/api/memory/Memory.h"
79
#include "ll/api/service/Bedrock.h"
810
#include "mc/common/ActorUniqueID.h"
9-
#include "mc/deps/core/string/HashedString.h"
1011
#include "mc/server/commands/CommandOrigin.h"
1112
#include "mc/server/commands/CommandOriginType.h"
12-
#include "mc/world/actor/ActorDamageSource.h"
13-
#include "mc/world/inventory/transaction/InventoryAction.h"
14-
#include "mc/world/inventory/transaction/InventorySource.h"
15-
#include "mc/world/inventory/transaction/InventoryTransaction.h"
16-
#include "mc/world/phys/HitResult.h"
17-
#include "mc/world/scores/IdentityDefinition.h"
18-
#include "mc/world/scores/Objective.h"
19-
#include "mc/world/scores/PlayerScoreboardId.h"
20-
#include "mc/world/scores/ScoreInfo.h"
21-
#include "mc/world/scores/ScoreboardId.h"
22-
#include "ll/api/memory/Hook.h"
23-
#include "ll/api/memory/Memory.h"
24-
#include "mc/server/module/VanillaServerGameplayEventListener.h"
2513
#include "mc/world/actor/ArmorStand.h"
26-
#include "mc/world/actor/FishingHook.h"
2714
#include "mc/world/actor/Hopper.h"
28-
#include "mc/world/actor/item/ItemActor.h"
2915
#include "mc/world/actor/player/Player.h"
3016
#include "mc/world/containers/models/LevelContainerModel.h"
31-
#include "mc/world/events/BlockEventCoordinator.h"
32-
#include "mc/world/gamemode/InteractionResult.h"
33-
#include "mc/world/inventory/transaction/ComplexInventoryTransaction.h"
34-
#include "mc/world/item/ItemInstance.h"
3517
#include "mc/world/item/ItemStack.h"
36-
#include "mc/world/item/TridentItem.h"
37-
#include "mc/world/level/BedrockSpawner.h"
3818
#include "mc/world/level/BlockSource.h"
39-
#include "mc/world/level/ChangeDimensionRequest.h"
19+
#include "mc/world/level/Explosion.h"
4020
#include "mc/world/level/Level.h"
4121
#include "mc/world/level/block/BasePressurePlateBlock.h"
4222
#include "mc/world/level/block/Block.h"
@@ -48,14 +28,9 @@
4828
#include "mc/world/level/block/RedstoneTorchBlock.h"
4929
#include "mc/world/level/block/RespawnAnchorBlock.h"
5030
#include "mc/world/level/block/actor/BaseCommandBlock.h"
51-
#include "mc/world/level/block/actor/ChestBlockActor.h"
5231
#include "mc/world/level/block/actor/PistonBlockActor.h"
53-
#include "mc/world/phys/AABB.h"
54-
#include "mc/world/scores/ServerScoreboard.h"
55-
#include "mc/world/level/Explosion.h"
56-
#include "mc/world/level/material/Material.h"
5732
#include "mc/world/level/dimension/Dimension.h"
58-
#include "mc/world/actor/player/PlayerItemInUse.h"
33+
#include "mc/world/level/material/Material.h"
5934

6035
namespace lse::events::block {
6136
LL_TYPE_INSTANCE_HOOK(
@@ -535,4 +510,4 @@ void HopperEvent(bool pullIn) {
535510
HopperEvents::HopperPushOutHook::hook();
536511
}
537512
}
538-
}
513+
} // namespace lse::events::block

src/lse/events/EntityEvents.cpp

+12-32
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,34 @@
33
#include "legacy/api/EntityAPI.h"
44
#include "legacy/api/EventAPI.h"
55
#include "legacy/api/PlayerAPI.h"
6+
#include "ll/api/memory/Hook.h"
7+
#include "ll/api/memory/Memory.h"
68
#include "ll/api/service/Bedrock.h"
79
#include "mc/common/ActorUniqueID.h"
810
#include "mc/deps/core/string/HashedString.h"
11+
#include "mc/entity/components_json_legacy/NpcComponent.h"
12+
#include "mc/entity/components_json_legacy/ProjectileComponent.h"
913
#include "mc/world/actor/ActorDamageCause.h"
1014
#include "mc/world/actor/ActorDamageSource.h"
11-
#include "mc/world/actor/Mob.h"
12-
#include "mc/world/inventory/transaction/InventoryAction.h"
13-
#include "mc/world/inventory/transaction/InventorySource.h"
14-
#include "mc/world/inventory/transaction/InventoryTransaction.h"
15-
#include "mc/world/phys/HitResult.h"
16-
#include "mc/world/scores/IdentityDefinition.h"
17-
#include "ll/api/memory/Hook.h"
18-
#include "ll/api/memory/Memory.h"
19-
#include "mc/entity/components_json_legacy/ProjectileComponent.h"
20-
#include "mc/server/module/VanillaServerGameplayEventListener.h"
2115
#include "mc/world/actor/ActorDefinitionIdentifier.h"
2216
#include "mc/world/actor/ActorType.h"
23-
#include "mc/world/actor/FishingHook.h"
17+
#include "mc/world/actor/Mob.h"
2418
#include "mc/world/actor/VanillaActorRendererId.h"
2519
#include "mc/world/actor/boss/WitherBoss.h"
26-
#include "mc/world/actor/item/ItemActor.h"
20+
#include "mc/world/actor/npc/ActionContainer.h"
21+
#include "mc/world/actor/npc/CommandAction.h"
22+
#include "mc/world/actor/npc/StoredCommand.h"
23+
#include "mc/world/actor/npc/UrlAction.h"
2724
#include "mc/world/actor/player/Player.h"
28-
#include "mc/world/containers/models/LevelContainerModel.h"
29-
#include "mc/world/events/BlockEventCoordinator.h"
30-
#include "mc/world/gamemode/InteractionResult.h"
31-
#include "mc/world/inventory/transaction/ComplexInventoryTransaction.h"
3225
#include "mc/world/item/CrossbowItem.h"
3326
#include "mc/world/item/ItemInstance.h"
3427
#include "mc/world/item/ItemStack.h"
3528
#include "mc/world/item/TridentItem.h"
3629
#include "mc/world/level/BedrockSpawner.h"
3730
#include "mc/world/level/BlockSource.h"
38-
#include "mc/world/level/ChangeDimensionRequest.h"
3931
#include "mc/world/level/Level.h"
40-
#include "mc/world/level/block/Block.h"
41-
#include "mc/world/level/block/actor/ChestBlockActor.h"
42-
#include "mc/world/level/block/actor/PistonBlockActor.h"
4332
#include "mc/world/phys/AABB.h"
44-
#include "mc/world/scores/ServerScoreboard.h"
45-
#include "mc/world/level/Explosion.h"
46-
#include "mc/world/level/material/Material.h"
47-
#include "mc/world/level/dimension/Dimension.h"
48-
#include "mc/world/actor/player/PlayerItemInUse.h"
49-
#include "mc/entity/components_json_legacy/NpcComponent.h"
50-
#include "mc/world/actor/npc/ActionContainer.h"
51-
#include "mc/world/actor/npc/CommandAction.h"
52-
#include "mc/world/actor/npc/UrlAction.h"
53-
#include "mc/world/actor/npc/StoredCommand.h"
33+
#include "mc/world/phys/HitResult.h"
5434

5535
namespace lse::events::entity {
5636
LL_TYPE_INSTANCE_HOOK(
@@ -268,7 +248,7 @@ LL_TYPE_INSTANCE_HOOK(
268248
IF_LISTENED(EVENT_TYPES::onNpcCmd) {
269249
auto action = this->getActionsContainer().at(actionIndex);
270250
if (std::holds_alternative<npc::CommandAction>(*action)) {
271-
auto& commands = std::get<npc::CommandAction>(*action).commands;
251+
auto& commands = std::get<npc::CommandAction>(*action).commands;
272252
std::string command;
273253
for (auto& cmd : commands.get()) {
274254
command += cmd.mUnk879303.as<std::string>() + ";";
@@ -302,4 +282,4 @@ void ProjectileHitEntityEvent() { ProjectileHitEntityHook::hook(); }
302282
void ProjectileHitBlockEvent() { ProjectileHitBlockHook::hook(); }
303283
void MobHurtEvent() { MobHurtEffectHook::hook(); }
304284
void NpcCommandEvent() { NpcCommandHook::hook(); }
305-
}
285+
} // namespace lse::events::entity

src/lse/events/OtherEvents.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
#include "ll/api/memory/Hook.h"
44
#include "ll/api/service/Bedrock.h"
55
#include "mc/common/ActorUniqueID.h"
6-
#include "mc/world/scores/ServerScoreboard.h"
6+
#include "mc/world/scores/IdentityDefinition.h"
77
#include "mc/world/scores/Objective.h"
8-
#include "mc/world/scores/ScoreboardId.h"
98
#include "mc/world/scores/PlayerScoreboardId.h"
109
#include "mc/world/scores/ScoreInfo.h"
11-
#include "mc/world/scores/IdentityDefinition.h"
10+
#include "mc/world/scores/ScoreboardId.h"
11+
#include "mc/world/scores/ServerScoreboard.h"
1212

1313
namespace lse::events::other {
1414
LL_TYPE_INSTANCE_HOOK(

src/lse/events/PlayerEvents.cpp

+15-29
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,36 @@
44
#include "legacy/api/EventAPI.h"
55
#include "legacy/api/ItemAPI.h"
66
#include "legacy/api/PlayerAPI.h"
7+
#include "ll/api/memory/Hook.h"
8+
#include "ll/api/memory/Memory.h"
79
#include "ll/api/service/Bedrock.h"
810
#include "mc/common/ActorUniqueID.h"
9-
#include "mc/deps/core/string/HashedString.h"
11+
#include "mc/deps/ecs/WeakEntityRef.h"
1012
#include "mc/server/ServerPlayer.h"
13+
#include "mc/server/module/VanillaServerGameplayEventListener.h"
1114
#include "mc/world/ContainerID.h"
1215
#include "mc/world/actor/ActorDamageSource.h"
13-
#include "mc/world/inventory/transaction/InventoryAction.h"
14-
#include "mc/world/inventory/transaction/InventorySource.h"
15-
#include "mc/world/inventory/transaction/InventoryTransaction.h"
16-
#include "mc/world/phys/HitResult.h"
17-
#include "ll/api/memory/Hook.h"
18-
#include "ll/api/memory/Memory.h"
19-
#include "mc/deps/ecs/WeakEntityRef.h"
20-
#include "mc/server/module/VanillaServerGameplayEventListener.h"
2116
#include "mc/world/actor/ActorType.h"
2217
#include "mc/world/actor/FishingHook.h"
2318
#include "mc/world/actor/item/ItemActor.h"
2419
#include "mc/world/actor/player/Player.h"
20+
#include "mc/world/actor/player/PlayerItemInUse.h"
2521
#include "mc/world/containers/models/LevelContainerModel.h"
2622
#include "mc/world/events/BlockEventCoordinator.h"
2723
#include "mc/world/events/EventResult.h"
24+
#include "mc/world/events/PlayerOpenContainerEvent.h"
2825
#include "mc/world/gamemode/InteractionResult.h"
2926
#include "mc/world/inventory/transaction/ComplexInventoryTransaction.h"
27+
#include "mc/world/inventory/transaction/InventoryAction.h"
28+
#include "mc/world/inventory/transaction/InventorySource.h"
29+
#include "mc/world/inventory/transaction/InventoryTransaction.h"
3030
#include "mc/world/item/BucketItem.h"
3131
#include "mc/world/item/ItemInstance.h"
3232
#include "mc/world/item/ItemStack.h"
3333
#include "mc/world/level/BedrockSpawner.h"
3434
#include "mc/world/level/BlockSource.h"
3535
#include "mc/world/level/ChangeDimensionRequest.h"
36+
#include "mc/world/level/Explosion.h"
3637
#include "mc/world/level/Level.h"
3738
#include "mc/world/level/block/BasePressurePlateBlock.h"
3839
#include "mc/world/level/block/Block.h"
@@ -41,13 +42,10 @@
4142
#include "mc/world/level/block/actor/BarrelBlockActor.h"
4243
#include "mc/world/level/block/actor/ChestBlockActor.h"
4344
#include "mc/world/level/block/actor/PistonBlockActor.h"
44-
#include "mc/world/phys/AABB.h"
45-
#include "mc/world/scores/ServerScoreboard.h"
46-
#include "mc/world/level/Explosion.h"
47-
#include "mc/world/events/PlayerOpenContainerEvent.h"
48-
#include "mc/world/level/material/Material.h"
4945
#include "mc/world/level/dimension/Dimension.h"
50-
#include "mc/world/actor/player/PlayerItemInUse.h"
46+
#include "mc/world/level/material/Material.h"
47+
#include "mc/world/phys/AABB.h"
48+
#include "mc/world/phys/HitResult.h"
5149

5250
namespace lse::events::player {
5351
LL_TYPE_INSTANCE_HOOK(
@@ -346,13 +344,7 @@ LL_TYPE_INSTANCE_HOOK(
346344
origin(player, std::move(changeRequest));
347345
}
348346

349-
LL_TYPE_INSTANCE_HOOK(
350-
OpenContainerScreenHook,
351-
HookPriority::Normal,
352-
Player,
353-
&Player::canOpenContainerScreen,
354-
bool
355-
) {
347+
LL_TYPE_INSTANCE_HOOK(OpenContainerScreenHook, HookPriority::Normal, Player, &Player::canOpenContainerScreen, bool) {
356348
IF_LISTENED(EVENT_TYPES::onOpenContainerScreen) {
357349
if (!CallEvent(EVENT_TYPES::onOpenContainerScreen, PlayerClass::newPlayer(this))) {
358350
return false;
@@ -406,13 +398,7 @@ LL_TYPE_INSTANCE_HOOK(
406398
IF_LISTENED_END(EVENT_TYPES::onBedEnter);
407399
return origin(pos);
408400
}
409-
LL_TYPE_INSTANCE_HOOK(
410-
OpenInventoryHook,
411-
HookPriority::Normal,
412-
ServerPlayer,
413-
&ServerPlayer::$openInventory,
414-
void,
415-
) {
401+
LL_TYPE_INSTANCE_HOOK(OpenInventoryHook, HookPriority::Normal, ServerPlayer, &ServerPlayer::$openInventory, void, ) {
416402
IF_LISTENED(EVENT_TYPES::onOpenInventory) {
417403
if (!CallEvent(EVENT_TYPES::onOpenInventory, PlayerClass::newPlayer(this))) {
418404
return;

0 commit comments

Comments
 (0)