2026-03-01 12:16:08 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
class Mob;
|
|
|
|
|
|
|
|
|
|
class MobEffectInstance
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
// sent as byte
|
|
|
|
|
int id;
|
|
|
|
|
// sent as short
|
|
|
|
|
int duration;
|
|
|
|
|
// sent as byte
|
|
|
|
|
int amplifier;
|
2026-03-03 03:04:10 +08:00
|
|
|
bool splash;
|
|
|
|
|
bool ambient;
|
|
|
|
|
bool noCounter;
|
2026-03-01 12:16:08 +08:00
|
|
|
|
|
|
|
|
void _init(int id, int duration, int amplifier);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
MobEffectInstance(int id);
|
|
|
|
|
MobEffectInstance(int id, int duration);
|
|
|
|
|
MobEffectInstance(int id, int duration, int amplifier);
|
2026-03-03 03:04:10 +08:00
|
|
|
MobEffectInstance(int id, int duration, int amplifier, bool ambient);
|
2026-03-01 12:16:08 +08:00
|
|
|
MobEffectInstance(MobEffectInstance *copy);
|
|
|
|
|
|
|
|
|
|
void update(MobEffectInstance *takeOver);
|
|
|
|
|
int getId();
|
|
|
|
|
int getDuration();
|
|
|
|
|
int getAmplifier();
|
2026-03-03 03:04:10 +08:00
|
|
|
|
|
|
|
|
bool isSplash();
|
|
|
|
|
void setSplash(bool splash);
|
|
|
|
|
bool isAmbient();
|
|
|
|
|
|
|
|
|
|
bool tick(shared_ptr<LivingEntity> target);
|
2026-03-01 12:16:08 +08:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
int tickDownDuration();
|
|
|
|
|
|
|
|
|
|
public:
|
2026-03-03 03:04:10 +08:00
|
|
|
void applyEffect(shared_ptr<LivingEntity> mob);
|
2026-03-01 12:16:08 +08:00
|
|
|
int getDescriptionId();
|
|
|
|
|
int getPostfixDescriptionId(); // 4J Added
|
|
|
|
|
int hashCode();
|
|
|
|
|
|
|
|
|
|
wstring toString();
|
|
|
|
|
|
|
|
|
|
// Was bool equals(Object obj)
|
|
|
|
|
bool equals(MobEffectInstance *obj);
|
2026-03-03 03:04:10 +08:00
|
|
|
|
|
|
|
|
CompoundTag *save(CompoundTag *tag);
|
|
|
|
|
static MobEffectInstance *load(CompoundTag *tag);
|
|
|
|
|
void setNoCounter(bool noCounter);
|
|
|
|
|
bool isNoCounter();
|
2026-03-01 12:16:08 +08:00
|
|
|
};
|