Skip to content

Commit 1ad064a

Browse files
committed
refactor: adapt to latest LeviLamina develop
1 parent 067ab5c commit 1ad064a

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

src/legacy/api/BlockAPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Local<Object> BlockClass::newBlock(Block const& block, BlockPos const& pos, Dime
8484
return newp->getScriptObject();
8585
}
8686

87-
Local<Object> BlockClass::newBlock(const BlockPos& pos, DimensionType dim) {
87+
Local<Object> BlockClass::newBlock(BlockPos const& pos, DimensionType dim) {
8888
if (pos.y < 320 && pos.y >= -64) {
8989
auto& bl = ll::service::getLevel()->getDimension(dim)->getBlockSourceFromMainChunkSource().getBlock(pos);
9090
return BlockClass::newBlock(bl, pos, dim);

src/lse/events/EventHooks.cpp

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -590,20 +590,15 @@ LL_TYPE_INSTANCE_HOOK(ExplodeHook, HookPriority::Normal, Level, &Level::$explode
590590
// Todo: broken need to be fixed
591591

592592
IF_LISTENED(EVENT_TYPES::onEntityExplode) {
593-
if (explosion.mUnka79c6e.as<ActorUniqueID>().rawID != ActorUniqueID::INVALID_ID().rawID) {
593+
if (explosion.mSourceID->rawID != ActorUniqueID::INVALID_ID().rawID) {
594594
if (!CallEvent(
595595
EVENT_TYPES::onEntityExplode,
596-
EntityClass::newEntity(
597-
ll::service::getLevel()->fetchEntity(explosion.mUnka79c6e.as<ActorUniqueID>(), false)
598-
),
599-
FloatPos::newPos(
600-
explosion.mUnkcbb3c1.as<Vec3>(),
601-
explosion.mUnk2a21f8.as<BlockSource*>()->getDimensionId()
602-
),
603-
Number::newNumber(explosion.mUnk304b6b.as<float>()),
604-
Number::newNumber(explosion.mUnk62d2a5.as<float>()),
605-
Boolean::newBoolean(explosion.mUnke8bdf7.as<bool>()),
606-
Boolean::newBoolean(explosion.mUnk501acf.as<bool>())
596+
EntityClass::newEntity(ll::service::getLevel()->fetchEntity(explosion.mSourceID, false)),
597+
FloatPos::newPos(explosion.mPos, explosion.mRegion.getDimensionId()),
598+
Number::newNumber(explosion.mRadius),
599+
Number::newNumber(explosion.mMaxResistance),
600+
Boolean::newBoolean(explosion.mBreaking),
601+
Boolean::newBoolean(explosion.mFire)
607602
)) {
608603
return false;
609604
}
@@ -614,18 +609,12 @@ LL_TYPE_INSTANCE_HOOK(ExplodeHook, HookPriority::Normal, Level, &Level::$explode
614609
IF_LISTENED(EVENT_TYPES::onBlockExplode) {
615610
if (!CallEvent(
616611
EVENT_TYPES::onBlockExplode,
617-
BlockClass::newBlock(
618-
explosion.mUnkcbb3c1.as<Vec3>(),
619-
explosion.mUnk2a21f8.as<BlockSource*>()->getDimensionId()
620-
),
621-
FloatPos::newPos(
622-
explosion.mUnkcbb3c1.as<Vec3>(),
623-
explosion.mUnk2a21f8.as<BlockSource*>()->getDimensionId()
624-
),
625-
Number::newNumber(explosion.mUnk304b6b.as<float>()),
626-
Number::newNumber(explosion.mUnk62d2a5.as<float>()),
627-
Boolean::newBoolean(explosion.mUnke8bdf7.as<bool>()),
628-
Boolean::newBoolean(explosion.mUnk501acf.as<bool>())
612+
BlockClass::newBlock(*explosion.mPos, explosion.mRegion.getDimensionId()),
613+
FloatPos::newPos(explosion.mPos, explosion.mRegion.getDimensionId()),
614+
Number::newNumber(explosion.mRadius),
615+
Number::newNumber(explosion.mMaxResistance),
616+
Boolean::newBoolean(explosion.mBreaking),
617+
Boolean::newBoolean(explosion.mFire)
629618
)) {
630619
return false;
631620
}

0 commit comments

Comments
 (0)