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 MCAPI_C bool _replaceExistingDecoration(
154 ::std::shared_ptr<::MapDecoration> const& newDecoration
155 );
156
157 MCAPI bool
158 _updateTrackedEntityDecoration(::BlockSource& region, ::std::shared_ptr<::MapItemTrackedActor> trackedActor);
159
160 MCAPI void _updateTrackedEntityDecorations(::BlockSource& region);
161
162 MCAPI void _updateTrackedPlayerDecorations(
163 ::BlockSource& region,
164 ::Player& player,
165 ::Vec3& decorationPos,
166 ::std::string& decorationLabel,
167 ::mce::Color& decorationColor,
168 ::DimensionType dimensionID,
169 ::MapDecoration::Type& type
170 );
171
172 MCAPI ::std::shared_ptr<::MapItemTrackedActor>
173 addTrackedMapEntity(::Actor& entity, ::MapDecoration::Type decorationType);
174
175 MCAPI void checkNeedsResampling();
176
177 MCAPI ::std::unique_ptr<::Packet> getFullDataPacket() const;
178
179 MCAPI ::std::shared_ptr<::MapItemTrackedActor> getTrackedMapEntity(::Actor& entity);
180
181 MCAPI ::std::unique_ptr<::Packet> getUpdatePacket(::Level&, ::BlockPos const& pos) const;
182
183 MCAPI ::std::unique_ptr<::Packet> getUpdatePacket(::ItemStack const&, ::Level&, ::Actor& entity) const;
184
185 MCAPI_C void replaceDecorations(
186 ::std::vector<::std::shared_ptr<::MapDecoration>> decorations,
187 ::std::vector<::MapItemTrackedActor::UniqueId> const& uniqueIds
188 );
189
190 MCAPI void save(::LevelStorage& storage);
191
192 MCAPI void serialize(::CompoundTag& tag) const;
193
194 MCAPI void setMapSection(::buffer_span<uint> src, ::MapItemSavedData::ChunkBounds bb);
195
196 MCAPI void setOrigin(
197 ::Vec3 origin,
198 int mapScale,
199 ::DimensionType dimension,
200 bool isLegacyLevel,
201 bool isCentered,
202 ::BlockPos const& worldCenter
203 );
204
205 MCAPI void tickByBlock(::BlockPos const& pos, ::BlockSource& region);
206
207 MCAPI void tickCarriedBy(::Actor& player, ::CompoundTag const* item);
208 // NOLINTEND
209
210public:
211 // static functions
212 // NOLINTBEGIN
213 MCAPI static ::std::string getSerializationKey(::ActorUniqueID id);
214 // NOLINTEND
215
216public:
217 // constructor thunks
218 // NOLINTBEGIN
219 MCAPI void* $ctor(::ActorUniqueID mapId, bool isDLCworld);
220 // NOLINTEND
221};
Definition Actor.h:105
Definition BlockPos.h:19
Definition BlockSource.h:68
Definition CompoundTag.h:23
Definition Dimension.h:85
Definition ItemStack.h:26
Definition LevelStorage.h:25
Definition Level.h:249
Definition MapDecoration.h:8
Definition MapItemTrackedActor.h:20
Definition Packet.h:28
Definition Player.h:125
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