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::ThreadModel { struct MultiThreaded; }
20// clang-format on
21
23public:
24 // GameRules inner types define
25 using GameRuleMap = ::std::vector<::GameRule>;
26
27 using WorldPolicyMap = ::std::map<::HashedString, ::GameRule>;
28
29 enum class GameRulesIndex : int {
30 InvalidGameRule = -1,
31 CommandBlockOutput = 0,
32 DoDaylightCycle = 1,
33 DoEntityDrops = 2,
34 DoFireTick = 3,
35 RecipesUnlock = 4,
36 DoLimitedCrafting = 5,
37 DoMobLoot = 6,
38 DoMobSpawning = 7,
39 DoTileDrops = 8,
40 DoWeatherCycle = 9,
41 DrowningDamage = 10,
42 FallDamage = 11,
43 FireDamage = 12,
44 KeepInventory = 13,
45 MobGriefing = 14,
46 Pvp = 15,
47 ShowCoordinates = 16,
48 ShowDaysPlayed = 17,
49 DoNaturalRegeneration = 18,
50 DoTntExplode = 19,
51 SendCommandFeedback = 20,
52 MaxCommandChainLength = 21,
53 DoInsomnia = 22,
54 CommandBlocksEnabled = 23,
55 RandomTickSpeed = 24,
56 DoImmediateRespawn = 25,
57 ShowDeathMessages = 26,
58 FunctionCommandLimit = 27,
59 PlayerSpawnRadius = 28,
60 ShowTags = 29,
61 FreezeDamage = 30,
62 RespawnBlocksExplode = 31,
63 ShowBorderEffect = 32,
64 ShowRecipeMessages = 33,
65 PlayerSleepingPercentage = 34,
66 ProjectilesCanBreakBlocks = 35,
67 TntExplosionDropDecay = 36,
68 VanillaGameRuleCount = 37,
69 GlobalMute = 37,
70 AllowDestructiveObjects = 38,
71 AllowMobs = 39,
72 CodeBuilder = 40,
73 EduCloudSave = 41,
74 EduGameRuleCount = 42,
75 GameRuleCount = 42,
76 };
77
78public:
79 // member variables
80 // NOLINTBEGIN
81 ::ll::TypedStorage<8, 24, ::std::vector<::GameRule>> mGameRules;
82 ::ll::TypedStorage<8, 16, ::std::map<::HashedString, ::GameRule>> mWorldPolicies;
83 ::ll::TypedStorage<
84 8,
85 128,
86 ::Bedrock::PubSub::
88 mGameRuleChangePublisher;
89 // NOLINTEND
90
91public:
92 // virtual functions
93 // NOLINTBEGIN
94 // vIndex: 0
95 virtual ~GameRules() /*override*/;
96 // NOLINTEND
97
98public:
99 // member functions
100 // NOLINTBEGIN
101 MCAPI GameRules();
102
103 MCAPI GameRules(::GameRules const& rhs);
104
105 MCAPI ::GameRule& _registerRule(::std::string const& name, ::GameRuleId rule);
106
107 MCAPI void _registerRules();
108
109 MCAPI ::std::unique_ptr<::GameRulesChangedPacket> _setGameRule(
110 ::GameRule* gameRule,
111 ::GameRule::Value value,
112 ::GameRule::Type type,
113 bool returnPacket,
114 bool* errorOutput,
115 bool* pValueValidated,
116 ::GameRule::ValidationError* pValueChanged
117 );
118
119 MCAPI ::std::unique_ptr<::GameRulesChangedPacket> createAllGameRulesPacket() const;
120
121 MCAPI void deserializeRules(::GameRulesChangedPacketData const& ruleData);
122
123 MCAPI bool getBool(::GameRuleId ruleType, bool defaultValue) const;
124
125 MCAPI int getInt(::GameRuleId ruleType) const;
126
127 MCAPI void getTagData(::CompoundTag const& tag, ::BaseGameVersion const& version);
128
129 MCAPI ::GameRuleId nameToGameRuleIndex(::std::string const& name) const;
130
131 MCAPI ::GameRules& operator=(::GameRules const& rhs);
132
133 MCAPI void setMarketplaceOverrides();
134
135 MCAPI ::std::unique_ptr<::GameRulesChangedPacket> setRule(
136 ::GameRuleId rule,
137 bool value,
138 bool returnPacket,
139 bool* errorOutput,
140 bool* pValueValidated,
141 ::GameRule::ValidationError* pValueChanged
142 );
143
144 MCAPI void setTagData(::CompoundTag& tag) const;
145 // NOLINTEND
146
147public:
148 // static functions
149 // NOLINTBEGIN
150 MCAPI static ::std::map<::GameRuleId, ::GameRule> const& _getMarketplaceGameRulesDefaultMap();
151 // NOLINTEND
152
153public:
154 // static variables
155 // NOLINTBEGIN
156 MCAPI static int const& MAX_FUNCTIONCOMMANDLIMIT();
157
158 MCAPI static ::std::string const& WORLD_POLICY_TAG_NAME();
159 // NOLINTEND
160
161public:
162 // constructor thunks
163 // NOLINTBEGIN
164 MCAPI void* $ctor();
165
166 MCAPI void* $ctor(::GameRules const& rhs);
167 // NOLINTEND
168
169public:
170 // destructor thunk
171 // NOLINTBEGIN
172 MCAPI void $dtor();
173 // NOLINTEND
174
175public:
176 // vftables
177 // NOLINTBEGIN
178 MCAPI static void** $vftable();
179 // NOLINTEND
180};
Definition BaseGameVersion.h:13
Definition EnableNonOwnerReferences.h:7
Definition CompoundTag.h:13
Definition GameRule.h:34
Definition GameRule.h:10
Definition GameRulesChangedPacketData.h:10
Definition GameRulesChangedPacket.h:17
Definition GameRules.h:22
Definition HashedString.h:5
Definition GameRuleId.h:8
Definition GameRule.h:25