-
-
Notifications
You must be signed in to change notification settings - Fork 308
/
WitherTrait.java
40 lines (32 loc) · 971 Bytes
/
WitherTrait.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
package net.citizensnpcs.trait;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWither;
import org.bukkit.entity.Wither;
import net.citizensnpcs.api.persistence.Persist;
import net.citizensnpcs.api.trait.Trait;
import net.citizensnpcs.api.trait.TraitName;
import net.minecraft.server.v1_8_R3.EntityWither;
@TraitName("withertrait")
public class WitherTrait extends Trait {
@Persist("charged")
private boolean charged = false;
public WitherTrait() {
super("withertrait");
}
public boolean isCharged() {
return charged;
}
@Override
public void onSpawn() {
}
@Override
public void run() {
if (npc.getEntity() instanceof Wither) {
Wither wither = (Wither) npc.getEntity();
EntityWither handle = ((CraftWither) wither).getHandle();
handle.r(charged ? 20 : 0);
}
}
public void setCharged(boolean charged) {
this.charged = charged;
}
}