LeviLamina
Loading...
Searching...
No Matches
BlockSource.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/utility/optional_ref.h"
7#include "mc/deps/game_refs/EnableGetWeakRef.h"
8#include "mc/deps/game_refs/WeakRef.h"
9#include "mc/deps/shared_types/v1_26_20/block/MaterialType.h"
10#include "mc/platform/brstd/function_ref.h"
11#include "mc/util/IDType.h"
12#include "mc/world/actor/ActorType.h"
13#include "mc/world/level/BlockChangedEventTarget.h"
14#include "mc/world/level/BlockDataFetchResult.h"
15#include "mc/world/level/BlockPos.h"
16#include "mc/world/level/ChunkPos.h"
17#include "mc/world/level/IBlockSource.h"
18#include "mc/world/level/ShapeType.h"
19#include "mc/world/level/TickingQueueType.h"
20#include "mc/world/level/block/BlockSupportType.h"
21#include "mc/world/level/block/BrightnessPair.h"
22#include "mc/world/level/block/actor/BlockActorType.h"
23
24// auto generated forward declare list
25// clang-format off
26class AABB;
27class Actor;
28class Biome;
29class Block;
30class BlockActor;
32class BlockDescriptor;
35class BlockType;
36class BlockVolume;
37class BoundingBox;
38class ChunkSource;
39class Dimension;
40class EntityContext;
41class GameEvent;
43class HitResult;
45class ILevel;
46class ItemStackBase;
47class Level;
48class LevelChunk;
49class LevelSeed64;
50class Material;
51class SubChunkPos;
52class Vec3;
53class WeakEntityRef;
57struct BiomeTagIDType;
58struct Bounds;
59struct Brightness;
60struct ClipParameters;
61struct Tick;
63namespace BlockSourceVisitor { struct CollisionShape; }
64// clang-format on
65
66class Mob;
67class Container;
68class CompoundTag;
69
70class BlockSource : public ::IBlockSource,
71 public ::EnableGetWeakRef<::BlockSource>,
72 public ::std::enable_shared_from_this<::BlockSource> {
73public:
74 LLNDAPI std::vector<Actor*> getEntities(
75 AABB const& range,
76 float extendDistance = 2.0f,
77 ActorType actorType = ActorType::TypeMask,
78 bool ignoreType = false
79 ) const;
80
81 LLNDAPI optional_ref<Container> tryGetContainer(BlockPos const& pos);
82
83 LLAPI optional_ref<Actor> spawnActor(CompoundTag const&);
84
85public:
86 // member variables
87 // NOLINTBEGIN
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;
110 // NOLINTEND
111
112public:
113 // prevent constructor by default
114 BlockSource& operator=(BlockSource const&);
115 BlockSource(BlockSource const&);
116 BlockSource();
117
118public:
119 // virtual functions
120 // NOLINTBEGIN
121 virtual ~BlockSource() /*override*/;
122
123 virtual ::WeakRef<::BlockSource> getWeakRef() /*override*/;
124
125 virtual ::Level& getLevel() /*override*/;
126
127 virtual ::Dimension& getDimension() const /*override*/;
128
129 virtual ::Dimension& getDimension() /*override*/;
130
131 virtual ::Dimension const& getDimensionConst() const /*override*/;
132
133 virtual ::DimensionType getDimensionId() const /*override*/;
134
135 virtual bool shouldFireEvents(::LevelChunk const& c) const /*override*/;
136
137 virtual bool isInstaticking(::BlockPos const& pos) const /*override*/;
138
139 virtual void addListener(::BlockSourceListener& l) /*override*/;
140
141 virtual void removeListener(::BlockSourceListener& l) /*override*/;
142
143 virtual ::LevelChunk* getChunk(int x, int z) const /*override*/;
144
145 virtual ::LevelChunk* getChunk(::ChunkPos const& pos) const /*override*/;
146
147 virtual ::LevelChunk* getChunkAt(::BlockPos const& pos) const /*override*/;
148
149 virtual short getAboveTopSolidBlock(
150 ::BlockPos const& pos,
151 bool includeWater,
152 bool includeLeaves,
153 bool iteratePastInitialBlocking
154 ) const /*override*/;
155
156 virtual short getAboveTopSolidBlock(int x, int z, bool includeWater, bool includeLeaves) const /*override*/;
157
158 virtual short getHeight(::brstd::function_ref<bool(::Block const&)> const& type, ::BlockPos const& pos) const
159 /*override*/;
160
161 virtual short getHeight(::brstd::function_ref<bool(::Block const&)> const& type, int x, int z) const /*override*/;
162
163 virtual ::Material const& getMaterial(::BlockPos const& pos) const /*override*/;
164
165 virtual ::Material const& getMaterial(int x, int y, int z) const /*override*/;
166
167 virtual short getMaxHeight() const /*override*/;
168
169 virtual short getMinHeight() const /*override*/;
170
171 virtual bool hasBorderBlock(::BlockPos const pos) const /*override*/;
172
173 virtual float getBrightness(::BlockPos const& pos) const /*override*/;
174
175 virtual bool mayPlace(
176 ::Block const& block,
177 ::BlockPos const& pos,
178 uchar face,
179 ::Actor* placer,
180 bool ignoreEntities,
181 ::Vec3 clickPos
182 ) /*override*/;
183
184 virtual bool canDoBlockDrops() const /*override*/;
185
186 virtual bool canDoContainedItemDrops() const /*override*/;
187
188 virtual bool hasChunksAt(::Bounds const& bounds, bool ignoreClientChunk) const /*override*/;
189
190 virtual bool hasChunksAt(::BlockPos const& pos, int r, bool ignoreClientChunk) const /*override*/;
191
192 virtual bool hasChunksAt(::AABB const& bb, bool ignoreClientChunk) const /*override*/;
193
194 virtual bool areChunksFullyLoaded(::BlockPos const& pos, int r) const /*override*/;
195
196 virtual bool containsAnyLiquid(::AABB const& box) const /*override*/;
197
198 virtual bool containsMaterial(::AABB const& box, ::SharedTypes::v1_26_20::MaterialType material) const /*override*/;
199
200 virtual void blockEvent(::BlockPos const& pos, int b0, int b1) /*override*/;
201
202 virtual ::gsl::span<::gsl::not_null<::Actor*>>
203 fetchEntities(::Actor const* except, ::AABB const& bb, bool useHitbox, bool getDisplayEntities) /*override*/;
204
205 virtual ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
206 ::ActorType entityTypeId,
207 ::AABB const& bb,
208 ::Actor const* except,
209 ::std::function<bool(::Actor*)> selector
210 ) /*override*/;
211
212 virtual void
213 fetchAABBs(::std::vector<::AABB>& shapes, ::AABB const& intersectTestBox, bool withUnloadedChunks) const
214 /*override*/;
215
216 virtual ::std::vector<::AABB>& fetchAABBs(::AABB const& intersectTestBox, bool withUnloadedChunks) /*override*/;
217
218 virtual ::std::vector<::AABB>& fetchCollisionShapes(
219 ::AABB const& intersectTestBox,
220 bool withUnloadedChunks,
221 ::std::optional<::EntityContext const> entity,
222 ::std::vector<::AABB>* tempShapes
223 ) /*override*/;
224
225 virtual void fetchCollisionShapes(
226 ::std::vector<::AABB>& shapes,
227 ::AABB const& intersectTestBox,
228 bool withUnloadedChunks,
230 ::std::vector<::AABB>* tempShapes
231 ) const /*override*/;
232
233 virtual void fetchCollisionShapesAndBlocks(
234 ::std::vector<::BlockSourceVisitor::CollisionShape>& shapes,
235 ::AABB const& intersectTestBox,
236 bool withUnloadedChunks,
238 ::std::vector<::AABB>* tempShapes
239 ) const /*override*/;
240
241 virtual ::AABB getTallestCollisionShape(
242 ::AABB const& intersectTestBox,
243 float* actualSurfaceOffset,
244 bool withUnloadedChunks,
246 ) const /*override*/;
247
248 virtual ::HitResult clip(
249 ::Vec3 const& A,
250 ::Vec3 const& B,
251 bool checkAgainstLiquid,
252 ::ShapeType shapeType,
253 int maxDistance,
254 bool ignoreBorderBlocks,
255 bool fullOnly,
256 ::Actor* actor,
257 ::std::function<bool(::BlockSource const&, ::Block const&, bool)> const& shouldCheckBlock,
258 bool stopOnFirstLiquidHit
259 ) const /*override*/;
260
261 virtual ::HitResult clip(::ClipParameters const& parameters) const /*override*/;
262
263 virtual bool isInWall(::Vec3 const& pos) const /*override*/;
264
265 virtual bool isUnderWater(::BlockPos const& pos, ::Block const& block) const /*override*/;
266
267 virtual void fireBlockChanged(
268 ::BlockPos const& pos,
269 uint layer,
270 ::Block const& block,
271 ::Block const& oldBlock,
272 int flags,
273 ::BlockChangedEventTarget eventTarget,
274 ::ActorBlockSyncMessage const* syncMsg,
275 ::Actor* source
276 ) /*override*/;
277
278 virtual ::Block const& getBlock(::BlockPos const& pos) const /*override*/;
279
280 virtual ::Block const& getBlock(::BlockPos const& pos, uint layer) const /*override*/;
281
282 virtual ::BlockActor const* getBlockEntity(::BlockPos const& pos) const /*override*/;
283
284 virtual ::Block const& getExtraBlock(::BlockPos const& pos) const /*override*/;
285
286 virtual ::Block const& getLiquidBlock(::BlockPos const& pos) const /*override*/;
287
288 virtual bool hasBlock(::BlockPos const& pos) const /*override*/;
289
290 virtual bool setBlock(
291 ::BlockPos const& pos,
292 ::Block const& block,
293 int updateFlags,
294 ::ActorBlockSyncMessage const* syncMsg,
295 ::BlockChangeContext const& changeSourceContext
296 ) /*override*/;
297
298 virtual bool setExtraBlock(::BlockPos const& pos, ::Block const& block, int updateFlags) /*override*/;
299
300 virtual bool removeBlock(::BlockPos const& pos, ::BlockChangeContext const& changeSourceContext) /*override*/;
301
302 virtual bool isSolidBlockingBlock(int x, int y, int z) const /*override*/;
303
304 virtual bool isSolidBlockingBlock(::BlockPos const& p) const /*override*/;
305
306 virtual ::ILevel& getILevel() const /*override*/;
307
308 virtual ::LevelSeed64 getLevelSeed64() const /*override*/;
309
310 virtual ::ChunkSource& getChunkSource() /*override*/;
311
312 virtual bool checkBlockDestroyPermissions(
313 ::Actor& entity,
314 ::BlockPos const& pos,
315 ::ItemStackBase const& item,
316 bool generateParticle
317 ) /*override*/;
318
319 virtual bool checkBlockPermissions(
320 ::Actor& entity,
321 ::BlockPos const& blockPos,
322 uchar face,
323 ::ItemStackBase const& item,
324 bool generateParticle
325 ) /*override*/;
326
327 virtual void postGameEvent(
328 ::Actor* source,
329 ::GameEvent const& gameEvent,
330 ::BlockPos const& originPos,
331 ::Block const* affectedBlock
332 ) /*override*/;
333 // NOLINTEND
334
335public:
336 // member functions
337 // NOLINTBEGIN
338 MCAPI BlockSource(::ChunkSource& source, bool publicSource, bool allowUnpopulatedChunks);
339
340 MCAPI BlockSource(
341 ::Level& level,
342 ::Dimension& dimension,
343 ::ChunkSource& source,
344 bool publicSource,
345 bool allowUnpopulatedChunks,
346 bool allowClientTickingChanges
347 );
348
349 MCAPI void _blockChanged(
350 ::BlockPos const& pos,
351 uint layer,
352 ::Block const& block,
353 ::Block const& previousBlock,
354 int updateFlags,
355 bool fireEvent,
356 ::ActorBlockSyncMessage const* syncMsg,
357 ::Actor* blockChangeSource
358 );
359
360 MCAPI void _fetchBorderBlockCollisions(
361 ::std::vector<::AABB>& shapes,
362 ::AABB const& intersectTestBox,
364 bool
365 ) const;
366
367 MCAPI void _fetchEntityHelper(
368 ::WeakEntityRef const& entityRef,
369 ::gsl::span<::gsl::not_null<::Actor const*>> const& ignoredEntities,
370 ::AABB const& bb,
371 bool useHitbox
372 );
373
374 MCAPI void _fetchEntityHelper(
375 ::WeakEntityRef const& entityRef,
376 ::ActorType entityTypeId,
377 ::AABB const& bb,
378 ::Actor const* except,
379 ::std::function<bool(::Actor*)> selector
380 );
381
382 MCAPI bool _getBlockPermissions(::BlockPos const& pos, bool currentState);
383
384 MCAPI ::Brightness
385 _getRawBrightness(::BlockPos const& pos, ::Brightness skyDarken, bool propagate, bool accountForNight) const;
386
387 MCAPI bool _hasChunksAt(::Bounds const& bounds, bool ignoreClientChunk) const;
388
389 MCAPI void _updateTallestCollisionShapeWithBorderBlockCollisions(
390 ::AABB const& intersectTestBox,
392 ::AABB& result,
393 ::Vec3 const& posToMinimizeDistanceToIfMatchingHeight,
394 float& currentDistanceSqr
395 ) const;
396
397 MCAPI void addToRandomTickingQueue(
398 ::BlockPos const& pos,
399 ::Block const& block,
400 int tickDelay,
401 int priorityOffset,
402 bool skipOverrides
403 );
404
405 MCAPI void addToRandomTickingQueuePercentChance(
406 ::BlockPos const& pos,
407 ::Block const& block,
408 float percentChance,
409 int priorityOffset,
410 bool skipOverrides
411 );
412
413 MCAPI void addToTickingQueue(
414 ::BlockPos const& pos,
415 ::Block const& block,
416 int tickDelay,
417 int priorityOffset,
418 bool skipOverrides
419 );
420
421 MCAPI bool allowsRunes(::BlockPos const& pos);
422
423 MCAPI bool areAllChunksLoaded(::BlockPos const& origin, ::BlockVolume& volume) const;
424
425 MCAPI bool areChunksFullyLoaded(::BlockPos const& min, ::BlockPos const& max) const;
426
427 MCAPI bool biomeAtPosHasTag(::BlockPos const& pos, ::IDType<::BiomeTagIDType> const& tagId) const;
428
429#ifdef LL_PLAT_C
430 MCAPI void blockEvent(int x, int y, int z, int b0, int b1);
431#endif
432
433 MCAPI bool canProvideSupport(::BlockPos const& pos, uchar face, ::BlockSupportType type) const;
434
435#ifdef LL_PLAT_C
436 MCAPI bool canRedstoneWirePassThrough(::BlockPos const& p) const;
437#endif
438
439 MCAPI bool canSeeSky(::BlockPos const& pos) const;
440
441 MCAPI bool canSeeSky(int x, int y, int z) const;
442
443 MCAPI bool canSeeSkyFromBelowWater(::BlockPos const& pos);
444
445 MCAPI bool containsAnyBlockInBox(::BoundingBox const& box, ::brstd::function_ref<bool(::Block const&)> predicate);
446
447 MCAPI bool containsAnyBlockOfType(::BlockPos const& min, ::BlockPos const& max, ::Block const& type) const;
448
449 MCAPI bool containsAnySolidBlocking(::AABB const& box) const;
450
451 MCAPI uint64 countBlocksOfType(
452 ::BlockDescriptor const& blockDescriptor,
453 ::BlockPos const& min,
454 ::BlockPos const& max,
455 uint64 maxCount
456 ) const;
457
458 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
459 fetchActors(::ActorDefinitionIdentifier const& actorId, ::AABB const& bb);
460
461 MCAPI ::std::vector<::BlockActor*> fetchBlockEntities(::BlockActorType blockActorTypeId, ::AABB const& bb) const;
462
463 MCAPI ::std::vector<::BlockActor*> const& fetchBlockEntities(::AABB const& bb);
464
465 MCAPI void
466 fetchBlockEntities(::AABB const& bb, ::std::vector<::BlockActor*>& blockEntityList, bool withPreservedEntities);
467
468 MCAPI bool fetchBlocks(::BlockPos const& origin, ::BlockVolume& volume) const;
469
470 MCAPI ::gsl::span<::BlockDataFetchResult<::Block> const>
471 fetchBlocksInBox(::BoundingBox const& box, ::brstd::function_ref<bool(::Block const&)> predicate);
472
473 MCAPI ::gsl::span<::BlockDataFetchResult<::Block> const>
474 fetchBlocksInBoxSorted(::BoundingBox const& box, ::brstd::function_ref<bool(::Block const&)> predicate);
475
476 MCAPI ::gsl::span<::BlockDataFetchResult<::Block> const> fetchBlocksInCylinder(
477 ::BlockPos const& centerPos,
478 uint radius,
479 uint height,
480 ::brstd::function_ref<bool(::Block const&)> predicate
481 );
482
483 MCAPI ::gsl::span<::BlockDataFetchResult<::Block> const> fetchBlocksInCylinderSorted(
484 ::BlockPos const& centerPos,
485 uint radius,
486 uint height,
487 ::brstd::function_ref<bool(::Block const&)> predicate
488 );
489
490 MCAPI ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
491 ::gsl::span<::gsl::not_null<::Actor const*>> ignoredEntities,
492 ::AABB const& bb,
493 bool useHitbox,
494 bool getDisplayEntities
495 );
496
497 MCAPI ::std::vector<::Actor*> const& fetchEntities2(::ActorType type, ::AABB const& aabb, bool ignoreTargetType);
498
499 MCAPI ::Actor* fetchNearestEntityOfType(::Actor const* except, ::AABB const& bb, ::ActorType entityTypeId);
500
501 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
502 fetchPlayers(::AABB const& bb, ::Actor const* except, ::std::function<bool(::Actor*)> selector);
503
504 MCAPI bool findNextTopSolidBlockAbove(::BlockPos& pos);
505
506 MCAPI bool findNextTopSolidBlockUnder(::BlockPos& pos);
507
508 MCAPI void fireAreaChanged(::BlockPos const& min, ::BlockPos const& max);
509
510 MCAPI void fireBlockEntityAboutToBeRemoved(::std::shared_ptr<::BlockActor> te);
511
512 MCAPI void fireBlockEntityChanged(::BlockActor& te);
513
514 MCAPI void fireBrightnessChanged(::BlockPos const& pos);
515
516 MCAPI void fireEntityChanged(::Actor& entity);
517
518 MCFOLD ::std::vector<::AABB>& getAABBFetchResultCache();
519
520 MCAPI short getAllocatedHeightAt(::BlockPos const& xzPos);
521
522 MCAPI ::Biome const& getBiome(::BlockPos const& pos) const;
523
524#ifdef LL_PLAT_C
525 MCAPI ::BiomeIdLatticeBatch getBiomeIdsInBatch(::BlockPos const& centerPos, int areaOffset, int gridOffset) const;
526#endif
527
528 MCFOLD ::BlockActor* getBlockEntity(::BlockPos const& pos);
529
530 MCAPI ::BrightnessPair getBrightnessPair(::BlockPos const& pos) const;
531
532 MCAPI ::BrightnessPair getDefaultBrightness() const;
533
534#ifdef LL_PLAT_C
535 MCAPI int getGrassColor(::BlockPos const& pos) const;
536#endif
537
538 MCAPI short getHeightmap(::BlockPos const& pos) const;
539
540 MCAPI short getHeightmap(int x, int z);
541
542 MCAPI ::BlockPos getHeightmapPos(::BlockPos const& xzPos) const;
543
544 MCFOLD ::Level& getLevel() const;
545
546 MCFOLD ::Level const& getLevelConst() const;
547
548#ifdef LL_PLAT_C
549 MCAPI ::BrightnessPair getLightColor(::BlockPos const& pos, ::Brightness minBlockLight) const;
550#endif
551
552 MCAPI bool getNextTickUpdateForPos(::BlockPos const& pos, ::TickingQueueType queueType, ::Tick& tick) const;
553
554 MCFOLD bool getPublicSource() const;
555
556 MCAPI ::Brightness getRawBrightness(::BlockPos const& pos, bool propagate, bool accountForNight) const;
557
558 MCAPI ::Brightness getRawBrightnessWithManualDarken(
559 ::BlockPos const& pos,
560 ::Brightness manualSkyDarken,
561 bool propagate,
562 bool accountForNight
563 ) const;
564
565 MCAPI float getSeenPercent(::Vec3 const& center, ::AABB const& bb);
566
567 MCAPI int getSkylightBrightness(::BlockPos const& pos) const;
568
569#ifdef LL_PLAT_C
570 MCAPI ::Biome const& getSurfaceBiome(::BlockPos const& pos) const;
571#endif
572
573 MCAPI void getTallestCollisionShapeFromUnloadedChunksAABBs(
574 ::AABB const& intersectTestBox,
575 ::AABB& tallestCollisionShape,
576 ::Vec3 const& posToMinimizeDistanceToIfMatchingHeight,
577 float& currentDistanceSqr
578 ) const;
579
580#ifdef LL_PLAT_C
581 MCFOLD float getTextureShiftNoise() const;
582#endif
583
584 MCAPI ::BlockTickingQueue*
585 getTickingQueue(::BlockPos const& pos, ::TickingQueueType queueType, bool skipOverrides) const;
586
587 MCAPI short getVoidHeight() const;
588
589#ifdef LL_PLAT_C
590 MCAPI int getWaterColor(::BlockPos const& pos) const;
591#endif
592
593 MCAPI ::WellKnownBiomeTags const& getWellKnownBiomeTags() const;
594
595 MCAPI ::LevelChunk* getWritableChunk(::ChunkPos const& pos);
596
597#ifdef LL_PLAT_C
598 MCAPI bool hasChunksAt(::BlockPos const& min, ::BlockPos const& max, bool ignoreClientChunk) const;
599#endif
600
601 MCAPI ::std::pair<bool, ::std::optional<::SubChunkPos>>
602 hasSubChunksAt(::BlockPos const& min, ::BlockPos const& max) const;
603
604 MCAPI bool hasTickInCurrentTick(::BlockPos const& pos) const;
605
606 MCAPI bool hasTickInPendingTicks(::BlockPos const& pos) const;
607
608 MCAPI bool hasTickInPendingTicks(::BlockPos const& pos, ::Block const& block) const;
609
610 MCAPI bool hasTickInPendingTicks(::BlockPos const& pos, ::BlockType const& block) const;
611
612 MCAPI bool hasTickInPendingTicks(::BlockPos const& pos, ::TickingQueueType queueType) const;
613
614 MCAPI bool hasTickInPendingTicks(::BlockPos const& pos, ::Block const& block, ::TickingQueueType queueType) const;
615
616 MCAPI bool
617 hasTickInPendingTicks(::BlockPos const& pos, ::BlockType const& block, ::TickingQueueType queueType) const;
618
619 MCAPI bool hasUntickedNeighborChunk(::ChunkPos const& pos, int chunkRadius) const;
620
621 MCAPI bool isChunkFullyLoaded(::ChunkPos const& chunkPos, ::ChunkSource const& chunkSource) const;
622
623 MCAPI bool isConsideredSolidBlock(::BlockPos const& pos) const;
624
625 MCAPI bool isEmptyBlock(::BlockPos const& pos) const;
626
627 MCAPI bool isEmptyWaterBlock(::BlockPos const& pos) const;
628
629 MCAPI bool isNearUnloadedChunks(::ChunkPos const& pos) const;
630
631#ifdef LL_PLAT_C
632 MCAPI bool isPositionUnderSnow(::Vec3 const& p);
633#endif
634
635 MCAPI bool isTouchingMaterial(::BlockPos const& pos, ::SharedTypes::v1_26_20::MaterialType type) const;
636
637#ifdef LL_PLAT_C
638 MCAPI bool isUnderWater(::BlockPos const& pos) const;
639#endif
640
641 MCAPI bool isUnobstructedByEntities(::AABB const& aabb, ::Actor const* ignoreEntity);
642
643 MCAPI bool isWithinHeightLimits(int y) const;
644
645 MCAPI void neighborChanged(::BlockPos const& neighPos, ::BlockPos const& myPos);
646
647 MCAPI void
648 postGameEvent(::Actor* source, ::GameEvent const& gameEvent, ::Vec3 const& originPos, ::Block const* affectedBlock);
649
650 MCAPI ::std::shared_ptr<::BlockActor> removeBlockEntity(::BlockPos const& blockPos);
651
652 MCAPI void removeFromRandomTickingQueue(::BlockPos const& pos, ::Block const& block);
653
654 MCAPI void removeFromTickingQueue(::BlockPos const& pos, ::Block const& block);
655
656 MCAPI bool setBlock(
657 ::BlockPos const& pos,
658 ::Block const& block,
659 int updateFlags,
660 ::std::shared_ptr<::BlockActor> blockEntity,
661 ::ActorBlockSyncMessage const* syncMsg,
662 ::BlockChangeContext const& changeSourceContext
663 );
664
665 MCAPI bool setBlockAndRetainCompatibleBlockActor(::BlockPos const& pos, ::Block const& block, int updateFlags);
666
667 MCAPI bool setBlockNoUpdate(::BlockPos const& pos, ::Block const& block);
668
669 MCAPI bool setBlockSimple(::BlockPos const& pos, ::Block const& block);
670
671 MCAPI void setBorderBlock(::BlockPos const& pos, bool val);
672
673 MCAPI bool setExtraBlockSimple(::BlockPos const& pos, ::Block const& block);
674
675#ifdef LL_PLAT_C
676 MCAPI void setGrassColor(int grassColor, ::BlockPos const& pos, int flags);
677#endif
678
679 MCFOLD void setIsPersistentBlockSource();
680
681 MCAPI bool setLiquidBlock(::BlockPos const& pos, ::Block const& block, bool useExtraData, int updateFlags);
682
683 MCAPI void setRandomTickingQueue(::BlockTickingQueue& queue);
684
685 MCAPI void setTickingQueue(::BlockTickingQueue& queue);
686
687#ifdef LL_PLAT_C
688 MCAPI void setWaterColor(int waterColor, ::BlockPos const& pos, int flags);
689#endif
690
691 MCAPI int ticksFromNow(::BlockPos const& pos, ::TickingQueueType queueType, int offset) const;
692
693 MCAPI ::Biome const* tryGetBiome(::BlockPos const& pos) const;
694
695 MCAPI void updateConnectionsAt(::BlockPos const& pos);
696
697 MCAPI void updateNeighborsAt(::BlockPos const& pos);
698
699 MCAPI void updateNeighborsAtExceptFromFacing(::BlockPos const& pos, int skipFacing);
700 // NOLINTEND
701
702public:
703 // static functions
704 // NOLINTBEGIN
705 MCAPI static bool containsAnyLiquid(::IConstBlockSource const& region, ::AABB const& box);
706
707 MCAPI static bool containsMaterial(
708 ::IConstBlockSource const& region,
709 ::AABB const& box,
710 ::SharedTypes::v1_26_20::MaterialType material
711 );
712
713 MCAPI static bool doesIntersect(
714 ::IConstBlockSource const& region,
715 ::AABB const& testAABB,
716 ::GetCollisionShapeInterface const& entity,
717 ::std::vector<::AABB>& storage,
718 bool withUnloadedChunks
719 );
720
721 MCFOLD static ::Block const& getEmptyBlock();
722
723 MCAPI static bool isEmptyBlock(::Block const& block);
724
725 MCAPI static bool isEmptyWaterBlock(::Block const& block);
726 // NOLINTEND
727
728public:
729 // constructor thunks
730 // NOLINTBEGIN
731 MCAPI void* $ctor(::ChunkSource& source, bool publicSource, bool allowUnpopulatedChunks);
732
733 MCAPI void* $ctor(
734 ::Level& level,
735 ::Dimension& dimension,
736 ::ChunkSource& source,
737 bool publicSource,
738 bool allowUnpopulatedChunks,
739 bool allowClientTickingChanges
740 );
741 // NOLINTEND
742
743public:
744 // destructor thunk
745 // NOLINTBEGIN
746 MCAPI void $dtor();
747 // NOLINTEND
748
749public:
750 // virtual function thunks
751 // NOLINTBEGIN
752 MCAPI ::WeakRef<::BlockSource> $getWeakRef();
753
754 MCFOLD ::Level& $getLevel();
755
756 MCFOLD ::Dimension& $getDimension() const;
757
758 MCFOLD ::Dimension const& $getDimensionConst() const;
759
760 MCAPI ::DimensionType $getDimensionId() const;
761
762 MCAPI bool $shouldFireEvents(::LevelChunk const& c) const;
763
764 MCAPI bool $isInstaticking(::BlockPos const& pos) const;
765
766 MCAPI void $addListener(::BlockSourceListener& l);
767
768 MCAPI void $removeListener(::BlockSourceListener& l);
769
770 MCAPI ::LevelChunk* $getChunk(int x, int z) const;
771
772 MCAPI ::LevelChunk* $getChunk(::ChunkPos const& pos) const;
773
774 MCAPI ::LevelChunk* $getChunkAt(::BlockPos const& pos) const;
775
776 MCAPI short $getAboveTopSolidBlock(
777 ::BlockPos const& pos,
778 bool includeWater,
779 bool includeLeaves,
780 bool iteratePastInitialBlocking
781 ) const;
782
783 MCAPI short $getAboveTopSolidBlock(int x, int z, bool includeWater, bool includeLeaves) const;
784
785 MCAPI short $getHeight(::brstd::function_ref<bool(::Block const&)> const& type, ::BlockPos const& pos) const;
786
787 MCAPI short $getHeight(::brstd::function_ref<bool(::Block const&)> const& type, int x, int z) const;
788
789 MCAPI ::Material const& $getMaterial(::BlockPos const& pos) const;
790
791 MCAPI ::Material const& $getMaterial(int x, int y, int z) const;
792
793 MCAPI short $getMaxHeight() const;
794
795 MCAPI short $getMinHeight() const;
796
797 MCAPI bool $hasBorderBlock(::BlockPos const pos) const;
798
799 MCAPI float $getBrightness(::BlockPos const& pos) const;
800
801 MCAPI bool $mayPlace(
802 ::Block const& block,
803 ::BlockPos const& pos,
804 uchar face,
805 ::Actor* placer,
806 bool ignoreEntities,
807 ::Vec3 clickPos
808 );
809
810 MCAPI bool $canDoBlockDrops() const;
811
812 MCAPI bool $canDoContainedItemDrops() const;
813
814 MCAPI bool $hasChunksAt(::Bounds const& bounds, bool ignoreClientChunk) const;
815
816 MCAPI bool $hasChunksAt(::BlockPos const& pos, int r, bool ignoreClientChunk) const;
817
818 MCAPI bool $hasChunksAt(::AABB const& bb, bool ignoreClientChunk) const;
819
820 MCAPI bool $areChunksFullyLoaded(::BlockPos const& pos, int r) const;
821
822 MCAPI bool $containsAnyLiquid(::AABB const& box) const;
823
824 MCAPI bool $containsMaterial(::AABB const& box, ::SharedTypes::v1_26_20::MaterialType material) const;
825
826 MCAPI void $blockEvent(::BlockPos const& pos, int b0, int b1);
827
828 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
829 $fetchEntities(::Actor const* except, ::AABB const& bb, bool useHitbox, bool getDisplayEntities);
830
831 MCAPI ::gsl::span<::gsl::not_null<::Actor*>> $fetchEntities(
832 ::ActorType entityTypeId,
833 ::AABB const& bb,
834 ::Actor const* except,
835 ::std::function<bool(::Actor*)> selector
836 );
837
838 MCAPI void
839 $fetchAABBs(::std::vector<::AABB>& shapes, ::AABB const& intersectTestBox, bool withUnloadedChunks) const;
840
841 MCAPI ::std::vector<::AABB>& $fetchAABBs(::AABB const& intersectTestBox, bool withUnloadedChunks);
842
843 MCAPI ::std::vector<::AABB>& $fetchCollisionShapes(
844 ::AABB const& intersectTestBox,
845 bool withUnloadedChunks,
846 ::std::optional<::EntityContext const> entity,
847 ::std::vector<::AABB>* tempShapes
848 );
849
850 MCAPI void $fetchCollisionShapes(
851 ::std::vector<::AABB>& shapes,
852 ::AABB const& intersectTestBox,
853 bool withUnloadedChunks,
855 ::std::vector<::AABB>* tempShapes
856 ) const;
857
858 MCAPI void $fetchCollisionShapesAndBlocks(
859 ::std::vector<::BlockSourceVisitor::CollisionShape>& shapes,
860 ::AABB const& intersectTestBox,
861 bool withUnloadedChunks,
863 ::std::vector<::AABB>* tempShapes
864 ) const;
865
866 MCAPI ::AABB $getTallestCollisionShape(
867 ::AABB const& intersectTestBox,
868 float* actualSurfaceOffset,
869 bool withUnloadedChunks,
871 ) const;
872
873 MCAPI ::HitResult $clip(
874 ::Vec3 const& A,
875 ::Vec3 const& B,
876 bool checkAgainstLiquid,
877 ::ShapeType shapeType,
878 int maxDistance,
879 bool ignoreBorderBlocks,
880 bool fullOnly,
881 ::Actor* actor,
882 ::std::function<bool(::BlockSource const&, ::Block const&, bool)> const& shouldCheckBlock,
883 bool stopOnFirstLiquidHit
884 ) const;
885
886 MCAPI ::HitResult $clip(::ClipParameters const& parameters) const;
887
888 MCAPI bool $isInWall(::Vec3 const& pos) const;
889
890 MCAPI bool $isUnderWater(::BlockPos const& pos, ::Block const& block) const;
891
892 MCAPI void $fireBlockChanged(
893 ::BlockPos const& pos,
894 uint layer,
895 ::Block const& block,
896 ::Block const& oldBlock,
897 int flags,
898 ::BlockChangedEventTarget eventTarget,
899 ::ActorBlockSyncMessage const* syncMsg,
900 ::Actor* source
901 );
902
903 MCAPI ::Block const& $getBlock(::BlockPos const& pos) const;
904
905 MCAPI ::Block const& $getBlock(::BlockPos const& pos, uint layer) const;
906
907 MCFOLD ::BlockActor const* $getBlockEntity(::BlockPos const& pos) const;
908
909 MCAPI ::Block const& $getExtraBlock(::BlockPos const& pos) const;
910
911 MCAPI ::Block const& $getLiquidBlock(::BlockPos const& pos) const;
912
913 MCAPI bool $hasBlock(::BlockPos const& pos) const;
914
915 MCAPI bool $setBlock(
916 ::BlockPos const& pos,
917 ::Block const& block,
918 int updateFlags,
919 ::ActorBlockSyncMessage const* syncMsg,
920 ::BlockChangeContext const& changeSourceContext
921 );
922
923 MCAPI bool $setExtraBlock(::BlockPos const& pos, ::Block const& block, int updateFlags);
924
925 MCAPI bool $removeBlock(::BlockPos const& pos, ::BlockChangeContext const& changeSourceContext);
926
927 MCAPI bool $isSolidBlockingBlock(int x, int y, int z) const;
928
929 MCAPI bool $isSolidBlockingBlock(::BlockPos const& p) const;
930
931 MCFOLD ::ILevel& $getILevel() const;
932
933 MCAPI ::LevelSeed64 $getLevelSeed64() const;
934
935 MCFOLD ::ChunkSource& $getChunkSource();
936
937 MCAPI bool $checkBlockDestroyPermissions(
938 ::Actor& entity,
939 ::BlockPos const& pos,
940 ::ItemStackBase const& item,
941 bool generateParticle
942 );
943
944 MCAPI bool $checkBlockPermissions(
945 ::Actor& entity,
946 ::BlockPos const& blockPos,
947 uchar face,
948 ::ItemStackBase const& item,
949 bool generateParticle
950 );
951
952 MCAPI void $postGameEvent(
953 ::Actor* source,
954 ::GameEvent const& gameEvent,
955 ::BlockPos const& originPos,
956 ::Block const* affectedBlock
957 );
958
959
960 // NOLINTEND
961
962public:
963 // vftables
964 // NOLINTBEGIN
965 MCAPI static void** $vftable();
966 // NOLINTEND
967};
Definition AABB.h:18
Definition Actor.h:123
Definition Biome.h:24
Definition BlockActor.h:30
Definition BlockChangeContext.h:16
Definition BlockDescriptor.h:21
Definition BlockPos.h:21
Definition BlockSourceListener.h:18
Definition BlockTickingQueue.h:27
Definition BlockType.h:84
Definition BlockVolume.h:14
Definition Block.h:69
Definition BoundingBox.h:13
Definition ChunkPos.h:11
Definition ChunkSource.h:37
Definition CompoundTag.h:23
Definition Container.h:34
Definition Dimension.h:88
Definition EnableGetWeakRef.h:6
Definition EntityContext.h:17
Definition GameEvent.h:9
Definition GetCollisionShapeInterface.h:13
Definition HitResult.h:19
Definition IBlockSource.h:38
Definition IConstBlockSource.h:23
Definition ILevel.h:218
Definition ItemStackBase.h:52
Definition LevelChunk.h:87
Definition LevelSeed64.h:5
Definition Level.h:254
Definition Material.h:8
Definition Mob.h:56
Definition SubChunkPos.h:5
Definition Vec3.h:10
Definition WeakEntityRef.h:14
Definition function_ref.h:60
Definition optional_ref.h:10
Definition ActorBlockSyncMessage.h:8
Definition ActorDefinitionIdentifier.h:15
Definition BiomeIdLatticeBatch.h:10
Definition BiomeTagIDType.h:5
Definition CollisionShape.h:16
Definition Bounds.h:8
Definition Brightness.h:8
Definition ClipParameters.h:16
Definition IDType.h:6
Definition Tick.h:5
Definition WellKnownBiomeTags.h:17