aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/MobEffectInstance.h
blob: 5d9e68f6c6db94d1ec9f53d7513cb4b12fd7531d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once

class Mob;

class MobEffectInstance
{
private:
	// sent as byte
	int id;
	// sent as short
	int duration;
	// sent as byte
	int amplifier;
	bool splash;
	bool ambient;
	bool noCounter;

	void _init(int id, int duration, int amplifier);

public:
	MobEffectInstance(int id);
	MobEffectInstance(int id, int duration);
	MobEffectInstance(int id, int duration, int amplifier);
	MobEffectInstance(int id, int duration, int amplifier, bool ambient);
	MobEffectInstance(MobEffectInstance *copy);

	void update(MobEffectInstance *takeOver);
	int getId();
	int getDuration();
	int getAmplifier();

	bool isSplash();
	void setSplash(bool splash);
	bool isAmbient();

	bool tick(shared_ptr<LivingEntity> target);

private:
	int tickDownDuration();

public:
	void applyEffect(shared_ptr<LivingEntity> mob);
	int getDescriptionId();
	int getPostfixDescriptionId(); // 4J Added
	int hashCode();

	wstring toString();

	// Was bool equals(Object obj)
	bool equals(MobEffectInstance *obj);

	CompoundTag *save(CompoundTag *tag);
	static MobEffectInstance *load(CompoundTag *tag);
	void setNoCounter(bool noCounter);
	bool isNoCounter();
};