diff --git a/src/main/java/org/spongepowered/api/entity/projectile/EyeOfEnder.java b/src/main/java/org/spongepowered/api/entity/projectile/EyeOfEnder.java index 6a20906148..1bcbaf7aa2 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/EyeOfEnder.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/EyeOfEnder.java @@ -32,7 +32,7 @@ /** * Represents an Eye of Ender. */ -public interface EyeOfEnder extends Projectile { +public interface EyeOfEnder extends Projectile, ItemSupplier { /** * {@link Keys#DESPAWN_DELAY} diff --git a/src/main/java/org/spongepowered/api/entity/projectile/IgnitingProjectile.java b/src/main/java/org/spongepowered/api/entity/projectile/IgnitingProjectile.java index 0566a866b6..61998fcdfe 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/IgnitingProjectile.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/IgnitingProjectile.java @@ -29,6 +29,6 @@ /** * Represents an abstract projectile that may ignite, such as {@link SmallFireball}. */ -public interface IgnitingProjectile extends DamagingProjectile { +public interface IgnitingProjectile extends DamagingProjectile, ItemSupplier { } diff --git a/src/main/java/org/spongepowered/api/entity/projectile/ThrowableProjectile.java b/src/main/java/org/spongepowered/api/entity/projectile/ItemSupplier.java similarity index 72% rename from src/main/java/org/spongepowered/api/entity/projectile/ThrowableProjectile.java rename to src/main/java/org/spongepowered/api/entity/projectile/ItemSupplier.java index c353596e93..c0ad363aef 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/ThrowableProjectile.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/ItemSupplier.java @@ -24,5 +24,19 @@ */ package org.spongepowered.api.entity.projectile; -public interface ThrowableProjectile extends Projectile { +import org.spongepowered.api.data.Keys; +import org.spongepowered.api.data.value.Value; +import org.spongepowered.api.entity.Entity; +import org.spongepowered.api.item.inventory.ItemStackSnapshot; + +public interface ItemSupplier extends Entity { + + /** + * {@link Keys#ITEM_STACK_SNAPSHOT} + * + * @return The potion item represented by this potion + */ + default Value.Mutable item() { + return this.requireValue(Keys.ITEM_STACK_SNAPSHOT).asMutable(); + } } diff --git a/src/main/java/org/spongepowered/api/entity/projectile/Potion.java b/src/main/java/org/spongepowered/api/entity/projectile/Potion.java index 867646eda5..79577212e7 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/Potion.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/Potion.java @@ -26,24 +26,13 @@ import org.spongepowered.api.data.Keys; import org.spongepowered.api.data.value.ListValue; -import org.spongepowered.api.data.value.Value; import org.spongepowered.api.effect.potion.PotionEffect; -import org.spongepowered.api.item.inventory.ItemStackSnapshot; /** * Represents a thrown potion. */ public interface Potion extends ThrowableItemProjectile { - /** - * {@link Keys#ITEM_STACK_SNAPSHOT} - * - * @return The potion item represented by this potion - */ - default Value.Mutable item() { - return this.requireValue(Keys.ITEM_STACK_SNAPSHOT).asMutable(); - } - /** * {@link Keys#POTION_EFFECTS} * diff --git a/src/main/java/org/spongepowered/api/entity/projectile/ThrowableItemProjectile.java b/src/main/java/org/spongepowered/api/entity/projectile/ThrowableItemProjectile.java index 3f7f463b30..26e63ad9e3 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/ThrowableItemProjectile.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/ThrowableItemProjectile.java @@ -24,5 +24,5 @@ */ package org.spongepowered.api.entity.projectile; -public interface ThrowableItemProjectile extends ThrowableProjectile { +public interface ThrowableItemProjectile extends Projectile, ItemSupplier { } diff --git a/src/main/java/org/spongepowered/api/entity/projectile/explosive/FireworkRocket.java b/src/main/java/org/spongepowered/api/entity/projectile/explosive/FireworkRocket.java index ae394a811c..15eef66c90 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/explosive/FireworkRocket.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/explosive/FireworkRocket.java @@ -28,6 +28,7 @@ import org.spongepowered.api.data.value.ListValue; import org.spongepowered.api.data.value.Value; import org.spongepowered.api.entity.explosive.fused.FusedExplosive; +import org.spongepowered.api.entity.projectile.ItemSupplier; import org.spongepowered.api.entity.projectile.Projectile; import org.spongepowered.api.item.FireworkEffect; import org.spongepowered.api.util.Ticks; @@ -37,7 +38,7 @@ /** * Represents a Firework. */ -public interface FireworkRocket extends Projectile, FusedExplosive { +public interface FireworkRocket extends Projectile, FusedExplosive, ItemSupplier { /** * {@link Keys#FIREWORK_EFFECTS} diff --git a/src/main/java/org/spongepowered/api/entity/projectile/windcharge/WindChargeLike.java b/src/main/java/org/spongepowered/api/entity/projectile/windcharge/WindChargeLike.java index 3ab50a3796..cac3569b5b 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/windcharge/WindChargeLike.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/windcharge/WindChargeLike.java @@ -25,6 +25,7 @@ package org.spongepowered.api.entity.projectile.windcharge; import org.spongepowered.api.entity.projectile.DamagingProjectile; +import org.spongepowered.api.entity.projectile.ItemSupplier; -public interface WindChargeLike extends DamagingProjectile { +public interface WindChargeLike extends DamagingProjectile, ItemSupplier { }