Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
BlockActor.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/deps/core/container/EnumSet.h"
5
6// auto generated inclusion list
7#include "mc/world/level/BlockPos.h"
8#include "mc/world/level/block/actor/BlockActorType.h"
9
10// auto generated forward declare list
11// clang-format off
13class BlockSource;
14class BlockType;
15class CompoundTag;
17class DataLoadHelper;
20class ILevel;
24class LevelChunk;
25class Player;
27class SaveContext;
28// clang-format on
29
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
55 [[nodiscard]] BlockPos const& getPosition() const { return mPosition.get(); }
56
57 [[nodiscard]] BlockActorType getType() const { return mType; }
58
59public:
60 // member variables
61 // NOLINTBEGIN
62 ::ll::TypedStorage<4, 12, ::BlockPos> mPosition;
63 ::ll::TypedStorage<1, 1, ::BlockActorType const> mType;
64 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::DynamicPropertiesBlockActorComponent>> mDynamicProperties;
65 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::EntityStorageBlockActorComponent>> mEntityStorage;
66 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::RandomizableContainerBlockActorComponent>> mRandomizableContainer;
67 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ContainerBlockActorComponent>> mContainer;
68 // NOLINTEND
69
70public:
71 // virtual functions
72 // NOLINTBEGIN
73 virtual ~BlockActor();
74
75 virtual void load(::ILevel& level, ::CompoundTag const& tag, ::DataLoadHelper& helper);
76
77 virtual bool save(::CompoundTag& tag, ::SaveContext const& saveContext) const;
78
79 virtual bool saveItemInstanceData(::CompoundTag& tag) const;
80
81 virtual void saveBlockData(::CompoundTag& tag, ::BlockSource& region) const;
82
83 virtual void loadBlockData(::CompoundTag const& tag, ::BlockSource& region, ::DataLoadHelper& dataLoadHelper);
84
85 virtual void onCustomTagLoadDone(::BlockSource& region);
86
87 virtual void loadStatic();
88
89 virtual void onPlace(::BlockSource& region);
90
91 virtual void onMove();
92
93 virtual void onRemoved(::BlockSource& region);
94
95 virtual void onChunkLoaded(::LevelChunk& lc);
96
97 virtual void onChunkUnloaded(::LevelChunk& lc);
98
99 virtual void onSubChunkLoaded(::LevelChunk&, short, bool);
100
101 virtual void onNeighborChanged(::BlockSource& region, ::BlockPos const& position);
102
103 virtual void triggerEvent(int b0, int b1);
104
105 virtual bool isTypeOrDerived(::BlockActorType type) const;
106
107 virtual void getDebugText(
108 ::std::vector<::std::string>& outputInfo,
109 ::BlockPos const& debugPos,
110 ::BlockSource const* region
111 ) const;
112
113 virtual ::std::unique_ptr<::BlockActorDataPacket> _getUpdatePacket(::BlockSource& region);
114
115 virtual void _onUpdatePacket(::CompoundTag const& data, ::BlockSource& region);
116
117 virtual bool _playerCanUpdate(::Player const& player) const;
118
119 virtual ::IVanillaRenderBlockActorComponent const* _getRenderComponent() const;
120
121 virtual ::IVanillaRenderBlockActorComponent* _getRenderComponent();
122
123 virtual ::IVanillaTickBlockActorComponent const* _getTickComponent() const;
124
125 virtual ::IVanillaTickBlockActorComponent* _getTickComponent();
126
127 virtual ::IVanillaMainBlockActorComponent const* _getMainComponent() const;
128
129 virtual ::IVanillaMainBlockActorComponent* _getMainComponent();
130 // NOLINTEND
131
132public:
133 // member functions
134 // NOLINTBEGIN
135 MCNAPI bool onUpdatePacket(::CompoundTag const& data, ::BlockSource& region, ::Player const* fromPlayer);
136 // NOLINTEND
137
138public:
139 // static functions
140 // NOLINTBEGIN
141 MCAPI static ::std::shared_ptr<::BlockActor> loadStatic(
142 ::BlockType const& block,
143 ::BlockPos const& pos,
144 ::ILevel& level,
145 ::CompoundTag const& tag,
146 ::DataLoadHelper& dataLoadHelper
147 );
148 // NOLINTEND
149
150public:
151 // static variables
152 // NOLINTBEGIN
153 MCNAPI static ::std::string const& KEY_VERSION();
154 // NOLINTEND
155
156public:
157 // destructor thunk
158 // NOLINTBEGIN
159 MCNAPI void $dtor();
160 // NOLINTEND
161
162public:
163 // virtual function thunks
164 // NOLINTBEGIN
165 MCNAPI void $load(::ILevel& level, ::CompoundTag const& tag, ::DataLoadHelper& helper);
166
167 MCAPI bool $save(::CompoundTag& tag, ::SaveContext const& saveContext) const;
168
169 MCAPI bool $saveItemInstanceData(::CompoundTag& tag) const;
170
171 MCFOLD void $saveBlockData(::CompoundTag& tag, ::BlockSource& region) const;
172
173 MCFOLD void $loadBlockData(::CompoundTag const& tag, ::BlockSource& region, ::DataLoadHelper& dataLoadHelper);
174
175 MCFOLD void $onCustomTagLoadDone(::BlockSource& region);
176
177 MCNAPI void $loadStatic();
178
179 MCNAPI void $onPlace(::BlockSource& region);
180
181 MCFOLD void $onMove();
182
183 MCNAPI void $onRemoved(::BlockSource& region);
184
185 MCFOLD void $onChunkLoaded(::LevelChunk& lc);
186
188
189 MCFOLD void $onSubChunkLoaded(::LevelChunk&, short, bool);
190
191 MCFOLD void $onNeighborChanged(::BlockSource& region, ::BlockPos const& position);
192
193 MCFOLD void $triggerEvent(int b0, int b1);
194
195 MCAPI bool $isTypeOrDerived(::BlockActorType type) const;
196
197 MCAPI void $getDebugText(
198 ::std::vector<::std::string>& outputInfo,
199 ::BlockPos const& debugPos,
200 ::BlockSource const* region
201 ) const;
202
203 MCNAPI ::std::unique_ptr<::BlockActorDataPacket> $_getUpdatePacket(::BlockSource& region);
204
205 MCNAPI void $_onUpdatePacket(::CompoundTag const& data, ::BlockSource& region);
206
207 MCFOLD bool $_playerCanUpdate(::Player const& player) const;
208
209 MCNAPI ::IVanillaRenderBlockActorComponent const* $_getRenderComponent() const;
210
211 MCNAPI ::IVanillaRenderBlockActorComponent* $_getRenderComponent();
212
213 MCNAPI ::IVanillaTickBlockActorComponent const* $_getTickComponent() const;
214
215 MCNAPI ::IVanillaTickBlockActorComponent* $_getTickComponent();
216
217 MCNAPI ::IVanillaMainBlockActorComponent const* $_getMainComponent() const;
218
219 MCNAPI ::IVanillaMainBlockActorComponent* $_getMainComponent();
220
221
222 // NOLINTEND
223
224public:
225 // vftables
226 // NOLINTBEGIN
227 MCNAPI static void** $vftable();
228 // NOLINTEND
229};
Definition EnumSet.h:9
Definition BlockActorDataPacket.h:19
Definition BlockActor.h:30
MCAPI void $onRemoved(::BlockSource &region)
MCAPI void $loadStatic()
MCAPI void $onChunkUnloaded(::LevelChunk &lc)
MCAPI::IVanillaMainBlockActorComponent * $_getMainComponent()
MCAPI::IVanillaRenderBlockActorComponent * $_getRenderComponent()
MCAPI::IVanillaTickBlockActorComponent * $_getTickComponent()
MCAPI bool onUpdatePacket(::CompoundTag const &data, ::BlockSource &region, ::Player const *fromPlayer)
static MCAPI ::std::string const & KEY_VERSION()
MCAPI::IVanillaTickBlockActorComponent const * $_getTickComponent() const
MCAPI::IVanillaMainBlockActorComponent const * $_getMainComponent() const
MCAPI void $_onUpdatePacket(::CompoundTag const &data, ::BlockSource &region)
MCAPI void $dtor()
MCAPI void $load(::ILevel &level, ::CompoundTag const &tag, ::DataLoadHelper &helper)
MCAPI::IVanillaRenderBlockActorComponent const * $_getRenderComponent() const
MCAPI ::std::unique_ptr<::BlockActorDataPacket > $_getUpdatePacket(::BlockSource &region)
static MCAPI void ** $vftable()
MCAPI void $onPlace(::BlockSource &region)
Definition BlockPos.h:14
Definition BlockSource.h:72
Definition BlockType.h:79
Definition CompoundTag.h:18
Definition ContainerBlockActorComponent.h:18
Definition DataLoadHelper.h:20
Definition DynamicPropertiesBlockActorComponent.h:20
Definition EntityStorageBlockActorComponent.h:21
Definition ILevel.h:223
Definition IVanillaMainBlockActorComponent.h:18
Definition IVanillaRenderBlockActorComponent.h:19
Definition IVanillaTickBlockActorComponent.h:15
Definition LevelChunk.h:76
Definition Player.h:131
Definition RandomizableContainerBlockActorComponent.h:16
Definition SaveContext.h:5
Definition optional_ref.h:10