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