LeviLamina
Loading...
Searching...
No Matches
StructureManager.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/file/PathBuffer.h"
7#include "mc/deps/core/string/BasicStackString.h"
8#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
9#include "mc/deps/core/utility/NonOwnerPointer.h"
10#include "mc/deps/puv/Loader.h"
11#include "mc/world/level/chunk/ChunksLoadedStatus.h"
12#include "mc/world/level/chunk/QueueRequestResult.h"
13#include "mc/world/level/levelgen/structure/StructureDeleteResult.h"
14
15// auto generated forward declare list
16// clang-format off
17class BlockPos;
18class BoundingBox;
20class CommandArea;
21class CompoundTag;
22class Dimension;
25class Level;
26class LevelStorage;
27class PackInstance;
29class ServerLevel;
33struct Tick;
34namespace Core { class Path; }
35namespace SharedTypes::v1_21_50 { struct JigsawStructureMetadataFile; }
36namespace SharedTypes::v1_21_50 { struct JigsawStructureMetadataRegistry; }
37namespace cereal { struct ReflectionCtx; }
38// clang-format on
39
41public:
42 // member variables
43 // NOLINTBEGIN
44 ::ll::TypedStorage<8, 8, ::std::shared_mutex> mRepositoryMutex;
45 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::std::unique_ptr<::LegacyStructureTemplate>>>
46 mLegacyStructureRepository;
47 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::std::unique_ptr<::StructureTemplate>>>
48 mStructureRepository;
49 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::StructureAnimationData>>> mStructurePlacementQueue;
50 ::ll::TypedStorage<4, 4, uint> mStructurePlacementSaveCounter;
51 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::IUnknownBlockTypeRegistry>> mUnknownBlockRegistry;
52 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::ResourcePackManager> const> mPackManager;
53 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::SharedTypes::v1_21_50::JigsawStructureMetadataRegistry>>
54 mMetadataRegistry;
55 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::cereal::ReflectionCtx>> mCerealContext;
56 // NOLINTEND
57
58public:
59 // virtual functions
60 // NOLINTBEGIN
61 // vIndex: 0
62 virtual ~StructureManager() /*override*/;
63 // NOLINTEND
64
65public:
66 // member functions
67 // NOLINTBEGIN
68 MCAPI explicit StructureManager(::ResourcePackManager& packManager);
69
70 MCAPI ::StructureTemplate* _createAndLoadStructure(
71 ::std::string const& structureName,
72 ::ResourcePackManager const* packManager,
73 ::LevelStorage* levelStorage
74 );
75
76 MCAPI ::std::string _createLevelStorageId(::std::string const& dimensionPrefix, ::std::string const& saveId);
77
78 MCAPI bool _findResource(
80 ::PackInstance const& pack,
81 ::std::string& resourceStream
82 );
83
84 MCAPI ::SharedTypes::v1_21_50::JigsawStructureMetadataRegistry& _getMetadataRegistry() const;
85
86 MCAPI bool _placeSegment(::StructureAnimationData& structureAnimationData);
87
88 MCAPI bool _placeSegment(
89 ::Dimension& dimension,
90 ::StructureAnimationData& structureAnimationData,
91 ::ChunkLoadActionList& chunkLoadActionList,
92 ::BoundingBox const& boundingBox,
93 ::std::function<::ChunksLoadedStatus(::Tick)> const& areChunksLoaded
94 );
95
96 MCAPI ::LegacyStructureTemplate* _readLegacyStructure(::std::string const& name);
97
98 MCAPI void
99 _removePlacementQueueItem(::std::string const& dimensionPrefix, ::StructureAnimationData& structureAnimationData);
100
101 MCAPI void
102 _savePlacementQueueItem(::std::string const& dimensionPrefix, ::StructureAnimationData& structureAnimationData);
103
104 MCAPI ::StructureTemplate&
105 cloneStructure(::StructureTemplate const& structureTemplate, ::std::string const& structureName);
106
107 MCAPI ::StructureDeleteResult deleteStructure(::std::string const& structureName, ::LevelStorage& levelStorage);
108
109 MCAPI ::StructureTemplate& getOrCreate(::std::string const& structureName);
110
111 MCAPI ::LegacyStructureTemplate& getOrCreateLegacy(::std::string const& structureName);
112
113 MCAPI ::StructureTemplate* getStructure(::std::string const& structureName) const;
114
115 MCAPI ::std::vector<::std::string> getStructureNames(::LevelStorage& levelStorage, bool includeUnremovable) const;
116
117 MCAPI void importStructureFromTemplate(::std::string name, ::StructureTemplate const& temp);
118
119 MCAPI bool load(
120 ::StructureTemplate& structureTemplate,
121 ::ResourcePackManager const* packManager,
122 ::LevelStorage* levelStorage
123 );
124
125 MCAPI bool loadLegacy(::LegacyStructureTemplate& structure, ::std::string& data);
126
127 MCAPI void loadMetadataRegistries(::ResourcePackManager& packManager);
128
129 MCAPI void loadPlacementQueue(::LevelStorage& storage, ::Level& level, ::Dimension& dimension);
130
131 MCAPI void
132 loadPlacementQueueItem(::std::string const& key, ::CompoundTag const& tag, ::Level& level, ::Dimension& dimension);
133
134 MCAPI void queueLoad(::std::unique_ptr<::StructureAnimationData> structureAnimationData);
135
136 MCAPI bool readStructure(::StructureTemplate& structureTemplate);
137
138 MCAPI void saveToLevel(::StructureTemplate const& structureTemplate, ::LevelStorage& levelStorage);
139
140 MCAPI void setUnknownBlockRegistry(::Bedrock::NonOwnerPointer<::IUnknownBlockTypeRegistry> unknownBlockRegistry);
141
142 MCAPI void tick(::Dimension const& dimension);
143
144 MCAPI ::QueueRequestResult tryPlaceStructureInWorld(
145 ::std::unique_ptr<::CommandArea> cmdArea,
146 ::ServerLevel& level,
147 ::Dimension& dimension,
148 ::BoundingBox const& bounds,
149 ::BlockPos const& loadPosition,
150 ::StructureSettings const& settings,
151 ::StructureTemplate const& structureTemplate,
152 ::std::unique_ptr<::StructureAnimationData> structureAnimationData
153 );
154 // NOLINTEND
155
156public:
157 // static functions
158 // NOLINTBEGIN
159 MCAPI static ::std::unique_ptr<::SharedTypes::v1_21_50::JigsawStructureMetadataRegistry>
160 _loadMetadataRegistries(::cereal::ReflectionCtx const& ctx, ::ResourcePackManager& packManager, bool excludeLatest);
161
162 MCAPI static void _metadataPackForEachCallback(
165 ::PackInstance const& pack,
166 ::std::string& fileData,
167 ::Core::Path const& filenameWithExtension
168 );
169
170 MCAPI static ::Core::PathBuffer<::Core::BasicStackString<char, 1024>>
171 getStructurePath(::std::string const& structureFullName);
172
173 MCAPI static ::Core::PathBuffer<::Core::BasicStackString<char, 1024>>
174 getStructurePath(::std::string const& structureNamespace, ::std::string const& structureName);
175 // NOLINTEND
176
177public:
178 // static variables
179 // NOLINTBEGIN
180 MCAPI static char const*& BEHAVIOR_PACK_STRUCTURES_FOLDER();
181
182 MCAPI static char const*& LEVEL_STORAGE_STRUCTURE_TEMPLATE_PREFIX();
183 // NOLINTEND
184
185public:
186 // constructor thunks
187 // NOLINTBEGIN
188 MCAPI void* $ctor(::ResourcePackManager& packManager);
189 // NOLINTEND
190
191public:
192 // destructor thunk
193 // NOLINTBEGIN
194 MCAPI void $dtor();
195 // NOLINTEND
196
197public:
198 // vftables
199 // NOLINTBEGIN
200 MCAPI static void** $vftable();
201 // NOLINTEND
202};
Definition EnableNonOwnerReferences.h:7
Definition NonOwnerPointer.h:9
Definition BlockPos.h:18
Definition BoundingBox.h:18
Definition ChunkLoadActionList.h:20
Definition CommandArea.h:5
Definition CompoundTag.h:13
Definition BasicStackString.h:8
Definition PathBuffer.h:8
Definition Path.h:15
Definition Dimension.h:83
Definition IUnknownBlockTypeRegistry.h:14
Definition LegacyStructureTemplate.h:24
Definition LevelStorage.h:24
Definition Level.h:234
Definition PackInstance.h:23
Definition Path.h:16
Definition Loader.h:8
Definition ResourcePackManager.h:24
Definition ServerLevel.h:52
Definition StructureAnimationData.h:17
Definition StructureManager.h:40
Definition StructureSettings.h:18
Definition StructureTemplate.h:32
Definition JigsawStructureMetadataRegistry.h:7
Definition Tick.h:5
Definition ReflectionCtx.h:11
Definition ctx.h:5