From 39874ebf1a6753718ca9dc175c9a9d6282abf1d5 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sat, 14 Jan 2012 17:35:52 +0000 Subject: [PATCH] Added entity.playEffect, thanks to main-- in an (unfortunately old) PR. By: Nathan Adams --- .../main/java/org/bukkit/EntityEffect.java | 54 +++++++++++++++++++ .../main/java/org/bukkit/entity/Entity.java | 10 ++++ .../bukkit/plugin/messaging/TestPlayer.java | 15 ++---- 3 files changed, 69 insertions(+), 10 deletions(-) create mode 100644 paper-api/src/main/java/org/bukkit/EntityEffect.java diff --git a/paper-api/src/main/java/org/bukkit/EntityEffect.java b/paper-api/src/main/java/org/bukkit/EntityEffect.java new file mode 100644 index 0000000000..9b2550ddb7 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/EntityEffect.java @@ -0,0 +1,54 @@ +package org.bukkit; + +/** + * A list of all Effects that can happen to entities. + */ +public enum EntityEffect { + + /** + * When mobs get hurt. + */ + HURT((byte) 2), + + /** + * When a mob dies. + *

+ * This will cause client-glitches! + */ + DEATH((byte) 3), + + /** + * The smoke when taming a wolf fails. + *

+ * Without client-mods this will be ignored if the entity is not a wolf. + */ + WOLF_SMOKE((byte) 6), + + /** + * The hearts when taming a wolf succeeds. + *

+ * Without client-mods this will be ignored if the entity is not a wolf. + */ + WOLF_HEARTS((byte) 7), + + /** + * When a wolf shakes (after being wet). + *

+ * Without client-mods this will be ignored if the entity is not a wolf. + */ + WOLF_SHAKE((byte) 8); + + private final byte data; + + EntityEffect(byte data) + { + this.data = data; + } + + /** + * @return The data-value that is sent to the client to play this effect. + */ + public byte getData() { + return data; + } +} diff --git a/paper-api/src/main/java/org/bukkit/entity/Entity.java b/paper-api/src/main/java/org/bukkit/entity/Entity.java index b47a7ddbe5..5ecebb46fa 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Entity.java +++ b/paper-api/src/main/java/org/bukkit/entity/Entity.java @@ -1,6 +1,7 @@ package org.bukkit.entity; import org.bukkit.Location; +import org.bukkit.EntityEffect; import org.bukkit.Server; import org.bukkit.World; import org.bukkit.event.entity.EntityDamageEvent; @@ -216,4 +217,13 @@ public interface Entity { * @param value Age of entity */ public void setTicksLived(int value); + + /** + * Performs the specified {@link EntityEffect} for this entity. + *

+ * This will be viewable to all players near the entity. + * + * @param type Effect to play. + */ + public void playEffect(EntityEffect type); } diff --git a/paper-api/src/test/java/org/bukkit/plugin/messaging/TestPlayer.java b/paper-api/src/test/java/org/bukkit/plugin/messaging/TestPlayer.java index 5c392a879d..6fa07704bd 100644 --- a/paper-api/src/test/java/org/bukkit/plugin/messaging/TestPlayer.java +++ b/paper-api/src/test/java/org/bukkit/plugin/messaging/TestPlayer.java @@ -6,16 +6,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; -import org.bukkit.Achievement; -import org.bukkit.Effect; -import org.bukkit.GameMode; -import org.bukkit.Instrument; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Note; -import org.bukkit.Server; -import org.bukkit.Statistic; -import org.bukkit.World; +import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.entity.Arrow; import org.bukkit.entity.Egg; @@ -602,4 +593,8 @@ public class TestPlayer implements Player { public Set getListeningPluginChannels() { throw new UnsupportedOperationException("Not supported yet."); } + + public void playEffect(EntityEffect type) { + throw new UnsupportedOperationException("Not supported yet."); + } }