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