/
MCLivingEntity.java
178 lines (111 loc) · 3.89 KB
/
MCLivingEntity.java
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
package com.laytonsmith.abstraction;
import com.laytonsmith.abstraction.blocks.MCBlock;
import com.laytonsmith.abstraction.blocks.MCMaterial;
import com.laytonsmith.abstraction.enums.MCAttribute;
import com.laytonsmith.abstraction.enums.MCPotionEffectType;
import com.laytonsmith.core.constructs.Target;
import java.util.HashSet;
import java.util.List;
public interface MCLivingEntity extends MCEntity, MCProjectileSource {
boolean addEffect(MCPotionEffectType type, int strength, int ticks, boolean ambient, boolean particles, boolean icon);
boolean removeEffect(MCPotionEffectType type);
void removeEffects();
List<MCEffect> getEffects();
void damage(double amount);
void damage(double amount, MCEntity source);
boolean getCanPickupItems();
boolean getRemoveWhenFarAway();
/**
* With the addition of ArmorStands, this can be null. At the time of this writing, ArmorStands are the only
* LivingEntity with such a limitation, and a workaround has been added.
*/
MCEntityEquipment getEquipment();
double getEyeHeight();
double getEyeHeight(boolean ignoreSneaking);
MCLocation getEyeLocation();
double getHealth();
MCPlayer getKiller();
double getLastDamage();
MCEntity getLeashHolder();
MCLivingEntity getTarget(Target t);
MCBlock getTargetBlock(HashSet<MCMaterial> transparent, int maxDistance);
MCBlock getTargetSpace(int maxDistance);
List<MCBlock> getLineOfSight(HashSet<MCMaterial> transparent, int maxDistance);
boolean hasLineOfSight(MCEntity other);
double getMaxHealth();
int getMaximumAir();
int getNoDamageTicks();
int getRemainingAir();
boolean isGliding();
boolean isLeashed();
boolean hasAI();
void resetMaxHealth();
void setCanPickupItems(boolean pickup);
void setRemoveWhenFarAway(boolean remove);
void setHealth(double health);
void setLastDamage(double damage);
void setLeashHolder(MCEntity holder);
void setMaxHealth(double health);
void setMaximumAir(int ticks);
void setNoDamageTicks(int ticks);
void setRemainingAir(int ticks);
void setTarget(MCLivingEntity target, Target t);
void setGliding(Boolean glide);
void setAI(Boolean ai);
boolean isCollidable();
void setCollidable(boolean collidable);
/**
* Kills the entity. In some cases, this will be equivalent to setHealth(0), but may not be, so this method should
* be used instead.
*/
void kill();
boolean isTameable();
double getAttributeValue(MCAttribute attr);
double getAttributeDefault(MCAttribute attr);
double getAttributeBase(MCAttribute attr);
void setAttributeBase(MCAttribute attr, double base);
void resetAttributeBase(MCAttribute attr);
List<MCAttributeModifier> getAttributeModifiers(MCAttribute attr);
void addAttributeModifier(MCAttributeModifier modifier);
void removeAttributeModifier(MCAttributeModifier modifier);
class MCEffect {
private MCPotionEffectType type;
private int strength;
private int ticksRemaining;
private boolean ambient;
private boolean particles;
private boolean icon;
public MCEffect(MCPotionEffectType type, int strength, int ticks, boolean ambient) {
this(type, strength, ticks, ambient, true, true);
}
public MCEffect(MCPotionEffectType type, int strength, int ticks, boolean ambient, boolean particles) {
this(type, strength, ticks, ambient, particles, particles);
}
public MCEffect(MCPotionEffectType type, int strength, int ticks, boolean ambient, boolean particles, boolean icon) {
this.type = type;
this.strength = strength;
this.ticksRemaining = ticks;
this.ambient = ambient;
this.particles = particles;
this.icon = icon;
}
public MCPotionEffectType getPotionEffectType() {
return type;
}
public int getStrength() {
return strength;
}
public int getTicksRemaining() {
return ticksRemaining;
}
public boolean isAmbient() {
return ambient;
}
public boolean hasParticles() {
return particles;
}
public boolean showIcon() {
return icon;
}
}
}