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