LeviLamina
Loading...
Searching...
No Matches
MapItemSavedData.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/utility/buffer_span.h"
7#include "mc/legacy/ActorUniqueID.h"
8#include "mc/world/level/BlockPos.h"
9#include "mc/world/level/dimension/DimensionType.h"
10#include "mc/world/level/saveddata/maps/MapDecoration.h"
11#include "mc/world/level/saveddata/maps/MapItemTrackedActor.h"
12
13// auto generated forward declare list
14// clang-format off
15class AABB;
16class Actor;
17class BlockSource;
18class CompoundTag;
19class ItemStack;
20class Level;
21class LevelStorage;
22class MapDecoration;
24class Packet;
25class Player;
26class SpinLockImpl;
27class Vec3;
29namespace mce { class Color; }
30// clang-format on
31
32class MapItemSavedData {
33public:
34 // MapItemSavedData inner types declare
35 // clang-format off
36 struct ChunkBounds;
39 // clang-format on
40
41 // MapItemSavedData inner types define
42 struct ChunkBounds {
43 public:
44 // member variables
45 // NOLINTBEGIN
46 ::ll::TypedStorage<4, 4, uint> x0;
47 ::ll::TypedStorage<4, 4, uint> z0;
48 ::ll::TypedStorage<4, 4, uint> x1;
49 ::ll::TypedStorage<4, 4, uint> z1;
50 // NOLINTEND
51 };
52
54 public:
55 // member variables
56 // NOLINTBEGIN
57 ::ll::TypedStorage<1, 1, ::MapDecoration::Type> type;
58 ::ll::TypedStorage<4, 4, int> x;
59 ::ll::TypedStorage<4, 4, int> y;
60 ::ll::TypedStorage<4, 4, int> rot;
61 // NOLINTEND
62 };
63
65 public:
66 // member variables
67 // NOLINTBEGIN
68 ::ll::TypedStorage<1, 1, ::MapDecoration::Type> type;
69 ::ll::TypedStorage<4, 4, int> rotation;
70 // NOLINTEND
71 };
72
73 using DecorationCollection =
74 ::std::vector<::std::pair<::MapItemTrackedActor::UniqueId, ::std::shared_ptr<::MapDecoration>>>;
75
76public:
77 // member variables
78 // NOLINTBEGIN
79 ::ll::TypedStorage<8, 8, uint64> mUpdateInterval;
80 ::ll::TypedStorage<8, 8, ::ActorUniqueID> mMapId;
81 ::ll::TypedStorage<8, 8, ::ActorUniqueID> mParentMapId;
82 ::ll::TypedStorage<1, 1, bool> mIsFullyExplored;
83 ::ll::TypedStorage<1, 1, bool> mPreviewIncomplete;
84 ::ll::TypedStorage<4, 12, ::BlockPos> mOrigin;
85 ::ll::TypedStorage<4, 4, ::DimensionType> mDimension;
86 ::ll::TypedStorage<1, 1, schar> mScale;
87 ::ll::TypedStorage<8, 24, ::std::vector<uint>> mPixels;
88 ::ll::TypedStorage<8, 24, ::std::vector<::ClientTerrainPixel>> mClientPixels;
89 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::MapItemTrackedActor>>> mTrackedEntities;
90 ::ll::TypedStorage<1, 1, bool> mUnlimitedTracking;
91 ::ll::TypedStorage<1, 1, bool> mDirtyForSave;
92 ::ll::TypedStorage<1, 1, bool> mDirtyPixelData;
93 ::ll::TypedStorage<1, 1, bool> mLocked;
94 ::ll::TypedStorage<
95 8,
96 24,
97 ::std::vector<::std::pair<::MapItemTrackedActor::UniqueId, ::std::shared_ptr<::MapDecoration>>>>
98 mDecorations;
99 ::ll::TypedStorage<1, 1, bool> mHasDirtyClientPixels;
100 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::SpinLockImpl>> mClientSamplingLock;
101 ::ll::TypedStorage<1, 1, bool> mNeedsResampling;
102 ::ll::TypedStorage<1, 1, bool> mIsDLCWorld;
103 // NOLINTEND
104
105public:
106 // prevent constructor by default
107 MapItemSavedData();
108
109public:
110 // member functions
111 // NOLINTBEGIN
112 MCAPI MapItemSavedData(::ActorUniqueID mapId, bool isDLCworld);
113
114 MCAPI void _addDecoration(
115 ::MapDecoration::Type type,
117 ::Vec3 const& position,
118 ::std::string const& label,
119 ::mce::Color const& color
120 );
121
122 MCAPI ::std::shared_ptr<::MapItemTrackedActor> _addTrackedMapEntity(
124 ::BlockSource& region,
125 ::MapDecoration::Type decorationType
126 );
127
128 MCAPI ::MapItemSavedData::MapDecorationContext _calculateDecorationLocationAndType(
129 ::MapDecoration::Type type,
130 float yRot,
131 int xDeltaFromCenter,
132 int yDeltaFromCenter,
133 ::MapItemTrackedActor::UniqueId const& uniqueId
134 ) const;
135
136 MCAPI ::MapItemSavedData::MapDecorationTypeAndRotation _calculatePlayerDecorationTypeAndRotation(
137 ::MapDecoration::Type type,
138 float yRot,
139 int xDeltaFromCenter,
140 int yDeltaFromCenter,
141 ::MapItemTrackedActor::UniqueId const& uniqueId
142 ) const;
143
144 MCAPI void _clampOriginWithinLimitedWorld(::BlockPos& origin, ::Vec3 const& worldCenter, int scaledMapSize) const;
145
146 MCAPI void _deserializeData(::CompoundTag const& tag);
147
148 MCAPI bool _isPlayerHoldingMap(::Player& player);
149
150 MCAPI void _removeDecoration(::MapItemTrackedActor::UniqueId const& id);
151
152 MCAPI void _removeTrackedMapEntity(::MapItemTrackedActor::UniqueId const& key);
153
154 MCAPI bool
155 _updateTrackedEntityDecoration(::BlockSource& region, ::std::shared_ptr<::MapItemTrackedActor> trackedActor);
156
157 MCAPI void _updateTrackedEntityDecorations(::BlockSource& region);
158
159 MCAPI void _updateTrackedPlayerDecorations(
160 ::BlockSource& region,
161 ::Player& player,
162 ::Vec3& decorationPos,
163 ::std::string& decorationLabel,
164 ::mce::Color& decorationColor,
165 ::DimensionType dimensionID,
166 ::MapDecoration::Type& type
167 );
168
169#ifdef LL_PLAT_C
170 MCAPI void
171 addDecoration(::MapItemTrackedActor::UniqueId const& id, ::std::shared_ptr<::MapDecoration> const& newDecoration);
172#endif
173
174 MCAPI ::std::shared_ptr<::MapItemTrackedActor>
175 addTrackedMapEntity(::Actor& entity, ::MapDecoration::Type decorationType);
176
177 MCAPI ::std::shared_ptr<::MapItemTrackedActor>
178 addTrackedMapEntity(::BlockPos const& position, ::BlockSource& region, ::MapDecoration::Type decorationType);
179
180 MCFOLD bool areClientPixelsDirty() const;
181
182 MCAPI void checkNeedsResampling();
183
184 MCAPI void copyMapData(::MapItemSavedData const& map);
185
186 MCAPI void deserialize(::CompoundTag const& tag);
187
188 MCAPI void enableUnlimitedTracking();
189
190 MCFOLD ::std::vector<::ClientTerrainPixel>& getClientPixels();
191
192 MCAPI ::SpinLockImpl* getClientSamplingLock();
193
194 MCAPI ::std::unique_ptr<::Packet> getFullDataPacket() const;
195
196 MCFOLD ::ActorUniqueID getMapId() const;
197
198 MCFOLD ::ActorUniqueID getParentMapId() const;
199
200 MCAPI ::buffer_span<uint> getPixels() const;
201
202 MCAPI ::std::shared_ptr<::MapItemTrackedActor> getTrackedMapEntity(::Actor& entity);
203
204 MCAPI ::std::unique_ptr<::Packet> getUpdatePacket(::Level&, ::BlockPos const& pos) const;
205
206 MCAPI ::std::unique_ptr<::Packet> getUpdatePacket(::ItemStack const&, ::Level&, ::Actor& entity) const;
207
208 MCAPI bool hasParentMap() const;
209
210 MCAPI bool isAdjacent(::MapItemSavedData const& other, int dir) const;
211
212 MCAPI bool isChunkAllEmpty(::MapItemSavedData::ChunkBounds bb) const;
213
214 MCAPI bool isFullyExplored() const;
215
216 MCAPI bool isLocked() const;
217
218#ifdef LL_PLAT_C
219 MCFOLD bool isPixelDataDirty() const;
220#endif
221
222 MCAPI bool needsResampling() const;
223
224 MCAPI void removeTrackedMapEntity(::BlockPos const& position);
225
226#ifdef LL_PLAT_C
227 MCAPI void replaceDecorations(
228 ::std::vector<::std::shared_ptr<::MapDecoration>> decorations,
229 ::std::vector<::MapItemTrackedActor::UniqueId> const& uniqueIds
230 );
231
232 MCAPI void replacePixels(::buffer_span<uint> mapPixels, uint startX, uint startY, uint width, uint height);
233#endif
234
235 MCAPI void save(::LevelStorage& storage);
236
237 MCAPI void serialize(::CompoundTag& tag) const;
238
239 MCFOLD void setClientPixelsDirty(bool isDirty);
240
241#ifdef LL_PLAT_C
242 MCFOLD void setDimensionId(::DimensionType dimension);
243#endif
244
245 MCAPI void setDirtyForSaveAndPixelData();
246
247 MCAPI void setLocked();
248
249 MCAPI void setMapSection(::buffer_span<uint> src, ::MapItemSavedData::ChunkBounds bb);
250
251 MCAPI void setOrigin(
252 ::Vec3 origin,
253 int mapScale,
254 ::DimensionType dimension,
255 bool isLegacyLevel,
256 bool isCentered,
257 ::BlockPos const& worldCenter
258 );
259
260 MCAPI bool setPixel(uint color, uint x, uint y);
261
262#ifdef LL_PLAT_C
263 MCAPI void setPixelDataClean();
264#endif
265
266 MCAPI void setScale(int mapScale);
267
268 MCAPI void setScaleAndParentMapId(int mapScale, ::ActorUniqueID parentMapId);
269
270 MCAPI void tickByBlock(::BlockPos const& pos, ::BlockSource& region);
271
272 MCAPI void tickCarriedBy(::Actor& player, ::CompoundTag const* item);
273
274 MCAPI void trySave(::LevelStorage& storage);
275
276 MCAPI ~MapItemSavedData();
277 // NOLINTEND
278
279public:
280 // static functions
281 // NOLINTBEGIN
282#ifdef LL_PLAT_C
283 MCAPI static ::AABB getMapWorldBounds(::BlockPos const& mapOrigin, int blocksPerTexel, int offset);
284#endif
285
286 MCAPI static ::std::string getSerializationKey(::ActorUniqueID id);
287 // NOLINTEND
288
289public:
290 // constructor thunks
291 // NOLINTBEGIN
292 MCAPI void* $ctor(::ActorUniqueID mapId, bool isDLCworld);
293 // NOLINTEND
294
295public:
296 // destructor thunk
297 // NOLINTBEGIN
298 MCAPI void $dtor();
299 // NOLINTEND
300};
Definition AABB.h:18
Definition Actor.h:125
Definition BlockPos.h:21
Definition BlockSource.h:73
Definition CompoundTag.h:23
Definition ItemStack.h:35
Definition LevelStorage.h:26
Definition Level.h:255
Definition MapDecoration.h:8
Definition MapItemTrackedActor.h:20
Definition Packet.h:31
Definition Player.h:137
Definition SpinLockImpl.h:5
Definition Vec3.h:10
Definition buffer_span.h:6
Definition Color.h:13
Definition ActorUniqueID.h:10
Definition ClientTerrainPixel.h:5
Definition DimensionType.h:5
Definition MapItemSavedData.h:42
Definition MapItemSavedData.h:53
Definition MapItemSavedData.h:64
Definition MapItemTrackedActor.h:34