LeviLamina
Loading...
Searching...
No Matches
PropertyGroup.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/molang/MolangVersion.h"
7#include "mc/platform/brstd/flat_map.h"
8#include "mc/world/actor/state/DefaultPropertyValues.h"
9#include "mc/world/actor/state/PropertyMetadata.h"
10
11// auto generated forward declare list
12// clang-format off
13class ExpressionNode;
14class HashedString;
15class ListTag;
17class RenderParams;
18namespace Json { class Value; }
19// clang-format on
20
21class PropertyGroup : public ::std::enable_shared_from_this<::PropertyGroup> {
22public:
23 // member variables
24 // NOLINTBEGIN
25 ::ll::TypedStorage<8, 24, ::std::vector<::PropertyMetadata>> mPropertyMetadata;
26 ::ll::TypedStorage<
27 8,
28 48,
29 ::brstd::flat_map<uint64, uint64, ::std::less<uint64>, ::std::vector<uint64>, ::std::vector<int64>>>
30 mPropertyIndexesByHash;
31 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, uint64>> mPropertyIndexesByString;
32 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<int, int>>> mIntPropertyLimits;
33 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<float, float>>> mFloatPropertyLimits;
34 ::ll::TypedStorage<8, 24, ::std::vector<::std::vector<::HashedString>>> mStringEnumValues;
35 ::ll::TypedStorage<8, 96, ::DefaultPropertyValues> mDefaultValues;
36 // NOLINTEND
37
38public:
39 // member functions
40 // NOLINTBEGIN
41 MCAPI void _addBoolProperty(::std::string const& name, bool clientSync, ::ExpressionNode&& defaultExpression);
42
43 MCAPI void _addBoolProperty(::std::string const& name, bool clientSync, bool defaultValue);
44
45 MCAPI void _addEnumIndexProperty(
46 ::std::string const& name,
47 bool clientSync,
48 ::ExpressionNode&& defaultExpression,
49 ::std::vector<::HashedString> const& enumValues
50 );
51
52 MCAPI void _addEnumIndexProperty(
53 ::std::string const& name,
54 bool clientSync,
55 uint64 defaultValue,
56 ::std::vector<::HashedString> const& enumValues
57 );
58
59 MCAPI void _addFloatProperty(
60 ::std::string const& name,
61 bool clientSync,
62 ::ExpressionNode&& defaultExpression,
63 float rangeMin,
64 float rangeMax
65 );
66
67 MCAPI void
68 _addFloatProperty(::std::string const& name, bool clientSync, float defaultValue, float rangeMin, float rangeMax);
69
70 MCAPI void _addIntProperty(
71 ::std::string const& name,
72 bool clientSync,
73 ::ExpressionNode&& defaultExpression,
74 int rangeMin,
75 int rangeMax
76 );
77
78 MCAPI void
79 _addIntProperty(::std::string const& name, bool clientSync, int defaultValue, int rangeMin, int rangeMax);
80
81 MCAPI void
82 _addPropertyMetadata(::std::string const& name, bool clientSync, ::PropertyMetadata::ContainedType propertyType);
83
84 MCAPI bool _loadPropertyFromJson(
85 ::std::string const& name,
86 ::Json::Value const& propertyNode,
87 ::MolangVersion molangVersion,
88 bool clientSync
89 );
90
91 MCAPI void _reserveSpaceForTypes(::std::vector<uint64> const& typeCounts);
92
93 MCAPI bool getDefaultBoolValue(uint64 boolArrayIndex, ::RenderParams& renderParams) const;
94
95 MCAPI uint64 getDefaultEnumIndexValue(
96 uint64 enumIndexArrayIndex,
97 ::RenderParams& renderParams,
98 ::std::string const& propertyName
99 ) const;
100
101 MCAPI float getDefaultFloatValue(uint64 floatArrayIndex, ::RenderParams& renderParams) const;
102
103 MCAPI int getDefaultIntValue(uint64 intArrayIndex, ::RenderParams& renderParams) const;
104
105 MCAPI ::ListTag getNetworkSyncPropertyDescriptionsAsListTag() const;
106
107 MCAPI ::PropertyMetadata const* getPropertyMetadata(uint64 propertyNameHash) const;
108
109 MCAPI ::PropertyMetadata const* getPropertyMetadataByString(::std::string const& propertyName) const;
110
111 MCAPI bool hasAnyClientSyncProperties() const;
112
113 MCAPI ~PropertyGroup();
114 // NOLINTEND
115
116public:
117 // static functions
118 // NOLINTBEGIN
119 MCAPI static ::PropertyMetadata::ContainedType _getJsonPropertyType(::Json::Value const& typeNode);
120
121 MCAPI static bool
122 _tryGetClientSync(::std::string const& propertyName, ::Json::Value const& propertyNode, bool& clientSyncOut);
123
124 MCAPI static bool isValidEnumEntry(::std::string const& entryValue);
125
126 MCAPI static ::std::shared_ptr<::PropertyGroup const>
127 loadPropertiesFromJson(::Json::Value const& root, ::MolangVersion molangVersion);
128
129#ifdef LL_PLAT_C
130 MCAPI static ::std::shared_ptr<::PropertyGroup const> loadPropertiesFromNetworkSync(::ListTag const& propertiesTag);
131#endif
132 // NOLINTEND
133
134public:
135 // static variables
136 // NOLINTBEGIN
137 MCAPI static uint64 const& MAX_ENUM_SIZE();
138
139 MCAPI static uint64 const& MAX_ENUM_VALUE_SIZE();
140
141 MCAPI static uint64 const& MAX_PROPERTIES_COUNT();
142 // NOLINTEND
143
144public:
145 // destructor thunk
146 // NOLINTBEGIN
147 MCAPI void $dtor();
148 // NOLINTEND
149};
Definition ExpressionNode.h:36
Definition HashedString.h:5
Definition Value.h:16
Definition ListTag.h:21
Definition PropertyGroup.h:21
Definition PropertyMetadata.h:8
Definition RenderParams.h:30
Definition flat_map.h:15