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
21class PredictedMovementComponent {
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 virtual ~HistoryItem() = default;
85
86 virtual bool isValidStartItem() const = 0;
87
88 virtual bool isAddedActorItem() const = 0;
89
90 virtual bool isMotionHintItem() const = 0;
91
92 virtual ::std::string toString() const;
93
94 virtual ::Vec3 const& getPos() const = 0;
95
96 virtual ::Vec2 const& getRot() const = 0;
97
98 virtual float getYHeadRot() const = 0;
99
100 virtual bool isOnGround() const = 0;
101 // NOLINTEND
102
103 public:
104 // virtual function thunks
105 // NOLINTBEGIN
106 MCAPI ::std::string $toString() const;
107
108
109 // NOLINTEND
110
111 public:
112 // vftables
113 // NOLINTBEGIN
114 MCNAPI static void** $vftable();
115 // NOLINTEND
116 };
117
118 struct PredictionDbgWindowData {
119 public:
120 // member variables
121 // NOLINTBEGIN
133 // NOLINTEND
134
135 public:
136 // prevent constructor by default
137 PredictionDbgWindowData& operator=(PredictionDbgWindowData const&);
138 PredictionDbgWindowData(PredictionDbgWindowData const&);
139 PredictionDbgWindowData();
140 };
141
142 struct PredictionDbgData {
143 public:
144 // member variables
145 // NOLINTBEGIN
152 // NOLINTEND
153
154 public:
155 // prevent constructor by default
156 PredictionDbgData& operator=(PredictionDbgData const&);
157 PredictionDbgData(PredictionDbgData const&);
158 PredictionDbgData();
159
160 public:
161 // member functions
162 // NOLINTBEGIN
163 MCAPI ::std::string toString() const;
164
165 MCAPI ~PredictionDbgData();
166 // NOLINTEND
167
168 public:
169 // destructor thunk
170 // NOLINTBEGIN
171 MCFOLD void $dtor();
172 // NOLINTEND
173 };
174
175 struct RuntimePredictionData {
176 public:
177 // RuntimePredictionData inner types declare
178 // clang-format off
179 struct LerpedInterval;
180 // clang-format on
181
182 // RuntimePredictionData inner types define
183 struct LerpedInterval {
184 public:
185 // member variables
186 // NOLINTBEGIN
191 // NOLINTEND
192
193 public:
194 // prevent constructor by default
195 LerpedInterval& operator=(LerpedInterval const&);
196 LerpedInterval(LerpedInterval const&);
197 LerpedInterval();
198 };
199
200 public:
201 // member variables
202 // NOLINTBEGIN
214 // NOLINTEND
215
216 public:
217 // prevent constructor by default
218 RuntimePredictionData& operator=(RuntimePredictionData const&);
219 RuntimePredictionData(RuntimePredictionData const&);
220 RuntimePredictionData();
221
222 public:
223 // virtual functions
224 // NOLINTBEGIN
225 virtual ~RuntimePredictionData() = default;
226 // NOLINTEND
227
228 public:
229 // member functions
230 // NOLINTBEGIN
231 MCAPI void reset();
232
233#ifdef LL_PLAT_C
234 MCAPI void updateRuntimeData(
235 ::std::shared_ptr<::PredictedMovementComponent::HistoryItem const> const& newItem,
236 ::std::shared_ptr<::PredictedMovementComponent::HistoryItem const> const& prevNewItem,
237 uint64 currentHistoryItemSize
238 );
239#endif
240 // NOLINTEND
241
242 public:
243 // vftables
244 // NOLINTBEGIN
245 MCNAPI static void** $vftable();
246 // NOLINTEND
247 };
248
249 class HistoryCache {
250 public:
251 // member variables
252 // NOLINTBEGIN
257 // NOLINTEND
258
259 public:
260 // prevent constructor by default
261 HistoryCache& operator=(HistoryCache const&);
262 HistoryCache(HistoryCache const&);
263 HistoryCache();
264
265 public:
266 // member functions
267 // NOLINTBEGIN
268 MCAPI void _addHistoryItem(::std::shared_ptr<::PredictedMovementComponent::HistoryItem const> const& item);
269
270 MCAPI void _clearHistory();
271
272#ifdef LL_PLAT_C
273 MCAPI void
274 addHistory(::AddActorPacket const& actorData, ::std::chrono::steady_clock::time_point const& receiveTimepoint);
275
276 MCAPI void addHistory(
277 ::SetActorMotionPacket const& motionData,
278 ::std::chrono::steady_clock::time_point const& receiveTimepoint
279 );
280
281 MCAPI void addHistory(
282 ::MotionPredictionHintsPacket const& motionPredictionHints,
283 ::std::chrono::steady_clock::time_point const& receiveTimepoint
284 );
285#endif
286
287 MCAPI void addHistory(
288 ::MoveActorAbsoluteData const& moveData,
289 ::std::chrono::steady_clock::time_point const& receiveTimepoint
290 );
291
292 MCFOLD ::std::deque<::std::shared_ptr<::PredictedMovementComponent::HistoryItem const>> const&
293 getHistory() const;
294
295#ifdef LL_PLAT_C
296 MCFOLD uint64 getHistorySize() const;
297
298 MCAPI ::std::tuple<
299 ::std::shared_ptr<::PredictedMovementComponent::HistoryItem const>,
300 ::std::shared_ptr<::PredictedMovementComponent::HistoryItem const>>
301 getLastTwoHistoryItems() const;
302#endif
303
304 MCAPI void pruneHistory(uint beforeSequenceId);
305
306 MCAPI ::std::string toString();
307 // NOLINTEND
308 };
309
310 struct MotionHistoryItem : public ::PredictedMovementComponent::HistoryItem {
311 public:
312 // member variables
313 // NOLINTBEGIN
323 // NOLINTEND
324
325 public:
326 // prevent constructor by default
327 MotionHistoryItem& operator=(MotionHistoryItem const&);
328 MotionHistoryItem(MotionHistoryItem const&);
329 MotionHistoryItem();
330
331 public:
332 // virtual functions
333 // NOLINTBEGIN
334 virtual bool isValidStartItem() const /*override*/;
335
336 virtual bool isAddedActorItem() const /*override*/;
337
338 virtual bool isMotionHintItem() const /*override*/;
339
340 virtual ::Vec3 const& getPos() const /*override*/;
341
342 virtual ::Vec2 const& getRot() const /*override*/;
343
344 virtual float getYHeadRot() const /*override*/;
345
346 virtual bool isOnGround() const /*override*/;
347 // NOLINTEND
348
349 public:
350 // member functions
351 // NOLINTBEGIN
352#ifdef LL_PLAT_C
353 MCAPI MotionHistoryItem(
354 ::Vec3 const& motion,
355 bool onGround,
356 bool isMotionHintItem,
357 ::std::chrono::steady_clock::time_point const& timepoint,
358 ::std::shared_ptr<::PredictedMovementComponent::MoveHistoryItem const> const& prevMoveItem,
359 ::std::shared_ptr<::PredictedMovementComponent::MotionHistoryItem const> const& prevMotionItem,
360 bool didAdjustTimepoint,
361 ::std::chrono::milliseconds const& timepointDiff
362 );
363#endif
364 // NOLINTEND
365
366 public:
367 // constructor thunks
368 // NOLINTBEGIN
369#ifdef LL_PLAT_C
370 MCAPI void* $ctor(
371 ::Vec3 const& motion,
372 bool onGround,
373 bool isMotionHintItem,
374 ::std::chrono::steady_clock::time_point const& timepoint,
375 ::std::shared_ptr<::PredictedMovementComponent::MoveHistoryItem const> const& prevMoveItem,
376 ::std::shared_ptr<::PredictedMovementComponent::MotionHistoryItem const> const& prevMotionItem,
377 bool didAdjustTimepoint,
378 ::std::chrono::milliseconds const& timepointDiff
379 );
380#endif
381 // NOLINTEND
382
383 public:
384 // virtual function thunks
385 // NOLINTBEGIN
386#ifdef LL_PLAT_C
387 MCFOLD bool $isValidStartItem() const;
388
389 MCAPI bool $isAddedActorItem() const;
390
391 MCFOLD bool $isMotionHintItem() const;
392
393 MCFOLD ::Vec3 const& $getPos() const;
394
395 MCFOLD ::Vec2 const& $getRot() const;
396
397 MCFOLD float $getYHeadRot() const;
398
399 MCFOLD bool $isOnGround() const;
400#endif
401
402
403 // NOLINTEND
404
405 public:
406 // vftables
407 // NOLINTBEGIN
408 MCNAPI static void** $vftable();
409 // NOLINTEND
410 };
411
412 struct MoveHistoryItem : public ::PredictedMovementComponent::HistoryItem {
413 public:
414 // member variables
415 // NOLINTBEGIN
421 // NOLINTEND
422
423 public:
424 // prevent constructor by default
425 MoveHistoryItem& operator=(MoveHistoryItem const&);
426 MoveHistoryItem(MoveHistoryItem const&);
427 MoveHistoryItem();
428
429 public:
430 // virtual functions
431 // NOLINTBEGIN
432 virtual bool isValidStartItem() const /*override*/;
433
434 virtual bool isAddedActorItem() const /*override*/;
435
436 virtual bool isMotionHintItem() const /*override*/;
437
438 virtual ::Vec3 const& getPos() const /*override*/;
439
440 virtual ::Vec2 const& getRot() const /*override*/;
441
442 virtual float getYHeadRot() const /*override*/;
443
444 virtual bool isOnGround() const /*override*/;
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 MCFOLD 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
475
477
479
480 using PredictionEventsListenerFunction = ::std::function<void(::MovePredictionType)>;
481
482public:
483 // member variables
484 // NOLINTBEGIN
485 ::ll::TypedStorage<1, 1, ::brstd::bitset<2, uchar>> mDisableConditions;
486 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PredictedMovementComponent::RuntimePredictionData>>
487 mRuntimePredictionData;
488 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::PredictedMovementComponent::HistoryItem const>> mLastStartItem;
489 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::PredictedMovementComponent::HistoryItem const>> mLastEndItem;
490 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PredictedMovementComponent::HistoryCache>> mHistoryCache;
491 ::ll::TypedStorage<1, 1, bool> mForceTeleportAfterResuming;
492 ::ll::TypedStorage<1, 1, bool> mAllowTeleportingWithoutRegion;
493 ::ll::TypedStorage<4, 4, uint> mLastCompletedInterpolationSequenceID;
494 ::ll::TypedStorage<8, 64, ::std::function<void(::MovePredictionType)>> mPredictionEventsListenerFunc;
495 ::ll::TypedStorage<8, 16, ::PredictedMovementValues> mPredictedMovementValues;
496 // NOLINTEND
497
498public:
499 // member functions
500 // NOLINTBEGIN
501 MCAPI PredictedMovementComponent();
502
503 MCAPI void _debugLog(
506 ) const;
507
508 MCAPI void _debugLog(
510 ::MovePredictionType type,
512 ) const;
513
514 MCAPI bool _tryInterpolate(
516 ::std::chrono::steady_clock::time_point const& renderTimepoint
517 );
518
519 MCAPI void reset();
520
521 MCAPI void
522 tickNextPosition(::PredictedMovementSystemParams& params, ::std::chrono::steady_clock::time_point const& timepoint);
523
524 MCAPI ~PredictedMovementComponent();
525 // NOLINTEND
526
527public:
528 // static functions
529 // NOLINTBEGIN
530 MCAPI static bool isPredictedMovementEnabled(::PredictedMovementComponent const* component);
531 // NOLINTEND
532
533public:
534 // static variables
535 // NOLINTBEGIN
536 MCAPI static ::std::unique_ptr<::PredictedMovementComponent::RuntimePredictionData>& mGlobalRuntimePredictionData();
537 // NOLINTEND
538
539public:
540 // constructor thunks
541 // NOLINTBEGIN
542 MCAPI void* $ctor();
543 // NOLINTEND
544
545public:
546 // destructor thunk
547 // NOLINTBEGIN
548 MCAPI void $dtor();
549 // NOLINTEND
550};
Definition AddActorPacket.h:29
Definition MotionPredictionHintsPacket.h:19
Definition MoveActorAbsoluteData.h:16
Definition PredictedMovementComponent.h:249
Definition SetActorMotionPacket.h:19
Definition Vec2.h:5
Definition Vec3.h:10
Definition PredictedMovementComponent.h:58
Definition PredictedMovementComponent.h:36
Definition PredictedMovementComponent.h:310
Definition PredictedMovementComponent.h:412
Definition PredictedMovementComponent.h:142
Definition PredictedMovementComponent.h:118
Definition PredictedMovementComponent.h:175
Definition PredictedMovementSystemParams.h:5
Definition Alias.h:14