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