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 56,
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 PropertyGroup();
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 ::std::string const& _getFriendlyJsonTypeString(::PropertyMetadata::ContainedType type);
85
86 MCAPI bool _loadPropertyFromJson(
87 ::std::string const& name,
88 ::Json::Value const& propertyNode,
89 ::MolangVersion molangVersion,
90 bool clientSync
91 );
92
93 MCAPI void _reserveSpaceForTypes(::std::vector<uint64> const& typeCounts);
94
95 MCAPI bool _validateDataType(::Json::Value const& value, ::PropertyMetadata::ContainedType type);
96
97 MCAPI bool getDefaultBoolValue(uint64 boolArrayIndex, ::RenderParams& renderParams) const;
98
99 MCAPI uint64 getDefaultEnumIndexValue(
100 uint64 enumIndexArrayIndex,
101 ::RenderParams& renderParams,
102 ::std::string const& propertyName
103 ) const;
104
105 MCAPI float getDefaultFloatValue(uint64 floatArrayIndex, ::RenderParams& renderParams) const;
106
107 MCAPI int getDefaultIntValue(uint64 intArrayIndex, ::RenderParams& renderParams) const;
108
109 MCAPI ::ListTag getNetworkSyncPropertyDescriptionsAsListTag() const;
110
111 MCAPI ~PropertyGroup();
112 // NOLINTEND
113
114public:
115 // static functions
116 // NOLINTBEGIN
117 MCAPI static ::PropertyMetadata::ContainedType _getJsonPropertyType(::Json::Value const& typeNode);
118
119 MCAPI static bool isValidEnumEntry(::std::string const& entryValue);
120
121 MCAPI static ::std::shared_ptr<::PropertyGroup const>
122 loadPropertiesFromJson(::Json::Value const& root, ::MolangVersion molangVersion);
123 // NOLINTEND
124
125public:
126 // static variables
127 // NOLINTBEGIN
128 MCAPI static uint64 const& MAX_ENUM_SIZE();
129
130 MCAPI static uint64 const& MAX_ENUM_VALUE_SIZE();
131 // NOLINTEND
132
133public:
134 // constructor thunks
135 // NOLINTBEGIN
136 MCAPI void* $ctor();
137 // NOLINTEND
138
139public:
140 // destructor thunk
141 // NOLINTBEGIN
142 MCAPI void $dtor();
143 // NOLINTEND
144};
Definition ExpressionNode.h:28
Definition HashedString.h:5
Definition Value.h:16
Definition ListTag.h:12
Definition PropertyGroup.h:21
Definition PropertyMetadata.h:8
Definition RenderParams.h:30
Definition flat_map.h:8