72 public ::std::enable_shared_from_this<::BlockSource> {
74 LLNDAPI std::vector<Actor*> getEntities(
76 float extendDistance = 2.0f,
77 ActorType actorType = ActorType::TypeMask,
78 bool ignoreType =
false
85 LLNDAPI
bool findNextTopSolidBlockAbove(
::BlockPos& pos)
const;
87 LLAPI
void addToTickingQueue(
91 int priorityOffset = 0,
92 bool skipOverrides =
false
98 ::ll::TypedStorage<4, 4, ::std::thread::id const> mOwnerThreadID;
99 ::ll::TypedStorage<1, 1, bool const> mAllowUnpopulatedChunks;
100 ::ll::TypedStorage<1, 1, bool const> mPublicSource;
101 ::ll::TypedStorage<1, 1, bool const> mMarkChangedBlocksForSaving;
102 ::ll::TypedStorage<8, 8, ::Level&> mLevel;
103 ::ll::TypedStorage<8, 8, ::ChunkSource&> mChunkSource;
104 ::ll::TypedStorage<8, 8, ::Dimension&> mDimension;
105 ::ll::TypedStorage<2, 2, short const> mMaxHeight;
106 ::ll::TypedStorage<2, 2, short const> mMinHeight;
107 ::ll::TypedStorage<8, 24, ::std::vector<::BlockDataFetchResult<::Block>>> mTempBlockFetchResult;
108 ::ll::TypedStorage<1, 1, bool> mAllowTickingChanges;
109 ::ll::TypedStorage<1, 1, bool> mProcessingConnectionUpdates;
110 ::ll::TypedStorage<8, 40, ::std::deque<::BlockPos>> mPendingConnectionUpdates;
111 ::ll::TypedStorage<4, 12, ::BlockPos> mPlaceChunkPos;
112 ::ll::TypedStorage<8, 24, ::std::vector<::BlockSourceListener*>> mListeners;
113 ::ll::TypedStorage<1, 1, bool> mIsPersistantBlockSource;
114 ::ll::TypedStorage<8, 8, ::ChunkPos> mLastChunkPos;
115 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::LevelChunk>> mLastChunkWeakPtr;
116 ::ll::TypedStorage<8, 8, ::LevelChunk*> mLastChunkDirectPtr;
117 ::ll::TypedStorage<8, 8, ::BlockTickingQueue*> mRandomTickQueue;
118 ::ll::TypedStorage<8, 8, ::BlockTickingQueue*> mTickQueue;
119 ::ll::TypedStorage<1, 2, ::BrightnessPair const> mDefaultBrightness;
120 ::ll::TypedStorage<8, 24, ::std::vector<::Actor*>> mTempEntityList;
121 ::ll::TypedStorage<8, 24, ::std::vector<::BlockActor*>> mTempBlockEntityList;
122 ::ll::TypedStorage<8, 24, ::std::vector<::AABB>> mTempCubeList;
123 ::ll::TypedStorage<8, 64, ::std::unordered_set<::ChunkPos>> mPendingPreservedBlockEntityChunks;
128 BlockSource& operator=(BlockSource
const&);
129 BlockSource(BlockSource
const&);
135 virtual ~BlockSource() ;
137 virtual ::WeakRef<::BlockSource> getWeakRef() ;
139 virtual ::Level& getLevel() ;
141 virtual ::Dimension& getDimension()
const ;
143 virtual ::Dimension& getDimension() ;
145 virtual ::Dimension
const& getDimensionConst()
const ;
147 virtual ::DimensionType getDimensionId()
const ;
149 virtual bool shouldFireEvents(
::LevelChunk const& c)
const ;
151 virtual bool isInstaticking(
::BlockPos const& pos)
const ;
157 virtual ::LevelChunk* getChunk(
int x,
int z)
const ;
159 virtual ::LevelChunk* getChunk(
::ChunkPos const& pos)
const ;
161 virtual ::LevelChunk* getChunkAt(
::BlockPos const& pos)
const ;
163 virtual short getAboveTopSolidBlock(
167 bool iteratePastInitialBlocking
170 virtual short getAboveTopSolidBlock(
int x,
int z,
bool includeWater,
bool includeLeaves)
const ;
177 virtual ::Material
const& getMaterial(
::BlockPos const& pos)
const ;
179 virtual ::Material
const& getMaterial(
int x,
int y,
int z)
const ;
181 virtual short getMaxHeight()
const ;
183 virtual short getMinHeight()
const ;
185 virtual bool hasBorderBlock(
::BlockPos const pos)
const ;
187 virtual float getBrightness(
::BlockPos const& pos)
const ;
189 virtual bool mayPlace(
198 virtual bool canDoBlockDrops(
::Actor const* instigatingActor)
const ;
200 virtual bool canDoContainedItemDrops(
::Actor const* instigatingActor)
const ;
202 virtual bool hasChunk(
::ChunkPos const& pos,
bool serverSideOnly)
const ;
204 virtual bool hasChunksAt(
::Bounds const& bounds,
bool ignoreClientChunk)
const ;
206 virtual bool hasChunksAt(
::BlockPos const& pos,
int r,
bool ignoreClientChunk)
const ;
208 virtual bool hasChunksAt(
::AABB const& bb,
bool ignoreClientChunk)
const ;
210 virtual bool areChunksFullyLoaded(
::BlockPos const& pos,
int r)
const ;
212 virtual bool containsAnyLiquid(
::AABB const& box)
const ;
214 virtual bool containsMaterial(
::AABB const& box, ::SharedTypes::v1_26_20::MaterialType material)
const ;
216 virtual void blockEvent(
::BlockPos const& pos,
int b0,
int b1) ;
218 virtual ::gsl::span<::gsl::not_null<::Actor*>>
219 fetchEntities(
::Actor const* except,
::AABB const& bb,
bool useHitbox,
bool getDisplayEntities) ;
221 virtual ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
222 ::ActorType entityTypeId,
225 ::std::function<
bool(
::Actor*)> selector
229 fetchAABBs(::std::vector<::AABB>& shapes,
::AABB const& intersectTestBox,
bool withUnloadedChunks)
const
232 virtual ::std::vector<::AABB>& fetchAABBs(
::AABB const& intersectTestBox,
bool withUnloadedChunks) ;
234 virtual ::std::vector<::AABB>& fetchCollisionShapes(
235 ::AABB const& intersectTestBox,
236 bool withUnloadedChunks,
237 ::std::optional<::EntityContext const> entity,
238 ::std::vector<::AABB>* tempShapes
241 virtual void fetchCollisionShapes(
242 ::std::vector<::AABB>& shapes,
243 ::AABB const& intersectTestBox,
244 bool withUnloadedChunks,
246 ::std::vector<::AABB>* tempShapes
249 virtual void fetchCollisionShapesAndBlocks(
250 ::std::vector<::BlockSourceVisitor::CollisionShape>& shapes,
251 ::AABB const& intersectTestBox,
252 bool withUnloadedChunks,
254 ::std::vector<::AABB>* tempShapes
257 virtual ::AABB getTallestCollisionShape(
258 ::AABB const& intersectTestBox,
259 float* actualSurfaceOffset,
260 bool withUnloadedChunks,
264 virtual ::HitResult clip(
267 bool checkAgainstLiquid,
268 ::ShapeType shapeType,
270 bool ignoreBorderBlocks,
273 ::std::function<
bool(::BlockSource
const&,
::Block const&,
bool)>
const& shouldCheckBlock,
274 bool stopOnFirstLiquidHit
279 virtual bool isInWall(
::Vec3 const& pos)
const ;
283 virtual void fireBlockChanged(
289 ::BlockChangedEventTarget eventTarget,
296 virtual ::Block
const& getBlock(
::BlockPos const& pos)
const ;
298 virtual ::Block
const& getBlock(
::BlockPos const& pos, uint layer)
const ;
300 virtual ::BlockActor
const* getBlockEntity(
::BlockPos const& pos)
const ;
302 virtual ::Block
const& getExtraBlock(
::BlockPos const& pos)
const ;
304 virtual ::Block
const& getLiquidBlock(
::BlockPos const& pos)
const ;
306 virtual bool hasBlock(
::BlockPos const& pos)
const ;
308 virtual bool setBlock(
316 virtual bool setExtraBlock(
::BlockPos const& pos,
::Block const& block,
int updateFlags) ;
320 virtual bool isSolidBlockingBlock(
int x,
int y,
int z)
const ;
322 virtual bool isSolidBlockingBlock(
::BlockPos const& p)
const ;
324 virtual ::ILevel& getILevel()
const ;
326 virtual ::LevelSeed64 getLevelSeed64()
const ;
328 virtual ::ChunkSource& getChunkSource() ;
330 virtual bool checkBlockDestroyPermissions(
334 bool generateParticle
337 virtual bool checkBlockPermissions(
342 bool generateParticle
345 virtual void postGameEvent(
361 bool allowUnpopulatedChunks,
362 bool allowClientTickingChanges,
363 bool markChangedBlocksForSaving
379 ::gsl::span<::gsl::not_null<::Actor const*>>
const& ignoredEntities,
382 ::std::function<
bool(
::Actor*)> selector
385 MCAPI ::Brightness _getRawBrightness(
::BlockPos const& pos,
::Brightness skyDarken,
bool accountForNight)
const;
394 MCAPI
void addToRandomTickingQueue(
402 MCAPI
void addToRandomTickingQueuePercentChance(
416 MCAPI
bool canSeeSky(
::BlockPos const& pos)
const;
424 MCAPI
bool containsAnySolidBlocking(
::AABB const& box)
const;
426 MCAPI uint64 countBlocksOfType(
433 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
436 MCAPI ::std::vector<::BlockActor*> fetchBlockEntities(::BlockActorType blockActorTypeId,
::AABB const& bb)
const;
439 fetchBlockEntities(
::AABB const& bb, ::std::vector<::BlockActor*>& blockEntityList,
bool withPreservedEntities);
441 MCAPI ::gsl::span<::BlockDataFetchResult<::Block>
const>
444 MCAPI ::gsl::span<::BlockDataFetchResult<::Block>
const> fetchBlocksInCylinder(
451 MCAPI ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
452 ::gsl::span<::gsl::not_null<::Actor const*>> ignoredEntities,
455 bool getDisplayEntities,
456 ::std::function<
bool(
::Actor*)> selector
459 MCAPI ::std::vector<::Actor*>
const& fetchEntities2(::ActorType type,
::AABB const& aabb,
bool ignoreTargetType);
461 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
462 fetchPlayers(
::AABB const& bb,
::Actor const* except, ::std::function<
bool(
::Actor*)> selector);
465 MCAPI
void fetchRenderBlockActorComponents(
467 ::std::vector<::gsl::not_null<::IVanillaRenderBlockActorComponent*>>& blockEntityList,
468 bool withPreservedEntities
472 MCAPI
bool findNextTopSolidBlockUnder(
::BlockPos& pos);
476 MCAPI ::Biome
const& getBiome(
::BlockPos const& pos)
const;
479 MCNAPI ::BiomeIdLatticeBatch getBiomeIdsInBatch(
::BlockPos const& centerPos,
int areaOffset,
int gridOffset)
const;
482 MCFOLD ::BlockActor* getBlockEntity(
::BlockPos const& pos);
484 MCAPI ::BrightnessPair getBrightnessPair(
::BlockPos const& pos)
const;
486 MCAPI ::BlockPos getHeightmapPos(
::BlockPos const& xzPos)
const;
492 MCAPI
float getSeenPercent(
::Vec3 const& center,
::AABB const& bb);
494 MCAPI
int getSkylightBrightness(
::BlockPos const& pos)
const;
497 MCNAPI ::Biome
const& getSurfaceBiome(
::BlockPos const& pos)
const;
500 MCNAPI ::std::pair<bool, ::std::optional<::SubChunkPos>>
506 MCNAPI
bool hasTickInPendingTicks(
::BlockPos const& pos)
const;
508 MCNAPI
bool hasTickInPendingTicks(
::BlockPos const& pos,
::Block const& block)
const;
514 MCAPI
bool hasTickInPendingTicks(
::BlockPos const& pos, ::TickingQueueType queueType)
const;
516 MCAPI
bool hasTickInPendingTicks(
::BlockPos const& pos,
::Block const& block, ::TickingQueueType queueType)
const;
519 hasTickInPendingTicks(
::BlockPos const& pos,
::BlockType const& block, ::TickingQueueType queueType)
const;
523 MCNAPI
bool isPositionUnderSnow(
::Vec3 const& p);
535 ::std::shared_ptr<::BlockActor> blockEntity,
540 MCAPI
bool setBlockAndRetainCompatibleBlockActor(
::BlockPos const& pos,
::Block const& block,
int updateFlags);
545 MCNAPI
void setGrassColor(
int grassColor,
::BlockPos const& pos,
int flags);
570 bool allowUnpopulatedChunks,
571 bool allowClientTickingChanges,
572 bool markChangedBlocksForSaving
585 MCAPI ::WeakRef<::BlockSource> $getWeakRef();
587 MCFOLD ::Level& $getLevel();
589 MCFOLD ::Dimension& $getDimension()
const;
591 MCFOLD ::Dimension
const& $getDimensionConst()
const;
593 MCAPI ::DimensionType $getDimensionId()
const;
595 MCAPI
bool $shouldFireEvents(
::LevelChunk const& c)
const;
597 MCAPI
bool $isInstaticking(
::BlockPos const& pos)
const;
603 MCAPI ::LevelChunk* $getChunk(
int x,
int z)
const;
605 MCAPI ::LevelChunk* $getChunk(
::ChunkPos const& pos)
const;
607 MCAPI ::LevelChunk* $getChunkAt(
::BlockPos const& pos)
const;
609 MCAPI
short $getAboveTopSolidBlock(
613 bool iteratePastInitialBlocking
616 MCAPI
short $getAboveTopSolidBlock(
int x,
int z,
bool includeWater,
bool includeLeaves)
const;
622 MCAPI ::Material
const& $getMaterial(
::BlockPos const& pos)
const;
624 MCAPI ::Material
const& $getMaterial(
int x,
int y,
int z)
const;
626 MCAPI
short $getMaxHeight()
const;
628 MCAPI
short $getMinHeight()
const;
630 MCAPI
bool $hasBorderBlock(
::BlockPos const pos)
const;
632 MCAPI
float $getBrightness(
::BlockPos const& pos)
const;
634 MCAPI
bool $mayPlace(
643 MCAPI
bool $canDoBlockDrops(
::Actor const* instigatingActor)
const;
645 MCAPI
bool $canDoContainedItemDrops(
::Actor const* instigatingActor)
const;
647 MCAPI
bool $hasChunk(
::ChunkPos const& pos,
bool serverSideOnly)
const;
649 MCAPI
bool $hasChunksAt(
::Bounds const& bounds,
bool ignoreClientChunk)
const;
651 MCAPI
bool $hasChunksAt(
::BlockPos const& pos,
int r,
bool ignoreClientChunk)
const;
653 MCAPI
bool $hasChunksAt(
::AABB const& bb,
bool ignoreClientChunk)
const;
655 MCAPI
bool $areChunksFullyLoaded(
::BlockPos const& pos,
int r)
const;
657 MCAPI
bool $containsAnyLiquid(
::AABB const& box)
const;
659 MCAPI
bool $containsMaterial(
::AABB const& box, ::SharedTypes::v1_26_20::MaterialType material)
const;
661 MCAPI
void $blockEvent(
::BlockPos const& pos,
int b0,
int b1);
663 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
664 $fetchEntities(
::Actor const* except,
::AABB const& bb,
bool useHitbox,
bool getDisplayEntities);
666 MCAPI ::gsl::span<::gsl::not_null<::Actor*>> $fetchEntities(
667 ::ActorType entityTypeId,
670 ::std::function<
bool(
::Actor*)> selector
674 $fetchAABBs(::std::vector<::AABB>& shapes,
::AABB const& intersectTestBox,
bool withUnloadedChunks)
const;
676 MCAPI ::std::vector<::AABB>& $fetchAABBs(
::AABB const& intersectTestBox,
bool withUnloadedChunks);
678 MCAPI ::std::vector<::AABB>& $fetchCollisionShapes(
679 ::AABB const& intersectTestBox,
680 bool withUnloadedChunks,
681 ::std::optional<::EntityContext const> entity,
682 ::std::vector<::AABB>* tempShapes
685 MCAPI
void $fetchCollisionShapes(
686 ::std::vector<::AABB>& shapes,
687 ::AABB const& intersectTestBox,
688 bool withUnloadedChunks,
690 ::std::vector<::AABB>* tempShapes
693 MCAPI
void $fetchCollisionShapesAndBlocks(
694 ::std::vector<::BlockSourceVisitor::CollisionShape>& shapes,
695 ::AABB const& intersectTestBox,
696 bool withUnloadedChunks,
698 ::std::vector<::AABB>* tempShapes
701 MCAPI ::AABB $getTallestCollisionShape(
702 ::AABB const& intersectTestBox,
703 float* actualSurfaceOffset,
704 bool withUnloadedChunks,
708 MCAPI ::HitResult $clip(
711 bool checkAgainstLiquid,
712 ::ShapeType shapeType,
714 bool ignoreBorderBlocks,
717 ::std::function<
bool(::BlockSource
const&,
::Block const&,
bool)>
const& shouldCheckBlock,
718 bool stopOnFirstLiquidHit
723 MCAPI
bool $isInWall(
::Vec3 const& pos)
const;
727 MCAPI
void $fireBlockChanged(
733 ::BlockChangedEventTarget eventTarget,
740 MCAPI ::Block
const& $getBlock(
::BlockPos const& pos)
const;
742 MCAPI ::Block
const& $getBlock(
::BlockPos const& pos, uint layer)
const;
744 MCFOLD ::BlockActor
const* $getBlockEntity(
::BlockPos const& pos)
const;
746 MCAPI ::Block
const& $getExtraBlock(
::BlockPos const& pos)
const;
748 MCAPI ::Block
const& $getLiquidBlock(
::BlockPos const& pos)
const;
750 MCAPI
bool $hasBlock(
::BlockPos const& pos)
const;
752 MCAPI
bool $setBlock(
760 MCAPI
bool $setExtraBlock(
::BlockPos const& pos,
::Block const& block,
int updateFlags);
764 MCAPI
bool $isSolidBlockingBlock(
int x,
int y,
int z)
const;
766 MCAPI
bool $isSolidBlockingBlock(
::BlockPos const& p)
const;
768 MCFOLD ::ILevel& $getILevel()
const;
770 MCAPI ::LevelSeed64 $getLevelSeed64()
const;
772 MCFOLD ::ChunkSource& $getChunkSource();
774 MCAPI
bool $checkBlockDestroyPermissions(
778 bool generateParticle
781 MCAPI
bool $checkBlockPermissions(
786 bool generateParticle
789 MCAPI
void $postGameEvent(