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 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#ifdef LL_PLAT_C
136 MCAPI bool operator==(::GameRules const& rhs) const;
137
138 MCAPI ::Bedrock::PubSub::Subscription
139 registerOnGameRuleChangeCallback(::std::function<void(::GameRules const&, ::GameRuleId const&)> callback);
140#endif
141
142 MCAPI void setMarketplaceOverrides();
143
144 MCAPI ::std::unique_ptr<::GameRulesChangedPacket> setRule(
145 ::GameRuleId rule,
146 int value,
147 bool returnPacket,
148 bool* pValueValidated,
149 bool* pValueChanged,
150 ::GameRule::ValidationError* errorOutput
151 );
152
153 MCAPI ::std::unique_ptr<::GameRulesChangedPacket> setRule(
154 ::GameRuleId rule,
155 bool value,
156 bool returnPacket,
157 bool* pValueValidated,
158 bool* pValueChanged,
159 ::GameRule::ValidationError* errorOutput
160 );
161
162 MCAPI void setTagData(::CompoundTag& tag) const;
163 // NOLINTEND
164
165public:
166 // static functions
167 // NOLINTBEGIN
168 MCAPI static ::std::map<::GameRuleId, ::GameRule> const& _getMarketplaceGameRulesDefaultMap();
169 // NOLINTEND
170
171public:
172 // static variables
173 // NOLINTBEGIN
174 MCAPI static ::std::string const& WORLD_POLICY_TAG_NAME();
175 // NOLINTEND
176
177public:
178 // constructor thunks
179 // NOLINTBEGIN
180 MCAPI void* $ctor();
181
182 MCAPI void* $ctor(::GameRules const& rhs);
183 // NOLINTEND
184
185public:
186 // destructor thunk
187 // NOLINTBEGIN
188 MCAPI void $dtor();
189 // NOLINTEND
190
191public:
192 // vftables
193 // NOLINTBEGIN
194 MCNAPI static void** $vftable();
195 // NOLINTEND
196};
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 MultiThreaded.h:12
Definition GameRuleId.h:8
Definition NullType.h:7