LeviLamina
Loading...
Searching...
No Matches
GameMode.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/math/Vec3.h"
7#include "mc/deps/input/InputMode.h"
8#include "mc/world/level/BlockPos.h"
9
10// auto generated forward declare list
11// clang-format off
12class Actor;
13class Block;
14class HitResult;
16class ItemStack;
17class Player;
19struct IGameModeTimer;
20// clang-format on
21
22class GameMode {
23public:
24 // GameMode inner types declare
25 // clang-format off
26 struct BuildContext;
27 struct BuildDelay;
28 struct BuildPlayerContext;
29 struct ContinueBuildData;
30 // clang-format on
31
32 // GameMode inner types define
33 struct BuildContext {
34 public:
35 // member variables
36 // NOLINTBEGIN
46 // NOLINTEND
47
48 public:
49 // prevent constructor by default
50 BuildContext& operator=(BuildContext const&);
53 };
54
55 struct BuildDelay {
56 public:
57 // member variables
58 // NOLINTBEGIN
61 // NOLINTEND
62
63 public:
64 // prevent constructor by default
65 BuildDelay& operator=(BuildDelay const&);
66 BuildDelay(BuildDelay const&);
67 BuildDelay();
68 };
69
71 public:
72 // member variables
73 // NOLINTBEGIN
76 // NOLINTEND
77
78 public:
79 // prevent constructor by default
80 ContinueBuildData& operator=(ContinueBuildData const&);
83 };
84
86 public:
87 // member variables
88 // NOLINTBEGIN
91 // NOLINTEND
92
93 public:
94 // prevent constructor by default
95 BuildPlayerContext& operator=(BuildPlayerContext const&);
98 };
99
100public:
101 // member variables
102 // NOLINTBEGIN
103 ::ll::TypedStorage<8, 8, ::Player&> mPlayer;
104 ::ll::TypedStorage<4, 12, ::BlockPos> mDestroyBlockPos;
105 ::ll::TypedStorage<1, 1, uchar> mDestroyBlockFace;
106 ::ll::TypedStorage<4, 4, float> mOldDestroyProgress;
107 ::ll::TypedStorage<4, 4, float> mDestroyProgress;
108 ::ll::TypedStorage<8, 8, double> mLastDestroyTime;
109 ::ll::TypedStorage<4, 4, float> mDistanceTravelled;
110 ::ll::TypedStorage<4, 12, ::Vec3> mPlayerLastPosition;
111 ::ll::TypedStorage<4, 56, ::GameMode::BuildContext> mBuildContext;
112 ::ll::TypedStorage<4, 4, float> mMinPlayerSpeed;
113 ::ll::TypedStorage<4, 4, int> mContinueBreakBlockCount;
114 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastBuildTime;
115 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mNoDestroyUntil;
116 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mNoDestroySoundUntil;
117 ::ll::TypedStorage<8, 8, ::std::chrono::milliseconds> creativeDestructionTickDelay;
118 ::ll::TypedStorage<8, 8, ::std::chrono::milliseconds> buildingTickDelay;
119 ::ll::TypedStorage<8, 8, ::std::chrono::milliseconds> destroySoundDelay;
120 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IGameModeTimer>> mTimer;
121 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IGameModeMessenger>> mMessenger;
122 // NOLINTEND
123
124public:
125 // prevent constructor by default
126 GameMode& operator=(GameMode const&);
127 GameMode(GameMode const&);
128 GameMode();
129
130public:
131 // virtual functions
132 // NOLINTBEGIN
133 // vIndex: 0
134 virtual ~GameMode() = default;
135
136 // vIndex: 1
137 virtual bool startDestroyBlock(::BlockPos const& pos, uchar face, bool& hasDestroyedBlock);
138
139 // vIndex: 2
140 virtual bool destroyBlock(::BlockPos const& pos, uchar face);
141
142 // vIndex: 3
143 virtual bool
144 continueDestroyBlock(::BlockPos const& pos, uchar face, ::Vec3 const& playerPos, bool& hasDestroyedBlock);
145
146 // vIndex: 4
147 virtual void stopDestroyBlock(::BlockPos const& pos);
148
149 // vIndex: 5
150 virtual void startBuildBlock(::BlockPos const& pos, uchar face);
151
152 // vIndex: 6
153 virtual bool buildBlock(::BlockPos const& pos, uchar face, bool const isSimTick);
154
155 // vIndex: 7
156 virtual void continueBuildBlock(::BlockPos const& pos, uchar face);
157
158 // vIndex: 8
159 virtual void stopBuildBlock();
160
161 // vIndex: 9
162 virtual void tick();
163
164 // vIndex: 10
165 virtual float getPickRange(::InputMode const& currentInputMode, bool isVR);
166
167 // vIndex: 11
168 virtual bool useItem(::ItemStack& item);
169
170 // vIndex: 12
171 virtual ::InteractionResult useItemOn(
172 ::ItemStack& item,
173 ::BlockPos const& at,
174 uchar face,
175 ::Vec3 const& hit,
176 ::Block const* targetBlock,
177 bool isFirstEvent
178 );
179
180 // vIndex: 13
181 virtual bool interact(::Actor& entity, ::Vec3 const& location);
182
183 // vIndex: 14
184 virtual bool attack(::Actor& entity);
185
186 // vIndex: 15
187 virtual void releaseUsingItem();
188
189 // vIndex: 16
190 virtual void setTrialMode(bool isEnabled);
191
192 // vIndex: 17
193 virtual bool isInTrialMode();
194
195 // vIndex: 18
196 virtual void registerUpsellScreenCallback(::std::function<void(bool)> callback);
197 // NOLINTEND
198
199public:
200 // member functions
201 // NOLINTBEGIN
202 MCAPI GameMode(
203 ::Player& player,
204 ::std::unique_ptr<::IGameModeTimer> timer,
205 ::std::unique_ptr<::IGameModeMessenger> messenger
206 );
207
208 MCAPI bool _attack(::Actor& entity, bool playPredictiveSound);
209
210 MCAPI ::BlockPos _calculatePlacePos(::ItemStack& heldStack, ::BlockPos const& pos, uchar& face) const;
211
212 MCAPI bool _canDestroy(::BlockPos const& pos, uchar face);
213
214 MCAPI bool _canUseBlock(::Block const& block);
215
216 MCAPI bool _creativeDestroyBlock(::BlockPos const& pos, uchar face);
217
218 MCAPI void _destroyBlockInternal(::BlockPos const& pos, ::Block const& oldBlock, ::Block const& newBlock) const;
219
220 MCAPI bool _enableBlockBreakDelay() const;
221
222 MCAPI void _sendPlayerInteractWithBlockAfterEvent(
223 ::ItemStack const& beforeItem,
224 ::ItemStack const& afterItem,
225 ::Player& player,
226 ::BlockPos const& at,
227 uchar face,
228 ::Vec3 const& hit,
229 bool isFirstEvent
230 );
231
232 MCAPI void _sendPlayerInteractWithEntityAfterEvent(
233 ::ItemStack const& beforeItem,
234 ::ItemStack const& afterItem,
235 ::Player& player,
236 ::Actor const& entity
237 );
238
239 MCAPI ::std::optional<::ItemStack>
240 _sendTryDestroyBlockEvent(::Block const& block, ::BlockPos const& pos, ::ItemStack itemBeforeEvent) const;
241
242 MCAPI ::InteractionResult _sendUseItemOnEvents(
243 ::ItemStack& item,
244 ::BlockPos const& at,
245 uchar face,
246 ::Vec3 const& hit,
247 bool isFirstEvent
248 ) const;
249
250 MCAPI bool baseUseItem(::ItemStack& item);
251
252 MCAPI void continueBuildBlockAction(::Player const& player, ::HitResult const& hr);
253
254 MCAPI float getDestroyRate(::Block const& block);
255
256 MCAPI float getMaxPickRange();
257 // NOLINTEND
258
259public:
260 // static variables
261 // NOLINTBEGIN
262 MCAPI static float const& MIN_MOVING_NON_CREATIVE_BUILD_DELAY();
263 // NOLINTEND
264
265public:
266 // constructor thunks
267 // NOLINTBEGIN
268 MCAPI void* $ctor(
269 ::Player& player,
270 ::std::unique_ptr<::IGameModeTimer> timer,
271 ::std::unique_ptr<::IGameModeMessenger> messenger
272 );
273 // NOLINTEND
274
275public:
276 // virtual function thunks
277 // NOLINTBEGIN
278 MCAPI bool $startDestroyBlock(::BlockPos const& pos, uchar face, bool& hasDestroyedBlock);
279
280 MCAPI bool $destroyBlock(::BlockPos const& pos, uchar face);
281
282 MCAPI bool
283 $continueDestroyBlock(::BlockPos const& pos, uchar face, ::Vec3 const& playerPos, bool& hasDestroyedBlock);
284
285 MCAPI void $stopDestroyBlock(::BlockPos const& pos);
286
287 MCAPI void $startBuildBlock(::BlockPos const& pos, uchar face);
288
289 MCAPI bool $buildBlock(::BlockPos const& pos, uchar face, bool const isSimTick);
290
291 MCAPI void $continueBuildBlock(::BlockPos const& pos, uchar face);
292
293 MCAPI void $stopBuildBlock();
294
295 MCAPI void $tick();
296
297 MCAPI float $getPickRange(::InputMode const& currentInputMode, bool isVR);
298
299 MCAPI bool $useItem(::ItemStack& item);
300
301 MCAPI ::InteractionResult $useItemOn(
302 ::ItemStack& item,
303 ::BlockPos const& at,
304 uchar face,
305 ::Vec3 const& hit,
306 ::Block const* targetBlock,
307 bool isFirstEvent
308 );
309
310 MCAPI bool $interact(::Actor& entity, ::Vec3 const& location);
311
312 MCAPI bool $attack(::Actor& entity);
313
314 MCAPI void $releaseUsingItem();
315
316 MCFOLD void $setTrialMode(bool isEnabled);
317
318 MCFOLD bool $isInTrialMode();
319
320 MCFOLD void $registerUpsellScreenCallback(::std::function<void(bool)> callback);
321 // NOLINTEND
322
323public:
324 // vftables
325 // NOLINTBEGIN
326 MCNAPI static void** $vftable();
327 // NOLINTEND
328};
Definition Actor.h:103
Definition BlockPos.h:18
Definition Block.h:38
Definition GameMode.h:22
static MCAPI void ** $vftable()
Definition HitResult.h:19
Definition InteractionResult.h:5
Definition ItemStack.h:25
Definition Player.h:119
Definition Vec3.h:10
Definition GameMode.h:33
Definition GameMode.h:55
Definition GameMode.h:85
Definition GameMode.h:70
Definition IGameModeMessenger.h:12
Definition IGameModeTimer.h:5
Definition Alias.h:14