Commits
Nathan (antiPerson) authored and md_5 committed 856adc3e6af
1 + | package org.bukkit.event.entity; |
2 + | |
3 + | import org.bukkit.Warning; |
4 + | import org.bukkit.entity.Entity; |
5 + | import org.bukkit.event.Cancellable; |
6 + | import org.bukkit.event.HandlerList; |
7 + | |
8 + | /** |
9 + | * Called when an entity is about to be replaced by another entity. |
10 + | * |
11 + | * @deprecated draft API |
12 + | */ |
13 + | |
14 + | false) | (
15 + | public class EntityTransformEvent extends EntityEvent implements Cancellable { |
16 + | |
17 + | private static final HandlerList handlers = new HandlerList(); |
18 + | private boolean cancelled; |
19 + | private final Entity converted; |
20 + | private final TransformReason transformReason; |
21 + | |
22 + | public EntityTransformEvent(Entity original, Entity converted, TransformReason transformReason) { |
23 + | super(original); |
24 + | this.converted = converted; |
25 + | this.transformReason = transformReason; |
26 + | } |
27 + | |
28 + | /** |
29 + | * Gets the entity that the original entity was transformed to. |
30 + | * |
31 + | * @return The transformed entity. |
32 + | */ |
33 + | public Entity getTransformedEntity() { |
34 + | return converted; |
35 + | } |
36 + | |
37 + | /** |
38 + | * Gets the reason for the conversion that has occurred. |
39 + | * |
40 + | * @return The reason for conversion that has occurred. |
41 + | */ |
42 + | public TransformReason getTransformReason() { |
43 + | return transformReason; |
44 + | } |
45 + | |
46 + | |
47 + | public boolean isCancelled() { |
48 + | return cancelled; |
49 + | } |
50 + | |
51 + | |
52 + | public void setCancelled(boolean cancel) { |
53 + | cancelled = cancel; |
54 + | } |
55 + | |
56 + | |
57 + | public HandlerList getHandlers() { |
58 + | return handlers; |
59 + | } |
60 + | |
61 + | public static HandlerList getHandlerList() { |
62 + | return handlers; |
63 + | } |
64 + | |
65 + | public enum TransformReason { |
66 + | /** |
67 + | * When a zombie gets cured and a villager is spawned. |
68 + | */ |
69 + | CURED, |
70 + | /** |
71 + | * When a villager gets infected and a zombie villager spawns. |
72 + | */ |
73 + | INFECTION, |
74 + | /** |
75 + | * When a entity drowns in water and a new entity spawns. |
76 + | */ |
77 + | DROWNED, |
78 + | /** |
79 + | * When a mooshroom (or MUSHROOM_COW) is sheared and a cow spawns. |
80 + | */ |
81 + | SHEARED, |
82 + | /** |
83 + | * When lightning strikes a entity. |
84 + | */ |
85 + | LIGHTNING, |
86 + | /** |
87 + | * When a slime splits into multiple smaller slimes. |
88 + | */ |
89 + | SPLIT |
90 + | } |
91 + | } |