LeviLamina
Loading...
Searching...
No Matches
PackSettingsFactory.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/cereal/ReflectionCtx.h"
7#include "mc/deps/core/file/PathBuffer.h"
8#include "mc/deps/core/utility/pub_sub/Publisher.h"
9#include "mc/platform/UUID.h"
10#include "mc/platform/brstd/basic_cstring_view.h"
11
12// auto generated forward declare list
13// clang-format off
14class PackManifest;
15class PackSettings;
17namespace Bedrock::PubSub { class Subscription; }
18namespace Bedrock::PubSub::ThreadModel { struct MultiThreaded; }
19namespace Core { class Path; }
20namespace Core { class PathView; }
21namespace SharedTypes::v1_21_100::PackSettingsDefinition { struct Document; }
22// clang-format on
23
24class PackSettingsFactory {
25public:
26 // PackSettingsFactory inner types declare
27 // clang-format off
28 struct Stats;
29 // clang-format on
30
31 // PackSettingsFactory inner types define
32 struct Stats {
33 public:
34 // member variables
35 // NOLINTBEGIN
40 // NOLINTEND
41
42 public:
43 // prevent constructor by default
44 Stats& operator=(Stats const&);
45 Stats(Stats const&);
46 Stats();
47 };
48
49 using PackIdToSettingsMap = ::std::unordered_map<::mce::UUID, ::std::unique_ptr<::PackSettings>>;
50
51public:
52 // member variables
53 // NOLINTBEGIN
54 ::ll::TypedStorage<8, 8, uint64 const> mMaxGlobalPackSettingEntriesPerFile;
55 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mGlobalPackSettingsPath;
56 ::ll::TypedStorage<4, 16, ::PackSettingsFactory::Stats> mStats;
57 ::ll::TypedStorage<8, 128, ::cereal::ReflectionCtx> mReflectionCtx;
58 ::ll::TypedStorage<
59 8,
60 256,
63 nullptr_t,
64 nullptr_t,
66 mLoader;
67 ::ll::TypedStorage<
68 8,
69 16,
70 ::std::shared_ptr<::Bedrock::PubSub::Publisher<
71 void(::mce::UUID const&, ::std::string const&, ::std::variant<float, bool, ::std::string> const&),
73 0>>>
74 mOnChangePublisher;
75 ::ll::TypedStorage<
76 8,
77 8,
78 ::std::unique_ptr<::std::unordered_map<
80 ::std::unique_ptr<::PackSettings, ::std::default_delete<::PackSettings>>>>>
81 mGlobalPackSettings;
82 ::ll::TypedStorage<
83 8,
84 64,
85 ::std::unordered_map<::std::string, ::std::unordered_map<::mce::UUID, ::std::unique_ptr<::PackSettings>>>>
86 mWorldPackSettings;
87 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::SharedTypes::v1_21_100::PackSettingsDefinition::Document>>
88 mGlobalUserOverrides;
89 ::ll::TypedStorage<
90 8,
91 64,
92 ::std::
93 unordered_map<::std::string, ::std::unique_ptr<::SharedTypes::v1_21_100::PackSettingsDefinition::Document>>>
94 mPerWorldUserOverrides;
95 // NOLINTEND
96
97public:
98 // prevent constructor by default
99 PackSettingsFactory();
100
101public:
102 // virtual functions
103 // NOLINTBEGIN
104 virtual ~PackSettingsFactory();
105
106 virtual uint64 getAccessTimestamp() const;
107 // NOLINTEND
108
109public:
110 // member functions
111 // NOLINTBEGIN
112 MCAPI
113 PackSettingsFactory(uint64 maxGlobalPackSettingEntriesPerFile, ::std::optional<::Core::PathView> globalPathRoot);
114
115 MCAPI ::PackSettings* _getGlobalPackSettings(::PackManifest const& manifest);
116
117 MCAPI ::std::unordered_map<::mce::UUID, ::std::unique_ptr<::PackSettings>>&
118 _getWorldIdToPackSettingsMap(::std::string const& worldId);
119
120 MCAPI ::PackSettings* _getWorldPackSettings(::PackManifest const& manifest, ::std::optional<::std::string> worldId);
121
122 MCAPI ::std::unique_ptr<::SharedTypes::v1_21_100::PackSettingsDefinition::Document>
123 _loadUserOverridesFromFile(::Core::Path const& path) const;
124
125#ifdef LL_PLAT_C
126 MCAPI bool _saveUserOverridesToFile(
128 ::Core::Path const& path
129 ) const;
130
131 MCAPI void _syncPackSettingsToSaveDoc(
132 ::mce::UUID packId,
133 ::PackSettings const& packSettings,
135 bool includeTimestamp
136 ) const;
137#endif
138
139 MCAPI ::PackSettings* getPackSettings(::PackManifest const& manifest, ::std::optional<::std::string> worldId);
140
141 MCAPI bool loadPerWorldUserOverrides(::std::string const& worldId, ::Core::Path const& worldPath);
142
143#ifdef LL_PLAT_C
144 MCAPI ::Bedrock::PubSub::Subscription registerObserver(
145 ::std::function<
146 void(::mce::UUID const&, ::std::string const&, ::std::variant<float, bool, ::std::string> const&)> callback
147 );
148
149 MCAPI bool saveGlobalUserOverrides();
150
151 MCAPI bool savePerWorldUserOverrides(::std::string const& worldId, ::Core::Path const& worldPath);
152
153 MCAPI ::std::string serializePackSettingsNameValueMap(
154 ::std::unordered_map<::std::string, ::PackSettingValueAndDefault> const& packSettingsNameValueMap
155 ) const;
156#endif
157 // NOLINTEND
158
159public:
160 // static variables
161 // NOLINTBEGIN
162 MCAPI static ::brstd::basic_cstring_view<char, ::std::char_traits<char>> const&
163 GLOBAL_RESOURCE_PACK_SETTINGS_FILENAME();
164
165 MCAPI static ::brstd::basic_cstring_view<char, ::std::char_traits<char>> const&
166 WORLD_BEHAVIOR_PACK_SETTINGS_FILENAME();
167 // NOLINTEND
168
169public:
170 // constructor thunks
171 // NOLINTBEGIN
172 MCAPI void* $ctor(uint64 maxGlobalPackSettingEntriesPerFile, ::std::optional<::Core::PathView> globalPathRoot);
173 // NOLINTEND
174
175public:
176 // destructor thunk
177 // NOLINTBEGIN
178 MCAPI void $dtor();
179 // NOLINTEND
180
181public:
182 // virtual function thunks
183 // NOLINTBEGIN
184 MCAPI uint64 $getAccessTimestamp() const;
185
186
187 // NOLINTEND
188
189public:
190 // vftables
191 // NOLINTBEGIN
192 MCNAPI static void** $vftable();
193 // NOLINTEND
194};
Definition Publisher.h:8
Definition Subscription.h:10
Definition PathView.h:19
Definition Path.h:17
Definition PackManifest.h:37
static MCAPI void ** $vftable()
Definition PackSettings.h:19
Definition _HeaderOutputPredefine.h:293
Definition UUID.h:7
Definition MultiThreaded.h:12
Definition PackSettingValueAndDefault.h:5
Definition PackSettingsFactory.h:32
Definition Alias.h:14