LeviLamina
Loading...
Searching...
No Matches
GameRules.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/string/HashedString.h"
7#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
8#include "mc/deps/core/utility/pub_sub/Publisher.h"
9#include "mc/world/level/storage/GameRule.h"
10
11// auto generated forward declare list
12// clang-format off
13class BaseGameVersion;
14class CompoundTag;
15class GameRule;
18struct GameRuleId;
19namespace Bedrock::PubSub { class Subscription; }
20namespace Bedrock::PubSub::ThreadModel { struct MultiThreaded; }
21namespace cereal { struct NullType; }
22// clang-format on
23
24class GameRules : public ::Bedrock::EnableNonOwnerReferences {
25public:
26 // GameRules inner types define
27 enum class GameRulesIndex : int {
28 InvalidGameRule = -1,
29 CommandBlockOutput = 0,
30 DoDaylightCycle = 1,
31 DoEntityDrops = 2,
32 DoFireTick = 3,
33 RecipesUnlock = 4,
34 DoLimitedCrafting = 5,
35 DoMobLoot = 6,
36 DoMobSpawning = 7,
37 DoTileDrops = 8,
38 DoWeatherCycle = 9,
39 DrowningDamage = 10,
40 FallDamage = 11,
41 FireDamage = 12,
42 KeepInventory = 13,
43 MobGriefing = 14,
44 Pvp = 15,
45 ShowCoordinates = 16,
46 LocatorBar = 17,
47 ShowDaysPlayed = 18,
48 DoNaturalRegeneration = 19,
49 DoTntExplode = 20,
50 SendCommandFeedback = 21,
51 MaxCommandChainLength = 22,
52 DoInsomnia = 23,
53 CommandBlocksEnabled = 24,
54 RandomTickSpeed = 25,
55 DoImmediateRespawn = 26,
56 ShowDeathMessages = 27,
57 FunctionCommandLimit = 28,
58 PlayerSpawnRadius = 29,
59 ShowTags = 30,
60 FreezeDamage = 31,
61 RespawnBlocksExplode = 32,
62 ShowBorderEffect = 33,
63 ShowRecipeMessages = 34,
64 PlayerSleepingPercentage = 35,
65 ProjectilesCanBreakBlocks = 36,
66 TntExplosionDropDecay = 37,
67 VanillaGameRuleCount = 38,
68 GlobalMute = 38,
69 AllowDestructiveObjects = 39,
70 AllowMobs = 40,
71 CodeBuilder = 41,
72 EduCloudSave = 42,
73 EduGameRuleCount = 43,
74 GameRuleCount = 43,
75 };
76
77 using GameRuleMap = ::std::vector<::GameRule>;
78
79 using WorldPolicyMap = ::std::map<::HashedString, ::GameRule>;
80
81public:
82 // member variables
83 // NOLINTBEGIN
84 ::ll::TypedStorage<8, 24, ::std::vector<::GameRule>> mGameRules;
85 ::ll::TypedStorage<8, 16, ::std::map<::HashedString, ::GameRule>> mWorldPolicies;
86 ::ll::TypedStorage<
87 8,
88 128,
89 ::Bedrock::PubSub::
90 Publisher<void(::GameRules const&, ::GameRuleId const&), ::Bedrock::PubSub::ThreadModel::MultiThreaded, 0>>
91 mGameRuleChangePublisher;
92 // NOLINTEND
93
94public:
95 // virtual functions
96 // NOLINTBEGIN
97 virtual ~GameRules() /*override*/;
98 // NOLINTEND
99
100public:
101 // member functions
102 // NOLINTBEGIN
103 MCAPI GameRules();
104
105 MCAPI GameRules(::GameRules const& rhs);
106
107 MCAPI ::GameRule& _registerRule(::std::string const& name, ::GameRuleId rule);
108
109 MCAPI void _registerRules();
110
111 MCAPI ::std::unique_ptr<::GameRulesChangedPacket> _setGameRule(
112 ::GameRule* gameRule,
113 ::std::variant<::cereal::NullType, bool, int, float> value,
114 ::GameRule::Type type,
115 bool returnPacket,
116 bool* pValueValidated,
117 bool* pValueChanged,
118 ::GameRule::ValidationError* errorOutput
119 );
120
121 MCAPI ::std::unique_ptr<::GameRulesChangedPacket> createAllGameRulesPacket() const;
122
123 MCAPI void deserializeRules(::GameRulesChangedPacketData const& ruleData);
124
125 MCAPI bool getBool(::GameRuleId ruleType, bool defaultValue) const;
126
127 MCAPI float getFloat(::GameRuleId ruleType) const;
128
129 MCAPI int getInt(::GameRuleId ruleType) const;
130
131 MCAPI ::GameRule const* getRule(::GameRuleId rule) const;
132
133 MCFOLD ::std::vector<::GameRule> const& getRules() const;
134
135 MCAPI void getTagData(::CompoundTag const& tag, ::BaseGameVersion const& version);
136
137 MCAPI bool hasRule(::GameRuleId ruleType) const;
138
139 MCAPI ::GameRuleId nameToGameRuleIndex(::std::string const& name) const;
140
141 MCAPI ::GameRules& operator=(::GameRules const& rhs);
142
143#ifdef LL_PLAT_C
144 MCAPI bool operator==(::GameRules const& rhs) const;
145#endif
146
147 MCFOLD ::Bedrock::PubSub::Subscription
148 registerOnGameRuleChangeCallback(::std::function<void(::GameRules const&, ::GameRuleId const&)> callback);
149
150 MCAPI void setMarketplaceOverrides();
151
152 MCAPI ::std::unique_ptr<::GameRulesChangedPacket> setRule(
153 ::GameRuleId rule,
154 int value,
155 bool returnPacket,
156 bool* pValueValidated,
157 bool* pValueChanged,
158 ::GameRule::ValidationError* errorOutput
159 );
160
161 MCAPI ::std::unique_ptr<::GameRulesChangedPacket> setRule(
162 ::GameRuleId rule,
163 float value,
164 bool returnPacket,
165 bool* pValueValidated,
166 bool* pValueChanged,
167 ::GameRule::ValidationError* errorOutput
168 );
169
170 MCAPI ::std::unique_ptr<::GameRulesChangedPacket> setRule(
171 ::GameRuleId rule,
172 bool value,
173 bool returnPacket,
174 bool* pValueValidated,
175 bool* pValueChanged,
176 ::GameRule::ValidationError* errorOutput
177 );
178
179 MCAPI void setTagData(::CompoundTag& tag) const;
180 // NOLINTEND
181
182public:
183 // static functions
184 // NOLINTBEGIN
185 MCAPI static ::std::map<::GameRuleId, ::GameRule> const& _getMarketplaceGameRulesDefaultMap();
186 // NOLINTEND
187
188public:
189 // static variables
190 // NOLINTBEGIN
191 MCAPI static int const& DEFAULT_RANDOMTICKSPEED();
192
193 MCAPI static int const& MAX_FUNCTIONCOMMANDLIMIT();
194
195 MCAPI static uint const& MAX_PLAYER_SPAWN_RADIUS();
196
197 MCAPI static int const& MAX_RANDOMTICKSPEED();
198
199 MCAPI static uint const& MIN_PLAYER_SPAWN_RADIUS();
200
201 MCAPI static ::std::string const& WORLD_POLICY_TAG_NAME();
202 // NOLINTEND
203
204public:
205 // constructor thunks
206 // NOLINTBEGIN
207 MCAPI void* $ctor();
208
209 MCAPI void* $ctor(::GameRules const& rhs);
210 // NOLINTEND
211
212public:
213 // destructor thunk
214 // NOLINTBEGIN
215 MCAPI void $dtor();
216 // NOLINTEND
217
218public:
219 // vftables
220 // NOLINTBEGIN
221 MCNAPI static void** $vftable();
222 // NOLINTEND
223};
Definition BaseGameVersion.h:13
Definition EnableNonOwnerReferences.h:7
Definition Subscription.h:10
Definition CompoundTag.h:23
Definition GameRule.h:28
Definition GameRule.h:13
Definition GameRulesChangedPacketData.h:10
Definition GameRulesChangedPacket.h:19
static MCAPI void ** $vftable()
Definition GameRuleId.h:8
Definition NullType.h:7