68 public ::std::enable_shared_from_this<::BlockSource> {
70 LLNDAPI std::vector<Actor*> getEntities(
72 float extendDistance = 2.0f,
73 ActorType actorType = ActorType::TypeMask,
74 bool ignoreType =
false
84 ::ll::TypedStorage<4, 4, ::std::thread::id const> mOwnerThreadID;
85 ::ll::TypedStorage<1, 1, bool const> mAllowUnpopulatedChunks;
86 ::ll::TypedStorage<1, 1, bool const> mPublicSource;
87 ::ll::TypedStorage<8, 8, ::Level&> mLevel;
88 ::ll::TypedStorage<8, 8, ::ChunkSource&> mChunkSource;
89 ::ll::TypedStorage<8, 8, ::Dimension&> mDimension;
90 ::ll::TypedStorage<2, 2, short const> mMaxHeight;
91 ::ll::TypedStorage<2, 2, short const> mMinHeight;
92 ::ll::TypedStorage<8, 24, ::std::vector<::BlockDataFetchResult<::Block>>> mTempBlockFetchResult;
93 ::ll::TypedStorage<1, 1, bool> mAllowTickingChanges;
94 ::ll::TypedStorage<4, 12, ::BlockPos> mPlaceChunkPos;
95 ::ll::TypedStorage<8, 24, ::std::vector<::BlockSourceListener*>> mListeners;
96 ::ll::TypedStorage<1, 1, bool> mIsPersistantBlockSource;
97 ::ll::TypedStorage<8, 8, ::ChunkPos> mLastChunkPos;
98 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::LevelChunk>> mLastChunkWeakPtr;
99 ::ll::TypedStorage<8, 8, ::LevelChunk*> mLastChunkDirectPtr;
100 ::ll::TypedStorage<8, 8, ::BlockTickingQueue*> mRandomTickQueue;
101 ::ll::TypedStorage<8, 8, ::BlockTickingQueue*> mTickQueue;
102 ::ll::TypedStorage<1, 2, ::BrightnessPair const> mDefaultBrightness;
103 ::ll::TypedStorage<8, 24, ::std::vector<::Actor*>> mTempEntityList;
104 ::ll::TypedStorage<8, 24, ::std::vector<::BlockActor*>> mTempBlockEntityList;
105 ::ll::TypedStorage<8, 24, ::std::vector<::AABB>> mTempCubeList;
110 BlockSource& operator=(BlockSource
const&);
111 BlockSource(BlockSource
const&);
117 virtual ~BlockSource() ;
119 virtual ::WeakRef<::BlockSource> getWeakRef() ;
121 virtual ::Level& getLevel() ;
123 virtual ::Dimension& getDimension()
const ;
125 virtual ::Dimension& getDimension() ;
127 virtual ::Dimension
const& getDimensionConst()
const ;
129 virtual ::DimensionType getDimensionId()
const ;
131 virtual bool shouldFireEvents(
::LevelChunk const& c)
const ;
133 virtual bool isInstaticking(
::BlockPos const& pos)
const ;
139 virtual ::LevelChunk* getChunk(
int x,
int z)
const ;
141 virtual ::LevelChunk* getChunk(
::ChunkPos const& pos)
const ;
143 virtual ::LevelChunk* getChunkAt(
::BlockPos const& pos)
const ;
145 virtual short getAboveTopSolidBlock(
149 bool iteratePastInitialBlocking
152 virtual short getAboveTopSolidBlock(
int x,
int z,
bool includeWater,
bool includeLeaves)
const ;
154 virtual short getHeight(::std::function<
bool(
::Block const&)>
const& type,
::BlockPos const& pos)
const
157 virtual short getHeight(::std::function<
bool(
::Block const&)>
const& type,
int x,
int z)
const ;
159 virtual ::Material
const& getMaterial(
::BlockPos const& pos)
const ;
161 virtual ::Material
const& getMaterial(
int x,
int y,
int z)
const ;
163 virtual short getMaxHeight()
const ;
165 virtual short getMinHeight()
const ;
167 virtual bool hasBorderBlock(
::BlockPos const pos)
const ;
169 virtual float getBrightness(
::BlockPos const& pos)
const ;
171 virtual bool mayPlace(
180 virtual bool canDoBlockDrops()
const ;
182 virtual bool canDoContainedItemDrops()
const ;
184 virtual bool hasChunksAt(
::Bounds const& bounds,
bool ignoreClientChunk)
const ;
186 virtual bool hasChunksAt(
::BlockPos const& pos,
int r,
bool ignoreClientChunk)
const ;
188 virtual bool hasChunksAt(
::AABB const& bb,
bool ignoreClientChunk)
const ;
190 virtual bool areChunksFullyLoaded(
::BlockPos const& pos,
int r)
const ;
192 virtual bool containsAnyLiquid(
::AABB const& box)
const ;
194 virtual bool containsMaterial(
::AABB const& box, ::MaterialType material)
const ;
196 virtual void blockEvent(
::BlockPos const& pos,
int b0,
int b1) ;
198 virtual ::gsl::span<::gsl::not_null<::Actor*>>
199 fetchEntities(
::Actor const* except,
::AABB const& bb,
bool useHitbox,
bool getDisplayEntities) ;
201 virtual ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
202 ::ActorType entityTypeId,
205 ::std::function<
bool(
::Actor*)> selector
209 fetchAABBs(::std::vector<::AABB>& shapes,
::AABB const& intersectTestBox,
bool withUnloadedChunks)
const
212 virtual ::std::vector<::AABB>& fetchAABBs(
::AABB const& intersectTestBox,
bool withUnloadedChunks) ;
214 virtual ::std::vector<::AABB>& fetchCollisionShapes(
215 ::AABB const& intersectTestBox,
216 bool withUnloadedChunks,
217 ::std::optional<::EntityContext const> entity,
218 ::std::vector<::AABB>* tempShapes
221 virtual void fetchCollisionShapes(
222 ::std::vector<::AABB>& shapes,
223 ::AABB const& intersectTestBox,
224 bool withUnloadedChunks,
226 ::std::vector<::AABB>* tempShapes
229 virtual void fetchCollisionShapesAndBlocks(
230 ::std::vector<::BlockSourceVisitor::CollisionShape>& shapes,
231 ::AABB const& intersectTestBox,
232 bool withUnloadedChunks,
234 ::std::vector<::AABB>* tempShapes
237 virtual ::AABB getTallestCollisionShape(
238 ::AABB const& intersectTestBox,
239 float* actualSurfaceOffset,
240 bool withUnloadedChunks,
244 virtual ::HitResult clip(
247 bool checkAgainstLiquid,
248 ::ShapeType shapeType,
250 bool ignoreBorderBlocks,
253 ::std::function<
bool(::BlockSource
const&,
::Block const&,
bool)>
const& shouldCheckBlock,
254 bool stopOnFirstLiquidHit
259 virtual bool isInWall(
::Vec3 const& pos)
const ;
263 virtual void fireBlockChanged(
269 ::BlockChangedEventTarget,
274 virtual ::Block
const& getBlock(
::BlockPos const& pos)
const ;
276 virtual ::Block
const& getBlock(
::BlockPos const& pos, uint layer)
const ;
278 virtual ::BlockActor
const* getBlockEntity(
::BlockPos const& pos)
const ;
280 virtual ::Block
const& getExtraBlock(
::BlockPos const& pos)
const ;
282 virtual ::Block
const& getLiquidBlock(
::BlockPos const& pos)
const ;
284 virtual bool hasBlock(
::BlockPos const& pos)
const ;
286 virtual bool setBlock(
294 virtual bool setExtraBlock(
::BlockPos const& pos,
::Block const& block,
int updateFlags) ;
298 virtual bool isSolidBlockingBlock(
int x,
int y,
int z)
const ;
300 virtual bool isSolidBlockingBlock(
::BlockPos const& p)
const ;
302 virtual ::ILevel& getILevel()
const ;
304 virtual ::LevelSeed64 getLevelSeed64()
const ;
306 virtual ::ChunkSource& getChunkSource() ;
308 virtual bool checkBlockDestroyPermissions(
312 bool generateParticle
315 virtual bool checkBlockPermissions(
320 bool generateParticle
323 virtual void postGameEvent(
339 bool allowUnpopulatedChunks,
340 bool allowClientTickingChanges
343 MCAPI
void _addToTickingQueue(
348 ::TickingQueueType queueType,
352 MCAPI
void _blockChanged(
363 MCAPI
void _fetchBorderBlockCollisions(
364 ::std::vector<::AABB>& shapes,
365 ::AABB const& intersectTestBox,
370 MCAPI
void _fetchEntityHelper(
372 ::gsl::span<::gsl::not_null<::Actor const*>>
const& ignoredEntities,
377 MCAPI
void _fetchEntityHelper(
379 ::ActorType entityTypeId,
382 ::std::function<
bool(
::Actor*)> selector
385 MCAPI
bool _getBlockPermissions(
::BlockPos const& pos,
bool currentState);
388 _getRawBrightness(
::BlockPos const& pos,
::Brightness skyDarken,
bool propagate,
bool accountForNight)
const;
390 MCAPI
void _removeFromTickingQueue(
::BlockPos const& pos,
::Block const& block, ::TickingQueueType queueType);
392 MCAPI
void _updateTallestCollisionShapeWithBorderBlockCollisions(
393 ::AABB const& intersectTestBox,
396 ::Vec3 const& posToMinimizeDistanceToIfMatchingHeight,
397 float& currentDistanceSqr
400 MCAPI
void addToRandomTickingQueuePercentChance(
408 MCAPI
void addToTickingQueue(
418 MCAPI_C
void blockEvent(
int x,
int y,
int z,
int b0,
int b1);
420 MCAPI
bool canProvideSupport(
::BlockPos const& pos, uchar face, ::BlockSupportType type)
const;
422 MCAPI
bool canSeeSky(
::BlockPos const& pos)
const;
424 MCAPI
bool canSeeSkyFromBelowWater(
::BlockPos const& pos);
426 MCAPI
bool containsAnyBlockInBox(
::BoundingBox const& box, ::std::function<
bool(
::Block const&)> predicate);
430 MCAPI
bool containsAnySolidBlocking(
::AABB const& box)
const;
432 MCAPI uint64 countBlocksOfType(
439 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
442 MCAPI ::std::vector<::BlockActor*> fetchBlockEntities(::BlockActorType blockActorTypeId,
::AABB const& bb)
const;
444 MCAPI_S ::std::vector<::BlockActor*>
const& fetchBlockEntities(
::AABB const& bb);
447 fetchBlockEntities(
::AABB const& bb, ::std::vector<::BlockActor*>& blockEntityList,
bool withPreservedEntities);
451 MCAPI ::gsl::span<::BlockDataFetchResult<::Block>
const>
454 MCAPI ::gsl::span<::BlockDataFetchResult<::Block>
const>
455 fetchBlocksInBoxSorted(
::BoundingBox const& box, ::std::function<
bool(
::Block const&)> predicate);
457 MCAPI ::gsl::span<::BlockDataFetchResult<::Block>
const> fetchBlocksInCylinder(
461 ::std::function<
bool(
::Block const&)> predicate
464 MCAPI ::gsl::span<::BlockDataFetchResult<::Block>
const> fetchBlocksInCylinderSorted(
468 ::std::function<
bool(
::Block const&)> predicate
471 MCAPI ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
472 ::gsl::span<::gsl::not_null<::Actor const*>> ignoredEntities,
475 bool getDisplayEntities
478 MCAPI ::std::vector<::Actor*>
const& fetchEntities2(::ActorType type,
::AABB const& aabb,
bool ignoreTargetType);
480 MCAPI ::Actor* fetchNearestEntityOfType(
::Actor const* except,
::AABB const& bb, ::ActorType entityTypeId);
482 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
483 fetchPlayers(
::AABB const& bb,
::Actor const* except, ::std::function<
bool(
::Actor*)> selector);
485 MCAPI
bool findNextTopSolidBlockUnder(
::BlockPos& pos);
489 MCAPI ::Biome
const& getBiome(
::BlockPos const& pos)
const;
491 MCAPI_C ::BiomeIdLatticeBatch getBiomeIdsInBatch(
::BlockPos const& centerPos,
int areaOffset,
int gridOffset)
const;
493 MCAPI ::BlockActor* getBlockEntity(
::BlockPos const&);
497 MCAPI
float getSeenPercent(
::Vec3 const& center,
::AABB const& bb);
499 MCAPI
int getSkylightBrightness(
::BlockPos const& pos)
const;
501 MCAPI_C ::Biome
const& getSurfaceBiome(
::BlockPos const& pos)
const;
503 MCAPI
void getTallestCollisionShapeFromUnloadedChunksAABBs(
504 ::AABB const& intersectTestBox,
505 ::AABB& tallestCollisionShape,
506 ::Vec3 const& posToMinimizeDistanceToIfMatchingHeight,
507 float& currentDistanceSqr
510 MCAPI ::std::pair<bool, ::std::optional<::SubChunkPos>>
513 MCAPI
bool hasTickInCurrentTick(
::BlockPos const& pos, ::TickingQueueType queueType)
const;
515 MCAPI
bool hasTickInPendingTicks(
::BlockPos const& pos, ::TickingQueueType queueType)
const;
517 MCAPI
bool hasTickInPendingTicks(
::BlockPos const& pos,
::Block const& block, ::TickingQueueType queueType)
const;
520 hasTickInPendingTicks(
::BlockPos const& pos,
::BlockType const& block, ::TickingQueueType queueType)
const;
522 MCAPI
bool hasUntickedNeighborChunk(
::ChunkPos const& pos,
int chunkRadius)
const;
524 MCAPI_C
bool isEmptyBlock(
::BlockPos const& pos)
const;
526 MCAPI
bool isNearUnloadedChunks(
::ChunkPos const& pos)
const;
528 MCAPI_C
bool isPositionUnderSnow(
::Vec3 const& p);
530 MCAPI
bool isTouchingMaterial(
::BlockPos const& pos, ::MaterialType type)
const;
532 MCAPI
bool isWithinHeightLimits(
int y)
const;
539 MCAPI ::std::shared_ptr<::BlockActor> removeBlockEntity(
::BlockPos const& blockPos);
545 ::std::shared_ptr<::BlockActor> blockEntity,
550 MCAPI
bool setBlockAndRetainCompatibleBlockActor(
::BlockPos const& pos,
::Block const& block,
int updateFlags);
552 MCAPI
void setBorderBlock(
::BlockPos const& pos,
bool val);
556 MCAPI
bool setLiquidBlock(
::BlockPos const& pos,
::Block const& block,
bool useExtraData,
int updateFlags);
558 MCAPI_C ::Biome
const* tryGetBiome(
::BlockPos const& pos)
const;
560 MCAPI
void updateConnectionsAt(
::BlockPos const& pos);
562 MCAPI
void updateNeighborsAt(
::BlockPos const& pos);
564 MCAPI
void updateNeighborsAtExceptFromFacing(
::BlockPos const& pos,
int skipFacing);
574 MCFOLD static ::Block
const& getEmptyBlock();
585 bool allowUnpopulatedChunks,
586 bool allowClientTickingChanges
599 MCAPI ::WeakRef<::BlockSource> $getWeakRef();
601 MCFOLD ::Level& $getLevel();
603 MCFOLD ::Dimension& $getDimension()
const;
605 MCFOLD ::Dimension
const& $getDimensionConst()
const;
607 MCAPI ::DimensionType $getDimensionId()
const;
609 MCAPI
bool $shouldFireEvents(
::LevelChunk const& c)
const;
611 MCAPI
bool $isInstaticking(
::BlockPos const& pos)
const;
617 MCAPI ::LevelChunk* $getChunk(
int x,
int z)
const;
619 MCAPI ::LevelChunk* $getChunk(
::ChunkPos const& pos)
const;
621 MCAPI ::LevelChunk* $getChunkAt(
::BlockPos const& pos)
const;
623 MCAPI
short $getAboveTopSolidBlock(
627 bool iteratePastInitialBlocking
630 MCAPI
short $getAboveTopSolidBlock(
int x,
int z,
bool includeWater,
bool includeLeaves)
const;
632 MCAPI
short $getHeight(::std::function<
bool(
::Block const&)>
const& type,
::BlockPos const& pos)
const;
634 MCAPI
short $getHeight(::std::function<
bool(
::Block const&)>
const& type,
int x,
int z)
const;
636 MCAPI ::Material
const& $getMaterial(
::BlockPos const& pos)
const;
638 MCAPI ::Material
const& $getMaterial(
int x,
int y,
int z)
const;
640 MCAPI
short $getMaxHeight()
const;
642 MCAPI
short $getMinHeight()
const;
644 MCAPI
bool $hasBorderBlock(
::BlockPos const pos)
const;
646 MCAPI
float $getBrightness(
::BlockPos const& pos)
const;
648 MCAPI
bool $mayPlace(
657 MCAPI
bool $canDoBlockDrops()
const;
659 MCAPI
bool $canDoContainedItemDrops()
const;
661 MCAPI
bool $hasChunksAt(
::Bounds const& bounds,
bool ignoreClientChunk)
const;
663 MCAPI
bool $hasChunksAt(
::BlockPos const& pos,
int r,
bool ignoreClientChunk)
const;
665 MCAPI
bool $hasChunksAt(
::AABB const& bb,
bool ignoreClientChunk)
const;
667 MCAPI
bool $areChunksFullyLoaded(
::BlockPos const& pos,
int r)
const;
669 MCAPI
bool $containsAnyLiquid(
::AABB const& box)
const;
671 MCAPI
bool $containsMaterial(
::AABB const& box, ::MaterialType material)
const;
673 MCAPI
void $blockEvent(
::BlockPos const& pos,
int b0,
int b1);
675 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
676 $fetchEntities(
::Actor const* except,
::AABB const& bb,
bool useHitbox,
bool getDisplayEntities);
678 MCAPI ::gsl::span<::gsl::not_null<::Actor*>> $fetchEntities(
679 ::ActorType entityTypeId,
682 ::std::function<
bool(
::Actor*)> selector
686 $fetchAABBs(::std::vector<::AABB>& shapes,
::AABB const& intersectTestBox,
bool withUnloadedChunks)
const;
688 MCAPI ::std::vector<::AABB>& $fetchAABBs(
::AABB const& intersectTestBox,
bool withUnloadedChunks);
690 MCAPI ::std::vector<::AABB>& $fetchCollisionShapes(
691 ::AABB const& intersectTestBox,
692 bool withUnloadedChunks,
693 ::std::optional<::EntityContext const> entity,
694 ::std::vector<::AABB>* tempShapes
697 MCAPI
void $fetchCollisionShapes(
698 ::std::vector<::AABB>& shapes,
699 ::AABB const& intersectTestBox,
700 bool withUnloadedChunks,
702 ::std::vector<::AABB>* tempShapes
705 MCAPI
void $fetchCollisionShapesAndBlocks(
706 ::std::vector<::BlockSourceVisitor::CollisionShape>& shapes,
707 ::AABB const& intersectTestBox,
708 bool withUnloadedChunks,
710 ::std::vector<::AABB>* tempShapes
713 MCAPI ::AABB $getTallestCollisionShape(
714 ::AABB const& intersectTestBox,
715 float* actualSurfaceOffset,
716 bool withUnloadedChunks,
720 MCAPI ::HitResult $clip(
723 bool checkAgainstLiquid,
724 ::ShapeType shapeType,
726 bool ignoreBorderBlocks,
729 ::std::function<
bool(::BlockSource
const&,
::Block const&,
bool)>
const& shouldCheckBlock,
730 bool stopOnFirstLiquidHit
735 MCAPI
bool $isInWall(
::Vec3 const& pos)
const;
739 MCAPI ::Block
const& $getBlock(
::BlockPos const& pos)
const;
741 MCAPI ::Block
const& $getBlock(
::BlockPos const& pos, uint layer)
const;
743 MCFOLD ::BlockActor
const* $getBlockEntity(
::BlockPos const& pos)
const;
745 MCAPI ::Block
const& $getExtraBlock(
::BlockPos const& pos)
const;
747 MCAPI ::Block
const& $getLiquidBlock(
::BlockPos const& pos)
const;
749 MCAPI
bool $hasBlock(
::BlockPos const& pos)
const;
751 MCAPI
bool $setBlock(
759 MCAPI
bool $setExtraBlock(
::BlockPos const& pos,
::Block const& block,
int updateFlags);
763 MCAPI
bool $isSolidBlockingBlock(
int x,
int y,
int z)
const;
765 MCAPI
bool $isSolidBlockingBlock(
::BlockPos const& p)
const;
767 MCFOLD ::ILevel& $getILevel()
const;
769 MCAPI ::LevelSeed64 $getLevelSeed64()
const;
771 MCFOLD ::ChunkSource& $getChunkSource();
773 MCAPI
bool $checkBlockDestroyPermissions(
777 bool generateParticle
780 MCAPI
bool $checkBlockPermissions(
785 bool generateParticle
788 MCAPI
void $postGameEvent(
801 MCAPI
static void** $vftable();