Skip to content

Commit 4cd863b

Browse files
committed
fix:fix BlockExplodedHook
1 parent 8ac8212 commit 4cd863b

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

src/lse/events/BlockEvents.cpp

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "mc/legacy/ActorUniqueID.h"
1212
#include "mc/server/commands/CommandOrigin.h"
1313
#include "mc/server/commands/CommandOriginType.h"
14+
#include "mc/scripting/modules/minecraft/events/ScriptBlockGlobalEventListener.h"
1415
#include "mc/world/actor/ArmorStand.h"
1516
#include "mc/world/actor/Hopper.h"
1617
#include "mc/world/actor/player/Player.h"
@@ -250,26 +251,27 @@ LL_TYPE_STATIC_HOOK(
250251
origin(player, pos, region, level);
251252
}
252253

253-
// LL_TYPE_INSTANCE_HOOK(
254-
// BlockExplodedHook,
255-
// HookPriority::Normal,
256-
// Block,
257-
// &Block::onExploded,
258-
// void,
259-
// BlockSource& region,
260-
// BlockPos const& pos,
261-
// Actor* entitySource
262-
//) {
263-
// IF_LISTENED(EVENT_TYPES::onBlockExploded) {
264-
// CallEvent(
265-
// EVENT_TYPES::onBlockExploded,
266-
// BlockClass::newBlock(pos, region.getDimensionId()),
267-
// EntityClass::newEntity(entitySource)
268-
// );
269-
// }
270-
// IF_LISTENED_END(EVENT_TYPES::onBlockExploded);
271-
// origin(region, pos, entitySource);
272-
// }
254+
LL_TYPE_INSTANCE_HOOK(
255+
BlockExplodedHook,
256+
HookPriority::Normal,
257+
ScriptModuleMinecraft::ScriptBlockGlobalEventListener ,
258+
&ScriptBlockGlobalEventListener::onBlockExploded,
259+
EventResult,
260+
Dimension& dimension,
261+
BlockPos const& blockPos,
262+
Block const& destroyedBlock,
263+
Actor* source
264+
) {
265+
IF_LISTENED(EVENT_TYPES::onBlockExploded) {
266+
CallEvent(
267+
EVENT_TYPES::onBlockExploded,
268+
BlockClass::newBlock(blockPos, dimension.getDimensionId()),
269+
EntityClass::newEntity(source)
270+
);
271+
}
272+
IF_LISTENED_END(EVENT_TYPES::onBlockExploded);
273+
return origin(dimension, blockPos, destroyedBlock, source);
274+
}
273275

274276
namespace redstone {
275277
inline bool RedstoneUpdateEvent(BlockSource& region, BlockPos const& pos, int& strength, bool& isFirstTime) {

xmake.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ add_rules("mode.debug", "mode.release")
33
add_repositories("levimc-repo https://github.com/LiteLDev/xmake-repo.git")
44

55
if is_config("target_type", "server") then
6-
add_requires("levilamina 2e818330ddc776bffa06c2ccea9f6f6497b8978d", {configs = {target_type = "server"}})
6+
add_requires("levilamina 1.1.0", {configs = {target_type = "server"}})
77
else
8-
add_requires("levilamina 2e818330ddc776bffa06c2ccea9f6f6497b8978d", {configs = {target_type = "client"}})
8+
add_requires("levilamina 1,1,0", {configs = {target_type = "client"}})
99
end
1010

1111
add_requires("levibuildscript")

0 commit comments

Comments
 (0)