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
88 ::ll::TypedStorage<4, 4, ::std::thread::id const> mOwnerThreadID;
89 ::ll::TypedStorage<1, 1, bool const> mAllowUnpopulatedChunks;
90 ::ll::TypedStorage<1, 1, bool const> mPublicSource;
91 ::ll::TypedStorage<8, 8, ::Level&> mLevel;
92 ::ll::TypedStorage<8, 8, ::ChunkSource&> mChunkSource;
93 ::ll::TypedStorage<8, 8, ::Dimension&> mDimension;
94 ::ll::TypedStorage<2, 2, short const> mMaxHeight;
95 ::ll::TypedStorage<2, 2, short const> mMinHeight;
96 ::ll::TypedStorage<8, 24, ::std::vector<::BlockDataFetchResult<::Block>>> mTempBlockFetchResult;
97 ::ll::TypedStorage<1, 1, bool> mAllowTickingChanges;
98 ::ll::TypedStorage<4, 12, ::BlockPos> mPlaceChunkPos;
99 ::ll::TypedStorage<8, 24, ::std::vector<::BlockSourceListener*>> mListeners;
100 ::ll::TypedStorage<1, 1, bool> mIsPersistantBlockSource;
101 ::ll::TypedStorage<8, 8, ::ChunkPos> mLastChunkPos;
102 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::LevelChunk>> mLastChunkWeakPtr;
103 ::ll::TypedStorage<8, 8, ::LevelChunk*> mLastChunkDirectPtr;
104 ::ll::TypedStorage<8, 8, ::BlockTickingQueue*> mRandomTickQueue;
105 ::ll::TypedStorage<8, 8, ::BlockTickingQueue*> mTickQueue;
106 ::ll::TypedStorage<1, 2, ::BrightnessPair const> mDefaultBrightness;
107 ::ll::TypedStorage<8, 24, ::std::vector<::Actor*>> mTempEntityList;
108 ::ll::TypedStorage<8, 24, ::std::vector<::BlockActor*>> mTempBlockEntityList;
109 ::ll::TypedStorage<8, 24, ::std::vector<::AABB>> mTempCubeList;
114 BlockSource& operator=(BlockSource
const&);
115 BlockSource(BlockSource
const&);
121 virtual ~BlockSource() ;
123 virtual ::WeakRef<::BlockSource> getWeakRef() ;
125 virtual ::Level& getLevel() ;
127 virtual ::Dimension& getDimension()
const ;
129 virtual ::Dimension& getDimension() ;
131 virtual ::Dimension
const& getDimensionConst()
const ;
133 virtual ::DimensionType getDimensionId()
const ;
135 virtual bool shouldFireEvents(
::LevelChunk const& c)
const ;
137 virtual bool isInstaticking(
::BlockPos const& pos)
const ;
143 virtual ::LevelChunk* getChunk(
int x,
int z)
const ;
145 virtual ::LevelChunk* getChunk(
::ChunkPos const& pos)
const ;
147 virtual ::LevelChunk* getChunkAt(
::BlockPos const& pos)
const ;
149 virtual short getAboveTopSolidBlock(
153 bool iteratePastInitialBlocking
156 virtual short getAboveTopSolidBlock(
int x,
int z,
bool includeWater,
bool includeLeaves)
const ;
163 virtual ::Material
const& getMaterial(
::BlockPos const& pos)
const ;
165 virtual ::Material
const& getMaterial(
int x,
int y,
int z)
const ;
167 virtual short getMaxHeight()
const ;
169 virtual short getMinHeight()
const ;
171 virtual bool hasBorderBlock(
::BlockPos const pos)
const ;
173 virtual float getBrightness(
::BlockPos const& pos)
const ;
175 virtual bool mayPlace(
184 virtual bool canDoBlockDrops()
const ;
186 virtual bool canDoContainedItemDrops()
const ;
188 virtual bool hasChunksAt(
::Bounds const& bounds,
bool ignoreClientChunk)
const ;
190 virtual bool hasChunksAt(
::BlockPos const& pos,
int r,
bool ignoreClientChunk)
const ;
192 virtual bool hasChunksAt(
::AABB const& bb,
bool ignoreClientChunk)
const ;
194 virtual bool areChunksFullyLoaded(
::BlockPos const& pos,
int r)
const ;
196 virtual bool containsAnyLiquid(
::AABB const& box)
const ;
198 virtual bool containsMaterial(
::AABB const& box, ::SharedTypes::v1_26_20::MaterialType material)
const ;
200 virtual void blockEvent(
::BlockPos const& pos,
int b0,
int b1) ;
202 virtual ::gsl::span<::gsl::not_null<::Actor*>>
203 fetchEntities(
::Actor const* except,
::AABB const& bb,
bool useHitbox,
bool getDisplayEntities) ;
205 virtual ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
206 ::ActorType entityTypeId,
209 ::std::function<
bool(
::Actor*)> selector
213 fetchAABBs(::std::vector<::AABB>& shapes,
::AABB const& intersectTestBox,
bool withUnloadedChunks)
const
216 virtual ::std::vector<::AABB>& fetchAABBs(
::AABB const& intersectTestBox,
bool withUnloadedChunks) ;
218 virtual ::std::vector<::AABB>& fetchCollisionShapes(
219 ::AABB const& intersectTestBox,
220 bool withUnloadedChunks,
221 ::std::optional<::EntityContext const> entity,
222 ::std::vector<::AABB>* tempShapes
225 virtual void fetchCollisionShapes(
226 ::std::vector<::AABB>& shapes,
227 ::AABB const& intersectTestBox,
228 bool withUnloadedChunks,
230 ::std::vector<::AABB>* tempShapes
233 virtual void fetchCollisionShapesAndBlocks(
234 ::std::vector<::BlockSourceVisitor::CollisionShape>& shapes,
235 ::AABB const& intersectTestBox,
236 bool withUnloadedChunks,
238 ::std::vector<::AABB>* tempShapes
241 virtual ::AABB getTallestCollisionShape(
242 ::AABB const& intersectTestBox,
243 float* actualSurfaceOffset,
244 bool withUnloadedChunks,
248 virtual ::HitResult clip(
251 bool checkAgainstLiquid,
252 ::ShapeType shapeType,
254 bool ignoreBorderBlocks,
257 ::std::function<
bool(::BlockSource
const&,
::Block const&,
bool)>
const& shouldCheckBlock,
258 bool stopOnFirstLiquidHit
263 virtual bool isInWall(
::Vec3 const& pos)
const ;
267 virtual void fireBlockChanged(
273 ::BlockChangedEventTarget eventTarget,
278 virtual ::Block
const& getBlock(
::BlockPos const& pos)
const ;
280 virtual ::Block
const& getBlock(
::BlockPos const& pos, uint layer)
const ;
282 virtual ::BlockActor
const* getBlockEntity(
::BlockPos const& pos)
const ;
284 virtual ::Block
const& getExtraBlock(
::BlockPos const& pos)
const ;
286 virtual ::Block
const& getLiquidBlock(
::BlockPos const& pos)
const ;
288 virtual bool hasBlock(
::BlockPos const& pos)
const ;
290 virtual bool setBlock(
298 virtual bool setExtraBlock(
::BlockPos const& pos,
::Block const& block,
int updateFlags) ;
302 virtual bool isSolidBlockingBlock(
int x,
int y,
int z)
const ;
304 virtual bool isSolidBlockingBlock(
::BlockPos const& p)
const ;
306 virtual ::ILevel& getILevel()
const ;
308 virtual ::LevelSeed64 getLevelSeed64()
const ;
310 virtual ::ChunkSource& getChunkSource() ;
312 virtual bool checkBlockDestroyPermissions(
316 bool generateParticle
319 virtual bool checkBlockPermissions(
324 bool generateParticle
327 virtual void postGameEvent(
338 MCAPI BlockSource(
::ChunkSource& source,
bool publicSource,
bool allowUnpopulatedChunks);
345 bool allowUnpopulatedChunks,
346 bool allowClientTickingChanges
349 MCAPI
void _blockChanged(
360 MCAPI
void _fetchBorderBlockCollisions(
361 ::std::vector<::AABB>& shapes,
362 ::AABB const& intersectTestBox,
367 MCAPI
void _fetchEntityHelper(
369 ::gsl::span<::gsl::not_null<::Actor const*>>
const& ignoredEntities,
374 MCAPI
void _fetchEntityHelper(
376 ::ActorType entityTypeId,
379 ::std::function<
bool(
::Actor*)> selector
382 MCAPI
bool _getBlockPermissions(
::BlockPos const& pos,
bool currentState);
385 _getRawBrightness(
::BlockPos const& pos,
::Brightness skyDarken,
bool propagate,
bool accountForNight)
const;
387 MCAPI
bool _hasChunksAt(
::Bounds const& bounds,
bool ignoreClientChunk)
const;
389 MCAPI
void _updateTallestCollisionShapeWithBorderBlockCollisions(
390 ::AABB const& intersectTestBox,
393 ::Vec3 const& posToMinimizeDistanceToIfMatchingHeight,
394 float& currentDistanceSqr
397 MCAPI
void addToRandomTickingQueue(
405 MCAPI
void addToRandomTickingQueuePercentChance(
413 MCAPI
void addToTickingQueue(
421 MCAPI
bool allowsRunes(
::BlockPos const& pos);
430 MCAPI
void blockEvent(
int x,
int y,
int z,
int b0,
int b1);
433 MCAPI
bool canProvideSupport(
::BlockPos const& pos, uchar face, ::BlockSupportType type)
const;
436 MCAPI
bool canRedstoneWirePassThrough(
::BlockPos const& p)
const;
439 MCAPI
bool canSeeSky(
::BlockPos const& pos)
const;
441 MCAPI
bool canSeeSky(
int x,
int y,
int z)
const;
443 MCAPI
bool canSeeSkyFromBelowWater(
::BlockPos const& pos);
449 MCAPI
bool containsAnySolidBlocking(
::AABB const& box)
const;
451 MCAPI uint64 countBlocksOfType(
458 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
461 MCAPI ::std::vector<::BlockActor*> fetchBlockEntities(::BlockActorType blockActorTypeId,
::AABB const& bb)
const;
463 MCAPI ::std::vector<::BlockActor*>
const& fetchBlockEntities(
::AABB const& bb);
466 fetchBlockEntities(
::AABB const& bb, ::std::vector<::BlockActor*>& blockEntityList,
bool withPreservedEntities);
470 MCAPI ::gsl::span<::BlockDataFetchResult<::Block>
const>
473 MCAPI ::gsl::span<::BlockDataFetchResult<::Block>
const>
476 MCAPI ::gsl::span<::BlockDataFetchResult<::Block>
const> fetchBlocksInCylinder(
483 MCAPI ::gsl::span<::BlockDataFetchResult<::Block>
const> fetchBlocksInCylinderSorted(
490 MCAPI ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
491 ::gsl::span<::gsl::not_null<::Actor const*>> ignoredEntities,
494 bool getDisplayEntities
497 MCAPI ::std::vector<::Actor*>
const& fetchEntities2(::ActorType type,
::AABB const& aabb,
bool ignoreTargetType);
499 MCAPI ::Actor* fetchNearestEntityOfType(
::Actor const* except,
::AABB const& bb, ::ActorType entityTypeId);
501 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
502 fetchPlayers(
::AABB const& bb,
::Actor const* except, ::std::function<
bool(
::Actor*)> selector);
504 MCAPI
bool findNextTopSolidBlockAbove(
::BlockPos& pos);
506 MCAPI
bool findNextTopSolidBlockUnder(
::BlockPos& pos);
510 MCAPI
void fireBlockEntityAboutToBeRemoved(::std::shared_ptr<::BlockActor> te);
514 MCAPI
void fireBrightnessChanged(
::BlockPos const& pos);
516 MCAPI
void fireEntityChanged(
::Actor& entity);
518 MCFOLD ::std::vector<::AABB>& getAABBFetchResultCache();
520 MCAPI
short getAllocatedHeightAt(
::BlockPos const& xzPos);
522 MCAPI ::Biome
const& getBiome(
::BlockPos const& pos)
const;
525 MCAPI ::BiomeIdLatticeBatch getBiomeIdsInBatch(
::BlockPos const& centerPos,
int areaOffset,
int gridOffset)
const;
528 MCFOLD ::BlockActor* getBlockEntity(
::BlockPos const& pos);
530 MCAPI ::BrightnessPair getBrightnessPair(
::BlockPos const& pos)
const;
532 MCAPI ::BrightnessPair getDefaultBrightness()
const;
535 MCAPI
int getGrassColor(
::BlockPos const& pos)
const;
538 MCAPI
short getHeightmap(
::BlockPos const& pos)
const;
540 MCAPI
short getHeightmap(
int x,
int z);
542 MCAPI ::BlockPos getHeightmapPos(
::BlockPos const& xzPos)
const;
544 MCFOLD ::Level& getLevel()
const;
546 MCFOLD ::Level
const& getLevelConst()
const;
552 MCAPI
bool getNextTickUpdateForPos(
::BlockPos const& pos, ::TickingQueueType queueType,
::Tick& tick)
const;
554 MCFOLD
bool getPublicSource()
const;
556 MCAPI ::Brightness getRawBrightness(
::BlockPos const& pos,
bool propagate,
bool accountForNight)
const;
558 MCAPI ::Brightness getRawBrightnessWithManualDarken(
565 MCAPI
float getSeenPercent(
::Vec3 const& center,
::AABB const& bb);
567 MCAPI
int getSkylightBrightness(
::BlockPos const& pos)
const;
570 MCAPI ::Biome
const& getSurfaceBiome(
::BlockPos const& pos)
const;
573 MCAPI
void getTallestCollisionShapeFromUnloadedChunksAABBs(
574 ::AABB const& intersectTestBox,
575 ::AABB& tallestCollisionShape,
576 ::Vec3 const& posToMinimizeDistanceToIfMatchingHeight,
577 float& currentDistanceSqr
581 MCFOLD
float getTextureShiftNoise()
const;
584 MCAPI ::BlockTickingQueue*
585 getTickingQueue(
::BlockPos const& pos, ::TickingQueueType queueType,
bool skipOverrides)
const;
587 MCAPI
short getVoidHeight()
const;
590 MCAPI
int getWaterColor(
::BlockPos const& pos)
const;
593 MCAPI ::WellKnownBiomeTags
const& getWellKnownBiomeTags()
const;
595 MCAPI ::LevelChunk* getWritableChunk(
::ChunkPos const& pos);
598 MCAPI
bool hasChunksAt(
::BlockPos const& min,
::BlockPos const& max,
bool ignoreClientChunk)
const;
601 MCAPI ::std::pair<bool, ::std::optional<::SubChunkPos>>
604 MCAPI
bool hasTickInCurrentTick(
::BlockPos const& pos)
const;
606 MCAPI
bool hasTickInPendingTicks(
::BlockPos const& pos)
const;
608 MCAPI
bool hasTickInPendingTicks(
::BlockPos const& pos,
::Block const& block)
const;
612 MCAPI
bool hasTickInPendingTicks(
::BlockPos const& pos, ::TickingQueueType queueType)
const;
614 MCAPI
bool hasTickInPendingTicks(
::BlockPos const& pos,
::Block const& block, ::TickingQueueType queueType)
const;
617 hasTickInPendingTicks(
::BlockPos const& pos,
::BlockType const& block, ::TickingQueueType queueType)
const;
619 MCAPI
bool hasUntickedNeighborChunk(
::ChunkPos const& pos,
int chunkRadius)
const;
623 MCAPI
bool isConsideredSolidBlock(
::BlockPos const& pos)
const;
625 MCAPI
bool isEmptyBlock(
::BlockPos const& pos)
const;
627 MCAPI
bool isEmptyWaterBlock(
::BlockPos const& pos)
const;
629 MCAPI
bool isNearUnloadedChunks(
::ChunkPos const& pos)
const;
632 MCAPI
bool isPositionUnderSnow(
::Vec3 const& p);
635 MCAPI
bool isTouchingMaterial(
::BlockPos const& pos, ::SharedTypes::v1_26_20::MaterialType type)
const;
638 MCAPI
bool isUnderWater(
::BlockPos const& pos)
const;
641 MCAPI
bool isUnobstructedByEntities(
::AABB const& aabb,
::Actor const* ignoreEntity);
643 MCAPI
bool isWithinHeightLimits(
int y)
const;
650 MCAPI ::std::shared_ptr<::BlockActor> removeBlockEntity(
::BlockPos const& blockPos);
652 MCAPI
void removeFromRandomTickingQueue(
::BlockPos const& pos,
::Block const& block);
660 ::std::shared_ptr<::BlockActor> blockEntity,
665 MCAPI
bool setBlockAndRetainCompatibleBlockActor(
::BlockPos const& pos,
::Block const& block,
int updateFlags);
671 MCAPI
void setBorderBlock(
::BlockPos const& pos,
bool val);
676 MCAPI
void setGrassColor(
int grassColor,
::BlockPos const& pos,
int flags);
679 MCFOLD
void setIsPersistentBlockSource();
681 MCAPI
bool setLiquidBlock(
::BlockPos const& pos,
::Block const& block,
bool useExtraData,
int updateFlags);
688 MCAPI
void setWaterColor(
int waterColor,
::BlockPos const& pos,
int flags);
691 MCAPI
int ticksFromNow(
::BlockPos const& pos, ::TickingQueueType queueType,
int offset)
const;
693 MCAPI ::Biome
const* tryGetBiome(
::BlockPos const& pos)
const;
695 MCAPI
void updateConnectionsAt(
::BlockPos const& pos);
697 MCAPI
void updateNeighborsAt(
::BlockPos const& pos);
699 MCAPI
void updateNeighborsAtExceptFromFacing(
::BlockPos const& pos,
int skipFacing);
707 MCAPI
static bool containsMaterial(
710 ::SharedTypes::v1_26_20::MaterialType material
713 MCAPI
static bool doesIntersect(
717 ::std::vector<::AABB>& storage,
718 bool withUnloadedChunks
721 MCFOLD static ::Block
const& getEmptyBlock();
723 MCAPI
static bool isEmptyBlock(
::Block const& block);
725 MCAPI
static bool isEmptyWaterBlock(
::Block const& block);
731 MCAPI
void* $ctor(
::ChunkSource& source,
bool publicSource,
bool allowUnpopulatedChunks);
738 bool allowUnpopulatedChunks,
739 bool allowClientTickingChanges
752 MCAPI ::WeakRef<::BlockSource> $getWeakRef();
754 MCFOLD ::Level& $getLevel();
756 MCFOLD ::Dimension& $getDimension()
const;
758 MCFOLD ::Dimension
const& $getDimensionConst()
const;
760 MCAPI ::DimensionType $getDimensionId()
const;
762 MCAPI
bool $shouldFireEvents(
::LevelChunk const& c)
const;
764 MCAPI
bool $isInstaticking(
::BlockPos const& pos)
const;
770 MCAPI ::LevelChunk* $getChunk(
int x,
int z)
const;
772 MCAPI ::LevelChunk* $getChunk(
::ChunkPos const& pos)
const;
774 MCAPI ::LevelChunk* $getChunkAt(
::BlockPos const& pos)
const;
776 MCAPI
short $getAboveTopSolidBlock(
780 bool iteratePastInitialBlocking
783 MCAPI
short $getAboveTopSolidBlock(
int x,
int z,
bool includeWater,
bool includeLeaves)
const;
789 MCAPI ::Material
const& $getMaterial(
::BlockPos const& pos)
const;
791 MCAPI ::Material
const& $getMaterial(
int x,
int y,
int z)
const;
793 MCAPI
short $getMaxHeight()
const;
795 MCAPI
short $getMinHeight()
const;
797 MCAPI
bool $hasBorderBlock(
::BlockPos const pos)
const;
799 MCAPI
float $getBrightness(
::BlockPos const& pos)
const;
801 MCAPI
bool $mayPlace(
810 MCAPI
bool $canDoBlockDrops()
const;
812 MCAPI
bool $canDoContainedItemDrops()
const;
814 MCAPI
bool $hasChunksAt(
::Bounds const& bounds,
bool ignoreClientChunk)
const;
816 MCAPI
bool $hasChunksAt(
::BlockPos const& pos,
int r,
bool ignoreClientChunk)
const;
818 MCAPI
bool $hasChunksAt(
::AABB const& bb,
bool ignoreClientChunk)
const;
820 MCAPI
bool $areChunksFullyLoaded(
::BlockPos const& pos,
int r)
const;
822 MCAPI
bool $containsAnyLiquid(
::AABB const& box)
const;
824 MCAPI
bool $containsMaterial(
::AABB const& box, ::SharedTypes::v1_26_20::MaterialType material)
const;
826 MCAPI
void $blockEvent(
::BlockPos const& pos,
int b0,
int b1);
828 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
829 $fetchEntities(
::Actor const* except,
::AABB const& bb,
bool useHitbox,
bool getDisplayEntities);
831 MCAPI ::gsl::span<::gsl::not_null<::Actor*>> $fetchEntities(
832 ::ActorType entityTypeId,
835 ::std::function<
bool(
::Actor*)> selector
839 $fetchAABBs(::std::vector<::AABB>& shapes,
::AABB const& intersectTestBox,
bool withUnloadedChunks)
const;
841 MCAPI ::std::vector<::AABB>& $fetchAABBs(
::AABB const& intersectTestBox,
bool withUnloadedChunks);
843 MCAPI ::std::vector<::AABB>& $fetchCollisionShapes(
844 ::AABB const& intersectTestBox,
845 bool withUnloadedChunks,
846 ::std::optional<::EntityContext const> entity,
847 ::std::vector<::AABB>* tempShapes
850 MCAPI
void $fetchCollisionShapes(
851 ::std::vector<::AABB>& shapes,
852 ::AABB const& intersectTestBox,
853 bool withUnloadedChunks,
855 ::std::vector<::AABB>* tempShapes
858 MCAPI
void $fetchCollisionShapesAndBlocks(
859 ::std::vector<::BlockSourceVisitor::CollisionShape>& shapes,
860 ::AABB const& intersectTestBox,
861 bool withUnloadedChunks,
863 ::std::vector<::AABB>* tempShapes
866 MCAPI ::AABB $getTallestCollisionShape(
867 ::AABB const& intersectTestBox,
868 float* actualSurfaceOffset,
869 bool withUnloadedChunks,
873 MCAPI ::HitResult $clip(
876 bool checkAgainstLiquid,
877 ::ShapeType shapeType,
879 bool ignoreBorderBlocks,
882 ::std::function<
bool(::BlockSource
const&,
::Block const&,
bool)>
const& shouldCheckBlock,
883 bool stopOnFirstLiquidHit
888 MCAPI
bool $isInWall(
::Vec3 const& pos)
const;
892 MCAPI
void $fireBlockChanged(
898 ::BlockChangedEventTarget eventTarget,
903 MCAPI ::Block
const& $getBlock(
::BlockPos const& pos)
const;
905 MCAPI ::Block
const& $getBlock(
::BlockPos const& pos, uint layer)
const;
907 MCFOLD ::BlockActor
const* $getBlockEntity(
::BlockPos const& pos)
const;
909 MCAPI ::Block
const& $getExtraBlock(
::BlockPos const& pos)
const;
911 MCAPI ::Block
const& $getLiquidBlock(
::BlockPos const& pos)
const;
913 MCAPI
bool $hasBlock(
::BlockPos const& pos)
const;
915 MCAPI
bool $setBlock(
923 MCAPI
bool $setExtraBlock(
::BlockPos const& pos,
::Block const& block,
int updateFlags);
927 MCAPI
bool $isSolidBlockingBlock(
int x,
int y,
int z)
const;
929 MCAPI
bool $isSolidBlockingBlock(
::BlockPos const& p)
const;
931 MCFOLD ::ILevel& $getILevel()
const;
933 MCAPI ::LevelSeed64 $getLevelSeed64()
const;
935 MCFOLD ::ChunkSource& $getChunkSource();
937 MCAPI
bool $checkBlockDestroyPermissions(
941 bool generateParticle
944 MCAPI
bool $checkBlockPermissions(
949 bool generateParticle
952 MCAPI
void $postGameEvent(
965 MCAPI
static void** $vftable();