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/utility/EnableNonOwnerReferences.h"
7#include "mc/deps/core/utility/pub_sub/Publisher.h"
8#include "mc/world/level/storage/GameRule.h"
9
10// auto generated forward declare list
11// clang-format off
12class BaseGameVersion;
13class CompoundTag;
14class GameRule;
17class HashedString;
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 int getInt(::GameRuleId ruleType) const;
128
129 MCAPI void getTagData(::CompoundTag const& tag, ::BaseGameVersion const& version);
130
131 MCAPI ::GameRuleId nameToGameRuleIndex(::std::string const& name) const;
132
133 MCAPI ::GameRules& operator=(::GameRules const& rhs);
134
135 MCAPI_C ::Bedrock::PubSub::Subscription
136 registerOnGameRuleChangeCallback(::std::function<void(::GameRules const&, ::GameRuleId const&)> callback);
137
138 MCAPI void setMarketplaceOverrides();
139
140 MCAPI ::std::unique_ptr<::GameRulesChangedPacket> setRule(
141 ::GameRuleId rule,
142 int value,
143 bool returnPacket,
144 bool* pValueValidated,
145 bool* pValueChanged,
146 ::GameRule::ValidationError* errorOutput
147 );
148
149 MCAPI ::std::unique_ptr<::GameRulesChangedPacket> setRule(
150 ::GameRuleId rule,
151 bool value,
152 bool returnPacket,
153 bool* pValueValidated,
154 bool* pValueChanged,
155 ::GameRule::ValidationError* errorOutput
156 );
157
158 MCAPI void setTagData(::CompoundTag& tag) const;
159 // NOLINTEND
160
161public:
162 // static functions
163 // NOLINTBEGIN
164 MCAPI static ::std::map<::GameRuleId, ::GameRule> const& _getMarketplaceGameRulesDefaultMap();
165 // NOLINTEND
166
167public:
168 // static variables
169 // NOLINTBEGIN
170 MCAPI_C static int const& DEFAULT_RANDOMTICKSPEED();
171
172 MCAPI static int const& MAX_FUNCTIONCOMMANDLIMIT();
173
174 MCAPI_C static uint const& MAX_PLAYER_SPAWN_RADIUS();
175
176 MCAPI_C static int const& MAX_RANDOMTICKSPEED();
177
178 MCAPI_C static uint const& MIN_PLAYER_SPAWN_RADIUS();
179
180 MCAPI static ::std::string const& WORLD_POLICY_TAG_NAME();
181 // NOLINTEND
182
183public:
184 // constructor thunks
185 // NOLINTBEGIN
186 MCAPI void* $ctor();
187
188 MCAPI void* $ctor(::GameRules const& rhs);
189 // NOLINTEND
190
191public:
192 // destructor thunk
193 // NOLINTBEGIN
194 MCAPI void $dtor();
195 // NOLINTEND
196
197public:
198 // vftables
199 // NOLINTBEGIN
200 MCNAPI static void** $vftable();
201 // NOLINTEND
202};
Definition BaseGameVersion.h:8
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 HashedString.h:5
Definition GameRuleId.h:8
Definition NullType.h:7