67 public ::std::enable_shared_from_this<::BlockSource> {
69 LLNDAPI std::vector<Actor*> getEntities(
71 float extendDistance = 2.0f,
72 ActorType actorType = ActorType::TypeMask,
73 bool ignoreType =
false
83 ::ll::TypedStorage<4, 4, ::std::thread::id const> mOwnerThreadID;
84 ::ll::TypedStorage<1, 1, bool const> mAllowUnpopulatedChunks;
85 ::ll::TypedStorage<1, 1, bool const> mPublicSource;
86 ::ll::TypedStorage<1, 1, bool> mCheckValidity;
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<8, 8, ::Tick> mCurrentTickForValidityChecks;
97 ::ll::TypedStorage<1, 1, bool> mIsPersistantBlockSource;
98 ::ll::TypedStorage<8, 8, ::ChunkPos> mLastChunkPos;
99 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::LevelChunk>> mLastChunkWeakPtr;
100 ::ll::TypedStorage<8, 8, ::LevelChunk*> mLastChunkDirectPtr;
101 ::ll::TypedStorage<8, 8, ::BlockTickingQueue*> mRandomTickQueue;
102 ::ll::TypedStorage<8, 8, ::BlockTickingQueue*> mTickQueue;
103 ::ll::TypedStorage<1, 2, ::BrightnessPair const> mDefaultBrightness;
104 ::ll::TypedStorage<8, 24, ::std::vector<::Actor*>> mTempEntityList;
105 ::ll::TypedStorage<8, 24, ::std::vector<::BlockActor*>> mTempBlockEntityList;
106 ::ll::TypedStorage<8, 24, ::std::vector<::AABB>> mTempCubeList;
122 virtual ::WeakRef<::BlockSource> getWeakRef() ;
125 virtual ::Level& getLevel() ;
128 virtual ::Dimension& getDimension()
const ;
131 virtual ::Dimension& getDimension() ;
134 virtual ::Dimension
const& getDimensionConst()
const ;
137 virtual ::DimensionType getDimensionId()
const ;
140 virtual bool isInstaticking(
::BlockPos const& pos)
const ;
149 virtual ::LevelChunk* getChunk(
int x,
int z)
const ;
152 virtual ::LevelChunk* getChunk(
::ChunkPos const& pos)
const ;
155 virtual ::LevelChunk* getChunkAt(
::BlockPos const& pos)
const ;
158 virtual short getAboveTopSolidBlock(
162 bool iteratePastInitialBlocking
166 virtual short getAboveTopSolidBlock(
int x,
int z,
bool includeWater,
bool includeLeaves)
const ;
169 virtual short getHeight(::std::function<
bool(
::Block const&)>
const& type,
::BlockPos const& pos)
const
173 virtual short getHeight(::std::function<
bool(
::Block const&)>
const& type,
int x,
int z)
const ;
176 virtual ::Material
const& getMaterial(
::BlockPos const& pos)
const ;
179 virtual ::Material
const& getMaterial(
int x,
int y,
int z)
const ;
182 virtual short getMaxHeight()
const ;
185 virtual short getMinHeight()
const ;
188 virtual bool hasBorderBlock(
::BlockPos const pos)
const ;
191 virtual float getBrightness(
::BlockPos const& pos)
const ;
194 virtual ::Block
const& getLiquidBlock(
::BlockPos const& p)
const ;
197 virtual ::Block
const& getExtraBlock(
::BlockPos const& p)
const ;
200 virtual bool mayPlace(
210 virtual bool hasBlock(
::BlockPos const& pos)
const ;
213 virtual bool canDoBlockDrops()
const ;
216 virtual bool canDoContainedItemDrops()
const ;
219 virtual bool hasChunksAt(
::Bounds const& bounds,
bool ignoreClientChunk)
const ;
222 virtual bool hasChunksAt(
::BlockPos const& pos,
int r,
bool ignoreClientChunk)
const ;
225 virtual bool hasChunksAt(
::AABB const& bb,
bool ignoreClientChunk)
const ;
228 virtual bool areChunksFullyLoaded(
::BlockPos const& pos,
int r)
const ;
231 virtual bool containsAnyLiquid(
::AABB const& box)
const ;
234 virtual bool containsMaterial(
::AABB const& box, ::MaterialType material)
const ;
237 virtual ::BlockActor
const* getBlockEntity(
::BlockPos const& pos)
const ;
240 virtual ::gsl::span<::gsl::not_null<::Actor*>>
241 fetchEntities(
::Actor const* except,
::AABB const& bb,
bool useHitbox,
bool getDisplayEntities) ;
244 virtual ::gsl::span<::gsl::not_null<::Actor*>>
249 fetchAABBs(::std::vector<::AABB>& shapes,
::AABB const& intersectTestBox,
bool withUnloadedChunks)
const
253 virtual ::std::vector<::AABB>& fetchAABBs(
::AABB const& intersectTestBox,
bool withUnloadedChunks) ;
256 virtual ::std::vector<::AABB>& fetchCollisionShapes(
257 ::AABB const& intersectTestBox,
258 bool withUnloadedChunks,
259 ::std::optional<::EntityContext const> entity,
260 ::std::vector<::AABB>* tempShapes
264 virtual void fetchCollisionShapes(
265 ::std::vector<::AABB>& shapes,
266 ::AABB const& intersectTestBox,
267 bool withUnloadedChunks,
269 ::std::vector<::AABB>* tempShapes
273 virtual void fetchCollisionShapesAndBlocks(
274 ::std::vector<::BlockSourceVisitor::CollisionShape>& shapes,
275 ::AABB const& intersectTestBox,
276 bool withUnloadedChunks,
278 ::std::vector<::AABB>* tempShapes
282 virtual ::AABB getTallestCollisionShape(
283 ::AABB const& intersectTestBox,
284 float* actualSurfaceOffset,
285 bool withUnloadedChunks,
290 virtual ::HitResult clip(
293 bool checkAgainstLiquid,
294 ::ShapeType shapeType,
296 bool ignoreBorderBlocks,
306 virtual bool isInWall(
::Vec3 const& pos)
const ;
309 virtual bool isUnderWater(
::Vec3 const& pos,
::Block const& block)
const ;
312 virtual ::Block
const& getBlock(
int x,
int y,
int z)
const ;
315 virtual ::Block
const& getBlock(
::BlockPos const& pos)
const ;
318 virtual ::Block
const& getBlock(
::BlockPos const& pos, uint layer)
const ;
321 virtual bool setBlock(
330 virtual bool isSolidBlockingBlock(
int x,
int y,
int z)
const ;
333 virtual bool isSolidBlockingBlock(
::BlockPos const& p)
const ;
336 virtual bool removeBlock(
::BlockPos const& pos) ;
339 virtual ::ILevel& getILevel()
const ;
342 virtual ::LevelSeed64 getLevelSeed64()
const ;
345 virtual ::ChunkSource& getChunkSource() ;
348 virtual bool checkBlockPermissions(
353 bool generateParticle
357 virtual float getVisualLiquidHeight(
::Vec3 const& pos)
const ;
360 virtual void postGameEvent(
368 virtual void updateCheckForValidityState(
bool checkForValidity) ;
379 bool allowUnpopulatedChunks,
380 bool allowClientTickingChanges
383 MCAPI
void _addToTickingQueue(
388 ::TickingQueueType queueType,
392 MCAPI
void _blockChanged(
402 MCAPI
void _fetchBorderBlockCollisions(
403 ::std::vector<::AABB>& shapes,
404 ::AABB const& intersectTestBox,
409 MCAPI
void _fetchEntityHelper(
411 ::gsl::span<::gsl::not_null<::Actor const*>>
const& ignoredEntities,
416 MCAPI
void _fetchEntityHelper(
418 ::ActorType entityTypeId,
421 ::std::function<
bool(
::Actor*)> selector
424 MCAPI
bool _getBlockPermissions(
::BlockPos const& pos,
bool currentState);
427 _getRawBrightness(
::BlockPos const& pos,
::Brightness skyDarken,
bool propagate,
bool accountForNight)
const;
429 MCAPI
void _removeFromTickingQueue(
::BlockPos const& pos,
::Block const& block, ::TickingQueueType queueType);
431 MCAPI
void _updateTallestCollisionShapeWithBorderBlockCollisions(
432 ::AABB const& intersectTestBox,
435 ::Vec3 const& posToMinimizeDistanceToIfMatchingHeight,
436 float& currentDistanceSqr
439 MCAPI
void addToRandomTickingQueuePercentChance(
447 MCAPI
void addToTickingQueue(
457 MCAPI
void blockEvent(
::BlockPos const& pos,
int b0,
int b1);
459 MCAPI
bool canProvideSupport(
::BlockPos const& pos, uchar face, ::BlockSupportType type)
const;
461 MCAPI
bool canSeeSky(
::BlockPos const& pos)
const;
463 MCAPI
bool canSeeSkyFromBelowWater(
::BlockPos const& pos);
465 MCAPI
bool checkBlockDestroyPermissions(
469 bool generateParticle
472 MCAPI
bool containsAnyBlockInBox(
::BoundingBox const& box, ::std::function<
bool(
::Block const&)> predicate);
476 MCAPI
bool containsAnySolidBlocking(
::AABB const& box)
const;
478 MCAPI uint64 countBlocksOfType(
485 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
488 MCAPI ::std::vector<::BlockActor*> fetchBlockEntities(::BlockActorType blockActorTypeId,
::AABB const& bb)
const;
490 MCAPI ::std::vector<::BlockActor*>
const& fetchBlockEntities(
::AABB const& bb);
494 MCAPI ::gsl::span<::BlockDataFetchResult<::Block>
const>
497 MCAPI ::gsl::span<::BlockDataFetchResult<::Block>
const>
498 fetchBlocksInBoxSorted(
::BoundingBox const& box, ::std::function<
bool(
::Block const&)> predicate);
500 MCAPI ::gsl::span<::BlockDataFetchResult<::Block>
const> fetchBlocksInCylinder(
504 ::std::function<
bool(
::Block const&)> predicate
507 MCAPI ::gsl::span<::BlockDataFetchResult<::Block>
const> fetchBlocksInCylinderSorted(
511 ::std::function<
bool(
::Block const&)> predicate
514 MCAPI ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
515 ::gsl::span<::gsl::not_null<::Actor const*>> ignoredEntities,
518 bool getDisplayEntities
521 MCAPI ::std::vector<::Actor*>
const& fetchEntities2(::ActorType type,
::AABB const& aabb,
bool ignoreTargetType);
523 MCAPI ::Actor* fetchNearestEntityOfType(
::Actor const* except,
::AABB const& bb, ::ActorType entityTypeId);
525 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
526 fetchPlayers(
::AABB const& bb,
::Actor const* except, ::std::function<
bool(
::Actor*)> selector);
528 MCAPI
bool findNextTopSolidBlockUnder(
::BlockPos& pos);
530 MCAPI
void fireBlockChanged(
536 ::BlockChangedEventTarget eventTarget,
543 MCAPI ::Biome
const& getBiome(
::BlockPos const& pos)
const;
545 MCAPI ::BlockActor* getBlockEntity(
::BlockPos const&);
547 MCAPI ::BrightnessPair getBrightnessPair(
::BlockPos const& pos)
const;
549 MCAPI
float getSeenPercent(
::Vec3 const& center,
::AABB const& bb);
551 MCAPI
void getTallestCollisionShapeFromUnloadedChunksAABBs(
552 ::AABB const& intersectTestBox,
553 ::AABB& tallestCollisionShape,
554 ::Vec3 const& posToMinimizeDistanceToIfMatchingHeight,
555 float& currentDistanceSqr
558 MCAPI
bool hasChunksAt(
::BlockPos const& min,
::BlockPos const& max,
bool ignoreClientChunk)
const;
560 MCAPI ::std::pair<bool, ::std::optional<::SubChunkPos>>
563 MCAPI
bool hasTickInCurrentTick(
::BlockPos const& pos, ::TickingQueueType queueType)
const;
565 MCAPI
bool hasTickInPendingTicks(
::BlockPos const& pos, ::TickingQueueType queueType)
const;
567 MCAPI
bool hasTickInPendingTicks(
::BlockPos const& pos,
::Block const& block, ::TickingQueueType queueType)
const;
572 MCAPI
bool hasUntickedNeighborChunk(
::ChunkPos const& pos,
int chunkRadius)
const;
574 MCAPI
bool isEmptyBlock(
int x,
int y,
int z);
576 MCAPI
bool isNearUnloadedChunks(
::ChunkPos const& pos)
const;
578 MCAPI
bool isTouchingMaterial(
::BlockPos const& pos, ::MaterialType type)
const;
580 MCAPI
bool isUnobstructedByEntities(
::AABB const& aabb,
::Actor const* ignoreEntity);
582 MCAPI
bool isWithinHeightLimits(
int y)
const;
589 MCAPI
bool removeBlock(
int x,
int y,
int z);
595 ::std::shared_ptr<::BlockActor> blockEntity,
600 MCAPI
bool setBlock(
int x,
int y,
int z,
::Block const& block,
int updateFlags,
::Actor* blockChangeSource);
602 MCAPI
void setBorderBlock(
::BlockPos const& pos,
bool val);
604 MCAPI
bool setExtraBlock(
::BlockPos const& p,
::Block const& block,
int updateFlags);
608 MCAPI
void updateNeighborsAt(
::BlockPos const& pos);
627 bool allowUnpopulatedChunks,
628 bool allowClientTickingChanges
641 MCAPI ::WeakRef<::BlockSource> $getWeakRef();
643 MCFOLD ::Level& $getLevel();
645 MCFOLD ::Dimension& $getDimension()
const;
647 MCFOLD ::Dimension& $getDimension();
649 MCFOLD ::Dimension
const& $getDimensionConst()
const;
651 MCAPI ::DimensionType $getDimensionId()
const;
653 MCAPI
bool $isInstaticking(
::BlockPos const& pos)
const;
659 MCAPI ::LevelChunk* $getChunk(
int x,
int z)
const;
661 MCAPI ::LevelChunk* $getChunk(
::ChunkPos const& pos)
const;
663 MCAPI ::LevelChunk* $getChunkAt(
::BlockPos const& pos)
const;
665 MCAPI
short $getAboveTopSolidBlock(
669 bool iteratePastInitialBlocking
672 MCAPI
short $getAboveTopSolidBlock(
int x,
int z,
bool includeWater,
bool includeLeaves)
const;
674 MCAPI
short $getHeight(::std::function<
bool(
::Block const&)>
const& type,
::BlockPos const& pos)
const;
676 MCAPI
short $getHeight(::std::function<
bool(
::Block const&)>
const& type,
int x,
int z)
const;
678 MCAPI ::Material
const& $getMaterial(
::BlockPos const& pos)
const;
680 MCAPI ::Material
const& $getMaterial(
int x,
int y,
int z)
const;
682 MCAPI
short $getMaxHeight()
const;
684 MCAPI
short $getMinHeight()
const;
686 MCAPI
bool $hasBorderBlock(
::BlockPos const pos)
const;
688 MCAPI
float $getBrightness(
::BlockPos const& pos)
const;
690 MCAPI ::Block
const& $getLiquidBlock(
::BlockPos const& p)
const;
692 MCAPI ::Block
const& $getExtraBlock(
::BlockPos const& p)
const;
694 MCAPI
bool $mayPlace(
703 MCAPI
bool $hasBlock(
::BlockPos const& pos)
const;
705 MCAPI
bool $canDoBlockDrops()
const;
707 MCAPI
bool $canDoContainedItemDrops()
const;
709 MCAPI
bool $hasChunksAt(
::Bounds const& bounds,
bool ignoreClientChunk)
const;
711 MCAPI
bool $hasChunksAt(
::BlockPos const& pos,
int r,
bool ignoreClientChunk)
const;
713 MCAPI
bool $hasChunksAt(
::AABB const& bb,
bool ignoreClientChunk)
const;
715 MCAPI
bool $areChunksFullyLoaded(
::BlockPos const& pos,
int r)
const;
717 MCAPI
bool $containsAnyLiquid(
::AABB const& box)
const;
719 MCAPI
bool $containsMaterial(
::AABB const& box, ::MaterialType material)
const;
721 MCFOLD ::BlockActor
const* $getBlockEntity(
::BlockPos const& pos)
const;
723 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
724 $fetchEntities(
::Actor const* except,
::AABB const& bb,
bool useHitbox,
bool getDisplayEntities);
727 $fetchAABBs(::std::vector<::AABB>& shapes,
::AABB const& intersectTestBox,
bool withUnloadedChunks)
const;
729 MCAPI ::std::vector<::AABB>& $fetchAABBs(
::AABB const& intersectTestBox,
bool withUnloadedChunks);
731 MCAPI ::std::vector<::AABB>& $fetchCollisionShapes(
732 ::AABB const& intersectTestBox,
733 bool withUnloadedChunks,
734 ::std::optional<::EntityContext const> entity,
735 ::std::vector<::AABB>* tempShapes
738 MCAPI
void $fetchCollisionShapes(
739 ::std::vector<::AABB>& shapes,
740 ::AABB const& intersectTestBox,
741 bool withUnloadedChunks,
743 ::std::vector<::AABB>* tempShapes
746 MCAPI
void $fetchCollisionShapesAndBlocks(
747 ::std::vector<::BlockSourceVisitor::CollisionShape>& shapes,
748 ::AABB const& intersectTestBox,
749 bool withUnloadedChunks,
751 ::std::vector<::AABB>* tempShapes
754 MCAPI ::AABB $getTallestCollisionShape(
755 ::AABB const& intersectTestBox,
756 float* actualSurfaceOffset,
757 bool withUnloadedChunks,
761 MCAPI ::HitResult $clip(
764 bool checkAgainstLiquid,
765 ::ShapeType shapeType,
767 bool ignoreBorderBlocks,
775 MCAPI
bool $isInWall(
::Vec3 const& pos)
const;
777 MCAPI
bool $isUnderWater(
::Vec3 const& pos,
::Block const& block)
const;
779 MCAPI ::Block
const& $getBlock(
int x,
int y,
int z)
const;
781 MCAPI ::Block
const& $getBlock(
::BlockPos const& pos)
const;
783 MCAPI ::Block
const& $getBlock(
::BlockPos const& pos, uint layer)
const;
785 MCAPI
bool $setBlock(
793 MCAPI
bool $isSolidBlockingBlock(
int x,
int y,
int z)
const;
795 MCAPI
bool $isSolidBlockingBlock(
::BlockPos const& p)
const;
797 MCAPI
bool $removeBlock(
::BlockPos const& pos);
799 MCFOLD ::ILevel& $getILevel()
const;
801 MCAPI ::LevelSeed64 $getLevelSeed64()
const;
803 MCFOLD ::ChunkSource& $getChunkSource();
805 MCAPI
bool $checkBlockPermissions(
810 bool generateParticle
813 MCFOLD
float $getVisualLiquidHeight(
::Vec3 const& pos)
const;
815 MCAPI
void $postGameEvent(
822 MCAPI
void $updateCheckForValidityState(
bool checkForValidity);