LeviLamina
Loading...
Searching...
No Matches
PredictedMovementComponent.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/entity/components/MovePredictionType.h"
7#include "mc/entity/components/PredictedMovementValues.h"
8#include "mc/platform/brstd/bitset.h"
9
10// auto generated forward declare list
11// clang-format off
12class AddActorPacket;
16class Vec2;
17class Vec3;
19// clang-format on
20
22public:
23 // PredictedMovementComponent inner types declare
24 // clang-format off
26 struct HistoryItem;
28 struct PredictionDbgData;
30 class HistoryCache;
31 struct MotionHistoryItem;
32 struct MoveHistoryItem;
33 // clang-format on
34
35 // PredictedMovementComponent inner types define
36 struct HistoryTimestampData {
37 public:
38 // member variables
39 // NOLINTBEGIN
43 // NOLINTEND
44
45 public:
46 // prevent constructor by default
47 HistoryTimestampData& operator=(HistoryTimestampData const&);
48 HistoryTimestampData(HistoryTimestampData const&);
49 HistoryTimestampData();
50
51 public:
52 // static variables
53 // NOLINTBEGIN
54 MCAPI static uint& mSequenceIdGenerator();
55 // NOLINTEND
56 };
57
58 struct HistoryItem {
59 public:
60 // HistoryItem inner types define
61 enum class ItemType : int {
62 Motion = 0,
63 Move = 1,
64 Max = 2,
65 };
66
67 public:
68 // member variables
69 // NOLINTBEGIN
73 // NOLINTEND
74
75 public:
76 // prevent constructor by default
77 HistoryItem& operator=(HistoryItem const&);
78 HistoryItem(HistoryItem const&);
79 HistoryItem();
80
81 public:
82 // virtual functions
83 // NOLINTBEGIN
84#ifdef LL_PLAT_S
85 virtual ~HistoryItem() = default;
86#else // LL_PLAT_C
87 virtual ~HistoryItem();
88#endif
89
90 virtual bool isValidStartItem() const = 0;
91
92 virtual bool isAddedActorItem() const = 0;
93
94 virtual bool isMotionHintItem() const = 0;
95
96 virtual ::std::string toString() const;
97
98 virtual ::Vec3 const& getPos() const = 0;
99
100 virtual ::Vec2 const& getRot() const = 0;
101
102 virtual float getYHeadRot() const = 0;
103
104 virtual bool isOnGround() const = 0;
105 // NOLINTEND
106
107 public:
108 // destructor thunk
109 // NOLINTBEGIN
110 MCAPI void $dtor();
111 // NOLINTEND
112
113 public:
114 // virtual function thunks
115 // NOLINTBEGIN
116 MCAPI ::std::string $toString() const;
117
118
119 // NOLINTEND
120
121 public:
122 // vftables
123 // NOLINTBEGIN
124 MCNAPI static void** $vftable();
125 // NOLINTEND
126 };
127
128 struct PredictionDbgWindowData {
129 public:
130 // member variables
131 // NOLINTBEGIN
143 // NOLINTEND
144
145 public:
146 // prevent constructor by default
147 PredictionDbgWindowData& operator=(PredictionDbgWindowData const&);
148 PredictionDbgWindowData(PredictionDbgWindowData const&);
149 PredictionDbgWindowData();
150 };
151
152 struct PredictionDbgData {
153 public:
154 // member variables
155 // NOLINTBEGIN
162 // NOLINTEND
163
164 public:
165 // prevent constructor by default
166 PredictionDbgData& operator=(PredictionDbgData const&);
167 PredictionDbgData(PredictionDbgData const&);
168 PredictionDbgData();
169
170 public:
171 // member functions
172 // NOLINTBEGIN
173 MCAPI ::std::string toString() const;
174
175 MCAPI ~PredictionDbgData();
176 // NOLINTEND
177
178 public:
179 // destructor thunk
180 // NOLINTBEGIN
181 MCFOLD void $dtor();
182 // NOLINTEND
183 };
184
185 struct RuntimePredictionData {
186 public:
187 // RuntimePredictionData inner types declare
188 // clang-format off
189 struct LerpedInterval;
190 // clang-format on
191
192 // RuntimePredictionData inner types define
193 struct LerpedInterval {
194 public:
195 // member variables
196 // NOLINTBEGIN
201 // NOLINTEND
202
203 public:
204 // prevent constructor by default
205 LerpedInterval& operator=(LerpedInterval const&);
206 LerpedInterval(LerpedInterval const&);
207 LerpedInterval();
208 };
209
210 public:
211 // member variables
212 // NOLINTBEGIN
224 // NOLINTEND
225
226 public:
227 // prevent constructor by default
228 RuntimePredictionData& operator=(RuntimePredictionData const&);
229 RuntimePredictionData(RuntimePredictionData const&);
230 RuntimePredictionData();
231
232 public:
233 // virtual functions
234 // NOLINTBEGIN
235 virtual ~RuntimePredictionData() = default;
236 // NOLINTEND
237
238 public:
239 // member functions
240 // NOLINTBEGIN
241 MCAPI void reset();
242
243#ifdef LL_PLAT_C
244 MCAPI void updateRuntimeData(
245 ::std::shared_ptr<::PredictedMovementComponent::HistoryItem const> const& newItem,
246 ::std::shared_ptr<::PredictedMovementComponent::HistoryItem const> const& prevNewItem,
247 uint64 currentHistoryItemSize
248 );
249#endif
250 // NOLINTEND
251
252 public:
253 // vftables
254 // NOLINTBEGIN
255 MCNAPI static void** $vftable();
256 // NOLINTEND
257 };
258
259 class HistoryCache {
260 public:
261 // member variables
262 // NOLINTBEGIN
267 // NOLINTEND
268
269 public:
270 // prevent constructor by default
271 HistoryCache& operator=(HistoryCache const&);
272 HistoryCache(HistoryCache const&);
273 HistoryCache();
274
275 public:
276 // member functions
277 // NOLINTBEGIN
278 MCAPI void _addHistoryItem(::std::shared_ptr<::PredictedMovementComponent::HistoryItem const> const& item);
279
280 MCAPI void _clearHistory();
281
282#ifdef LL_PLAT_C
283 MCAPI void
284 addHistory(::AddActorPacket const& actorData, ::std::chrono::steady_clock::time_point const& receiveTimepoint);
285
286 MCAPI void addHistory(
287 ::SetActorMotionPacket const& motionData,
288 ::std::chrono::steady_clock::time_point const& receiveTimepoint
289 );
290
291 MCAPI void addHistory(
292 ::MotionPredictionHintsPacket const& motionPredictionHints,
293 ::std::chrono::steady_clock::time_point const& receiveTimepoint
294 );
295#endif
296
297 MCAPI void addHistory(
298 ::MoveActorAbsoluteData const& moveData,
299 ::std::chrono::steady_clock::time_point const& receiveTimepoint
300 );
301
302 MCAPI ::std::string toString();
303 // NOLINTEND
304 };
305
306 struct MotionHistoryItem : public ::PredictedMovementComponent::HistoryItem {
307 public:
308 // member variables
309 // NOLINTBEGIN
319 // NOLINTEND
320
321 public:
322 // prevent constructor by default
323 MotionHistoryItem& operator=(MotionHistoryItem const&);
324 MotionHistoryItem(MotionHistoryItem const&);
325 MotionHistoryItem();
326
327 public:
328 // virtual functions
329 // NOLINTBEGIN
330 virtual bool isValidStartItem() const /*override*/;
331
332 virtual bool isAddedActorItem() const /*override*/;
333
334 virtual bool isMotionHintItem() const /*override*/;
335
336 virtual ::Vec3 const& getPos() const /*override*/;
337
338 virtual ::Vec2 const& getRot() const /*override*/;
339
340 virtual float getYHeadRot() const /*override*/;
341
342 virtual bool isOnGround() const /*override*/;
343
344 virtual ~MotionHistoryItem() /*override*/ = default;
345 // NOLINTEND
346
347 public:
348 // member functions
349 // NOLINTBEGIN
350#ifdef LL_PLAT_C
351 MCAPI MotionHistoryItem(
352 ::Vec3 const& motion,
353 bool onGround,
354 bool isMotionHintItem,
355 ::std::chrono::steady_clock::time_point const& timepoint,
356 ::std::shared_ptr<::PredictedMovementComponent::MoveHistoryItem const> const& prevMoveItem,
357 ::std::shared_ptr<::PredictedMovementComponent::MotionHistoryItem const> const& prevMotionItem,
358 bool didAdjustTimepoint,
359 ::std::chrono::milliseconds const& timepointDiff
360 );
361#endif
362 // NOLINTEND
363
364 public:
365 // constructor thunks
366 // NOLINTBEGIN
367#ifdef LL_PLAT_C
368 MCAPI void* $ctor(
369 ::Vec3 const& motion,
370 bool onGround,
371 bool isMotionHintItem,
372 ::std::chrono::steady_clock::time_point const& timepoint,
373 ::std::shared_ptr<::PredictedMovementComponent::MoveHistoryItem const> const& prevMoveItem,
374 ::std::shared_ptr<::PredictedMovementComponent::MotionHistoryItem const> const& prevMotionItem,
375 bool didAdjustTimepoint,
376 ::std::chrono::milliseconds const& timepointDiff
377 );
378#endif
379 // NOLINTEND
380
381 public:
382 // virtual function thunks
383 // NOLINTBEGIN
384#ifdef LL_PLAT_C
385 MCAPI bool $isValidStartItem() const;
386
387 MCAPI bool $isAddedActorItem() const;
388
389 MCAPI bool $isMotionHintItem() const;
390
391 MCFOLD ::Vec3 const& $getPos() const;
392
393 MCFOLD ::Vec2 const& $getRot() const;
394
395 MCAPI float $getYHeadRot() const;
396
397 MCFOLD bool $isOnGround() const;
398#endif
399
400
401 // NOLINTEND
402
403 public:
404 // vftables
405 // NOLINTBEGIN
406 MCNAPI static void** $vftable();
407 // NOLINTEND
408 };
409
410 struct MoveHistoryItem : public ::PredictedMovementComponent::HistoryItem {
411 public:
412 // member variables
413 // NOLINTBEGIN
419 // NOLINTEND
420
421 public:
422 // prevent constructor by default
423 MoveHistoryItem& operator=(MoveHistoryItem const&);
424 MoveHistoryItem(MoveHistoryItem const&);
425 MoveHistoryItem();
426
427 public:
428 // virtual functions
429 // NOLINTBEGIN
430 virtual bool isValidStartItem() const /*override*/;
431
432 virtual bool isAddedActorItem() const /*override*/;
433
434 virtual bool isMotionHintItem() const /*override*/;
435
436 virtual ::Vec3 const& getPos() const /*override*/;
437
438 virtual ::Vec2 const& getRot() const /*override*/;
439
440 virtual float getYHeadRot() const /*override*/;
441
442 virtual bool isOnGround() const /*override*/;
443
444 virtual ~MoveHistoryItem() /*override*/ = default;
445 // NOLINTEND
446
447 public:
448 // virtual function thunks
449 // NOLINTBEGIN
450 MCFOLD bool $isValidStartItem() const;
451
452 MCFOLD bool $isAddedActorItem() const;
453
454 MCFOLD bool $isMotionHintItem() const;
455
456 MCFOLD ::Vec3 const& $getPos() const;
457
458 MCAPI ::Vec2 const& $getRot() const;
459
460 MCAPI float $getYHeadRot() const;
461
462 MCFOLD bool $isOnGround() const;
463
464
465 // NOLINTEND
466
467 public:
468 // vftables
469 // NOLINTBEGIN
470 MCNAPI static void** $vftable();
471 // NOLINTEND
472 };
473
474 using PredictionEventsListenerFunction = ::std::function<void(::MovePredictionType)>;
475
476public:
477 // member variables
478 // NOLINTBEGIN
479 ::ll::TypedStorage<1, 1, ::brstd::bitset<2, uchar>> mDisableConditions;
480 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PredictedMovementComponent::RuntimePredictionData>>
481 mRuntimePredictionData;
482 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::PredictedMovementComponent::HistoryItem const>> mLastStartItem;
483 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::PredictedMovementComponent::HistoryItem const>> mLastEndItem;
484 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PredictedMovementComponent::HistoryCache>> mHistoryCache;
485 ::ll::TypedStorage<1, 1, bool> mForceTeleportAfterResuming;
486 ::ll::TypedStorage<1, 1, bool> mAllowTeleportingWithoutRegion;
487 ::ll::TypedStorage<4, 4, uint> mLastCompletedInterpolationSequenceID;
488 ::ll::TypedStorage<8, 64, ::std::function<void(::MovePredictionType)>> mPredictionEventsListenerFunc;
489 ::ll::TypedStorage<8, 16, ::PredictedMovementValues> mPredictedMovementValues;
490 // NOLINTEND
491
492public:
493 // member functions
494 // NOLINTBEGIN
495 MCAPI void _debugLog(
498 ) const;
499
500 MCAPI bool _tryInterpolate(
502 ::std::chrono::steady_clock::time_point const& renderTimepoint
503 );
504
505 MCAPI void reset();
506
507 MCAPI void
508 tickNextPosition(::PredictedMovementSystemParams& params, ::std::chrono::steady_clock::time_point const& timepoint);
509 // NOLINTEND
510
511public:
512 // static variables
513 // NOLINTBEGIN
514 MCAPI static ::std::unique_ptr<::PredictedMovementComponent::RuntimePredictionData>& mGlobalRuntimePredictionData();
515 // NOLINTEND
516};
Definition AddActorPacket.h:29
Definition MotionPredictionHintsPacket.h:19
Definition MoveActorAbsoluteData.h:15
Definition PredictedMovementComponent.h:259
Definition PredictedMovementComponent.h:21
Definition SetActorMotionPacket.h:19
Definition Vec2.h:5
Definition Vec3.h:10
Definition PredictedMovementComponent.h:58
Definition PredictedMovementComponent.h:36
Definition PredictedMovementComponent.h:306
Definition PredictedMovementComponent.h:410
Definition PredictedMovementComponent.h:152
Definition PredictedMovementComponent.h:128
Definition PredictedMovementComponent.h:185
Definition PredictedMovementSystemParams.h:5
Definition Alias.h:14