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/AutomaticID.h"
7#include "mc/deps/core/utility/buffer_span.h"
8#include "mc/legacy/ActorUniqueID.h"
9#include "mc/world/level/BlockPos.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 Actor;
16class BlockSource;
17class CompoundTag;
18class Dimension;
19class ItemStack;
20class Level;
21class LevelStorage;
22class MapDecoration;
24class Packet;
25class Player;
26class Random;
27class SpinLockImpl;
28class Vec3;
30namespace mce { class Color; }
31// clang-format on
32
33class MapItemSavedData {
34public:
35 // MapItemSavedData inner types declare
36 // clang-format off
37 struct ChunkBounds;
40 // clang-format on
41
42 // MapItemSavedData inner types define
43 struct ChunkBounds {
44 public:
45 // member variables
46 // NOLINTBEGIN
47 ::ll::TypedStorage<4, 4, uint> x0;
48 ::ll::TypedStorage<4, 4, uint> z0;
49 ::ll::TypedStorage<4, 4, uint> x1;
50 ::ll::TypedStorage<4, 4, uint> z1;
51 // NOLINTEND
52 };
53
55 public:
56 // member variables
57 // NOLINTBEGIN
58 ::ll::TypedStorage<1, 1, ::MapDecoration::Type> type;
59 ::ll::TypedStorage<4, 4, int> x;
60 ::ll::TypedStorage<4, 4, int> y;
61 ::ll::TypedStorage<4, 4, int> rot;
62 // NOLINTEND
63 };
64
66 public:
67 // member variables
68 // NOLINTBEGIN
69 ::ll::TypedStorage<1, 1, ::MapDecoration::Type> type;
70 ::ll::TypedStorage<4, 4, int> rotation;
71 // NOLINTEND
72 };
73
74 using DecorationCollection =
75 ::std::vector<::std::pair<::MapItemTrackedActor::UniqueId, ::std::shared_ptr<::MapDecoration>>>;
76
77public:
78 // member variables
79 // NOLINTBEGIN
80 ::ll::TypedStorage<8, 8, uint64> mUpdateInterval;
81 ::ll::TypedStorage<8, 8, ::ActorUniqueID> mMapId;
82 ::ll::TypedStorage<8, 8, ::ActorUniqueID> mParentMapId;
83 ::ll::TypedStorage<1, 1, bool> mIsFullyExplored;
84 ::ll::TypedStorage<1, 1, bool> mPreviewIncomplete;
85 ::ll::TypedStorage<4, 12, ::BlockPos> mOrigin;
86 ::ll::TypedStorage<4, 4, ::DimensionType> mDimension;
87 ::ll::TypedStorage<1, 1, schar> mScale;
88 ::ll::TypedStorage<8, 24, ::std::vector<uint>> mPixels;
89 ::ll::TypedStorage<8, 24, ::std::vector<::ClientTerrainPixel>> mClientPixels;
90 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::MapItemTrackedActor>>> mTrackedEntities;
91 ::ll::TypedStorage<1, 1, bool> mUnlimitedTracking;
92 ::ll::TypedStorage<1, 1, bool> mDirtyForSave;
93 ::ll::TypedStorage<1, 1, bool> mDirtyPixelData;
94 ::ll::TypedStorage<1, 1, bool> mLocked;
95 ::ll::TypedStorage<
96 8,
97 24,
98 ::std::vector<::std::pair<::MapItemTrackedActor::UniqueId, ::std::shared_ptr<::MapDecoration>>>>
99 mDecorations;
100 ::ll::TypedStorage<1, 1, bool> mHasDirtyClientPixels;
101 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::SpinLockImpl>> mClientSamplingLock;
102 ::ll::TypedStorage<1, 1, bool> mNeedsResampling;
103 ::ll::TypedStorage<1, 1, bool> mIsDLCWorld;
104 // NOLINTEND
105
106public:
107 // prevent constructor by default
108 MapItemSavedData();
109
110public:
111 // member functions
112 // NOLINTBEGIN
113 MCAPI MapItemSavedData(::ActorUniqueID mapId, bool isDLCworld);
114
115 MCAPI void _addDecoration(
116 ::MapDecoration::Type type,
118 ::Vec3 const& position,
119 ::std::string const& label,
120 ::mce::Color const& color
121 );
122
123 MCAPI ::std::shared_ptr<::MapItemTrackedActor> _addTrackedMapEntity(
125 ::BlockSource& region,
126 ::MapDecoration::Type decorationType
127 );
128
129 MCAPI ::MapItemSavedData::MapDecorationContext _calculateDecorationLocationAndType(
130 ::MapDecoration::Type type,
131 float yRot,
132 int xDeltaFromCenter,
133 int yDeltaFromCenter,
134 ::MapItemTrackedActor::UniqueId const& uniqueId
135 ) const;
136
137 MCAPI schar _calculateRotation(
138 float yRot,
139 ::MapDecoration::Type type,
140 ::MapItemTrackedActor::UniqueId const& uniqueId,
141 ::Random& rng
142 ) const;
143
144 MCAPI void _deserializeData(::CompoundTag const& tag);
145
146 MCAPI bool _isPlayerHoldingMap(::Player& player);
147
148 MCAPI void _removeDecoration(::MapItemTrackedActor::UniqueId const& id);
149
150 MCAPI void _removeTrackedMapEntity(::MapItemTrackedActor::UniqueId const& key);
151
152#ifdef LL_PLAT_C
153 MCAPI bool _replaceExistingDecoration(
155 ::std::shared_ptr<::MapDecoration> const& newDecoration
156 );
157#endif
158
159 MCAPI bool
160 _updateTrackedEntityDecoration(::BlockSource& region, ::std::shared_ptr<::MapItemTrackedActor> trackedActor);
161
162 MCAPI void _updateTrackedEntityDecorations(::BlockSource& region);
163
164 MCAPI void _updateTrackedPlayerDecorations(
165 ::BlockSource& region,
166 ::Player& player,
167 ::Vec3& decorationPos,
168 ::std::string& decorationLabel,
169 ::mce::Color& decorationColor,
170 ::DimensionType dimensionID,
171 ::MapDecoration::Type& type
172 );
173
174 MCAPI ::std::shared_ptr<::MapItemTrackedActor>
175 addTrackedMapEntity(::Actor& entity, ::MapDecoration::Type decorationType);
176
177 MCAPI void checkNeedsResampling();
178
179 MCAPI ::std::unique_ptr<::Packet> getFullDataPacket() const;
180
181 MCAPI ::std::shared_ptr<::MapItemTrackedActor> getTrackedMapEntity(::Actor& entity);
182
183 MCAPI ::std::unique_ptr<::Packet> getUpdatePacket(::Level&, ::BlockPos const& pos) const;
184
185 MCAPI ::std::unique_ptr<::Packet> getUpdatePacket(::ItemStack const&, ::Level&, ::Actor& entity) const;
186
187#ifdef LL_PLAT_C
188 MCAPI void replaceDecorations(
189 ::std::vector<::std::shared_ptr<::MapDecoration>> decorations,
190 ::std::vector<::MapItemTrackedActor::UniqueId> const& uniqueIds
191 );
192#endif
193
194 MCAPI void save(::LevelStorage& storage);
195
196 MCAPI void serialize(::CompoundTag& tag) const;
197
198 MCAPI void setMapSection(::buffer_span<uint> src, ::MapItemSavedData::ChunkBounds bb);
199
200 MCAPI void setOrigin(
201 ::Vec3 origin,
202 int mapScale,
203 ::DimensionType dimension,
204 bool isLegacyLevel,
205 bool isCentered,
206 ::BlockPos const& worldCenter
207 );
208
209 MCAPI void tickByBlock(::BlockPos const& pos, ::BlockSource& region);
210
211 MCAPI void tickCarriedBy(::Actor& player, ::CompoundTag const* item);
212 // NOLINTEND
213
214public:
215 // static functions
216 // NOLINTBEGIN
217 MCAPI static ::std::string getSerializationKey(::ActorUniqueID id);
218 // NOLINTEND
219
220public:
221 // constructor thunks
222 // NOLINTBEGIN
223 MCAPI void* $ctor(::ActorUniqueID mapId, bool isDLCworld);
224 // NOLINTEND
225};
Definition Actor.h:106
Definition BlockPos.h:19
Definition BlockSource.h:71
Definition CompoundTag.h:23
Definition Dimension.h:86
Definition ItemStack.h:26
Definition LevelStorage.h:25
Definition Level.h:250
Definition MapDecoration.h:8
Definition MapItemTrackedActor.h:20
Definition Packet.h:28
Definition Player.h:129
Definition Random.h:10
Definition SpinLockImpl.h:5
Definition Vec3.h:10
Definition buffer_span.h:6
Definition Color.h:13
Definition ActorUniqueID.h:5
Definition ClientTerrainPixel.h:5
Definition MapItemSavedData.h:43
Definition MapItemSavedData.h:54
Definition MapItemSavedData.h:65
Definition MapItemTrackedActor.h:34