-
-
Notifications
You must be signed in to change notification settings - Fork 104
/
AnimationHelperImpl.java
47 lines (44 loc) · 1.81 KB
/
AnimationHelperImpl.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
package com.denizenscript.denizen.nms.v1_17.helpers;
import com.denizenscript.denizen.nms.abstracts.AnimationHelper;
import net.minecraft.world.entity.Entity;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftHorse;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPolarBear;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.IronGolem;
public class AnimationHelperImpl extends AnimationHelper {
public AnimationHelperImpl() {
register("POLAR_BEAR_START_STANDING", entity -> {
if (entity.getType() == EntityType.POLAR_BEAR) {
((CraftPolarBear) entity).getHandle().setStanding(true);
}
});
register("POLAR_BEAR_STOP_STANDING", entity -> {
if (entity.getType() == EntityType.POLAR_BEAR) {
((CraftPolarBear) entity).getHandle().setStanding(false);
}
});
register("HORSE_START_STANDING", entity -> {
if (entity instanceof Horse) {
((CraftHorse) entity).getHandle().setStanding(true);
}
});
register("HORSE_STOP_STANDING", entity -> {
if (entity instanceof Horse) {
((CraftHorse) entity).getHandle().setStanding(false);
}
});
register("HORSE_BUCK", entity -> {
if (entity instanceof Horse) {
((CraftHorse) entity).getHandle().makeMad();
}
});
register("IRON_GOLEM_ATTACK", entity -> {
if (entity instanceof IronGolem) {
Entity nmsEntity = ((CraftEntity) entity).getHandle();
nmsEntity.level.broadcastEntityEvent(nmsEntity, (byte) 4);
}
});
}
}