LeviLamina
Loading...
Searching...
No Matches
IBlockSource.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/game_refs/WeakRef.h"
7#include "mc/deps/vanilla_components/IConstBlockSource.h"
8#include "mc/platform/brstd/function_ref.h"
9#include "mc/world/actor/ActorType.h"
10#include "mc/world/level/BlockChangedEventTarget.h"
11#include "mc/world/level/ShapeType.h"
12
13// auto generated forward declare list
14// clang-format off
15class AABB;
16class Actor;
17class Block;
19class BlockPos;
20class BlockSource;
22class ChunkPos;
23class ChunkSource;
24class Dimension;
25class EntityContext;
26class GameEvent;
27class HitResult;
28class ILevel;
29class ItemStackBase;
30class Level;
31class LevelChunk;
32class LevelSeed64;
33class Vec3;
35struct ClipParameters;
36// clang-format on
37
39public:
40 // IBlockSource inner types define
41 using Listener = ::BlockSourceListener;
42
43 using ListenerVector = ::std::vector<::BlockSourceListener*>;
44
45public:
46 // virtual functions
47 // NOLINTBEGIN
48 virtual ::std::vector<::AABB>& fetchAABBs(::AABB const& intersectTestBox, bool withUnloadedChunks) = 0;
49
50 virtual ::std::vector<::AABB>& fetchCollisionShapes(
51 ::AABB const& intersectTestBox,
52 bool withUnloadedChunks,
53 ::std::optional<::EntityContext const> entity,
54 ::std::vector<::AABB>* tempShapes
55 ) = 0;
56
57 virtual ::WeakRef<::BlockSource> getWeakRef() = 0;
58
59 virtual void addListener(::BlockSourceListener& l) = 0;
60
61 virtual void removeListener(::BlockSourceListener& l) = 0;
62
63 virtual ::gsl::span<::gsl::not_null<::Actor*>>
64 fetchEntities(::Actor const* except, ::AABB const& bb, bool useHitbox, bool getDisplayEntities) = 0;
65
66 virtual ::gsl::span<::gsl::not_null<::Actor*>> fetchEntities(
67 ::ActorType entityTypeId,
68 ::AABB const& bb,
69 ::Actor const* except,
70 ::std::function<bool(::Actor*)> selector
71 ) = 0;
72
73 virtual bool setBlock(
74 ::BlockPos const& pos,
75 ::Block const& block,
76 int updateFlags,
77 ::ActorBlockSyncMessage const* syncMsg,
78 ::BlockChangeContext const& changeSourceContext
79 ) = 0;
80
81 virtual bool setExtraBlock(::BlockPos const& pos, ::Block const& block, int updateFlags) = 0;
82
83 virtual bool removeBlock(::BlockPos const& pos, ::BlockChangeContext const& changeSourceContext) = 0;
84
85 virtual short getMinHeight() const = 0;
86
87 virtual short getMaxHeight() const = 0;
88
89 virtual ::Dimension& getDimension() const = 0;
90
91 virtual ::Dimension& getDimension() = 0;
92
93 virtual ::Dimension const& getDimensionConst() const = 0;
94
95 virtual ::LevelChunk* getChunkAt(::BlockPos const& pos) const = 0;
96
97 virtual ::LevelChunk* getChunk(int x, int z) const = 0;
98
99 virtual ::LevelChunk* getChunk(::ChunkPos const& pos) const = 0;
100
101 virtual ::Level& getLevel() = 0;
102
103 virtual ::ILevel& getILevel() const = 0;
104
105 virtual ::LevelSeed64 getLevelSeed64() const = 0;
106
107 virtual short getAboveTopSolidBlock(int x, int z, bool includeWater, bool includeLeaves) const = 0;
108
109 virtual short getAboveTopSolidBlock(
110 ::BlockPos const& pos,
111 bool includeWater,
112 bool includeLeaves,
113 bool iteratePastInitialBlocking
114 ) const = 0;
115
116 virtual short getHeight(::brstd::function_ref<bool(::Block const&)> const& type, ::BlockPos const& pos) const = 0;
117
118 virtual short getHeight(::brstd::function_ref<bool(::Block const&)> const& type, int x, int z) const = 0;
119
120 virtual ::HitResult clip(
121 ::Vec3 const& A,
122 ::Vec3 const& B,
123 bool checkAgainstLiquid,
124 ::ShapeType shapeType,
125 int maxDistance,
126 bool ignoreBorderBlocks,
127 bool fullOnly,
128 ::Actor* actor,
129 ::std::function<bool(::BlockSource const&, ::Block const&, bool)> const& shouldCheckBlock,
130 bool stopOnFirstLiquidHit
131 ) const = 0;
132
133 virtual ::HitResult clip(::ClipParameters const& parameters) const = 0;
134
135 virtual ::ChunkSource& getChunkSource() = 0;
136
137 virtual bool isSolidBlockingBlock(::BlockPos const& p) const = 0;
138
139 virtual bool isSolidBlockingBlock(int x, int y, int z) const = 0;
140
141 virtual bool areChunksFullyLoaded(::BlockPos const& pos, int r) const = 0;
142
143 virtual bool mayPlace(
144 ::Block const& block,
145 ::BlockPos const& pos,
146 uchar face,
147 ::Actor* placer,
148 bool ignoreEntities,
149 ::Vec3 clickPos
150 ) = 0;
151
152 virtual bool canDoBlockDrops() const = 0;
153
154 virtual bool canDoContainedItemDrops() const = 0;
155
156 virtual bool isInstaticking(::BlockPos const& pos) const = 0;
157
158 virtual bool checkBlockDestroyPermissions(
159 ::Actor& entity,
160 ::BlockPos const& pos,
161 ::ItemStackBase const& item,
162 bool generateParticle
163 ) = 0;
164
165 virtual bool checkBlockPermissions(
166 ::Actor& entity,
167 ::BlockPos const& blockPos,
168 uchar face,
169 ::ItemStackBase const& item,
170 bool generateParticle
171 ) = 0;
172
173 virtual void postGameEvent(
174 ::Actor* source,
175 ::GameEvent const& gameEvent,
176 ::BlockPos const& originPos,
177 ::Block const* affectedBlock
178 ) = 0;
179
180 virtual void fireBlockChanged(
181 ::BlockPos const& pos,
182 uint layer,
183 ::Block const& block,
184 ::Block const& oldBlock,
185 int flags,
186 ::BlockChangedEventTarget eventTarget,
187 ::ActorBlockSyncMessage const* syncMsg,
188 ::Actor* source
189 ) = 0;
190
191 virtual void blockEvent(::BlockPos const& pos, int b0, int b1) = 0;
192
193 virtual ~IBlockSource() /*override*/ = default;
194 // NOLINTEND
195
196public:
197 // virtual function thunks
198 // NOLINTBEGIN
199
200 // NOLINTEND
201};
Definition AABB.h:18
Definition Actor.h:106
Definition BlockChangeContext.h:10
Definition BlockPos.h:19
Definition BlockSourceListener.h:18
Definition BlockSource.h:71
Definition Block.h:43
Definition ChunkPos.h:11
Definition ChunkSource.h:38
Definition Dimension.h:86
Definition EntityContext.h:16
Definition GameEvent.h:8
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 Vec3.h:10
Definition function_ref.h:60
Definition ActorBlockSyncMessage.h:8
Definition ClipParameters.h:16