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/common/BrightnessPair.h"
7#include "mc/deps/core/utility/AutomaticID.h"
8#include "mc/deps/core/utility/optional_ref.h"
9#include "mc/deps/game_refs/EnableGetWeakRef.h"
10#include "mc/deps/game_refs/WeakRef.h"
11#include "mc/world/actor/ActorType.h"
12#include "mc/world/level/BlockChangedEventTarget.h"
13#include "mc/world/level/BlockDataFetchResult.h"
14#include "mc/world/level/BlockPos.h"
15#include "mc/world/level/ChunkPos.h"
16#include "mc/world/level/IBlockSource.h"
17#include "mc/world/level/ShapeType.h"
18#include "mc/world/level/TickingQueueType.h"
19#include "mc/world/level/block/BlockSupportType.h"
20#include "mc/world/level/block/actor/BlockActorType.h"
21#include "mc/world/level/material/MaterialType.h"
22
23// auto generated forward declare list
24// clang-format off
25class AABB;
26class Actor;
27class Biome;
28class Block;
29class BlockActor;
31class BlockDescriptor;
34class BlockType;
35class BlockVolume;
36class BoundingBox;
37class ChunkSource;
38class Dimension;
39class EntityContext;
40class GameEvent;
42class HitResult;
44class ILevel;
45class ItemStackBase;
46class Level;
47class LevelChunk;
48class LevelSeed64;
49class Material;
50class SubChunkPos;
51class Vec3;
52class WeakEntityRef;
56struct Bounds;
57struct Brightness;
58struct ClipParameters;
59namespace BlockSourceVisitor { struct CollisionShape; }
60// clang-format on
61
62class Mob;
63class Container;
64class CompoundTag;
65
66class BlockSource : public ::IBlockSource,
67 public ::EnableGetWeakRef<::BlockSource>,
68 public ::std::enable_shared_from_this<::BlockSource> {
69public:
70 LLNDAPI std::vector<Actor*> getEntities(
71 AABB const& range,
72 float extendDistance = 2.0f,
73 ActorType actorType = ActorType::TypeMask,
74 bool ignoreType = false
75 ) const;
76
77 LLNDAPI optional_ref<Container> tryGetContainer(BlockPos const& pos);
78
79 LLAPI optional_ref<Actor> spawnActor(CompoundTag const&);
80
81public:
82 // member variables
83 // NOLINTBEGIN
84 ::ll::TypedStorage<4, 4, ::std::thread::id const> mOwnerThreadID;
85 ::ll::TypedStorage<1, 1, bool const> mAllowUnpopulatedChunks;
86 ::ll::TypedStorage<1, 1, bool const> mPublicSource;
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<1, 1, bool> mIsPersistantBlockSource;
97 ::ll::TypedStorage<8, 8, ::ChunkPos> mLastChunkPos;
98 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::LevelChunk>> mLastChunkWeakPtr;
99 ::ll::TypedStorage<8, 8, ::LevelChunk*> mLastChunkDirectPtr;
100 ::ll::TypedStorage<8, 8, ::BlockTickingQueue*> mRandomTickQueue;
101 ::ll::TypedStorage<8, 8, ::BlockTickingQueue*> mTickQueue;
102 ::ll::TypedStorage<1, 2, ::BrightnessPair const> mDefaultBrightness;
103 ::ll::TypedStorage<8, 24, ::std::vector<::Actor*>> mTempEntityList;
104 ::ll::TypedStorage<8, 24, ::std::vector<::BlockActor*>> mTempBlockEntityList;
105 ::ll::TypedStorage<8, 24, ::std::vector<::AABB>> mTempCubeList;
106 // NOLINTEND
107
108public:
109 // prevent constructor by default
110 BlockSource& operator=(BlockSource const&);
111 BlockSource(BlockSource const&);
112 BlockSource();
113
114public:
115 // virtual functions
116 // NOLINTBEGIN
117 virtual ~BlockSource() /*override*/;
118
119 virtual ::WeakRef<::BlockSource> getWeakRef() /*override*/;
120
121 virtual ::Level& getLevel() /*override*/;
122
123 virtual ::Dimension& getDimension() const /*override*/;
124
125 virtual ::Dimension& getDimension() /*override*/;
126
127 virtual ::Dimension const& getDimensionConst() const /*override*/;
128
129 virtual ::DimensionType getDimensionId() const /*override*/;
130
131 virtual bool shouldFireEvents(::LevelChunk const& c) const /*override*/;
132
133 virtual bool isInstaticking(::BlockPos const& pos) const /*override*/;
134
135 virtual void addListener(::BlockSourceListener& l) /*override*/;
136
137 virtual void removeListener(::BlockSourceListener& l) /*override*/;
138
139 virtual ::LevelChunk* getChunk(int x, int z) const /*override*/;
140
141 virtual ::LevelChunk* getChunk(::ChunkPos const& pos) const /*override*/;
142
143 virtual ::LevelChunk* getChunkAt(::BlockPos const& pos) const /*override*/;
144
145 virtual short getAboveTopSolidBlock(
146 ::BlockPos const& pos,
147 bool includeWater,
148 bool includeLeaves,
149 bool iteratePastInitialBlocking
150 ) const /*override*/;
151
152 virtual short getAboveTopSolidBlock(int x, int z, bool includeWater, bool includeLeaves) const /*override*/;
153
154 virtual short getHeight(::std::function<bool(::Block const&)> const& type, ::BlockPos const& pos) const
155 /*override*/;
156
157 virtual short getHeight(::std::function<bool(::Block const&)> const& type, int x, int z) const /*override*/;
158
159 virtual ::Material const& getMaterial(::BlockPos const& pos) const /*override*/;
160
161 virtual ::Material const& getMaterial(int x, int y, int z) const /*override*/;
162
163 virtual short getMaxHeight() const /*override*/;
164
165 virtual short getMinHeight() const /*override*/;
166
167 virtual bool hasBorderBlock(::BlockPos const pos) const /*override*/;
168
169 virtual float getBrightness(::BlockPos const& pos) const /*override*/;
170
171 virtual bool mayPlace(
172 ::Block const& block,
173 ::BlockPos const& pos,
174 uchar face,
175 ::Actor* placer,
176 bool ignoreEntities,
177 ::Vec3 clickPos
178 ) /*override*/;
179
180 virtual bool canDoBlockDrops() const /*override*/;
181
182 virtual bool canDoContainedItemDrops() const /*override*/;
183
184 virtual bool hasChunksAt(::Bounds const& bounds, bool ignoreClientChunk) const /*override*/;
185
186 virtual bool hasChunksAt(::BlockPos const& pos, int r, bool ignoreClientChunk) const /*override*/;
187
188 virtual bool hasChunksAt(::AABB const& bb, bool ignoreClientChunk) const /*override*/;
189
190 virtual bool areChunksFullyLoaded(::BlockPos const& pos, int r) const /*override*/;
191
192 virtual bool containsAnyLiquid(::AABB const& box) const /*override*/;
193
194 virtual bool containsMaterial(::AABB const& box, ::MaterialType material) const /*override*/;
195
196 virtual void blockEvent(::BlockPos const& pos, int b0, int b1) /*override*/;
197
198 virtual ::gsl::span<::gsl::not_null<::Actor*>>
199 fetchEntities(::Actor const* except, ::AABB const& bb, bool useHitbox, bool getDisplayEntities) /*override*/;
200
201 virtual ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
202 ::ActorType entityTypeId,
203 ::AABB const& bb,
204 ::Actor const* except,
205 ::std::function<bool(::Actor*)> selector
206 ) /*override*/;
207
208 virtual void
209 fetchAABBs(::std::vector<::AABB>& shapes, ::AABB const& intersectTestBox, bool withUnloadedChunks) const
210 /*override*/;
211
212 virtual ::std::vector<::AABB>& fetchAABBs(::AABB const& intersectTestBox, bool withUnloadedChunks) /*override*/;
213
214 virtual ::std::vector<::AABB>& fetchCollisionShapes(
215 ::AABB const& intersectTestBox,
216 bool withUnloadedChunks,
217 ::std::optional<::EntityContext const> entity,
218 ::std::vector<::AABB>* tempShapes
219 ) /*override*/;
220
221 virtual void fetchCollisionShapes(
222 ::std::vector<::AABB>& shapes,
223 ::AABB const& intersectTestBox,
224 bool withUnloadedChunks,
226 ::std::vector<::AABB>* tempShapes
227 ) const /*override*/;
228
229 virtual void fetchCollisionShapesAndBlocks(
230 ::std::vector<::BlockSourceVisitor::CollisionShape>& shapes,
231 ::AABB const& intersectTestBox,
232 bool withUnloadedChunks,
234 ::std::vector<::AABB>* tempShapes
235 ) const /*override*/;
236
237 virtual ::AABB getTallestCollisionShape(
238 ::AABB const& intersectTestBox,
239 float* actualSurfaceOffset,
240 bool withUnloadedChunks,
242 ) const /*override*/;
243
244 virtual ::HitResult clip(
245 ::Vec3 const& A,
246 ::Vec3 const& B,
247 bool checkAgainstLiquid,
248 ::ShapeType shapeType,
249 int maxDistance,
250 bool ignoreBorderBlocks,
251 bool fullOnly,
252 ::Actor* actor,
253 ::std::function<bool(::BlockSource const&, ::Block const&, bool)> const& shouldCheckBlock,
254 bool stopOnFirstLiquidHit
255 ) const /*override*/;
256
257 virtual ::HitResult clip(::ClipParameters const& parameters) const /*override*/;
258
259 virtual bool isInWall(::Vec3 const& pos) const /*override*/;
260
261 virtual bool isUnderWater(::BlockPos const& pos, ::Block const& block) const /*override*/;
262
263 virtual void fireBlockChanged(
264 ::BlockPos const&,
265 uint,
266 ::Block const&,
267 ::Block const&,
268 int,
269 ::BlockChangedEventTarget,
271 ::Actor*
272 ) /*override*/;
273
274 virtual ::Block const& getBlock(::BlockPos const& pos) const /*override*/;
275
276 virtual ::Block const& getBlock(::BlockPos const& pos, uint layer) const /*override*/;
277
278 virtual ::BlockActor const* getBlockEntity(::BlockPos const& pos) const /*override*/;
279
280 virtual ::Block const& getExtraBlock(::BlockPos const& pos) const /*override*/;
281
282 virtual ::Block const& getLiquidBlock(::BlockPos const& pos) const /*override*/;
283
284 virtual bool hasBlock(::BlockPos const& pos) const /*override*/;
285
286 virtual bool setBlock(
287 ::BlockPos const& pos,
288 ::Block const& block,
289 int updateFlags,
290 ::ActorBlockSyncMessage const* syncMsg,
291 ::BlockChangeContext const& changeSourceContext
292 ) /*override*/;
293
294 virtual bool setExtraBlock(::BlockPos const& pos, ::Block const& block, int updateFlags) /*override*/;
295
296 virtual bool removeBlock(::BlockPos const& pos, ::BlockChangeContext const& changeSourceContext) /*override*/;
297
298 virtual bool isSolidBlockingBlock(int x, int y, int z) const /*override*/;
299
300 virtual bool isSolidBlockingBlock(::BlockPos const& p) const /*override*/;
301
302 virtual ::ILevel& getILevel() const /*override*/;
303
304 virtual ::LevelSeed64 getLevelSeed64() const /*override*/;
305
306 virtual ::ChunkSource& getChunkSource() /*override*/;
307
308 virtual bool checkBlockDestroyPermissions(
309 ::Actor& entity,
310 ::BlockPos const& pos,
311 ::ItemStackBase const& item,
312 bool generateParticle
313 ) /*override*/;
314
315 virtual bool checkBlockPermissions(
316 ::Actor& entity,
317 ::BlockPos const& blockPos,
318 uchar face,
319 ::ItemStackBase const& item,
320 bool generateParticle
321 ) /*override*/;
322
323 virtual void postGameEvent(
324 ::Actor* source,
325 ::GameEvent const& gameEvent,
326 ::BlockPos const& originPos,
327 ::Block const* affectedBlock
328 ) /*override*/;
329 // NOLINTEND
330
331public:
332 // member functions
333 // NOLINTBEGIN
334 MCAPI BlockSource(
335 ::Level& level,
336 ::Dimension& dimension,
337 ::ChunkSource& source,
338 bool publicSource,
339 bool allowUnpopulatedChunks,
340 bool allowClientTickingChanges
341 );
342
343 MCAPI void _addToTickingQueue(
344 ::BlockPos const& pos,
345 ::Block const& block,
346 int tickDelay,
347 int priorityOffset,
348 ::TickingQueueType queueType,
349 bool skipOverrides
350 );
351
352 MCAPI void _blockChanged(
353 ::BlockPos const& pos,
354 uint layer,
355 ::Block const& block,
356 ::Block const& previousBlock,
357 int updateFlags,
358 bool fireEvent,
359 ::ActorBlockSyncMessage const* syncMsg,
360 ::Actor* blockChangeSource
361 );
362
363 MCAPI void _fetchBorderBlockCollisions(
364 ::std::vector<::AABB>& shapes,
365 ::AABB const& intersectTestBox,
367 bool
368 ) const;
369
370 MCAPI void _fetchEntityHelper(
371 ::WeakEntityRef const& entityRef,
372 ::gsl::span<::gsl::not_null<::Actor const*>> const& ignoredEntities,
373 ::AABB const& bb,
374 bool useHitbox
375 );
376
377 MCAPI void _fetchEntityHelper(
378 ::WeakEntityRef const& entityRef,
379 ::ActorType entityTypeId,
380 ::AABB const& bb,
381 ::Actor const* except,
382 ::std::function<bool(::Actor*)> selector
383 );
384
385 MCAPI bool _getBlockPermissions(::BlockPos const& pos, bool currentState);
386
387 MCAPI ::Brightness
388 _getRawBrightness(::BlockPos const& pos, ::Brightness skyDarken, bool propagate, bool accountForNight) const;
389
390 MCAPI void _removeFromTickingQueue(::BlockPos const& pos, ::Block const& block, ::TickingQueueType queueType);
391
392 MCAPI void _updateTallestCollisionShapeWithBorderBlockCollisions(
393 ::AABB const& intersectTestBox,
395 ::AABB& result,
396 ::Vec3 const& posToMinimizeDistanceToIfMatchingHeight,
397 float& currentDistanceSqr
398 ) const;
399
400 MCAPI void addToRandomTickingQueuePercentChance(
401 ::BlockPos const& pos,
402 ::Block const& block,
403 float percentChance,
404 int priorityOffset,
405 bool skipOverrides
406 );
407
408 MCAPI void addToTickingQueue(
409 ::BlockPos const& pos,
410 ::Block const& block,
411 int tickDelay,
412 int priorityOffset,
413 bool skipOverrides
414 );
415
416 MCAPI bool areChunksFullyLoaded(::BlockPos const& min, ::BlockPos const& max) const;
417
418 MCAPI_C void blockEvent(int x, int y, int z, int b0, int b1);
419
420 MCAPI bool canProvideSupport(::BlockPos const& pos, uchar face, ::BlockSupportType type) const;
421
422 MCAPI bool canSeeSky(::BlockPos const& pos) const;
423
424 MCAPI bool canSeeSkyFromBelowWater(::BlockPos const& pos);
425
426 MCAPI bool containsAnyBlockInBox(::BoundingBox const& box, ::std::function<bool(::Block const&)> predicate);
427
428 MCAPI bool containsAnyBlockOfType(::BlockPos const& min, ::BlockPos const& max, ::Block const& type) const;
429
430 MCAPI bool containsAnySolidBlocking(::AABB const& box) const;
431
432 MCAPI uint64 countBlocksOfType(
433 ::BlockDescriptor const& blockDescriptor,
434 ::BlockPos const& min,
435 ::BlockPos const& max,
436 uint64 maxCount
437 ) const;
438
439 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
440 fetchActors(::ActorDefinitionIdentifier const& actorId, ::AABB const& bb);
441
442 MCAPI ::std::vector<::BlockActor*> fetchBlockEntities(::BlockActorType blockActorTypeId, ::AABB const& bb) const;
443
444 MCAPI_S ::std::vector<::BlockActor*> const& fetchBlockEntities(::AABB const& bb);
445
446 MCAPI_C void
447 fetchBlockEntities(::AABB const& bb, ::std::vector<::BlockActor*>& blockEntityList, bool withPreservedEntities);
448
449 MCAPI bool fetchBlocks(::BlockPos const& origin, ::BlockVolume& volume) const;
450
451 MCAPI ::gsl::span<::BlockDataFetchResult<::Block> const>
452 fetchBlocksInBox(::BoundingBox const& box, ::std::function<bool(::Block const&)> predicate);
453
454 MCAPI ::gsl::span<::BlockDataFetchResult<::Block> const>
455 fetchBlocksInBoxSorted(::BoundingBox const& box, ::std::function<bool(::Block const&)> predicate);
456
457 MCAPI ::gsl::span<::BlockDataFetchResult<::Block> const> fetchBlocksInCylinder(
458 ::BlockPos const& centerPos,
459 uint radius,
460 uint height,
461 ::std::function<bool(::Block const&)> predicate
462 );
463
464 MCAPI ::gsl::span<::BlockDataFetchResult<::Block> const> fetchBlocksInCylinderSorted(
465 ::BlockPos const& centerPos,
466 uint radius,
467 uint height,
468 ::std::function<bool(::Block const&)> predicate
469 );
470
471 MCAPI ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
472 ::gsl::span<::gsl::not_null<::Actor const*>> ignoredEntities,
473 ::AABB const& bb,
474 bool useHitbox,
475 bool getDisplayEntities
476 );
477
478 MCAPI ::std::vector<::Actor*> const& fetchEntities2(::ActorType type, ::AABB const& aabb, bool ignoreTargetType);
479
480 MCAPI ::Actor* fetchNearestEntityOfType(::Actor const* except, ::AABB const& bb, ::ActorType entityTypeId);
481
482 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
483 fetchPlayers(::AABB const& bb, ::Actor const* except, ::std::function<bool(::Actor*)> selector);
484
485 MCAPI bool findNextTopSolidBlockUnder(::BlockPos& pos);
486
487 MCAPI void fireBlockEntityChanged(::BlockActor& te);
488
489 MCAPI ::Biome const& getBiome(::BlockPos const& pos) const;
490
491 MCAPI_C ::BiomeIdLatticeBatch getBiomeIdsInBatch(::BlockPos const& centerPos, int areaOffset, int gridOffset) const;
492
493 MCAPI ::BlockActor* getBlockEntity(::BlockPos const&);
494
495 MCAPI_C ::BrightnessPair getLightColor(::BlockPos const& pos, ::Brightness minBlockLight) const;
496
497 MCAPI float getSeenPercent(::Vec3 const& center, ::AABB const& bb);
498
499 MCAPI int getSkylightBrightness(::BlockPos const& pos) const;
500
501 MCAPI_C ::Biome const& getSurfaceBiome(::BlockPos const& pos) const;
502
503 MCAPI void getTallestCollisionShapeFromUnloadedChunksAABBs(
504 ::AABB const& intersectTestBox,
505 ::AABB& tallestCollisionShape,
506 ::Vec3 const& posToMinimizeDistanceToIfMatchingHeight,
507 float& currentDistanceSqr
508 ) const;
509
510 MCAPI ::std::pair<bool, ::std::optional<::SubChunkPos>>
511 hasSubChunksAt(::BlockPos const& min, ::BlockPos const& max) const;
512
513 MCAPI bool hasTickInCurrentTick(::BlockPos const& pos, ::TickingQueueType queueType) const;
514
515 MCAPI bool hasTickInPendingTicks(::BlockPos const& pos, ::TickingQueueType queueType) const;
516
517 MCAPI bool hasTickInPendingTicks(::BlockPos const& pos, ::Block const& block, ::TickingQueueType queueType) const;
518
519 MCAPI bool
520 hasTickInPendingTicks(::BlockPos const& pos, ::BlockType const& block, ::TickingQueueType queueType) const;
521
522 MCAPI bool hasUntickedNeighborChunk(::ChunkPos const& pos, int chunkRadius) const;
523
524 MCAPI_C bool isEmptyBlock(::BlockPos const& pos) const;
525
526 MCAPI bool isNearUnloadedChunks(::ChunkPos const& pos) const;
527
528 MCAPI_C bool isPositionUnderSnow(::Vec3 const& p);
529
530 MCAPI bool isTouchingMaterial(::BlockPos const& pos, ::MaterialType type) const;
531
532 MCAPI bool isWithinHeightLimits(int y) const;
533
534 MCAPI void neighborChanged(::BlockPos const& neighPos, ::BlockPos const& myPos);
535
536 MCAPI void
537 postGameEvent(::Actor* source, ::GameEvent const& gameEvent, ::Vec3 const& originPos, ::Block const* affectedBlock);
538
539 MCAPI ::std::shared_ptr<::BlockActor> removeBlockEntity(::BlockPos const& blockPos);
540
541 MCAPI bool setBlock(
542 ::BlockPos const& pos,
543 ::Block const& block,
544 int updateFlags,
545 ::std::shared_ptr<::BlockActor> blockEntity,
546 ::ActorBlockSyncMessage const* syncMsg,
547 ::BlockChangeContext const& changeSourceContext
548 );
549
550 MCAPI bool setBlockAndRetainCompatibleBlockActor(::BlockPos const& pos, ::Block const& block, int updateFlags);
551
552 MCAPI void setBorderBlock(::BlockPos const& pos, bool val);
553
554 MCAPI bool setExtraBlockSimple(::BlockPos const& pos, ::Block const& block);
555
556 MCAPI bool setLiquidBlock(::BlockPos const& pos, ::Block const& block, bool useExtraData, int updateFlags);
557
558 MCAPI_C ::Biome const* tryGetBiome(::BlockPos const& pos) const;
559
560 MCAPI void updateConnectionsAt(::BlockPos const& pos);
561
562 MCAPI void updateNeighborsAt(::BlockPos const& pos);
563
564 MCAPI void updateNeighborsAtExceptFromFacing(::BlockPos const& pos, int skipFacing);
565 // NOLINTEND
566
567public:
568 // static functions
569 // NOLINTBEGIN
570 MCAPI static bool containsAnyLiquid(::IConstBlockSource const& region, ::AABB const& box);
571
572 MCAPI static bool containsMaterial(::IConstBlockSource const& region, ::AABB const& box, ::MaterialType material);
573
574 MCFOLD static ::Block const& getEmptyBlock();
575 // NOLINTEND
576
577public:
578 // constructor thunks
579 // NOLINTBEGIN
580 MCAPI void* $ctor(
581 ::Level& level,
582 ::Dimension& dimension,
583 ::ChunkSource& source,
584 bool publicSource,
585 bool allowUnpopulatedChunks,
586 bool allowClientTickingChanges
587 );
588 // NOLINTEND
589
590public:
591 // destructor thunk
592 // NOLINTBEGIN
593 MCAPI void $dtor();
594 // NOLINTEND
595
596public:
597 // virtual function thunks
598 // NOLINTBEGIN
599 MCAPI ::WeakRef<::BlockSource> $getWeakRef();
600
601 MCFOLD ::Level& $getLevel();
602
603 MCFOLD ::Dimension& $getDimension() const;
604
605 MCFOLD ::Dimension const& $getDimensionConst() const;
606
607 MCAPI ::DimensionType $getDimensionId() const;
608
609 MCAPI bool $shouldFireEvents(::LevelChunk const& c) const;
610
611 MCAPI bool $isInstaticking(::BlockPos const& pos) const;
612
613 MCAPI void $addListener(::BlockSourceListener& l);
614
615 MCAPI void $removeListener(::BlockSourceListener& l);
616
617 MCAPI ::LevelChunk* $getChunk(int x, int z) const;
618
619 MCAPI ::LevelChunk* $getChunk(::ChunkPos const& pos) const;
620
621 MCAPI ::LevelChunk* $getChunkAt(::BlockPos const& pos) const;
622
623 MCAPI short $getAboveTopSolidBlock(
624 ::BlockPos const& pos,
625 bool includeWater,
626 bool includeLeaves,
627 bool iteratePastInitialBlocking
628 ) const;
629
630 MCAPI short $getAboveTopSolidBlock(int x, int z, bool includeWater, bool includeLeaves) const;
631
632 MCAPI short $getHeight(::std::function<bool(::Block const&)> const& type, ::BlockPos const& pos) const;
633
634 MCAPI short $getHeight(::std::function<bool(::Block const&)> const& type, int x, int z) const;
635
636 MCAPI ::Material const& $getMaterial(::BlockPos const& pos) const;
637
638 MCAPI ::Material const& $getMaterial(int x, int y, int z) const;
639
640 MCAPI short $getMaxHeight() const;
641
642 MCAPI short $getMinHeight() const;
643
644 MCAPI bool $hasBorderBlock(::BlockPos const pos) const;
645
646 MCAPI float $getBrightness(::BlockPos const& pos) const;
647
648 MCAPI bool $mayPlace(
649 ::Block const& block,
650 ::BlockPos const& pos,
651 uchar face,
652 ::Actor* placer,
653 bool ignoreEntities,
654 ::Vec3 clickPos
655 );
656
657 MCAPI bool $canDoBlockDrops() const;
658
659 MCAPI bool $canDoContainedItemDrops() const;
660
661 MCAPI bool $hasChunksAt(::Bounds const& bounds, bool ignoreClientChunk) const;
662
663 MCAPI bool $hasChunksAt(::BlockPos const& pos, int r, bool ignoreClientChunk) const;
664
665 MCAPI bool $hasChunksAt(::AABB const& bb, bool ignoreClientChunk) const;
666
667 MCAPI bool $areChunksFullyLoaded(::BlockPos const& pos, int r) const;
668
669 MCAPI bool $containsAnyLiquid(::AABB const& box) const;
670
671 MCAPI bool $containsMaterial(::AABB const& box, ::MaterialType material) const;
672
673 MCAPI void $blockEvent(::BlockPos const& pos, int b0, int b1);
674
675 MCAPI ::gsl::span<::gsl::not_null<::Actor*>>
676 $fetchEntities(::Actor const* except, ::AABB const& bb, bool useHitbox, bool getDisplayEntities);
677
678 MCAPI ::gsl::span<::gsl::not_null<::Actor*>> $fetchEntities(
679 ::ActorType entityTypeId,
680 ::AABB const& bb,
681 ::Actor const* except,
682 ::std::function<bool(::Actor*)> selector
683 );
684
685 MCAPI void
686 $fetchAABBs(::std::vector<::AABB>& shapes, ::AABB const& intersectTestBox, bool withUnloadedChunks) const;
687
688 MCAPI ::std::vector<::AABB>& $fetchAABBs(::AABB const& intersectTestBox, bool withUnloadedChunks);
689
690 MCAPI ::std::vector<::AABB>& $fetchCollisionShapes(
691 ::AABB const& intersectTestBox,
692 bool withUnloadedChunks,
693 ::std::optional<::EntityContext const> entity,
694 ::std::vector<::AABB>* tempShapes
695 );
696
697 MCAPI void $fetchCollisionShapes(
698 ::std::vector<::AABB>& shapes,
699 ::AABB const& intersectTestBox,
700 bool withUnloadedChunks,
702 ::std::vector<::AABB>* tempShapes
703 ) const;
704
705 MCAPI void $fetchCollisionShapesAndBlocks(
706 ::std::vector<::BlockSourceVisitor::CollisionShape>& shapes,
707 ::AABB const& intersectTestBox,
708 bool withUnloadedChunks,
710 ::std::vector<::AABB>* tempShapes
711 ) const;
712
713 MCAPI ::AABB $getTallestCollisionShape(
714 ::AABB const& intersectTestBox,
715 float* actualSurfaceOffset,
716 bool withUnloadedChunks,
718 ) const;
719
720 MCAPI ::HitResult $clip(
721 ::Vec3 const& A,
722 ::Vec3 const& B,
723 bool checkAgainstLiquid,
724 ::ShapeType shapeType,
725 int maxDistance,
726 bool ignoreBorderBlocks,
727 bool fullOnly,
728 ::Actor* actor,
729 ::std::function<bool(::BlockSource const&, ::Block const&, bool)> const& shouldCheckBlock,
730 bool stopOnFirstLiquidHit
731 ) const;
732
733 MCAPI ::HitResult $clip(::ClipParameters const& parameters) const;
734
735 MCAPI bool $isInWall(::Vec3 const& pos) const;
736
737 MCAPI bool $isUnderWater(::BlockPos const& pos, ::Block const& block) const;
738
739 MCAPI ::Block const& $getBlock(::BlockPos const& pos) const;
740
741 MCAPI ::Block const& $getBlock(::BlockPos const& pos, uint layer) const;
742
743 MCFOLD ::BlockActor const* $getBlockEntity(::BlockPos const& pos) const;
744
745 MCAPI ::Block const& $getExtraBlock(::BlockPos const& pos) const;
746
747 MCAPI ::Block const& $getLiquidBlock(::BlockPos const& pos) const;
748
749 MCAPI bool $hasBlock(::BlockPos const& pos) const;
750
751 MCAPI bool $setBlock(
752 ::BlockPos const& pos,
753 ::Block const& block,
754 int updateFlags,
755 ::ActorBlockSyncMessage const* syncMsg,
756 ::BlockChangeContext const& changeSourceContext
757 );
758
759 MCAPI bool $setExtraBlock(::BlockPos const& pos, ::Block const& block, int updateFlags);
760
761 MCAPI bool $removeBlock(::BlockPos const& pos, ::BlockChangeContext const& changeSourceContext);
762
763 MCAPI bool $isSolidBlockingBlock(int x, int y, int z) const;
764
765 MCAPI bool $isSolidBlockingBlock(::BlockPos const& p) const;
766
767 MCFOLD ::ILevel& $getILevel() const;
768
769 MCAPI ::LevelSeed64 $getLevelSeed64() const;
770
771 MCFOLD ::ChunkSource& $getChunkSource();
772
773 MCAPI bool $checkBlockDestroyPermissions(
774 ::Actor& entity,
775 ::BlockPos const& pos,
776 ::ItemStackBase const& item,
777 bool generateParticle
778 );
779
780 MCAPI bool $checkBlockPermissions(
781 ::Actor& entity,
782 ::BlockPos const& blockPos,
783 uchar face,
784 ::ItemStackBase const& item,
785 bool generateParticle
786 );
787
788 MCAPI void $postGameEvent(
789 ::Actor* source,
790 ::GameEvent const& gameEvent,
791 ::BlockPos const& originPos,
792 ::Block const* affectedBlock
793 );
794
795
796 // NOLINTEND
797
798public:
799 // vftables
800 // NOLINTBEGIN
801 MCAPI static void** $vftable();
802 // NOLINTEND
803};
Definition AABB.h:18
Definition Actor.h:105
Definition Biome.h:23
Definition BlockActor.h:32
Definition BlockChangeContext.h:10
Definition BlockDescriptor.h:20
Definition BlockPos.h:19
Definition BlockSourceListener.h:18
Definition BlockTickingQueue.h:24
Definition BlockType.h:84
Definition BlockVolume.h:13
Definition Block.h:43
Definition BoundingBox.h:13
Definition ChunkPos.h:11
Definition ChunkSource.h:37
Definition CompoundTag.h:23
Definition Container.h:33
Definition Dimension.h:85
Definition EnableGetWeakRef.h:6
Definition EntityContext.h:16
Definition GameEvent.h:8
Definition GetCollisionShapeInterface.h:13
Definition HitResult.h:17
Definition IBlockSource.h:37
Definition IConstBlockSource.h:25
Definition ILevel.h:214
Definition ItemStackBase.h:44
Definition LevelChunk.h:79
Definition LevelSeed64.h:5
Definition Level.h:249
Definition Material.h:8
Definition Mob.h:50
Definition SubChunkPos.h:5
Definition Vec3.h:10
Definition WeakEntityRef.h:14
Definition optional_ref.h:10
Definition ActorBlockSyncMessage.h:8
Definition ActorDefinitionIdentifier.h:15
Definition BiomeIdLatticeBatch.h:5
Definition CollisionShape.h:16
Definition Bounds.h:8
Definition Brightness.h:8
Definition ClipParameters.h:16