1010#include " ll/api/service/Bedrock.h"
1111#include " lse/api/helper/BlockHelper.h"
1212#include " mc/deps/core/utility/optional_ref.h"
13+ #include " mc/deps/shared_types/v1_26_0/block/LiquidReaction.h"
1314#include " mc/world/level/BlockSource.h"
1415#include " mc/world/level/ChunkBlockPos.h"
1516#include " mc/world/level/block/BedrockBlockNames.h"
1617#include " mc/world/level/block/Block.h"
1718#include " mc/world/level/block/BlockChangeContext.h"
18- #include " mc/world/level/block/LiquidReaction.h"
1919#include " mc/world/level/block/VanillaBlockTags.h"
2020#include " mc/world/level/block/actor/BlockActor.h"
2121#include " mc/world/level/block/block_serialization_utils/BlockSerializationUtils.h"
@@ -281,7 +281,7 @@ Local<Value> BlockClass::isUnbreakable() const {
281281Local<Value> BlockClass::isWaterBlockingBlock () const {
282282 try {
283283 return Boolean::newBoolean (
284- block->mDirectData ->mWaterDetectionRule ->mOnLiquidTouches == LiquidReaction::Blocking
284+ block->mDirectData ->mWaterDetectionRule ->mOnLiquidTouches == SharedTypes::v1_26_0:: LiquidReaction::Blocking
285285 );
286286 }
287287 CATCH_AND_THROW
@@ -308,7 +308,14 @@ Local<Value> BlockClass::setNbt(Arguments const& args) {
308308 ->getDimension (blockPos.dim )
309309 .lock ()
310310 ->getBlockSourceFromMainChunkSource ()
311- .setBlock (blockPos.getBlockPos (), *bl, 3 , nullptr , nullptr , BlockChangeContext (false ));
311+ .setBlock (
312+ blockPos.getBlockPos (),
313+ *bl,
314+ 3 ,
315+ nullptr ,
316+ nullptr ,
317+ BlockChangeContext (StatelessBlockChangeContext::Commands)
318+ );
312319 }
313320 preloadData (blockPos.getBlockPos (), blockPos.getDimensionId ());
314321 return Boolean::newBoolean (true );
@@ -381,7 +388,8 @@ Local<Value> BlockClass::removeBlockEntity(Arguments const&) const {
381388 ->getDimension (blockPos.dim )
382389 .lock ()
383390 ->getBlockSourceFromMainChunkSource ()
384- .removeBlockEntity (blockPos.getBlockPos ())
391+ .getChunkAt (blockPos.getBlockPos ())
392+ ->removeBlockEntity (blockPos.getBlockPos ())
385393 != nullptr
386394 );
387395 }
@@ -398,8 +406,12 @@ Local<Value> BlockClass::destroyBlock(Arguments const& args) const {
398406 BlockSource& bl =
399407 ll::service::getLevel ()->getDimension (blockPos.dim ).lock ()->getBlockSourceFromMainChunkSource ();
400408 return Boolean::newBoolean (
401- ll::service::getLevel ()
402- ->destroyBlock (bl, blockPos.getBlockPos (), args[0 ].asBoolean ().value (), BlockChangeContext (false ))
409+ ll::service::getLevel ()->destroyBlock (
410+ bl,
411+ blockPos.getBlockPos (),
412+ args[0 ].asBoolean ().value (),
413+ BlockChangeContext (StatelessBlockChangeContext::Commands)
414+ )
403415 );
404416 }
405417 CATCH_AND_THROW
@@ -525,9 +537,14 @@ Local<Value> McClass::setBlock(Arguments const& args) {
525537 }
526538 BlockSource& bs =
527539 ll::service::getLevel ()->getDimension (pos.dim ).lock ()->getBlockSourceFromMainChunkSource ();
528- return Boolean::newBoolean (
529- bs.setBlock (pos.getBlockPos (), bl, 3 , nullptr , nullptr , BlockChangeContext (false ))
530- );
540+ return Boolean::newBoolean (bs.setBlock (
541+ pos.getBlockPos (),
542+ bl,
543+ 3 ,
544+ nullptr ,
545+ nullptr ,
546+ BlockChangeContext (StatelessBlockChangeContext::Commands)
547+ ));
531548 }
532549 if (IsInstanceOf<NbtCompoundClass>(block)) {
533550 // Nbt
@@ -538,17 +555,29 @@ Local<Value> McClass::setBlock(Arguments const& args) {
538555 }
539556 BlockSource& bs =
540557 ll::service::getLevel ()->getDimension (pos.dim ).lock ()->getBlockSourceFromMainChunkSource ();
541- return Boolean::newBoolean (
542- bs.setBlock (pos.getBlockPos (), bl, 3 , nullptr , nullptr , BlockChangeContext (false ))
543- );
558+ return Boolean::newBoolean (bs.setBlock (
559+ pos.getBlockPos (),
560+ bl,
561+ 3 ,
562+ nullptr ,
563+ nullptr ,
564+ BlockChangeContext (StatelessBlockChangeContext::Commands)
565+ ));
544566 }
545567 // other block object
546568 Block const * bl = BlockClass::extract (block);
547569 if (!bl) {
548570 throw WrongArgTypeException (__FUNCTION__);
549571 }
550572 BlockSource& bs = ll::service::getLevel ()->getDimension (pos.dim ).lock ()->getBlockSourceFromMainChunkSource ();
551- return Boolean::newBoolean (bs.setBlock (pos.getBlockPos (), *bl, 3 , nullptr , nullptr , BlockChangeContext (false )));
573+ return Boolean::newBoolean (bs.setBlock (
574+ pos.getBlockPos (),
575+ *bl,
576+ 3 ,
577+ nullptr ,
578+ nullptr ,
579+ BlockChangeContext (StatelessBlockChangeContext::Commands)
580+ ));
552581 }
553582 CATCH_AND_THROW
554583}
0 commit comments