LeviLamina
Loading...
Searching...
No Matches
MobEffect.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/math/Color.h"
7#include "mc/deps/core/string/HashedString.h"
8#include "mc/deps/shared_types/legacy/LevelSoundEvent.h"
9
10// auto generated forward declare list
11// clang-format off
12class Actor;
14class Amplifier;
15class Attribute;
16class AttributeBuff;
19class BaseGameVersion;
20class CompoundTag;
21class Experiments;
23struct EffectDuration;
24// clang-format on
25
26class MobEffect {
27public:
28 // MobEffect inner types declare
29 // clang-format off
31 // clang-format on
32
33 // MobEffect inner types define
35 public:
36 // member variables
37 // NOLINTBEGIN
38 ::ll::TypedStorage<4, 4, int> mPaddingDuration;
39 ::ll::TypedStorage<4, 4, float> mFactorStart;
40 ::ll::TypedStorage<4, 4, float> mFactorTarget;
41 ::ll::TypedStorage<4, 4, float> mFactorCurrent;
42 ::ll::TypedStorage<8, 64, ::std::function<void(::MobEffect::FactorCalculationData&, ::EffectDuration)>>
43 mUpdateFn;
44 ::ll::TypedStorage<4, 4, int> mTicksActive;
45 ::ll::TypedStorage<4, 4, float> mFactorPreviousFrame;
46 ::ll::TypedStorage<1, 1, bool> mHadEffectLastTick;
47 ::ll::TypedStorage<1, 1, bool> mHadApplied;
48 // NOLINTEND
49
50 public:
51 // member functions
52 // NOLINTBEGIN
53 MCAPI ::std::unique_ptr<::CompoundTag> save() const;
54 // NOLINTEND
55
56 public:
57 // static functions
58 // NOLINTBEGIN
59 MCAPI static ::MobEffect::FactorCalculationData load(::CompoundTag const* tag);
60 // NOLINTEND
61 };
62
63 using AttributeBuffPair = ::std::pair<::Attribute const*, ::std::shared_ptr<::AttributeBuff>>;
64
65 using AttributeModPair = ::std::pair<::Attribute const*, ::std::shared_ptr<::AttributeModifier>>;
66
67public:
68 // member variables
69 // NOLINTBEGIN
70 ::ll::TypedStorage<4, 4, uint const> mId;
71 ::ll::TypedStorage<1, 1, bool> mIsHarmful;
72 ::ll::TypedStorage<4, 16, ::mce::Color> mColor;
73 ::ll::TypedStorage<8, 48, ::HashedString> mParticleEffectId;
74 ::ll::TypedStorage<8, 48, ::HashedString> mParticleEffectAmbientId;
75 ::ll::TypedStorage<8, 32, ::std::string> mDescriptionId;
76 ::ll::TypedStorage<4, 4, int> mIcon;
77 ::ll::TypedStorage<4, 4, float> mDurationModifier;
78 ::ll::TypedStorage<1, 1, bool> mIsDisabled;
79 ::ll::TypedStorage<8, 32, ::std::string> mResourceName;
80 ::ll::TypedStorage<8, 32, ::std::string> mIconName;
81 ::ll::TypedStorage<1, 1, bool> mEffectVisible;
82 ::ll::TypedStorage<4, 8, ::std::optional<::SharedTypes::Legacy::LevelSoundEvent>> mOnApplySound;
83 ::ll::TypedStorage<8, 48, ::HashedString> mComponentName;
84 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::Amplifier>> mValueAmplifier;
85 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::Amplifier>> mDurationAmplifier;
86 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<::Attribute const*, ::std::shared_ptr<::AttributeBuff>>>>
87 mAttributeBuffs;
88 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<::Attribute const*, ::std::shared_ptr<::AttributeModifier>>>>
89 mAttributeModifiers;
90 ::ll::TypedStorage<8, 96, ::MobEffect::FactorCalculationData> mFactorCalculationData;
91 // NOLINTEND
92
93public:
94 // prevent constructor by default
95 MobEffect();
96
97public:
98 // virtual functions
99 // NOLINTBEGIN
100 virtual ~MobEffect();
101
102 virtual void applyEffects(::Actor& target, ::EffectDuration durationTicks, int amplification) const;
103
104 virtual void removeEffects(::BaseAttributeMap& attributeMapToRemoveFrom);
105
106 virtual void onEffectExpired(::Actor& target) const;
107
108 virtual void onActorDied(::Actor&, int) const;
109
110 virtual void onActorHurt(::Actor&, int, ::ActorDamageSource const&, float) const;
111
112 virtual void
113 applyInstantaneousEffect(::Actor* source, ::Actor* owner, ::Actor* target, int amplification, float scale) const;
114
115 virtual bool isInstantaneous() const;
116
117 virtual float getAttributeModifierValue(int amplifier, ::AttributeModifier const& modifier) const;
118 // NOLINTEND
119
120public:
121 // member functions
122 // NOLINTBEGIN
123 MCAPI MobEffect(
124 uint id,
125 ::std::string const& resourceName,
126 ::std::string const& locName,
127 bool isHarmful,
128 int color,
129 int icon,
130 ::std::string const& iconName,
131 bool drawParticles
132 );
133
134 MCAPI ::TemporalAttributeBuff
135 _createTemporalBuff(::AttributeBuff const& baseBuff, ::EffectDuration duration, int amplification) const;
136
137 MCAPI void _setParticleEffectIds(char const* particleEffectId, char const* particleEffectAmbientId);
138
139 MCAPI void addAttributeBuff(::Attribute const& attribute, ::std::shared_ptr<::AttributeBuff> buff);
140
141 MCAPI void addAttributeModifier(::Attribute const& attribute, ::std::shared_ptr<::AttributeModifier> modifier);
142
143 MCAPI void applyModsAndBuffs(
144 ::BaseAttributeMap& attributeMapToRemoveFrom,
145 ::EffectDuration durationTicks,
146 int amplification
147 ) const;
148
149 MCFOLD ::mce::Color const& getColor() const;
150
151 MCFOLD ::std::string const& getDescriptionId() const;
152
153 MCAPI float getDurationModifier() const;
154
155#ifdef LL_PLAT_C
156 MCAPI ::std::string const& getIconName() const;
157#endif
158
159 MCFOLD uint getId() const;
160
161 MCAPI ::HashedString const& getParticleEffect(bool isAmbient) const;
162
163 MCFOLD ::std::string const& getResourceName() const;
164
165#ifdef LL_PLAT_C
166 MCAPI bool hasIcon() const;
167#endif
168
169 MCFOLD bool isHarmful() const;
170
171 MCFOLD bool isVisible() const;
172
173 MCAPI void updateModsAndBuffs(
174 ::BaseAttributeMap& attributeMapToRemoveFrom,
175 ::EffectDuration durationTicks,
176 int amplification
177 ) const;
178
179 MCFOLD ::std::vector<::std::pair<::Attribute const*, ::std::shared_ptr<::AttributeModifier>>> const&
180 viewAttributeModifiers() const;
181 // NOLINTEND
182
183public:
184 // static functions
185 // NOLINTBEGIN
186 MCAPI static void
187 darknessEffectFactorUpdate(::MobEffect::FactorCalculationData& factorCalculationData, ::EffectDuration duration);
188
189 MCAPI static ::MobEffect* getById(uint effectId);
190
191 MCAPI static ::MobEffect* getByName(::std::string const& name);
192
193 MCAPI static ::std::string getNameById(uint effectId);
194
195 MCAPI static void initEffects(::BaseGameVersion const& baseGameVersion, ::Experiments const& experiments);
196
197 MCAPI static void shutdownEffects();
198 // NOLINTEND
199
200public:
201 // static variables
202 // NOLINTBEGIN
203 MCAPI static ::MobEffect*& ABSORPTION();
204
205 MCAPI static ::MobEffect*& BAD_OMEN();
206
207 MCAPI static ::MobEffect*& BLINDNESS();
208
209 MCAPI static ::MobEffect*& BREATH_OF_THE_NAUTILUS();
210
211 MCAPI static ::MobEffect*& CONDUIT_POWER();
212
213 MCAPI static ::MobEffect*& CONFUSION();
214
215 MCAPI static ::MobEffect*& DAMAGE_BOOST();
216
217 MCAPI static ::MobEffect*& DAMAGE_RESISTANCE();
218
219 MCAPI static ::MobEffect*& DARKNESS();
220
221 MCAPI static ::mce::Color const& DEFAULT_COLOR();
222
223 MCAPI static ::MobEffect*& DIG_SLOWDOWN();
224
225 MCAPI static ::MobEffect*& DIG_SPEED();
226
227 MCAPI static ::MobEffect*& EMPTY_EFFECT();
228
229 MCAPI static ::MobEffect*& FATAL_POISON();
230
231 MCAPI static ::MobEffect*& FIRE_RESISTANCE();
232
233 MCAPI static ::MobEffect*& HARM();
234
235 MCAPI static ::MobEffect*& HEAL();
236
237 MCAPI static ::MobEffect*& HEALTH_BOOST();
238
239 MCAPI static ::MobEffect*& HERO_OF_THE_VILLAGE();
240
241 MCAPI static ::MobEffect*& HUNGER();
242
243 MCAPI static ::MobEffect*& INFESTED();
244
245 MCAPI static ::MobEffect*& INVISIBILITY();
246
247 MCAPI static ::MobEffect*& JUMP();
248
249 MCAPI static ::MobEffect*& LEVITATION();
250
251 MCAPI static ::MobEffect*& MOVEMENT_SLOWDOWN();
252
253 MCAPI static ::MobEffect*& MOVEMENT_SPEED();
254
255 MCAPI static ::MobEffect*& NIGHT_VISION();
256
257 MCAPI static ::MobEffect*& OOZING();
258
259 MCAPI static ::MobEffect*& POISON();
260
261 MCAPI static ::MobEffect*& RAID_OMEN();
262
263 MCAPI static ::MobEffect*& REGENERATION();
264
265 MCAPI static ::MobEffect*& SATURATION();
266
267 MCAPI static ::MobEffect*& SLOW_FALLING();
268
269 MCAPI static ::MobEffect*& TRIAL_OMEN();
270
271 MCAPI static ::MobEffect*& WATER_BREATHING();
272
273 MCAPI static ::MobEffect*& WEAKNESS();
274
275 MCAPI static ::MobEffect*& WEAVING();
276
277 MCAPI static ::MobEffect*& WIND_CHARGED();
278
279 MCAPI static ::MobEffect*& WITHER();
280
281 MCAPI static ::std::add_lvalue_reference_t<::std::unique_ptr<::MobEffect>[]> mMobEffects();
282 // NOLINTEND
283
284public:
285 // constructor thunks
286 // NOLINTBEGIN
287 MCAPI void* $ctor(
288 uint id,
289 ::std::string const& resourceName,
290 ::std::string const& locName,
291 bool isHarmful,
292 int color,
293 int icon,
294 ::std::string const& iconName,
295 bool drawParticles
296 );
297 // NOLINTEND
298
299public:
300 // destructor thunk
301 // NOLINTBEGIN
302 MCAPI void $dtor();
303 // NOLINTEND
304
305public:
306 // virtual function thunks
307 // NOLINTBEGIN
308 MCAPI void $applyEffects(::Actor& target, ::EffectDuration durationTicks, int amplification) const;
309
310 MCAPI void $removeEffects(::BaseAttributeMap& attributeMapToRemoveFrom);
311
312 MCFOLD void $onEffectExpired(::Actor& target) const;
313
314 MCFOLD void $onActorDied(::Actor&, int) const;
315
316 MCFOLD void $onActorHurt(::Actor&, int, ::ActorDamageSource const&, float) const;
317
318 MCAPI void
319 $applyInstantaneousEffect(::Actor* source, ::Actor* owner, ::Actor* target, int amplification, float scale) const;
320
321 MCFOLD bool $isInstantaneous() const;
322
323 MCAPI float $getAttributeModifierValue(int amplifier, ::AttributeModifier const& modifier) const;
324
325
326 // NOLINTEND
327
328public:
329 // vftables
330 // NOLINTBEGIN
331 MCAPI static void** $vftable();
332 // NOLINTEND
333};
334
335// clang-format off
336template <>
337MCAPI ::ll::type_id_ref Bedrock::typeid_storage_impl<class CommandRegistry, ::MobEffect const *>();
338// clang-format on
Definition ActorDamageSource.h:18
Definition Actor.h:125
Definition Amplifier.h:5
Definition AttributeBuff.h:15
Definition AttributeModifier.h:10
Definition Attribute.h:9
Definition BaseAttributeMap.h:21
Definition BaseGameVersion.h:13
Definition CompoundTag.h:23
Definition Experiments.h:14
Definition TemporalAttributeBuff.h:15
Definition EffectDuration.h:5
Definition MobEffect.h:34