71 public ::std::enable_shared_from_this<::BlockSource> {
73 LLNDAPI std::vector<Actor*> getEntities(
75 float extendDistance = 2.0f,
76 ActorType actorType = ActorType::TypeMask,
77 bool ignoreType =
false
87 ::ll::TypedStorage<4, 4, ::std::thread::id const> mOwnerThreadID;
88 ::ll::TypedStorage<1, 1, bool const> mAllowUnpopulatedChunks;
89 ::ll::TypedStorage<1, 1, bool const> mPublicSource;
90 ::ll::TypedStorage<8, 8, ::Level&> mLevel;
91 ::ll::TypedStorage<8, 8, ::ChunkSource&> mChunkSource;
92 ::ll::TypedStorage<8, 8, ::Dimension&> mDimension;
93 ::ll::TypedStorage<2, 2, short const> mMaxHeight;
94 ::ll::TypedStorage<2, 2, short const> mMinHeight;
95 ::ll::TypedStorage<8, 24, ::std::vector<::BlockDataFetchResult<::Block>>> mTempBlockFetchResult;
96 ::ll::TypedStorage<1, 1, bool> mAllowTickingChanges;
97 ::ll::TypedStorage<4, 12, ::BlockPos> mPlaceChunkPos;
98 ::ll::TypedStorage<8, 24, ::std::vector<::BlockSourceListener*>> mListeners;
99 ::ll::TypedStorage<1, 1, bool> mIsPersistantBlockSource;
100 ::ll::TypedStorage<8, 8, ::ChunkPos> mLastChunkPos;
101 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::LevelChunk>> mLastChunkWeakPtr;
102 ::ll::TypedStorage<8, 8, ::LevelChunk*> mLastChunkDirectPtr;
103 ::ll::TypedStorage<8, 8, ::BlockTickingQueue*> mRandomTickQueue;
104 ::ll::TypedStorage<8, 8, ::BlockTickingQueue*> mTickQueue;
105 ::ll::TypedStorage<1, 2, ::BrightnessPair const> mDefaultBrightness;
106 ::ll::TypedStorage<8, 24, ::std::vector<::Actor*>> mTempEntityList;
107 ::ll::TypedStorage<8, 24, ::std::vector<::BlockActor*>> mTempBlockEntityList;
108 ::ll::TypedStorage<8, 24, ::std::vector<::AABB>> mTempCubeList;
113 BlockSource& operator=(BlockSource
const&);
114 BlockSource(BlockSource
const&);
120 virtual ~BlockSource() ;
122 virtual ::WeakRef<::BlockSource> getWeakRef() ;
124 virtual ::Level& getLevel() ;
126 virtual ::Dimension& getDimension()
const ;
128 virtual ::Dimension& getDimension() ;
130 virtual ::Dimension
const& getDimensionConst()
const ;
132 virtual ::DimensionType getDimensionId()
const ;
134 virtual bool shouldFireEvents(
::LevelChunk const& c)
const ;
136 virtual bool isInstaticking(
::BlockPos const& pos)
const ;
142 virtual ::LevelChunk* getChunk(
int x,
int z)
const ;
144 virtual ::LevelChunk* getChunk(
::ChunkPos const& pos)
const ;
146 virtual ::LevelChunk* getChunkAt(
::BlockPos const& pos)
const ;
148 virtual short getAboveTopSolidBlock(
152 bool iteratePastInitialBlocking
155 virtual short getAboveTopSolidBlock(
int x,
int z,
bool includeWater,
bool includeLeaves)
const ;
162 virtual ::Material
const& getMaterial(
::BlockPos const& pos)
const ;
164 virtual ::Material
const& getMaterial(
int x,
int y,
int z)
const ;
166 virtual short getMaxHeight()
const ;
168 virtual short getMinHeight()
const ;
170 virtual bool hasBorderBlock(
::BlockPos const pos)
const ;
172 virtual float getBrightness(
::BlockPos const& pos)
const ;
174 virtual bool mayPlace(
183 virtual bool canDoBlockDrops()
const ;
185 virtual bool canDoContainedItemDrops()
const ;
187 virtual bool hasChunksAt(
::Bounds const& bounds,
bool ignoreClientChunk)
const ;
189 virtual bool hasChunksAt(
::BlockPos const& pos,
int r,
bool ignoreClientChunk)
const ;
191 virtual bool hasChunksAt(
::AABB const& bb,
bool ignoreClientChunk)
const ;
193 virtual bool areChunksFullyLoaded(
::BlockPos const& pos,
int r)
const ;
195 virtual bool containsAnyLiquid(
::AABB const& box)
const ;
197 virtual bool containsMaterial(
::AABB const& box, ::MaterialType material)
const ;
199 virtual void blockEvent(
::BlockPos const& pos,
int b0,
int b1) ;
201 virtual ::gsl::span<::gsl::not_null<::Actor*>>
202 fetchEntities(
::Actor const* except,
::AABB const& bb,
bool useHitbox,
bool getDisplayEntities) ;
204 virtual ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
205 ::ActorType entityTypeId,
208 ::std::function<
bool(
::Actor*)> selector
212 fetchAABBs(::std::vector<::AABB>& shapes,
::AABB const& intersectTestBox,
bool withUnloadedChunks)
const
215 virtual ::std::vector<::AABB>& fetchAABBs(
::AABB const& intersectTestBox,
bool withUnloadedChunks) ;
217 virtual ::std::vector<::AABB>& fetchCollisionShapes(
218 ::AABB const& intersectTestBox,
219 bool withUnloadedChunks,
220 ::std::optional<::EntityContext const> entity,
221 ::std::vector<::AABB>* tempShapes
224 virtual void fetchCollisionShapes(
225 ::std::vector<::AABB>& shapes,
226 ::AABB const& intersectTestBox,
227 bool withUnloadedChunks,
229 ::std::vector<::AABB>* tempShapes
232 virtual void fetchCollisionShapesAndBlocks(
233 ::std::vector<::BlockSourceVisitor::CollisionShape>& shapes,
234 ::AABB const& intersectTestBox,
235 bool withUnloadedChunks,
237 ::std::vector<::AABB>* tempShapes
240 virtual ::AABB getTallestCollisionShape(
241 ::AABB const& intersectTestBox,
242 float* actualSurfaceOffset,
243 bool withUnloadedChunks,
247 virtual ::HitResult clip(
250 bool checkAgainstLiquid,
251 ::ShapeType shapeType,
253 bool ignoreBorderBlocks,
256 ::std::function<
bool(::BlockSource
const&,
::Block const&,
bool)>
const& shouldCheckBlock,
257 bool stopOnFirstLiquidHit
262 virtual bool isInWall(
::Vec3 const& pos)
const ;
266 virtual void fireBlockChanged(
272 ::BlockChangedEventTarget eventTarget,
277 virtual ::Block
const& getBlock(
::BlockPos const& pos)
const ;
279 virtual ::Block
const& getBlock(
::BlockPos const& pos, uint layer)
const ;
281 virtual ::BlockActor
const* getBlockEntity(
::BlockPos const& pos)
const ;
283 virtual ::Block
const& getExtraBlock(
::BlockPos const& pos)
const ;
285 virtual ::Block
const& getLiquidBlock(
::BlockPos const& pos)
const ;
287 virtual bool hasBlock(
::BlockPos const& pos)
const ;
289 virtual bool setBlock(
297 virtual bool setExtraBlock(
::BlockPos const& pos,
::Block const& block,
int updateFlags) ;
301 virtual bool isSolidBlockingBlock(
int x,
int y,
int z)
const ;
303 virtual bool isSolidBlockingBlock(
::BlockPos const& p)
const ;
305 virtual ::ILevel& getILevel()
const ;
307 virtual ::LevelSeed64 getLevelSeed64()
const ;
309 virtual ::ChunkSource& getChunkSource() ;
311 virtual bool checkBlockDestroyPermissions(
315 bool generateParticle
318 virtual bool checkBlockPermissions(
323 bool generateParticle
326 virtual void postGameEvent(
342 bool allowUnpopulatedChunks,
343 bool allowClientTickingChanges
346 MCAPI
void _addToTickingQueue(
351 ::TickingQueueType queueType,
355 MCAPI
void _blockChanged(
366 MCAPI
void _fetchBorderBlockCollisions(
367 ::std::vector<::AABB>& shapes,
368 ::AABB const& intersectTestBox,
373 MCAPI
void _fetchEntityHelper(
375 ::gsl::span<::gsl::not_null<::Actor const*>>
const& ignoredEntities,
380 MCAPI
void _fetchEntityHelper(
382 ::ActorType entityTypeId,
385 ::std::function<
bool(
::Actor*)> selector
388 MCAPI
bool _getBlockPermissions(
::BlockPos const& pos,
bool currentState);
391 _getRawBrightness(
::BlockPos const& pos,
::Brightness skyDarken,
bool propagate,
bool accountForNight)
const;
393 MCAPI
void _removeFromTickingQueue(
::BlockPos const& pos,
::Block const& block, ::TickingQueueType queueType);
395 MCAPI
void _updateTallestCollisionShapeWithBorderBlockCollisions(
396 ::AABB const& intersectTestBox,
399 ::Vec3 const& posToMinimizeDistanceToIfMatchingHeight,
400 float& currentDistanceSqr
403 MCAPI
void addToRandomTickingQueuePercentChance(
411 MCAPI
void addToTickingQueue(
424 MCAPI
void blockEvent(
int x,
int y,
int z,
int b0,
int b1);
427 MCAPI
bool canProvideSupport(
::BlockPos const& pos, uchar face, ::BlockSupportType type)
const;
429 MCAPI
bool canSeeSky(
::BlockPos const& pos)
const;
431 MCAPI
bool canSeeSkyFromBelowWater(
::BlockPos const& pos);
435 MCAPI
bool containsAnySolidBlocking(
::AABB const& box)
const;
437 MCAPI uint64 countBlocksOfType(
444 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
447 MCAPI ::std::vector<::BlockActor*> fetchBlockEntities(::BlockActorType blockActorTypeId,
::AABB const& bb)
const;
450 MCAPI ::std::vector<::BlockActor*>
const& fetchBlockEntities(
::AABB const& bb);
455 fetchBlockEntities(
::AABB const& bb, ::std::vector<::BlockActor*>& blockEntityList,
bool withPreservedEntities);
460 MCAPI ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
461 ::gsl::span<::gsl::not_null<::Actor const*>> ignoredEntities,
464 bool getDisplayEntities
467 MCAPI ::std::vector<::Actor*>
const& fetchEntities2(::ActorType type,
::AABB const& aabb,
bool ignoreTargetType);
469 MCAPI ::Actor* fetchNearestEntityOfType(
::Actor const* except,
::AABB const& bb, ::ActorType entityTypeId);
471 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
472 fetchPlayers(
::AABB const& bb,
::Actor const* except, ::std::function<
bool(
::Actor*)> selector);
474 MCAPI
bool findNextTopSolidBlockAbove(
::BlockPos& pos);
476 MCAPI
bool findNextTopSolidBlockUnder(
::BlockPos& pos);
478 MCAPI
void fireBlockEntityAboutToBeRemoved(::std::shared_ptr<::BlockActor> te);
482 MCAPI ::Biome
const& getBiome(
::BlockPos const& pos)
const;
485 MCAPI ::BiomeIdLatticeBatch getBiomeIdsInBatch(
::BlockPos const& centerPos,
int areaOffset,
int gridOffset)
const;
488 MCFOLD ::BlockActor* getBlockEntity(
::BlockPos const& pos);
494 MCAPI
float getSeenPercent(
::Vec3 const& center,
::AABB const& bb);
496 MCAPI
int getSkylightBrightness(
::BlockPos const& pos)
const;
499 MCAPI ::Biome
const& getSurfaceBiome(
::BlockPos const& pos)
const;
502 MCAPI
void getTallestCollisionShapeFromUnloadedChunksAABBs(
503 ::AABB const& intersectTestBox,
504 ::AABB& tallestCollisionShape,
505 ::Vec3 const& posToMinimizeDistanceToIfMatchingHeight,
506 float& currentDistanceSqr
509 MCAPI ::WellKnownBiomeTags
const& getWellKnownBiomeTags()
const;
511 MCAPI ::std::pair<bool, ::std::optional<::SubChunkPos>>
514 MCAPI
bool hasTickInCurrentTick(
::BlockPos const& pos, ::TickingQueueType queueType)
const;
516 MCAPI
bool hasTickInPendingTicks(
::BlockPos const& pos, ::TickingQueueType queueType)
const;
518 MCAPI
bool hasTickInPendingTicks(
::BlockPos const& pos,
::Block const& block, ::TickingQueueType queueType)
const;
521 hasTickInPendingTicks(
::BlockPos const& pos,
::BlockType const& block, ::TickingQueueType queueType)
const;
523 MCAPI
bool hasUntickedNeighborChunk(
::ChunkPos const& pos,
int chunkRadius)
const;
526 MCAPI
bool isEmptyBlock(
::BlockPos const& pos)
const;
529 MCAPI
bool isNearUnloadedChunks(
::ChunkPos const& pos)
const;
532 MCAPI
bool isPositionUnderSnow(
::Vec3 const& p);
535 MCAPI
bool isTouchingMaterial(
::BlockPos const& pos, ::MaterialType type)
const;
537 MCAPI
bool isWithinHeightLimits(
int y)
const;
548 ::std::shared_ptr<::BlockActor> blockEntity,
553 MCAPI
bool setBlockAndRetainCompatibleBlockActor(
::BlockPos const& pos,
::Block const& block,
int updateFlags);
555 MCAPI
void setBorderBlock(
::BlockPos const& pos,
bool val);
559 MCAPI
bool setLiquidBlock(
::BlockPos const& pos,
::Block const& block,
bool useExtraData,
int updateFlags);
562 MCAPI ::Biome
const* tryGetBiome(
::BlockPos const& pos)
const;
565 MCAPI
void updateConnectionsAt(
::BlockPos const& pos);
567 MCAPI
void updateNeighborsAt(
::BlockPos const& pos);
569 MCAPI
void updateNeighborsAtExceptFromFacing(
::BlockPos const& pos,
int skipFacing);
579 MCFOLD static ::Block
const& getEmptyBlock();
590 bool allowUnpopulatedChunks,
591 bool allowClientTickingChanges
604 MCAPI ::WeakRef<::BlockSource> $getWeakRef();
606 MCFOLD ::Level& $getLevel();
608 MCFOLD ::Dimension& $getDimension()
const;
610 MCFOLD ::Dimension
const& $getDimensionConst()
const;
612 MCAPI ::DimensionType $getDimensionId()
const;
614 MCAPI
bool $shouldFireEvents(
::LevelChunk const& c)
const;
616 MCAPI
bool $isInstaticking(
::BlockPos const& pos)
const;
622 MCAPI ::LevelChunk* $getChunk(
int x,
int z)
const;
624 MCAPI ::LevelChunk* $getChunk(
::ChunkPos const& pos)
const;
626 MCAPI ::LevelChunk* $getChunkAt(
::BlockPos const& pos)
const;
628 MCAPI
short $getAboveTopSolidBlock(
632 bool iteratePastInitialBlocking
635 MCAPI
short $getAboveTopSolidBlock(
int x,
int z,
bool includeWater,
bool includeLeaves)
const;
641 MCAPI ::Material
const& $getMaterial(
::BlockPos const& pos)
const;
643 MCAPI ::Material
const& $getMaterial(
int x,
int y,
int z)
const;
645 MCAPI
short $getMaxHeight()
const;
647 MCAPI
short $getMinHeight()
const;
649 MCAPI
bool $hasBorderBlock(
::BlockPos const pos)
const;
651 MCAPI
float $getBrightness(
::BlockPos const& pos)
const;
653 MCAPI
bool $mayPlace(
662 MCAPI
bool $canDoBlockDrops()
const;
664 MCAPI
bool $canDoContainedItemDrops()
const;
666 MCAPI
bool $hasChunksAt(
::Bounds const& bounds,
bool ignoreClientChunk)
const;
668 MCAPI
bool $hasChunksAt(
::BlockPos const& pos,
int r,
bool ignoreClientChunk)
const;
670 MCAPI
bool $hasChunksAt(
::AABB const& bb,
bool ignoreClientChunk)
const;
672 MCAPI
bool $areChunksFullyLoaded(
::BlockPos const& pos,
int r)
const;
674 MCAPI
bool $containsAnyLiquid(
::AABB const& box)
const;
676 MCAPI
bool $containsMaterial(
::AABB const& box, ::MaterialType material)
const;
678 MCAPI
void $blockEvent(
::BlockPos const& pos,
int b0,
int b1);
680 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
681 $fetchEntities(
::Actor const* except,
::AABB const& bb,
bool useHitbox,
bool getDisplayEntities);
683 MCAPI ::gsl::span<::gsl::not_null<::Actor*>> $fetchEntities(
684 ::ActorType entityTypeId,
687 ::std::function<
bool(
::Actor*)> selector
691 $fetchAABBs(::std::vector<::AABB>& shapes,
::AABB const& intersectTestBox,
bool withUnloadedChunks)
const;
693 MCAPI ::std::vector<::AABB>& $fetchAABBs(
::AABB const& intersectTestBox,
bool withUnloadedChunks);
695 MCAPI ::std::vector<::AABB>& $fetchCollisionShapes(
696 ::AABB const& intersectTestBox,
697 bool withUnloadedChunks,
698 ::std::optional<::EntityContext const> entity,
699 ::std::vector<::AABB>* tempShapes
702 MCAPI
void $fetchCollisionShapes(
703 ::std::vector<::AABB>& shapes,
704 ::AABB const& intersectTestBox,
705 bool withUnloadedChunks,
707 ::std::vector<::AABB>* tempShapes
710 MCAPI
void $fetchCollisionShapesAndBlocks(
711 ::std::vector<::BlockSourceVisitor::CollisionShape>& shapes,
712 ::AABB const& intersectTestBox,
713 bool withUnloadedChunks,
715 ::std::vector<::AABB>* tempShapes
718 MCAPI ::AABB $getTallestCollisionShape(
719 ::AABB const& intersectTestBox,
720 float* actualSurfaceOffset,
721 bool withUnloadedChunks,
725 MCAPI ::HitResult $clip(
728 bool checkAgainstLiquid,
729 ::ShapeType shapeType,
731 bool ignoreBorderBlocks,
734 ::std::function<
bool(::BlockSource
const&,
::Block const&,
bool)>
const& shouldCheckBlock,
735 bool stopOnFirstLiquidHit
740 MCAPI
bool $isInWall(
::Vec3 const& pos)
const;
744 MCAPI
void $fireBlockChanged(
750 ::BlockChangedEventTarget eventTarget,
755 MCAPI ::Block
const& $getBlock(
::BlockPos const& pos)
const;
757 MCAPI ::Block
const& $getBlock(
::BlockPos const& pos, uint layer)
const;
759 MCFOLD ::BlockActor
const* $getBlockEntity(
::BlockPos const& pos)
const;
761 MCAPI ::Block
const& $getExtraBlock(
::BlockPos const& pos)
const;
763 MCAPI ::Block
const& $getLiquidBlock(
::BlockPos const& pos)
const;
765 MCAPI
bool $hasBlock(
::BlockPos const& pos)
const;
767 MCAPI
bool $setBlock(
775 MCAPI
bool $setExtraBlock(
::BlockPos const& pos,
::Block const& block,
int updateFlags);
779 MCAPI
bool $isSolidBlockingBlock(
int x,
int y,
int z)
const;
781 MCAPI
bool $isSolidBlockingBlock(
::BlockPos const& p)
const;
783 MCFOLD ::ILevel& $getILevel()
const;
785 MCAPI ::LevelSeed64 $getLevelSeed64()
const;
787 MCFOLD ::ChunkSource& $getChunkSource();
789 MCAPI
bool $checkBlockDestroyPermissions(
793 bool generateParticle
796 MCAPI
bool $checkBlockPermissions(
801 bool generateParticle
804 MCAPI
void $postGameEvent(
817 MCAPI
static void** $vftable();