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