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 MCAPI_C void updateRuntimeData(
244 ::std::shared_ptr<::PredictedMovementComponent::HistoryItem const> const& newItem,
245 ::std::shared_ptr<::PredictedMovementComponent::HistoryItem const> const& prevNewItem,
246 uint64 currentHistoryItemSize
247 );
248 // NOLINTEND
249
250 public:
251 // vftables
252 // NOLINTBEGIN
253 MCNAPI static void** $vftable();
254 // NOLINTEND
255 };
256
257 class HistoryCache {
258 public:
259 // member variables
260 // NOLINTBEGIN
265 // NOLINTEND
266
267 public:
268 // prevent constructor by default
269 HistoryCache& operator=(HistoryCache const&);
270 HistoryCache(HistoryCache const&);
271 HistoryCache();
272
273 public:
274 // member functions
275 // NOLINTBEGIN
276 MCAPI void _addHistoryItem(::std::shared_ptr<::PredictedMovementComponent::HistoryItem const> const& item);
277
278 MCAPI void _clearHistory();
279
280 MCAPI_C void
281 addHistory(::AddActorPacket const& actorData, ::std::chrono::steady_clock::time_point const& receiveTimepoint);
282
283 MCAPI_C void addHistory(
284 ::SetActorMotionPacket const& motionData,
285 ::std::chrono::steady_clock::time_point const& receiveTimepoint
286 );
287
288 MCAPI_C void addHistory(
289 ::MotionPredictionHintsPacket const& motionPredictionHints,
290 ::std::chrono::steady_clock::time_point const& receiveTimepoint
291 );
292
293 MCAPI void addHistory(
294 ::MoveActorAbsoluteData const& moveData,
295 ::std::chrono::steady_clock::time_point const& receiveTimepoint
296 );
297
298 MCAPI ::std::string toString();
299 // NOLINTEND
300 };
301
302 struct MotionHistoryItem : public ::PredictedMovementComponent::HistoryItem {
303 public:
304 // member variables
305 // NOLINTBEGIN
315 // NOLINTEND
316
317 public:
318 // prevent constructor by default
319 MotionHistoryItem& operator=(MotionHistoryItem const&);
320 MotionHistoryItem(MotionHistoryItem const&);
321 MotionHistoryItem();
322
323 public:
324 // virtual functions
325 // NOLINTBEGIN
326 virtual bool isValidStartItem() const /*override*/;
327
328 virtual bool isAddedActorItem() const /*override*/;
329
330 virtual bool isMotionHintItem() const /*override*/;
331
332 virtual ::Vec3 const& getPos() const /*override*/;
333
334 virtual ::Vec2 const& getRot() const /*override*/;
335
336 virtual float getYHeadRot() const /*override*/;
337
338 virtual bool isOnGround() const /*override*/;
339
340 virtual ~MotionHistoryItem() /*override*/ = default;
341 // NOLINTEND
342
343 public:
344 // member functions
345 // NOLINTBEGIN
346
347 // NOLINTEND
348
349 public:
350 // constructor thunks
351 // NOLINTBEGIN
352 MCAPI_C void* $ctor(
353 ::Vec3 const& motion,
354 bool onGround,
355 bool isMotionHintItem,
356 ::std::chrono::steady_clock::time_point const& timepoint,
357 ::std::shared_ptr<::PredictedMovementComponent::MoveHistoryItem const> const& prevMoveItem,
358 ::std::shared_ptr<::PredictedMovementComponent::MotionHistoryItem const> const& prevMotionItem,
359 bool didAdjustTimepoint,
360 ::std::chrono::milliseconds const& timepointDiff
361 );
362 // NOLINTEND
363
364 public:
365 // virtual function thunks
366 // NOLINTBEGIN
367#ifdef LL_PLAT_C
368 MCAPI bool $isValidStartItem() const;
369
370 MCAPI bool $isAddedActorItem() const;
371
372 MCAPI bool $isMotionHintItem() const;
373
374 MCFOLD ::Vec3 const& $getPos() const;
375
376 MCFOLD ::Vec2 const& $getRot() const;
377
378 MCAPI float $getYHeadRot() const;
379
380 MCFOLD bool $isOnGround() const;
381#endif
382
383
384 // NOLINTEND
385
386 public:
387 // vftables
388 // NOLINTBEGIN
389 MCNAPI static void** $vftable();
390 // NOLINTEND
391 };
392
393 struct MoveHistoryItem : public ::PredictedMovementComponent::HistoryItem {
394 public:
395 // member variables
396 // NOLINTBEGIN
402 // NOLINTEND
403
404 public:
405 // prevent constructor by default
406 MoveHistoryItem& operator=(MoveHistoryItem const&);
407 MoveHistoryItem(MoveHistoryItem const&);
408 MoveHistoryItem();
409
410 public:
411 // virtual functions
412 // NOLINTBEGIN
413 virtual bool isValidStartItem() const /*override*/;
414
415 virtual bool isAddedActorItem() const /*override*/;
416
417 virtual bool isMotionHintItem() const /*override*/;
418
419 virtual ::Vec3 const& getPos() const /*override*/;
420
421 virtual ::Vec2 const& getRot() const /*override*/;
422
423 virtual float getYHeadRot() const /*override*/;
424
425 virtual bool isOnGround() const /*override*/;
426
427 virtual ~MoveHistoryItem() /*override*/ = default;
428 // NOLINTEND
429
430 public:
431 // virtual function thunks
432 // NOLINTBEGIN
433 MCFOLD bool $isValidStartItem() const;
434
435 MCFOLD bool $isAddedActorItem() const;
436
437 MCFOLD bool $isMotionHintItem() const;
438
439 MCFOLD ::Vec3 const& $getPos() const;
440
441 MCAPI ::Vec2 const& $getRot() const;
442
443 MCAPI float $getYHeadRot() const;
444
445 MCFOLD bool $isOnGround() const;
446
447
448 // NOLINTEND
449
450 public:
451 // vftables
452 // NOLINTBEGIN
453 MCNAPI static void** $vftable();
454 // NOLINTEND
455 };
456
457 using PredictionEventsListenerFunction = ::std::function<void(::MovePredictionType)>;
458
459public:
460 // member variables
461 // NOLINTBEGIN
462 ::ll::TypedStorage<1, 1, ::brstd::bitset<2, uchar>> mDisableConditions;
463 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PredictedMovementComponent::RuntimePredictionData>>
464 mRuntimePredictionData;
465 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::PredictedMovementComponent::HistoryItem const>> mLastStartItem;
466 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::PredictedMovementComponent::HistoryItem const>> mLastEndItem;
467 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PredictedMovementComponent::HistoryCache>> mHistoryCache;
468 ::ll::TypedStorage<1, 1, bool> mForceTeleportAfterResuming;
469 ::ll::TypedStorage<1, 1, bool> mAllowTeleportingWithoutRegion;
470 ::ll::TypedStorage<4, 4, uint> mLastCompletedInterpolationSequenceID;
471 ::ll::TypedStorage<8, 64, ::std::function<void(::MovePredictionType)>> mPredictionEventsListenerFunc;
472 ::ll::TypedStorage<8, 16, ::PredictedMovementValues> mPredictedMovementValues;
473 // NOLINTEND
474
475public:
476 // member functions
477 // NOLINTBEGIN
478 MCAPI void _debugLog(
481 ) const;
482
483 MCAPI bool _tryInterpolate(
485 ::std::chrono::steady_clock::time_point const& renderTimepoint
486 );
487
488 MCAPI void reset();
489
490 MCAPI void
491 tickNextPosition(::PredictedMovementSystemParams& params, ::std::chrono::steady_clock::time_point const& timepoint);
492 // NOLINTEND
493
494public:
495 // static variables
496 // NOLINTBEGIN
497 MCAPI static ::std::unique_ptr<::PredictedMovementComponent::RuntimePredictionData>& mGlobalRuntimePredictionData();
498 // NOLINTEND
499};
Definition AddActorPacket.h:29
Definition MotionPredictionHintsPacket.h:19
Definition MoveActorAbsoluteData.h:15
Definition PredictedMovementComponent.h:257
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:302
Definition PredictedMovementComponent.h:393
Definition PredictedMovementComponent.h:152
Definition PredictedMovementComponent.h:128
Definition PredictedMovementComponent.h:185
Definition PredictedMovementSystemParams.h:5
Definition Alias.h:14