|
11 | 11 | #include "mc/legacy/ActorUniqueID.h" |
12 | 12 | #include "mc/server/commands/CommandOrigin.h" |
13 | 13 | #include "mc/server/commands/CommandOriginType.h" |
| 14 | +#include "mc/scripting/modules/minecraft/events/ScriptBlockGlobalEventListener.h" |
14 | 15 | #include "mc/world/actor/ArmorStand.h" |
15 | 16 | #include "mc/world/actor/Hopper.h" |
16 | 17 | #include "mc/world/actor/player/Player.h" |
@@ -250,26 +251,27 @@ LL_TYPE_STATIC_HOOK( |
250 | 251 | origin(player, pos, region, level); |
251 | 252 | } |
252 | 253 |
|
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 | +} |
273 | 275 |
|
274 | 276 | namespace redstone { |
275 | 277 | inline bool RedstoneUpdateEvent(BlockSource& region, BlockPos const& pos, int& strength, bool& isFirstTime) { |
|
0 commit comments