Skip to content

Commit

Permalink
fix: fix block of onPlaceBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Feb 1, 2024
1 parent e0d4fcf commit fdb6ca5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/legacy/api/EventAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,27 @@ void EnableEventListener(int eventId) {
case EVENT_TYPES::onPlaceBlock:
bus.emplaceListener<PlayerPlacingBlockEvent>([](PlayerPlacingBlockEvent& ev) {
IF_LISTENED(EVENT_TYPES::onPlaceBlock) {
BlockPos truePos = ev.pos();
switch (ev.face()) {
case 0:
--truePos.y;
break;
case 1:
++truePos.y;
break;
case 2:
--truePos.z;
break;
case 3:
++truePos.z;
break;
case 4:
--truePos.x;
break;
case 5:
++truePos.x;
break;
}
CallEvent(
EVENT_TYPES::onPlaceBlock,
PlayerClass::newPlayer(&ev.self()),
Expand Down

0 comments on commit fdb6ca5

Please sign in to comment.