LeviLamina
Loading...
Searching...
No Matches
Mob.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/shared_types/legacy/EquipmentSlot.h"
7#include "mc/deps/shared_types/legacy/LevelSoundEvent.h"
8#include "mc/deps/shared_types/legacy/actor/ActorDamageCause.h"
9#include "mc/deps/shared_types/legacy/actor/ArmorSlot.h"
10#include "mc/legacy/ActorUniqueID.h"
11#include "mc/world/actor/Actor.h"
12#include "mc/world/actor/ActorEvent.h"
13#include "mc/world/actor/ActorInitializationMethod.h"
14#include "mc/world/actor/ActorSwingSource.h"
15#include "mc/world/actor/ArmorMaterialType.h"
16#include "mc/world/actor/BuiltInMobComponents.h"
17#include "mc/world/actor/MobSpawnMethod.h"
18#include "mc/world/actor/TravelType.h"
19#include "mc/world/item/ClockSpriteCalculator.h"
20#include "mc/world/item/CompassSpriteCalculator.h"
21#include "mc/world/level/BlockPos.h"
22
23// auto generated forward declare list
24// clang-format off
25class AABB;
27class ActorHurtResult;
29class Block;
30class BodyControl;
31class CompoundTag;
32class DataLoadHelper;
33class EntityContext;
34class HashedString;
35class ILevel;
36class ItemStack;
37class ListTag;
38class Player;
39class SaveContext;
41class Vec3;
43struct DimensionType;
45struct HurtParameters;
51namespace mce { class UUID; }
52class IOptionsReader;
53// clang-format on
54
55class Mob : public ::Actor {
56public:
57 LLAPI void refreshInventory();
58
59 LLAPI static ::Mob* tryGetFromEntity(::EntityContext& entity, bool includeRemoved);
60
61 LLNDAPI ItemStack const& getItemSlot(::SharedTypes::Legacy::EquipmentSlot slot) const;
62
63public:
64 // member variables
65 // NOLINTBEGIN
66 ::ll::TypedStorage<4, 4, float> mHurtDir;
67 ::ll::TypedStorage<4, 4, float> mOTilt;
68 ::ll::TypedStorage<4, 4, float> mTilt;
69 ::ll::TypedStorage<8, 32, ::CompassSpriteCalculator> mCompassSpriteCalc;
70 ::ll::TypedStorage<8, 32, ::CompassSpriteCalculator> mRecoveryCompassSpriteCalc;
71 ::ll::TypedStorage<4, 12, ::ClockSpriteCalculator> mClockSpriteCalc;
72 ::ll::TypedStorage<4, 4, float> mAttackAnim;
73 ::ll::TypedStorage<4, 4, int> mSwingTime;
74 ::ll::TypedStorage<8, 24, ::BuiltInMobComponents> mBuiltInMobComponents;
75 ::ll::TypedStorage<4, 4, float> mMovementComponentCurrentSpeed;
76 ::ll::TypedStorage<1, 1, bool> mSwinging;
77 ::ll::TypedStorage<1, 1, bool> mSurfaceMob;
78 ::ll::TypedStorage<1, 1, bool> mNaturallySpawned;
79 ::ll::TypedStorage<1, 1, bool> mWantsToBeJockey;
80 ::ll::TypedStorage<1, 1, bool> mHasBoundOrigin;
81 ::ll::TypedStorage<1, 1, ::MobSpawnMethod> mSpawnMethod;
82 ::ll::TypedStorage<1, 1, bool> mCreateAiOnReload;
83 ::ll::TypedStorage<8, 8, ::ActorUniqueID> mCaravanHead;
84 ::ll::TypedStorage<8, 8, ::ActorUniqueID> mCaravanTail;
85 ::ll::TypedStorage<4, 4, float> mOAttackAnim;
86 ::ll::TypedStorage<4, 12, ::BlockPos> mBoundOrigin;
87 ::ll::TypedStorage<8, 8, ::ActorUniqueID> mTargetCaptainId;
88 // NOLINTEND
89
90public:
91 // prevent constructor by default
92 Mob();
93
94public:
95 // virtual functions
96 // NOLINTBEGIN
97 virtual void
98 initializeComponents(::ActorInitializationMethod method, ::VariantParameterList const& params) /*override*/;
99
100 virtual void reloadHardcodedClient(::ActorInitializationMethod method) /*override*/;
101
102 virtual void reloadHardcoded(::ActorInitializationMethod method, ::VariantParameterList const& params) /*override*/;
103
104 virtual ~Mob() /*override*/;
105
106 virtual void knockback(::Actor* source, float damage, float xd, float zd, ::KnockbackParameters const& parameters);
107
108 virtual void kill() /*override*/;
109
110 virtual void die(::ActorDamageSource const& source) /*override*/;
111
112 virtual bool shouldDropDeathLoot() const /*override*/;
113
114 virtual void spawnAnim();
115
116 virtual bool isAlive() const /*override*/;
117
118 virtual bool isSleeping() const /*override*/;
119
120 virtual void setSleeping(bool val) /*override*/;
121
122 virtual bool isBlocking() const /*override*/;
123
124 virtual void setSprinting(bool shouldSprint);
125
126 virtual bool canBePulledIntoVehicle() const /*override*/;
127
128 virtual float getSpeed() const;
129
130 virtual void setSpeed(float speed);
131
132 virtual float getYawSpeedInDegreesPerSecond() const /*override*/;
133
134 virtual void normalTick() /*override*/;
135
136 virtual void baseTick() /*override*/;
137
138 virtual void hurtEffects(::ActorDamageSource const& source, float damage, ::HurtEffectsSettings const& settings);
139
140 virtual void damageCarriedItemOnAttack(::Actor& target, float damageDealtToTarget);
141
142 virtual ::ActorHurtResult doFireHurt(int amount) /*override*/;
143
144 virtual void aiStep();
145
146 virtual void pushActors();
147
148 virtual bool checkSpawnRules(bool fromSpawner);
149
150 virtual bool checkSpawnObstruction() const;
151
152 virtual void addPassenger(::Actor& newPassenger) /*override*/;
153
154 virtual bool startRiding(::Actor& vehicle, bool forceRiding) /*override*/;
155
156 virtual void handleEntityEvent(::ActorEvent id, int data) /*override*/;
157
158 virtual int getItemUseDuration() const;
159
160 virtual float getItemUseStartupProgress() const;
161
162 virtual float getItemUseIntervalProgress() const;
163
164 virtual bool swing(::ActorSwingSource swingSource) /*override*/;
165
166 virtual float getMaxHeadXRot();
167
168 virtual bool isImmobile() const /*override*/;
169
170 virtual void blockedByShield(::ActorDamageSource const& source, ::Actor& blocker) /*override*/;
171
172 virtual void setTarget(::Actor* target) /*override*/;
173
174 virtual ::ActorHurtResult
175 attack(::Actor& target, ::SharedTypes::Legacy::ActorDamageCause const& cause) /*override*/;
176
177 virtual bool isAlliedTo(::Mob* other);
178
179 virtual ::ActorHurtResult doHurtTarget(::Actor* target, ::SharedTypes::Legacy::ActorDamageCause const& cause);
180
181 virtual ::SharedTypes::Legacy::ActorDamageCause getBlockDamageCause(::Block const& block) const /*override*/;
182
183 virtual bool inCaravan() const /*override*/;
184
185 virtual int getArmorValue() const;
186
187 virtual void hurtArmorSlots(::ActorDamageSource const& source, int damage, ::std::bitset<5> const hurtSlots);
188
189 virtual void setDamagedArmor(::SharedTypes::Legacy::ArmorSlot slot, ::ItemStack const& item);
190
191 virtual void sendArmorDamage(::std::bitset<5> const damagedSlots);
192
193 virtual void sendArmor(::std::bitset<5> const armorSlots);
194
195 virtual ::ArmorMaterialType getArmorMaterialTypeInSlot(::SharedTypes::Legacy::ArmorSlot slot) const /*override*/;
196
197 virtual int getArmorTextureIndexInSlot(::SharedTypes::Legacy::ArmorSlot slot) const /*override*/;
198
199 virtual float getArmorColorInSlot(::SharedTypes::Legacy::ArmorSlot slot, int channelRGBA) const /*override*/;
200
201 virtual ::std::vector<::ItemStack const*> getAllHandEquipment() const;
202
203 virtual ::std::vector<::ItemStack const*> getAllEquipment() const;
204
205 virtual int getDeathTime() const /*override*/;
206
207 virtual void dropEquipmentOnDeath(::ActorDamageSource const& source);
208
209 virtual void dropEquipmentOnDeath();
210
211 virtual void clearVanishEnchantedItemsOnDeath();
212
213 virtual void sendInventory(bool shouldSelectSlot);
214
215 virtual void buildDebugInfo(::std::string& out) const /*override*/;
216
217 virtual float getInterpolatedBodyRot(float a) const /*override*/;
218
219 virtual float getInterpolatedHeadRot(float a) const /*override*/;
220
221 virtual float getInterpolatedBodyYaw(float a) const /*override*/;
222
223 virtual bool isSurfaceMob() const /*override*/;
224
225 virtual float getDamageAfterEnchantReduction(::ActorDamageSource const& source, float damage) const;
226
227 virtual bool createAIGoals();
228
229 virtual void onBorn(::Actor&, ::Actor&);
230
231 virtual bool setItemSlot(::SharedTypes::Legacy::EquipmentSlot slot, ::ItemStack const& item);
232
233 virtual void setTransitioningSitting(bool value);
234
235 virtual bool hasComponent(::HashedString const& name) const /*override*/;
236
237 virtual bool canChangeDimensionsUsingPortal() const /*override*/;
238
239 virtual void teleportTo(
240 ::Vec3 const& pos,
241 bool shouldStopRiding,
242 int cause,
243 int sourceEntityType,
244 bool keepVelocity
245 ) /*override*/;
246
247 virtual float _getWalkTargetValue(::BlockPos const& pos);
248
249 virtual bool canExistWhenDisallowMob() const;
250
251 virtual bool canPowerJump() const /*override*/;
252
253 virtual void setEquippedSlot(::SharedTypes::Legacy::EquipmentSlot slot, ::ItemStack const& item) /*override*/;
254
255 virtual void renderDebugServerState(::IOptionsReader const& options) /*override*/;
256
257 virtual bool canFreeze() const /*override*/;
258
259 virtual void addAdditionalSaveData(::CompoundTag& entityTag) const /*override*/;
260
261 virtual void readAdditionalSaveData(::CompoundTag const& tag, ::DataLoadHelper& dataLoadHelper) /*override*/;
262
263 virtual ::std::unique_ptr<::BodyControl> initBodyControl();
264
265 virtual float causeFallDamageToActor(float distance, float multiplier, ::ActorDamageSource source) /*override*/;
266
267 virtual void outOfWorld() /*override*/;
268
269 virtual ::ActorHurtResult
270 _hurt(::ActorDamageSource const& source, float damage, ::HurtParameters const& hurtParameters) /*override*/;
271
272 virtual void newServerAiStep();
273
274 virtual void _doInitialMove() /*override*/;
275
276 virtual ::AABB _getAdjustedAABBForSpawnCheck(::AABB const& aabb, ::Vec3 const& mobPos) const;
277 // NOLINTEND
278
279public:
280 // member functions
281 // NOLINTBEGIN
282 MCAPI Mob(::ILevel& level, ::EntityContext& entityContext);
283
284 MCAPI ::BuiltInMobComponents _addBuiltInMobComponents();
285
286 MCAPI void _doSprintParticleEffect();
287
288 MCAPI bool _initHardCodedComponents(bool isClientSide);
289
290 MCAPI void _initialize(::EntityContext& entityContext, bool isClientSide);
291
292 MCAPI bool _isDoingMaceSmashAttack() const;
293
294 MCAPI void _processSoulSpeed();
295
296 MCAPI void
297 addSpeedModifier(::mce::UUID const& attributeID, ::std::string const& attributeName, float speedModifier);
298
299 MCAPI float calcMoveRelativeSpeed(::TravelType travelType);
300
301 MCAPI float calculateAttackDamage(::Actor const& target, ::CalculateAttackDamageSettings const& settings) const;
302
303 MCAPI ::std::optional<float> checkTotemDeathProtection(::ActorDamageSource const& killingDamage);
304
305 MCAPI void clearMainHandSlot();
306
307 MCAPI void containerChanged(int iSlot);
308
309 MCAPI void createAI(::std::vector<::LegacyGoalDefinition> goals);
310
311 MCAPI void dropContainer();
312
313 MCAPI void emitJumpPreventedEvent(::BlockPos const& pos);
314
315 MCAPI void frostWalk();
316
317#ifdef LL_PLAT_C
318 MCAPI ::std::vector<int> getAllArmorID() const;
319#endif
320
321 MCAPI int getArmorTypeHash();
322
323 MCAPI int getCarriedItemKnockbackBonus() const;
324
325 MCAPI float getDamageAfterArmorReduction(::ActorDamageSource const& source, float damage) const;
326
327 MCAPI float getDamageAfterDamageSensorComponentAdjustments(::ActorDamageSource const& source, float damage);
328
329 MCAPI ::SharedTypes::Legacy::LevelSoundEvent getHurtSound(::SharedTypes::Legacy::ActorDamageCause cause) const;
330
331 MCAPI float getJumpEffectAmplifierValue();
332
333 MCAPI float getJumpMultiplier();
334
335 MCAPI ::JumpPreventionResult getJumpPrevention();
336
337#ifdef LL_PLAT_S
338 MCAPI int getJumpTicks() const;
339#endif
340
341 MCAPI int getModifiedSwingDuration() const;
342
343 MCAPI int getNoActionTime() const;
344
345#ifdef LL_PLAT_C
346 MCAPI float getPassengerLockedBodyRot() const;
347
348 MCAPI float getPassengerRotLimit() const;
349#endif
350
351 MCAPI ::SharedTypes::Legacy::LevelSoundEvent getSpawnSound() const;
352
353#ifdef LL_PLAT_C
354 MCAPI float getSwimSpeedMultiplier() const;
355#endif
356
357 MCAPI int getToughnessValue() const;
358
359 MCAPI ::TravelType getTravelType();
360
361 MCAPI float getYBodyRotation() const;
362
363#ifdef LL_PLAT_C
364 MCAPI ::InterpolationPair getYBodyRotationsNewOld() const;
365#endif
366
367 MCAPI void hurtArmor(::ActorDamageSource const& source, int damage);
368
369 MCAPI bool isAbleToMove() const;
370
371 MCAPI bool isTransitioningSitting() const;
372
373 MCAPI void joinCaravan(::Mob* head);
374
375 MCAPI void jumpFromGround();
376
377 MCAPI void leaveCaravan();
378
379 MCAPI void lookAt(::Actor* lookAt, float yMax, float xMax);
380
381 MCAPI void onPlayerDimensionChanged(::Player* player, ::DimensionType fromDimension, ::DimensionType toDimension);
382
383 MCAPI void removeSpeedModifier(::mce::UUID const& attributeID);
384
385 MCAPI void resetAttributes();
386
387 MCAPI void resetNoActionTime();
388
389 MCAPI ::std::unique_ptr<::ListTag> saveOffhand(::SaveContext const& saveContext) const;
390
391 MCAPI void setJumpTicks(int ticks);
392
393 MCAPI void setSpeedModifier(float speed);
394
395 MCAPI void setYBodyRotation(float rotation);
396
397 MCAPI void setYBodyRotations(float rotation, float oldRotation);
398
399 MCAPI bool shouldApplyWaterGravity();
400
401 MCAPI void snapToYBodyRot(float yBodyRot);
402
403 MCAPI void updateEquipment();
404
405 MCAPI void updateGlidingDurability();
406 // NOLINTEND
407
408public:
409 // static functions
410 // NOLINTBEGIN
411#ifdef LL_PLAT_C
412 MCAPI static void setSprinting(::BaseAttributeMap& attributes, ::SynchedActorDataWriter data, bool shouldSprint);
413#endif
414 // NOLINTEND
415
416public:
417 // constructor thunks
418 // NOLINTBEGIN
419 MCAPI void* $ctor(::ILevel& level, ::EntityContext& entityContext);
420 // NOLINTEND
421
422public:
423 // destructor thunk
424 // NOLINTBEGIN
425 MCAPI void $dtor();
426 // NOLINTEND
427
428public:
429 // virtual function thunks
430 // NOLINTBEGIN
431 MCAPI void $initializeComponents(::ActorInitializationMethod method, ::VariantParameterList const& params);
432
433 MCAPI void $reloadHardcodedClient(::ActorInitializationMethod method);
434
435 MCAPI void $reloadHardcoded(::ActorInitializationMethod method, ::VariantParameterList const& params);
436
437 MCAPI void $knockback(::Actor* source, float damage, float xd, float zd, ::KnockbackParameters const& parameters);
438
439 MCAPI void $kill();
440
441 MCAPI void $die(::ActorDamageSource const& source);
442
443 MCAPI bool $shouldDropDeathLoot() const;
444
445 MCFOLD void $spawnAnim();
446
447 MCAPI bool $isAlive() const;
448
449 MCAPI bool $isSleeping() const;
450
451 MCAPI void $setSleeping(bool val);
452
453 MCAPI bool $isBlocking() const;
454
455 MCAPI void $setSprinting(bool shouldSprint);
456
457 MCFOLD bool $canBePulledIntoVehicle() const;
458
459 MCAPI float $getSpeed() const;
460
461 MCAPI void $setSpeed(float speed);
462
463 MCAPI float $getYawSpeedInDegreesPerSecond() const;
464
465 MCAPI void $normalTick();
466
467 MCAPI void $baseTick();
468
469 MCAPI void $hurtEffects(::ActorDamageSource const& source, float damage, ::HurtEffectsSettings const& settings);
470
471 MCAPI void $damageCarriedItemOnAttack(::Actor& target, float damageDealtToTarget);
472
473 MCAPI ::ActorHurtResult $doFireHurt(int amount);
474
475 MCAPI void $aiStep();
476
477 MCAPI void $pushActors();
478
479 MCAPI bool $checkSpawnRules(bool fromSpawner);
480
481 MCAPI bool $checkSpawnObstruction() const;
482
483 MCAPI void $addPassenger(::Actor& newPassenger);
484
485 MCAPI bool $startRiding(::Actor& vehicle, bool forceRiding);
486
487 MCAPI void $handleEntityEvent(::ActorEvent id, int data);
488
489 MCFOLD int $getItemUseDuration() const;
490
491 MCFOLD float $getItemUseStartupProgress() const;
492
493 MCFOLD float $getItemUseIntervalProgress() const;
494
495 MCAPI bool $swing(::ActorSwingSource swingSource);
496
497 MCAPI float $getMaxHeadXRot();
498
499 MCAPI bool $isImmobile() const;
500
501 MCAPI void $blockedByShield(::ActorDamageSource const& source, ::Actor& blocker);
502
503 MCAPI void $setTarget(::Actor* target);
504
505 MCAPI ::ActorHurtResult $attack(::Actor& target, ::SharedTypes::Legacy::ActorDamageCause const& cause);
506
507 MCFOLD bool $isAlliedTo(::Mob* other);
508
509 MCAPI ::ActorHurtResult $doHurtTarget(::Actor* target, ::SharedTypes::Legacy::ActorDamageCause const& cause);
510
511 MCAPI ::SharedTypes::Legacy::ActorDamageCause $getBlockDamageCause(::Block const& block) const;
512
513 MCAPI bool $inCaravan() const;
514
515 MCAPI int $getArmorValue() const;
516
517 MCAPI void $hurtArmorSlots(::ActorDamageSource const& source, int damage, ::std::bitset<5> const hurtSlots);
518
519 MCAPI void $setDamagedArmor(::SharedTypes::Legacy::ArmorSlot slot, ::ItemStack const& item);
520
521 MCFOLD void $sendArmorDamage(::std::bitset<5> const damagedSlots);
522
523 MCAPI void $sendArmor(::std::bitset<5> const armorSlots);
524
525 MCAPI ::ArmorMaterialType $getArmorMaterialTypeInSlot(::SharedTypes::Legacy::ArmorSlot slot) const;
526
527 MCAPI int $getArmorTextureIndexInSlot(::SharedTypes::Legacy::ArmorSlot slot) const;
528
529 MCAPI float $getArmorColorInSlot(::SharedTypes::Legacy::ArmorSlot slot, int channelRGBA) const;
530
531 MCAPI ::std::vector<::ItemStack const*> $getAllHandEquipment() const;
532
533 MCAPI ::std::vector<::ItemStack const*> $getAllEquipment() const;
534
535 MCAPI int $getDeathTime() const;
536
537 MCAPI void $dropEquipmentOnDeath(::ActorDamageSource const& source);
538
539 MCAPI void $dropEquipmentOnDeath();
540
541 MCAPI void $clearVanishEnchantedItemsOnDeath();
542
543 MCAPI void $sendInventory(bool shouldSelectSlot);
544
545 MCAPI void $buildDebugInfo(::std::string& out) const;
546
547 MCAPI float $getInterpolatedBodyRot(float a) const;
548
549 MCAPI float $getInterpolatedHeadRot(float a) const;
550
551 MCAPI float $getInterpolatedBodyYaw(float a) const;
552
553 MCAPI bool $isSurfaceMob() const;
554
555 MCAPI float $getDamageAfterEnchantReduction(::ActorDamageSource const& source, float damage) const;
556
557 MCAPI bool $createAIGoals();
558
559 MCFOLD void $onBorn(::Actor&, ::Actor&);
560
561 MCAPI bool $setItemSlot(::SharedTypes::Legacy::EquipmentSlot slot, ::ItemStack const& item);
562
563 MCAPI void $setTransitioningSitting(bool value);
564
565 MCAPI bool $hasComponent(::HashedString const& name) const;
566
567 MCAPI bool $canChangeDimensionsUsingPortal() const;
568
569 MCAPI void
570 $teleportTo(::Vec3 const& pos, bool shouldStopRiding, int cause, int sourceEntityType, bool keepVelocity);
571
572 MCFOLD float $_getWalkTargetValue(::BlockPos const& pos);
573
574 MCAPI bool $canExistWhenDisallowMob() const;
575
576 MCAPI bool $canPowerJump() const;
577
578 MCAPI void $setEquippedSlot(::SharedTypes::Legacy::EquipmentSlot slot, ::ItemStack const& item);
579
580 MCFOLD void $renderDebugServerState(::IOptionsReader const& options);
581
582 MCAPI bool $canFreeze() const;
583
584 MCAPI void $addAdditionalSaveData(::CompoundTag& entityTag) const;
585
586 MCAPI void $readAdditionalSaveData(::CompoundTag const& tag, ::DataLoadHelper& dataLoadHelper);
587
588 MCAPI ::std::unique_ptr<::BodyControl> $initBodyControl();
589
590 MCAPI float $causeFallDamageToActor(float distance, float multiplier, ::ActorDamageSource source);
591
592 MCAPI void $outOfWorld();
593
594 MCAPI ::ActorHurtResult
595 $_hurt(::ActorDamageSource const& source, float damage, ::HurtParameters const& hurtParameters);
596
597 MCAPI void $newServerAiStep();
598
599 MCAPI void $_doInitialMove();
600
601 MCAPI ::AABB $_getAdjustedAABBForSpawnCheck(::AABB const& aabb, ::Vec3 const& mobPos) const;
602
603
604 // NOLINTEND
605
606public:
607 // vftables
608 // NOLINTBEGIN
609 MCAPI static void** $vftable();
610 // NOLINTEND
611};
Definition AABB.h:18
Definition ActorDamageSource.h:18
Definition ActorHurtResult.h:5
Definition BaseAttributeMap.h:21
Definition BlockPos.h:17
Definition Block.h:42
Definition BodyControl.h:13
Definition CompoundTag.h:18
Definition DataLoadHelper.h:20
Definition EntityContext.h:15
Definition HashedString.h:5
Definition ILevel.h:220
Definition IOptionsReader.h:5
Definition ItemStack.h:24
Definition ListTag.h:19
Definition Player.h:129
Definition SaveContext.h:5
Definition SynchedActorDataWriter.h:12
Definition Vec3.h:10
Definition UUID.h:7
Definition CalculateAttackDamageSettings.h:5
Definition DimensionType.h:5
Definition HurtEffectsSettings.h:8
Definition HurtParameters.h:8
Definition InterpolationPair.h:5
Definition JumpPreventionResult.h:8
Definition KnockbackParameters.h:5
Definition LegacyGoalDefinition.h:32
Definition VariantParameterList.h:14