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

Commit

Permalink
fix: Fix event PlayerPlaceBlock (LiteLDev#1329)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yushu2606 authored Jul 16, 2023
1 parent ba63d7f commit f3cf1bc
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion LiteLoader/src/llapi/EventAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,31 @@ TInstanceHook(char, "?checkBlockPermissions@BlockSource@@QEAA_NAEAVActor@@AEBVBl
auto player = (Player*)ac;
PlayerPlaceBlockEvent ev{};
ev.mPlayer = player;
ev.mBlockInstance = this->getBlockInstance(*blockPosPtr);
int x = blockPosPtr->x;
int y = blockPosPtr->y;
int z = blockPosPtr->z;
switch (facing) {
case 0:
--y;
break;
case 1:
++y;
break;
case 2:
--z;
break;
case 3:
++z;
break;
case 4:
--x;
break;
case 5:
++x;
break;
}
BlockPos pos(x, y, z);
ev.mBlockInstance = this->getBlockInstance(pos);
if (!ev.call()) { // this pointer is not used.
((ItemUseInventoryTransaction*)nullptr)->resendBlocksAroundArea(*player, *blockPosPtr, facing);
return false;
Expand Down

0 comments on commit f3cf1bc

Please sign in to comment.