diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b9e5716..3ec44e1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- `afterPlaceBlock` now passes the placed block instead of re-reading the position, which could report air [#402] + ## [0.22.3] - 2026-10-11 ### Fixed @@ -1466,6 +1470,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#393]: https://github.com/LiteLDev/LegacyScriptEngine/issues/393 [#394]: https://github.com/LiteLDev/LegacyScriptEngine/issues/394 [#396]: https://github.com/LiteLDev/LegacyScriptEngine/issues/396 +[#402]: https://github.com/LiteLDev/LegacyScriptEngine/issues/402 [Unreleased]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.22.3...HEAD [0.22.3]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.22.2...v0.22.3 diff --git a/src/lse/events/BlockEventsHooks.cpp b/src/lse/events/BlockEventsHooks.cpp index 69f1e05f..f7053bed 100644 --- a/src/lse/events/BlockEventsHooks.cpp +++ b/src/lse/events/BlockEventsHooks.cpp @@ -7,6 +7,7 @@ #include "legacy/api/PlayerAPI.h" #include "ll/api/memory/Hook.h" #include "lse/api/Thread.h" +#include "mc/scripting/modules/minecraft/events/ScriptBlockBreakingEventListener.h" #include "mc/scripting/modules/minecraft/events/ScriptBlockGlobalEventListener.h" #include "mc/server/commands/CommandOrigin.h" #include "mc/server/commands/CommandOriginType.h" diff --git a/src/lse/events/PlayerEvents.cpp b/src/lse/events/PlayerEvents.cpp index 312a1102..def60bde 100644 --- a/src/lse/events/PlayerEvents.cpp +++ b/src/lse/events/PlayerEvents.cpp @@ -281,7 +281,7 @@ void afterPlaceBlock() { CallEvent( EVENT_TYPES::afterPlaceBlock, PlayerClass::newPlayer(&ev.self()), - BlockClass::newBlock(ev.pos(), ev.self().getDimensionId()) + BlockClass::newBlock(ev.placedBlock(), ev.pos(), ev.self().getDimensionId()) ); // Not cancellable } } diff --git a/xmake.lua b/xmake.lua index 819d9fd6..5a7ca28a 100644 --- a/xmake.lua +++ b/xmake.lua @@ -65,7 +65,7 @@ option("backend") target("LegacyScriptEngine") add_rules("@levibuildscript/linkrule") if is_plat("windows") then - add_defines("NOMINMAX", "UNICODE", "_AMC64_") + add_defines("NOMINMAX", "UNICODE", "_AMD64_", "_HAS_CXX23=1") set_exceptions("none") -- To avoid conflicts with /EHa. add_cxflags( "/EHa", "/utf-8", "/W4", "/w44265", "/w44289", "/w44296", "/w45263", "/w44738", "/w45204") add_cxflags(