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
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Fri, 27 Sep 2024 17:12:50 -0700
Subject: [PATCH] Improve entity effect API
diff --git a/src/main/java/org/bukkit/EntityEffect.java b/src/main/java/org/bukkit/EntityEffect.java
index 5341957b10cccd7bce5a7595699b1d90412a01d0..912dafd5a8884d7973b2126f97ecdbe54e78937f 100644
--- a/src/main/java/org/bukkit/EntityEffect.java
+++ b/src/main/java/org/bukkit/EntityEffect.java
@@ -112,11 +112,25 @@ public enum EntityEffect {
// 5 - unused
/**
* The smoke when taming an entity fails.
+ * @deprecated use {@link EntityEffect#TAMING_FAILED}
*/
+ @Deprecated(since = "1.21") // Paper
WOLF_SMOKE(6, Tameable.class),
+ // Paper start - rename "wolf" effects
+ /**
+ * The smoke when taming an entity fails.
+ */
+ TAMING_FAILED(6, Tameable.class),
+ /**
+ * The hearts when taming an entity succeeds.
+ */
+ TAMING_SUCCEEDED(7, Tameable.class),
+ // Paper end - rename "wolf" effects
/**
* The hearts when taming an entity succeeds.
+ * @deprecated use {@link EntityEffect#TAMING_SUCCEEDED}
*/
+ @Deprecated(since = "1.21") // Paper
WOLF_HEARTS(7, Tameable.class),
/**
* When a wolf shakes (after being wet).
@@ -204,7 +218,9 @@ public enum EntityEffect {
ARMOR_STAND_HIT(32, ArmorStand.class),
/**
* Entity hurt by thorns attack.
+ * @deprecated in favor of {@link LivingEntity#playHurtAnimation(float)} or {@link Entity#broadcastHurtAnimation(java.util.Collection)}
*/
+ @Deprecated(since = "1.19.4", forRemoval = true) // Paper
THORNS_HURT(33, LivingEntity.class),
/**
* Iron golem puts away rose.
@@ -216,11 +232,15 @@ public enum EntityEffect {
TOTEM_RESURRECT(35, LivingEntity.class),
/**
* Entity hurt due to drowning damage.
+ * @deprecated in favor of {@link LivingEntity#playHurtAnimation(float)} or {@link Entity#broadcastHurtAnimation(java.util.Collection)}
*/
+ @Deprecated(since = "1.19.4", forRemoval = true)
HURT_DROWN(36, LivingEntity.class),
/**
* Entity hurt due to explosion damage.
+ * @deprecated in favor of {@link LivingEntity#playHurtAnimation(float)} or {@link Entity#broadcastHurtAnimation(java.util.Collection)}
*/
+ @Deprecated(since = "1.19.4", forRemoval = true)
HURT_EXPLOSION(37, LivingEntity.class),
/**
* Dolphin has been fed and is locating a structure.
@@ -244,11 +264,15 @@ public enum EntityEffect {
VILLAGER_SPLASH(42, Villager.class),
/**
* Player's bad omen effect removed to start or increase raid difficult.
+ * @deprecated raid system was overhauled in 1.20.5
*/
+ @Deprecated(since = "1.20.5", forRemoval = true)
PLAYER_BAD_OMEN_RAID(43, Player.class),
/**
* Entity hurt due to berry bush. Prickly!
+ * @deprecated in favor of {@link LivingEntity#playHurtAnimation(float)} or {@link Entity#broadcastHurtAnimation(java.util.Collection)}
*/
+ @Deprecated(since = "1.19.4", forRemoval = true)
HURT_BERRY_BUSH(44, LivingEntity.class),
/**
* Fox chews the food in its mouth
@@ -331,7 +355,24 @@ public enum EntityEffect {
* Sniffer must have a target and be in {@link Sniffer.State#SEARCHING} or
* {@link Sniffer.State#DIGGING}
*/
- SNIFFER_DIG(63, Sniffer.class);
+ SNIFFER_DIG(63, Sniffer.class),
+ // Paper start - add missing EntityEffect
+ /**
+ * Armadillo peeks out of its shell
+ */
+ ARMADILLO_PEEK(64, org.bukkit.entity.Armadillo.class),
+ /**
+ * {@link org.bukkit.inventory.EquipmentSlot#BODY} armor piece breaks
+ */
+ BODY_BREAK(65, LivingEntity.class),
+ /**
+ * A creaking transient shaking when being hit.
+ * Does not apply to plain creaking entities as they are not invulnerable like the transient ones spawned by the
+ * creaking heart.
+ */
+ @MinecraftExperimental(MinecraftExperimental.Requires.WINTER_DROP)
+ SHAKE(66, org.bukkit.entity.CreakingTransient.class);
+ // Paper end - add missing EntityEffect
private final byte data;
private final Class<? extends Entity> applicable;
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 725ef320f929d5e3d141c1ed3246d73a7d741f31..d0ae8a94db20281d3664d74718c65234eb2e5f83 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -1159,4 +1159,17 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
@NotNull String getScoreboardEntryName();
// Paper end - entity scoreboard name
+
+ // Paper start - broadcast hurt animation
+ /**
+ * Broadcasts a hurt animation. This fakes incoming damage towards the target entity.
+ * <p>
+ * The target players cannot include {@code this} player. For self-damage, use
+ * {@link Player#sendHurtAnimation(float)}.
+ *
+ * @param players the players to broadcast to (cannot include {@code this}
+ * @throws IllegalArgumentException if {@code this} is contained in {@code players}
+ */
+ void broadcastHurtAnimation(@NotNull java.util.Collection<Player> players);
+ // Paper end - broadcast hurt animation
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 82e92579f899ab3b86c748ba01860262b8ffa17f..95f0b3186e313c7fbd5c8531d52b82a69e525f94 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3899,4 +3899,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@Override
Spigot spigot();
// Spigot end
+
+ // Paper start - entity effect API
+ /**
+ * Plays an entity effect to this player for the target entity
+ * <p>
+ * If the effect is not applicable to this class of entity, it will not play.
+ *
+ * @param effect the entity effect
+ * @param target the target entity
+ */
+ void sendEntityEffect(org.bukkit.@NotNull EntityEffect effect, @NotNull Entity target);
+ // Paper end - entity effect API
}
|