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
37 ::ll::TypedStorage<1, 1, bool> mHasBuildDirection;
38 ::ll::TypedStorage<1, 1, bool> mHasLastBuiltPosition;
39 ::ll::TypedStorage<1, 1, bool> mLastBuildBlockWasInteractive;
40 ::ll::TypedStorage<1, 1, bool> mLastBuildBlockWasSnappable;
41 ::ll::TypedStorage<4, 12, ::BlockPos> mLastBuiltBlockPosition;
42 ::ll::TypedStorage<4, 12, ::BlockPos> mBuildDirection;
43 ::ll::TypedStorage<4, 12, ::BlockPos> mNextBuildPos;
44 ::ll::TypedStorage<4, 12, ::Vec3> mInitialClickPos;
45 ::ll::TypedStorage<1, 1, uchar> mContinueFacing;
46 // NOLINTEND
47 };
48
49 struct BuildDelay {
50 public:
51 // member variables
52 // NOLINTBEGIN
53 ::ll::TypedStorage<1, 1, bool> mHasDelayElapsed;
54 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mNewLastBuildTimeIfBlockIsBuilt;
55 // NOLINTEND
56 };
57
59 public:
60 // member variables
61 // NOLINTBEGIN
62 ::ll::TypedStorage<4, 12, ::BlockPos const> mHit;
63 ::ll::TypedStorage<1, 1, uchar const> mFacing;
64 // NOLINTEND
65 };
66
68 public:
69 // member variables
70 // NOLINTBEGIN
71 ::ll::TypedStorage<4, 12, ::Vec3> mPosDelta;
72 ::ll::TypedStorage<1, 1, bool> mIsSneaking;
73 // NOLINTEND
74 };
75
76public:
77 // member variables
78 // NOLINTBEGIN
79 ::ll::TypedStorage<8, 8, ::Player&> mPlayer;
80 ::ll::TypedStorage<4, 12, ::BlockPos> mDestroyBlockPos;
81 ::ll::TypedStorage<1, 1, uchar> mDestroyBlockFace;
82 ::ll::TypedStorage<4, 4, float> mOldDestroyProgress;
83 ::ll::TypedStorage<4, 4, float> mDestroyProgress;
84 ::ll::TypedStorage<8, 8, double> mLastDestroyTime;
85 ::ll::TypedStorage<4, 4, float> mDistanceTravelled;
86 ::ll::TypedStorage<4, 12, ::Vec3> mPlayerLastPosition;
87 ::ll::TypedStorage<4, 56, ::GameMode::BuildContext> mBuildContext;
88 ::ll::TypedStorage<4, 4, float> mMinPlayerSpeed;
89 ::ll::TypedStorage<4, 4, int> mContinueBreakBlockCount;
90 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastBuildTime;
91 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mNoDestroyUntil;
92 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mNoDestroySoundUntil;
93 ::ll::TypedStorage<8, 8, ::std::chrono::milliseconds> creativeDestructionTickDelay;
94 ::ll::TypedStorage<8, 8, ::std::chrono::milliseconds> buildingTickDelay;
95 ::ll::TypedStorage<8, 8, ::std::chrono::milliseconds> destroySoundDelay;
96 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IGameModeTimer>> mTimer;
97 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IGameModeMessenger>> mMessenger;
98 // NOLINTEND
99
100public:
101 // prevent constructor by default
102 GameMode& operator=(GameMode const&);
103 GameMode(GameMode const&);
104 GameMode();
105
106public:
107 // virtual functions
108 // NOLINTBEGIN
109 // vIndex: 0
110 virtual ~GameMode() = default;
111
112 // vIndex: 1
113 virtual bool startDestroyBlock(::BlockPos const& pos, uchar face, bool& hasDestroyedBlock);
114
115 // vIndex: 2
116 virtual bool destroyBlock(::BlockPos const& pos, uchar face);
117
118 // vIndex: 3
119 virtual bool
120 continueDestroyBlock(::BlockPos const& pos, uchar face, ::Vec3 const& playerPos, bool& hasDestroyedBlock);
121
122 // vIndex: 4
123 virtual void stopDestroyBlock(::BlockPos const& pos);
124
125 // vIndex: 5
126 virtual void startBuildBlock(::BlockPos const& pos, uchar face);
127
128 // vIndex: 6
129 virtual bool buildBlock(::BlockPos const& pos, uchar face, bool const isSimTick);
130
131 // vIndex: 7
132 virtual void continueBuildBlock(::BlockPos const& pos, uchar face);
133
134 // vIndex: 8
135 virtual void stopBuildBlock();
136
137 // vIndex: 9
138 virtual void tick();
139
140 // vIndex: 10
141 virtual float getPickRange(::InputMode const& currentInputMode);
142
143 // vIndex: 11
144 virtual bool useItem(::ItemStack& item);
145
146 // vIndex: 12
147 virtual bool useItemAsAttack(::ItemStack& item);
148
149 // vIndex: 13
150 virtual ::InteractionResult useItemOn(
151 ::ItemStack& item,
152 ::BlockPos const& at,
153 uchar face,
154 ::Vec3 const& hit,
155 ::Block const* targetBlock,
156 bool isFirstEvent
157 );
158
159 // vIndex: 14
160 virtual bool interact(::Actor& entity, ::Vec3 const& location);
161
162 // vIndex: 15
163 virtual bool attack(::Actor& entity);
164
165 // vIndex: 16
166 virtual void releaseUsingItem();
167
168 // vIndex: 17
169 virtual void setTrialMode(bool);
170
171 // vIndex: 18
172 virtual bool isInTrialMode();
173
174 // vIndex: 19
175 virtual void registerUpsellScreenCallback(::std::function<void(bool)>);
176 // NOLINTEND
177
178public:
179 // member functions
180 // NOLINTBEGIN
181 MCAPI GameMode(
182 ::Player& player,
183 ::std::unique_ptr<::IGameModeTimer> timer,
184 ::std::unique_ptr<::IGameModeMessenger> messenger
185 );
186
187 MCAPI bool _attack(::Actor& entity, bool playPredictiveSound);
188
189 MCAPI ::BlockPos _calculatePlacePos(::ItemStack& heldStack, ::BlockPos const& pos, uchar& face) const;
190
191 MCAPI bool _canDestroy(::BlockPos const& pos, uchar);
192
193 MCAPI bool _canUseBlock(::Block const& block);
194
195 MCAPI bool _creativeDestroyBlock(::BlockPos const& pos, uchar face);
196
197 MCAPI bool _enableBlockBreakDelay() const;
198
199 MCAPI void _sendPlayerInteractWithBlockAfterEvent(
200 ::ItemStack const& beforeItem,
201 ::ItemStack const& afterItem,
202 ::Player& player,
203 ::BlockPos const& at,
204 uchar face,
205 ::Vec3 const& hit,
206 bool isFirstEvent
207 );
208
209 MCAPI void _sendPlayerInteractWithEntityAfterEvent(
210 ::ItemStack const& beforeItem,
211 ::ItemStack const& afterItem,
212 ::Player& player,
213 ::Actor const& entity
214 );
215
216 MCAPI ::std::optional<::ItemStack>
217 _sendTryDestroyBlockEvent(::Block const& block, ::BlockPos const& pos, ::ItemStack itemBeforeEvent) const;
218
219 MCAPI ::InteractionResult _sendUseItemOnEvents(
220 ::ItemStack& item,
221 ::BlockPos const& at,
222 uchar face,
223 ::Vec3 const& hit,
224 bool isFirstEvent
225 ) const;
226
227 MCAPI bool baseUseItem(::ItemStack& item);
228
229 MCAPI bool baseUseItemAsAttack(::ItemStack& item);
230
231 MCAPI void continueBuildBlockAction(::Player const& player, ::HitResult const& hr);
232
233 MCAPI float getDestroyRate(::Block const& block);
234
235 MCAPI float getMaxPickRange();
236 // NOLINTEND
237
238public:
239 // constructor thunks
240 // NOLINTBEGIN
241 MCAPI void* $ctor(
242 ::Player& player,
243 ::std::unique_ptr<::IGameModeTimer> timer,
244 ::std::unique_ptr<::IGameModeMessenger> messenger
245 );
246 // NOLINTEND
247
248public:
249 // virtual function thunks
250 // NOLINTBEGIN
251 MCAPI bool $startDestroyBlock(::BlockPos const& pos, uchar face, bool& hasDestroyedBlock);
252
253 MCAPI bool $destroyBlock(::BlockPos const& pos, uchar face);
254
255 MCAPI bool
256 $continueDestroyBlock(::BlockPos const& pos, uchar face, ::Vec3 const& playerPos, bool& hasDestroyedBlock);
257
258 MCAPI void $stopDestroyBlock(::BlockPos const& pos);
259
260 MCAPI void $startBuildBlock(::BlockPos const& pos, uchar face);
261
262 MCAPI bool $buildBlock(::BlockPos const& pos, uchar face, bool const isSimTick);
263
264 MCAPI void $continueBuildBlock(::BlockPos const& pos, uchar face);
265
266 MCAPI void $stopBuildBlock();
267
268 MCAPI void $tick();
269
270 MCAPI float $getPickRange(::InputMode const& currentInputMode);
271
272 MCAPI bool $useItem(::ItemStack& item);
273
274 MCAPI bool $useItemAsAttack(::ItemStack& item);
275
276 MCAPI ::InteractionResult $useItemOn(
277 ::ItemStack& item,
278 ::BlockPos const& at,
279 uchar face,
280 ::Vec3 const& hit,
281 ::Block const* targetBlock,
282 bool isFirstEvent
283 );
284
285 MCAPI bool $interact(::Actor& entity, ::Vec3 const& location);
286
287 MCAPI bool $attack(::Actor& entity);
288
289 MCAPI void $releaseUsingItem();
290
291 MCFOLD void $setTrialMode(bool);
292
293 MCFOLD bool $isInTrialMode();
294
295 MCFOLD void $registerUpsellScreenCallback(::std::function<void(bool)>);
296 // NOLINTEND
297
298public:
299 // vftables
300 // NOLINTBEGIN
301 MCNAPI static void** $vftable();
302 // NOLINTEND
303};
Definition Actor.h:102
Definition BlockPos.h:17
Definition Block.h:37
Definition GameMode.h:22
static MCAPI void ** $vftable()
Definition HitResult.h:17
Definition InteractionResult.h:5
Definition ItemStack.h:23
Definition Player.h:123
Definition Vec3.h:10
Definition GameMode.h:33
Definition GameMode.h:49
Definition GameMode.h:67
Definition GameMode.h:58
Definition IGameModeMessenger.h:12
Definition IGameModeTimer.h:5