Skip to content
LeviMC
English
AutoLightDark
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::ThreadModel { struct MultiThreaded; }
20namespace cereal { struct NullType; }
21// clang-format on
22
24public:
25 // GameRules inner types define
26 enum class GameRulesIndex : int {
27 InvalidGameRule = -1,
28 CommandBlockOutput = 0,
29 DoDaylightCycle = 1,
30 DoEntityDrops = 2,
31 DoFireTick = 3,
32 RecipesUnlock = 4,
33 DoLimitedCrafting = 5,
34 DoMobLoot = 6,
35 DoMobSpawning = 7,
36 DoTileDrops = 8,
37 DoWeatherCycle = 9,
38 DrowningDamage = 10,
39 FallDamage = 11,
40 FireDamage = 12,
41 KeepInventory = 13,
42 MobGriefing = 14,
43 Pvp = 15,
44 ShowCoordinates = 16,
45 PlayerWaypoints = 17,
46 LocatorBarDeprecated = 18,
47 ShowDaysPlayed = 19,
48 DoNaturalRegeneration = 20,
49 DoTntExplode = 21,
50 SendCommandFeedback = 22,
51 MaxCommandChainLength = 23,
52 DoInsomnia = 24,
53 CommandBlocksEnabled = 25,
54 RandomTickSpeed = 26,
55 DoImmediateRespawn = 27,
56 ShowDeathMessages = 28,
57 FunctionCommandLimit = 29,
58 PlayerSpawnRadius = 30,
59 ShowTags = 31,
60 FreezeDamage = 32,
61 RespawnBlocksExplode = 33,
62 ShowBorderEffect = 34,
63 ShowRecipeMessages = 35,
64 PlayerSleepingPercentage = 36,
65 ProjectilesCanBreakBlocks = 37,
66 TntExplosionDropDecay = 38,
67 VanillaGameRuleCount = 39,
68 GlobalMute = 39,
69 AllowDestructiveObjects = 40,
70 AllowMobs = 41,
71 CodeBuilder = 42,
72 EduCloudSave = 43,
73 EduGameRuleCount = 44,
74 GameRuleCount = 44,
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::
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 MCNAPI GameRules();
104
105 MCNAPI GameRules(::GameRules&& rhs);
106
107 MCNAPI GameRules(::GameRules const& rhs);
108
109 MCAPI void _registerRules();
110
111 MCNAPI ::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 MCNAPI void deserializeRules(::GameRulesChangedPacketData const& ruleData);
124
125 MCAPI bool getBool(::GameRuleId ruleType, bool defaultValue) const;
126
127#ifdef LL_PLAT_C
128 MCNAPI void getTagData(::CompoundTag const& tag, ::BaseGameVersion const& version);
129#endif
130
131 MCNAPI ::GameRules& operator=(::GameRules&& rhs);
132
133 MCNAPI ::GameRules& operator=(::GameRules const& rhs);
134
135#ifdef LL_PLAT_C
136 MCNAPI bool operator==(::GameRules const& rhs) const;
137#endif
138
140
141#ifdef LL_PLAT_C
142 MCNAPI void setTagData(::CompoundTag& tag) const;
143#endif
144 // NOLINTEND
145
146public:
147 // static variables
148 // NOLINTBEGIN
149 MCNAPI static ::std::string const& WORLD_POLICY_TAG_NAME();
150 // NOLINTEND
151
152public:
153 // constructor thunks
154 // NOLINTBEGIN
155 MCNAPI void* $ctor();
156
157 MCNAPI void* $ctor(::GameRules&& rhs);
158
159 MCNAPI void* $ctor(::GameRules const& rhs);
160 // NOLINTEND
161
162public:
163 // destructor thunk
164 // NOLINTBEGIN
165 MCNAPI void $dtor();
166 // NOLINTEND
167
168public:
169 // vftables
170 // NOLINTBEGIN
171 MCNAPI static void** $vftable();
172 // NOLINTEND
173};
Definition BaseGameVersion.h:8
Definition EnableNonOwnerReferences.h:7
Definition CompoundTag.h:18
Definition GameRule.h:29
Definition GameRule.h:14
Definition GameRulesChangedPacketData.h:10
Definition GameRulesChangedPacket.h:19
MCAPI GameRules()
MCAPI::GameRules & operator=(::GameRules &&rhs)
MCAPI void * $ctor()
MCAPI void setMarketplaceOverrides()
MCAPI GameRules(::GameRules const &rhs)
MCAPI ::std::unique_ptr<::GameRulesChangedPacket > _setGameRule(::GameRule *gameRule, ::std::variant<::cereal::NullType, bool, int, float > value, ::GameRule::Type type, bool returnPacket, bool *pValueValidated, bool *pValueChanged, ::GameRule::ValidationError *errorOutput)
static MCAPI void ** $vftable()
MCAPI void $dtor()
MCAPI::GameRules & operator=(::GameRules const &rhs)
MCAPI GameRules(::GameRules &&rhs)
MCAPI void * $ctor(::GameRules &&rhs)
static MCAPI ::std::string const & WORLD_POLICY_TAG_NAME()
MCAPI void deserializeRules(::GameRulesChangedPacketData const &ruleData)
MCAPI void * $ctor(::GameRules const &rhs)
Definition GameRuleId.h:8
Definition NullType.h:7