LeviLamina
Loading...
Searching...
No Matches
BlockActor.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/container/EnumSet.h"
7#include "mc/safety/RedactableString.h"
8#include "mc/world/actor/ActorTerrainInterlockData.h"
9#include "mc/world/level/BlockPos.h"
10#include "mc/world/level/block/actor/BlockActorRendererId.h"
11#include "mc/world/level/block/actor/BlockActorType.h"
12#include "mc/world/phys/AABB.h"
13
14// auto generated forward declare list
15// clang-format off
16class Actor;
17class Block;
18class BlockActorDataPacket;
19class BlockSource;
20class CompoundTag;
21class Container;
22class DataLoadHelper;
24class ILevel;
25class LevelChunk;
27class Player;
28class SaveContext;
29class Vec3;
30// clang-format on
31
33public:
34 // BlockActor inner types define
35 enum class Property : uchar {
36 Changed = 0,
37 Movable = 1,
38 ClientSideOnly = 2,
39 SaveCustomName = 3,
40 CanRenderCustomName = 4,
41 Count = 5,
42 };
43
45
46 using MapIdType = ::std::unordered_map<::std::string, ::BlockActorType>;
47
48 using MapTypeId = ::std::unordered_map<::BlockActorType, ::std::string>;
49
50public:
51 LLAPI void refresh(optional_ref<class BlockSource> blockSource = std::nullopt);
52
53 LLNDAPI static std::shared_ptr<BlockActor> create(class CompoundTag const& nbt);
54
55 LLNDAPI static std::shared_ptr<BlockActor> create(class CompoundTag const& nbt, class BlockPos const& pos);
56
57public:
58 // member variables
59 // NOLINTBEGIN
60 ::ll::TypedStorage<4, 4, int> mTickCount;
61 ::ll::TypedStorage<4, 4, int> mRepairCost;
62 ::ll::TypedStorage<4, 12, ::BlockPos> mPosition;
63 ::ll::TypedStorage<4, 24, ::AABB> mBB;
64 ::ll::TypedStorage<1, 1, ::BlockActorRendererId> mRendererId;
65 ::ll::TypedStorage<1, 1, ::BlockActorType const> mType;
66 ::ll::TypedStorage<1, 1, ::Bedrock::EnumSet<::BlockActor::Property, 5>> mProperties;
67 ::ll::TypedStorage<8, 72, ::Bedrock::Safety::RedactableString> mCustomName;
68 ::ll::TypedStorage<8, 24, ::ActorTerrainInterlockData> mTerrainInterlockData;
69 // NOLINTEND
70
71public:
72 // prevent constructor by default
73 BlockActor();
74
75public:
76 // virtual functions
77 // NOLINTBEGIN
78 // vIndex: 0
79 virtual ~BlockActor();
80
81 // vIndex: 1
82 virtual void load(::ILevel&, ::CompoundTag const& tag, ::DataLoadHelper&);
83
84 // vIndex: 2
85 virtual bool save(::CompoundTag& tag, ::SaveContext const&) const;
86
87 // vIndex: 3
88 virtual bool saveItemInstanceData(::CompoundTag& tag, ::SaveContext const& saveContext) const;
89
90 // vIndex: 4
91 virtual void saveBlockData(::CompoundTag&, ::BlockSource&) const;
92
93 // vIndex: 5
94 virtual void loadBlockData(::CompoundTag const&, ::BlockSource&, ::DataLoadHelper&);
95
96 // vIndex: 6
97 virtual void onCustomTagLoadDone(::BlockSource&);
98
99 // vIndex: 7
100 virtual bool isPermanentlyRendered() const;
101
102 // vIndex: 8
103 virtual bool isWithinRenderDistance(::Vec3 const& cameraPosition) const;
104
105 // vIndex: 9
106 virtual void tick(::BlockSource& region);
107
108 // vIndex: 10
109 virtual void onChanged(::BlockSource&);
110
111 // vIndex: 11
112 virtual void onPlace(::BlockSource&);
113
114 // vIndex: 12
115 virtual void onMove();
116
117 // vIndex: 13
118 virtual void onRemoved(::BlockSource&);
119
120 // vIndex: 14
121 virtual bool isPreserved(::BlockSource&) const;
122
123 // vIndex: 15
124 virtual bool shouldPreserve(::BlockSource&);
125
126 // vIndex: 16
127 virtual void triggerEvent(int, int);
128
129 // vIndex: 17
130 virtual void executeEvent(::BlockSource&, ::BlockPos const&, ::Block const&, ::std::string const&, ::Actor&);
131
132 // vIndex: 18
133 virtual void onNeighborChanged(::BlockSource&, ::BlockPos const&);
134
135 // vIndex: 19
136 virtual float getShadowRadius(::BlockSource&) const;
137
138 // vIndex: 20
139 virtual bool hasAlphaLayer() const;
140
141 // vIndex: 21
142 virtual ::BlockActor* getCrackEntity(::BlockSource&, ::BlockPos const&);
143
144 // vIndex: 22
145 virtual ::AABB getCollisionShape(::IConstBlockSource const&) const;
146
147 // vIndex: 23
148 virtual void getDebugText(
149 ::std::vector<::std::string>& outputInfo,
150 ::BlockPos const& debugPos,
151 ::BlockSource const* region
152 ) const;
153
154 // vIndex: 24
155 virtual ::Bedrock::Safety::RedactableString const& getCustomName() const;
156
157 // vIndex: 25
158 virtual ::std::string getName() const;
159
160 // vIndex: 26
161 virtual void setCustomName(::Bedrock::Safety::RedactableString const& name);
162
163 // vIndex: 27
164 virtual ::std::string getImmersiveReaderText(::BlockSource&);
165
166 // vIndex: 29
167 virtual ::PistonBlockActor* getOwningPiston(::BlockSource&);
168
169 // vIndex: 28
170 virtual ::PistonBlockActor const* getOwningPiston(::BlockSource&) const;
171
172 // vIndex: 31
173 virtual ::Container* getContainer();
174
175 // vIndex: 30
176 virtual ::Container const* getContainer() const;
177
178 // vIndex: 32
179 virtual void eraseLootTable();
180
181 // vIndex: 33
182 virtual void onChunkLoaded(::LevelChunk&);
183
184 // vIndex: 34
185 virtual void onChunkUnloaded(::LevelChunk&);
186
187 // vIndex: 35
188 virtual void onSubChunkLoaded(::LevelChunk&, short, bool);
189
190 // vIndex: 36
191 virtual ::std::vector<::std::string> getUgcStrings(::CompoundTag const&) const;
192
193 // vIndex: 37
194 virtual ::std::vector<::std::string> getFilteredUgcStrings(::CompoundTag const&) const;
195
196 // vIndex: 38
197 virtual void setUgcStrings(::CompoundTag&, ::std::vector<::std::string> const&) const;
198
199 // vIndex: 39
200 virtual void setFilteredUgcStrings(::CompoundTag&, ::std::vector<::std::string> const&) const;
201
202 // vIndex: 40
203 virtual bool validateData(::CompoundTag const&) const;
204
205 // vIndex: 41
206 virtual void fixupOnLoad(::LevelChunk&);
207
208 // vIndex: 42
209 virtual ::std::unique_ptr<::BlockActorDataPacket> _getUpdatePacket(::BlockSource&);
210
211 // vIndex: 43
212 virtual void _onUpdatePacket(::CompoundTag const&, ::BlockSource&);
213
214 // vIndex: 44
215 virtual bool _playerCanUpdate(::Player const&) const;
216 // NOLINTEND
217
218public:
219 // member functions
220 // NOLINTBEGIN
221 MCAPI BlockActor(::BlockActorType type, ::BlockPos const& pos, ::BlockActorRendererId rendererId);
222
223 MCAPI bool onUpdatePacket(::CompoundTag const& data, ::BlockSource& region, ::Player const* fromPlayer);
224 // NOLINTEND
225
226public:
227 // static functions
228 // NOLINTBEGIN
229 MCAPI static ::std::unordered_map<::BlockActorType, ::std::string> const& _getClassIdMap();
230
231 MCAPI static ::std::shared_ptr<::BlockActor>
232 loadStatic(::ILevel& level, ::CompoundTag const& tag, ::DataLoadHelper& dataLoadHelper);
233 // NOLINTEND
234
235public:
236 // constructor thunks
237 // NOLINTBEGIN
238 MCAPI void* $ctor(::BlockActorType type, ::BlockPos const& pos, ::BlockActorRendererId rendererId);
239 // NOLINTEND
240
241public:
242 // destructor thunk
243 // NOLINTBEGIN
244 MCAPI void $dtor();
245 // NOLINTEND
246
247public:
248 // virtual function thunks
249 // NOLINTBEGIN
250 MCAPI void $load(::ILevel&, ::CompoundTag const& tag, ::DataLoadHelper&);
251
252 MCAPI bool $save(::CompoundTag& tag, ::SaveContext const&) const;
253
254 MCAPI bool $saveItemInstanceData(::CompoundTag& tag, ::SaveContext const& saveContext) const;
255
256 MCFOLD void $saveBlockData(::CompoundTag&, ::BlockSource&) const;
257
258 MCFOLD void $loadBlockData(::CompoundTag const&, ::BlockSource&, ::DataLoadHelper&);
259
260 MCFOLD void $onCustomTagLoadDone(::BlockSource&);
261
262 MCFOLD bool $isPermanentlyRendered() const;
263
264 MCAPI bool $isWithinRenderDistance(::Vec3 const& cameraPosition) const;
265
266 MCFOLD void $tick(::BlockSource& region);
267
268 MCFOLD void $onChanged(::BlockSource&);
269
270 MCFOLD void $onPlace(::BlockSource&);
271
272 MCFOLD void $onMove();
273
274 MCFOLD void $onRemoved(::BlockSource&);
275
276 MCFOLD bool $isPreserved(::BlockSource&) const;
277
278 MCFOLD bool $shouldPreserve(::BlockSource&);
279
280 MCFOLD void $triggerEvent(int, int);
281
282 MCFOLD void $executeEvent(::BlockSource&, ::BlockPos const&, ::Block const&, ::std::string const&, ::Actor&);
283
284 MCFOLD void $onNeighborChanged(::BlockSource&, ::BlockPos const&);
285
286 MCFOLD float $getShadowRadius(::BlockSource&) const;
287
288 MCFOLD bool $hasAlphaLayer() const;
289
290 MCFOLD ::BlockActor* $getCrackEntity(::BlockSource&, ::BlockPos const&);
291
292 MCAPI ::AABB $getCollisionShape(::IConstBlockSource const&) const;
293
294 MCAPI void $getDebugText(
295 ::std::vector<::std::string>& outputInfo,
296 ::BlockPos const& debugPos,
297 ::BlockSource const* region
298 ) const;
299
300 MCFOLD ::Bedrock::Safety::RedactableString const& $getCustomName() const;
301
302 MCFOLD ::std::string $getName() const;
303
304 MCAPI void $setCustomName(::Bedrock::Safety::RedactableString const& name);
305
306 MCFOLD ::std::string $getImmersiveReaderText(::BlockSource&);
307
308 MCFOLD ::PistonBlockActor* $getOwningPiston(::BlockSource&);
309
310 MCFOLD ::PistonBlockActor const* $getOwningPiston(::BlockSource&) const;
311
312 MCFOLD ::Container* $getContainer();
313
314 MCFOLD ::Container const* $getContainer() const;
315
316 MCFOLD void $eraseLootTable();
317
318 MCFOLD void $onChunkLoaded(::LevelChunk&);
319
320 MCFOLD void $onChunkUnloaded(::LevelChunk&);
321
322 MCFOLD void $onSubChunkLoaded(::LevelChunk&, short, bool);
323
324 MCFOLD ::std::vector<::std::string> $getUgcStrings(::CompoundTag const&) const;
325
326 MCFOLD ::std::vector<::std::string> $getFilteredUgcStrings(::CompoundTag const&) const;
327
328 MCFOLD void $setUgcStrings(::CompoundTag&, ::std::vector<::std::string> const&) const;
329
330 MCFOLD void $setFilteredUgcStrings(::CompoundTag&, ::std::vector<::std::string> const&) const;
331
332 MCFOLD bool $validateData(::CompoundTag const&) const;
333
334 MCFOLD void $fixupOnLoad(::LevelChunk&);
335
336 MCFOLD ::std::unique_ptr<::BlockActorDataPacket> $_getUpdatePacket(::BlockSource&);
337
338 MCFOLD void $_onUpdatePacket(::CompoundTag const&, ::BlockSource&);
339
340 MCFOLD bool $_playerCanUpdate(::Player const&) const;
341 // NOLINTEND
342
343public:
344 // vftables
345 // NOLINTBEGIN
346 MCAPI static void** $vftable();
347 // NOLINTEND
348};
Definition Actor.h:102
Definition EnumSet.h:8
Definition RedactableString.h:10
Definition BlockActor.h:32
Definition BlockPos.h:17
Definition BlockSource.h:66
Definition Block.h:38
Definition CompoundTag.h:13
Definition Container.h:31
Definition DataLoadHelper.h:20
Definition IConstBlockSource.h:25
Definition ILevel.h:211
Definition LevelChunk.h:78
Definition PistonBlockActor.h:26
Definition Player.h:123
Definition SaveContext.h:5
Definition Vec3.h:10
Definition optional_ref.h:10