From b4fab131ee01192ae3d6fa9bf33cdc2dc2af9076 Mon Sep 17 00:00:00 2001 From: Morpheus Date: Sat, 6 Jul 2024 16:27:02 +0000 Subject: [PATCH] Refactor projectiles classes (#2552) * Refactor projectiles classes * run spotlessApply * Update EyeOfEnder.java * Rename ArrowEntity to ArrowLike * Drop EntityTargetingProjectile * Add ItemSupplier and remove ThrowableProjectile * Abstract ItemRepresentable behaviour to a separate class * Update item frames * Update ItemRepresentable.java * run spotlessApply * Rename DamagingProjectile to AcceleratingProjectile * run spotlessApply * Update ShulkerBullet.java * Update EyeOfEnder.java --- .../java/org/spongepowered/api/data/Keys.java | 18 +++++------ .../api/data/type/PickupRule.java | 4 +-- .../org/spongepowered/api/entity/Item.java | 12 +------- ...Projectile.java => ItemRepresentable.java} | 19 +++++------- .../api/entity/OminousItemSpawner.java | 2 +- .../api/entity/display/ItemDisplay.java | 12 ++------ ...ctile.java => AcceleratingProjectile.java} | 4 +-- .../api/entity/projectile/Egg.java | 2 +- .../api/entity/projectile/EnderPearl.java | 2 +- .../api/entity/projectile/EvokerFangs.java | 4 ++- .../entity/projectile/ExperienceBottle.java | 2 +- .../api/entity/projectile/EyeOfEnder.java | 3 +- .../entity/projectile/IgnitingProjectile.java | 3 +- .../api/entity/projectile/Potion.java | 13 +------- .../api/entity/projectile/Projectile.java | 3 +- .../api/entity/projectile/ShulkerBullet.java | 16 ++++++++-- .../api/entity/projectile/Snowball.java | 2 +- .../projectile/ThrowableItemProjectile.java | 30 +++++++++++++++++++ .../api/entity/projectile/arrow/Arrow.java | 2 +- .../{ArrowEntity.java => ArrowLike.java} | 6 ++-- .../projectile/arrow/SpectralArrow.java | 4 +-- .../api/entity/projectile/arrow/Trident.java | 2 +- .../projectile/explosive/FireworkRocket.java | 3 +- .../projectile/explosive/WitherSkull.java | 4 +-- .../explosive/fireball/DragonFireball.java | 4 +-- .../projectile/windcharge/WindChargeLike.java | 5 ++-- .../api/event/entity/AttackEntityEvent.java | 6 ++-- .../api/event/entity/DamageEntityEvent.java | 6 ++-- 28 files changed, 103 insertions(+), 90 deletions(-) rename src/main/java/org/spongepowered/api/entity/{projectile/EntityTargetingProjectile.java => ItemRepresentable.java} (74%) rename src/main/java/org/spongepowered/api/entity/projectile/{DamagingProjectile.java => AcceleratingProjectile.java} (93%) create mode 100644 src/main/java/org/spongepowered/api/entity/projectile/ThrowableItemProjectile.java rename src/main/java/org/spongepowered/api/entity/projectile/arrow/{ArrowEntity.java => ArrowLike.java} (94%) diff --git a/src/main/java/org/spongepowered/api/data/Keys.java b/src/main/java/org/spongepowered/api/data/Keys.java index 3122e3a99aa..5ac39dabeaf 100644 --- a/src/main/java/org/spongepowered/api/data/Keys.java +++ b/src/main/java/org/spongepowered/api/data/Keys.java @@ -189,7 +189,7 @@ import org.spongepowered.api.entity.living.player.server.ServerPlayer; import org.spongepowered.api.entity.living.slime.Slime; import org.spongepowered.api.entity.living.trader.Villager; -import org.spongepowered.api.entity.projectile.DamagingProjectile; +import org.spongepowered.api.entity.projectile.AcceleratingProjectile; import org.spongepowered.api.entity.projectile.EyeOfEnder; import org.spongepowered.api.entity.projectile.FishingBobber; import org.spongepowered.api.entity.projectile.IgnitingProjectile; @@ -197,7 +197,7 @@ import org.spongepowered.api.entity.projectile.Projectile; import org.spongepowered.api.entity.projectile.ShulkerBullet; import org.spongepowered.api.entity.projectile.arrow.Arrow; -import org.spongepowered.api.entity.projectile.arrow.ArrowEntity; +import org.spongepowered.api.entity.projectile.arrow.ArrowLike; import org.spongepowered.api.entity.projectile.explosive.FireworkRocket; import org.spongepowered.api.entity.projectile.explosive.WitherSkull; import org.spongepowered.api.entity.vehicle.Boat; @@ -304,7 +304,7 @@ public final class Keys { public static final Key> ABSORPTION = Keys.key(ResourceKey.sponge("absorption"), Double.class); /** - * The acceleration of a {@link DamagingProjectile}. + * The acceleration of a {@link AcceleratingProjectile}. */ public static final Key> ACCELERATION = Keys.key(ResourceKey.sponge("acceleration"), Double.class); @@ -413,7 +413,7 @@ public final class Keys { public static final Key> ATTACHMENT_SURFACE = Keys.key(ResourceKey.sponge("attachment_surface"), AttachmentSurface.class); /** - * The damage dealt by an {@link ArrowEntity} on impact. + * The damage dealt by an {@link ArrowLike} on impact. */ public static final Key> ATTACK_DAMAGE = Keys.key(ResourceKey.sponge("attack_damage"), Double.class); @@ -781,11 +781,11 @@ public final class Keys { public static final Key> CURRENT_SPELL = Keys.key(ResourceKey.sponge("current_spell"), SpellType.class); /** - * The damage dealt towards entities of a specific {@link EntityType} by a {@link ArrowEntity}. + * The damage dealt towards entities of a specific {@link EntityType} by a {@link ArrowLike}. * *

Note that in events, the damage defined for the provided * {@link EntityType} will take priority over the "default" damage as - * defined from {@link ArrowEntity#attackDamage()}.

+ * defined from {@link ArrowLike#attackDamage()}.

* *

Types not present in this mapping will be * dealt damage to according to {@link #ATTACK_DAMAGE}.

@@ -2089,7 +2089,7 @@ public final class Keys { public static final Key> ITEM_STACK_SNAPSHOT = Keys.key(ResourceKey.sponge("item_stack_snapshot"), ItemStackSnapshot.class); /** - * The custom knockback strength applied by an {@link ArrowEntity}. + * The custom knockback strength applied by an {@link ArrowLike}. * *

For the knockback provided by hits with a weapon according to the * enchantment of the same name, see {@link #APPLIED_ENCHANTMENTS}.

@@ -2538,7 +2538,7 @@ public final class Keys { public static final Key> PICKUP_DELAY = Keys.key(ResourceKey.sponge("pickup_delay"), Ticks.class); /** - * The {@link PickupRule} of an {@link ArrowEntity}. + * The {@link PickupRule} of an {@link ArrowLike}. */ public static final Key> PICKUP_RULE = Keys.key(ResourceKey.sponge("pickup_rule"), PickupRule.class); @@ -2605,7 +2605,7 @@ public final class Keys { /** * The potion effects that are present on an {@link Entity} - *

or applied by an {@link AreaEffectCloud} or {@link ArrowEntity}

+ *

or applied by an {@link AreaEffectCloud} or {@link ArrowLike}

*

or stored on an {@link ItemStack}.

*/ public static final Key> POTION_EFFECTS = Keys.listKey(ResourceKey.sponge("potion_effects"), PotionEffect.class); diff --git a/src/main/java/org/spongepowered/api/data/type/PickupRule.java b/src/main/java/org/spongepowered/api/data/type/PickupRule.java index 143a82ec830..c9c78eaddf2 100644 --- a/src/main/java/org/spongepowered/api/data/type/PickupRule.java +++ b/src/main/java/org/spongepowered/api/data/type/PickupRule.java @@ -24,12 +24,12 @@ */ package org.spongepowered.api.data.type; -import org.spongepowered.api.entity.projectile.arrow.ArrowEntity; +import org.spongepowered.api.entity.projectile.arrow.ArrowLike; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; /** - * Represents a pickup rule used by {@link ArrowEntity}s. + * Represents a pickup rule used by {@link ArrowLike}s. */ @CatalogedBy(PickupRules.class) public interface PickupRule extends DefaultedRegistryValue { diff --git a/src/main/java/org/spongepowered/api/entity/Item.java b/src/main/java/org/spongepowered/api/entity/Item.java index e159ce697d0..6d534512fe4 100644 --- a/src/main/java/org/spongepowered/api/entity/Item.java +++ b/src/main/java/org/spongepowered/api/entity/Item.java @@ -26,22 +26,12 @@ import org.spongepowered.api.data.Keys; import org.spongepowered.api.data.value.Value; -import org.spongepowered.api.item.inventory.ItemStackSnapshot; import org.spongepowered.api.util.Ticks; /** * Represents an Item. */ -public interface Item extends Entity { - - /** - * {@link Keys#ITEM_STACK_SNAPSHOT} - * - * @return The item being represented by this entity - */ - default Value.Mutable item() { - return this.requireValue(Keys.ITEM_STACK_SNAPSHOT).asMutable(); - } +public interface Item extends Entity, ItemRepresentable { /** * {@link Keys#DESPAWN_DELAY} diff --git a/src/main/java/org/spongepowered/api/entity/projectile/EntityTargetingProjectile.java b/src/main/java/org/spongepowered/api/entity/ItemRepresentable.java similarity index 74% rename from src/main/java/org/spongepowered/api/entity/projectile/EntityTargetingProjectile.java rename to src/main/java/org/spongepowered/api/entity/ItemRepresentable.java index 99511010ac2..6bc4d67d716 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/EntityTargetingProjectile.java +++ b/src/main/java/org/spongepowered/api/entity/ItemRepresentable.java @@ -22,25 +22,20 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.entity.projectile; +package org.spongepowered.api.entity; 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; -import java.util.Optional; - -/** - * Represents a {@link Projectile} targeting an {@link Entity} - */ -public interface EntityTargetingProjectile extends Projectile { +public interface ItemRepresentable extends Entity { /** - * {@link Keys#TARGET_ENTITY} + * {@link Keys#ITEM_STACK_SNAPSHOT} * - * @return The targeted entity, if available + * @return The item being represented by this entity */ - default Optional> targetEntity() { - return this.getValue(Keys.TARGET_ENTITY).map(Value::asMutable); + default Value.Mutable item() { + return this.requireValue(Keys.ITEM_STACK_SNAPSHOT).asMutable(); } } diff --git a/src/main/java/org/spongepowered/api/entity/OminousItemSpawner.java b/src/main/java/org/spongepowered/api/entity/OminousItemSpawner.java index 77d161317f5..f910cf8787b 100644 --- a/src/main/java/org/spongepowered/api/entity/OminousItemSpawner.java +++ b/src/main/java/org/spongepowered/api/entity/OminousItemSpawner.java @@ -24,5 +24,5 @@ */ package org.spongepowered.api.entity; -public interface OminousItemSpawner extends Entity { +public interface OminousItemSpawner extends Entity, ItemRepresentable { } diff --git a/src/main/java/org/spongepowered/api/entity/display/ItemDisplay.java b/src/main/java/org/spongepowered/api/entity/display/ItemDisplay.java index 8ea8d27c073..62d55442a6d 100644 --- a/src/main/java/org/spongepowered/api/entity/display/ItemDisplay.java +++ b/src/main/java/org/spongepowered/api/entity/display/ItemDisplay.java @@ -25,20 +25,12 @@ package org.spongepowered.api.entity.display; import org.spongepowered.api.data.Keys; -import org.spongepowered.api.item.inventory.ItemStackSnapshot; +import org.spongepowered.api.entity.ItemRepresentable; /** * A ItemDisplay is an entity that displays a single item in the world. */ -public interface ItemDisplay extends DisplayEntity { - /** - * Returns the {@link ItemStackSnapshot item} displayed. - * - * @return The item displayed - */ - default ItemStackSnapshot displayedItem() { - return this.require(Keys.ITEM_STACK_SNAPSHOT); - } +public interface ItemDisplay extends DisplayEntity, ItemRepresentable { /** * Returns the {@link ItemDisplayType display type}. diff --git a/src/main/java/org/spongepowered/api/entity/projectile/DamagingProjectile.java b/src/main/java/org/spongepowered/api/entity/projectile/AcceleratingProjectile.java similarity index 93% rename from src/main/java/org/spongepowered/api/entity/projectile/DamagingProjectile.java rename to src/main/java/org/spongepowered/api/entity/projectile/AcceleratingProjectile.java index 3cd4aaaea45..6e095e8cc90 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/DamagingProjectile.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/AcceleratingProjectile.java @@ -28,9 +28,9 @@ import org.spongepowered.api.data.value.Value; /** - * Represents a {@link Projectile} that inflicts damage. + * Represents a {@link Projectile} that can accelerate. */ -public interface DamagingProjectile extends Projectile { +public interface AcceleratingProjectile extends Projectile { /** * {@link Keys#ACCELERATION} diff --git a/src/main/java/org/spongepowered/api/entity/projectile/Egg.java b/src/main/java/org/spongepowered/api/entity/projectile/Egg.java index 4a9bf7efe88..b182ce04ae0 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/Egg.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/Egg.java @@ -27,6 +27,6 @@ /** * Represents a thrown egg. */ -public interface Egg extends DamagingProjectile { +public interface Egg extends ThrowableItemProjectile { } diff --git a/src/main/java/org/spongepowered/api/entity/projectile/EnderPearl.java b/src/main/java/org/spongepowered/api/entity/projectile/EnderPearl.java index 6ed411b521f..d1537f51553 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/EnderPearl.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/EnderPearl.java @@ -27,6 +27,6 @@ /** * Represents an Ender Pearl. */ -public interface EnderPearl extends DamagingProjectile { +public interface EnderPearl extends ThrowableItemProjectile { } diff --git a/src/main/java/org/spongepowered/api/entity/projectile/EvokerFangs.java b/src/main/java/org/spongepowered/api/entity/projectile/EvokerFangs.java index d91406e7ffe..0d170eca508 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/EvokerFangs.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/EvokerFangs.java @@ -24,5 +24,7 @@ */ package org.spongepowered.api.entity.projectile; -public interface EvokerFangs extends Projectile { +import org.spongepowered.api.entity.Entity; + +public interface EvokerFangs extends Entity { } diff --git a/src/main/java/org/spongepowered/api/entity/projectile/ExperienceBottle.java b/src/main/java/org/spongepowered/api/entity/projectile/ExperienceBottle.java index 10e8d734a86..66b2aae2331 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/ExperienceBottle.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/ExperienceBottle.java @@ -27,6 +27,6 @@ /** * Represents a thrown experience bottle. */ -public interface ExperienceBottle extends Projectile { +public interface ExperienceBottle extends ThrowableItemProjectile { } 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 6a20906148c..20490eed056 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/EyeOfEnder.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/EyeOfEnder.java @@ -26,13 +26,14 @@ import org.spongepowered.api.data.Keys; import org.spongepowered.api.data.value.Value; +import org.spongepowered.api.entity.ItemRepresentable; import org.spongepowered.api.util.Ticks; import org.spongepowered.math.vector.Vector3d; /** * Represents an Eye of Ender. */ -public interface EyeOfEnder extends Projectile { +public interface EyeOfEnder extends Projectile, ItemRepresentable { /** * {@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 0566a866b68..85b2c8e463d 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/IgnitingProjectile.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/IgnitingProjectile.java @@ -24,11 +24,12 @@ */ package org.spongepowered.api.entity.projectile; +import org.spongepowered.api.entity.ItemRepresentable; import org.spongepowered.api.entity.projectile.explosive.fireball.SmallFireball; /** * Represents an abstract projectile that may ignite, such as {@link SmallFireball}. */ -public interface IgnitingProjectile extends DamagingProjectile { +public interface IgnitingProjectile extends AcceleratingProjectile, ItemRepresentable { } 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 fe674ef36f8..79577212e74 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/Potion.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/Potion.java @@ -26,23 +26,12 @@ 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 Projectile { - - /** - * {@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(); - } +public interface Potion extends ThrowableItemProjectile { /** * {@link Keys#POTION_EFFECTS} diff --git a/src/main/java/org/spongepowered/api/entity/projectile/Projectile.java b/src/main/java/org/spongepowered/api/entity/projectile/Projectile.java index cf45ae81120..aa54c65ca35 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/Projectile.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/Projectile.java @@ -32,8 +32,7 @@ import java.util.Optional; /** - * Represents entities that act as projectiles and can fly in the air. - * For example, Arrows. + * Represents an abstract projectile. */ public interface Projectile extends Entity { diff --git a/src/main/java/org/spongepowered/api/entity/projectile/ShulkerBullet.java b/src/main/java/org/spongepowered/api/entity/projectile/ShulkerBullet.java index 2854b4c645a..76537bbeac8 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/ShulkerBullet.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/ShulkerBullet.java @@ -26,20 +26,32 @@ import org.spongepowered.api.data.Keys; import org.spongepowered.api.data.value.Value; +import org.spongepowered.api.entity.Entity; import org.spongepowered.api.entity.living.golem.Shulker; import org.spongepowered.api.util.Direction; +import java.util.Optional; + /** * A {@link ShulkerBullet} is the projectile {@link Shulker}s shoot. */ -public interface ShulkerBullet extends EntityTargetingProjectile, DamagingProjectile { +public interface ShulkerBullet extends Projectile { /** * {@link Keys#DIRECTION} * * @return The direction of this bullet */ - default Value.Mutable hangingDirection() { + default Value.Mutable flyingDirection() { return this.requireValue(Keys.DIRECTION).asMutable(); } + + /** + * {@link Keys#TARGET_ENTITY} + * + * @return The targeted entity, if available + */ + default Optional> targetEntity() { + return this.getValue(Keys.TARGET_ENTITY).map(Value::asMutable); + } } diff --git a/src/main/java/org/spongepowered/api/entity/projectile/Snowball.java b/src/main/java/org/spongepowered/api/entity/projectile/Snowball.java index 30d4299219f..9ac052c23af 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/Snowball.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/Snowball.java @@ -27,6 +27,6 @@ /** * Represents a Snowball. */ -public interface Snowball extends DamagingProjectile { +public interface Snowball extends ThrowableItemProjectile { } diff --git a/src/main/java/org/spongepowered/api/entity/projectile/ThrowableItemProjectile.java b/src/main/java/org/spongepowered/api/entity/projectile/ThrowableItemProjectile.java new file mode 100644 index 00000000000..8244d181430 --- /dev/null +++ b/src/main/java/org/spongepowered/api/entity/projectile/ThrowableItemProjectile.java @@ -0,0 +1,30 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package org.spongepowered.api.entity.projectile; + +import org.spongepowered.api.entity.ItemRepresentable; + +public interface ThrowableItemProjectile extends Projectile, ItemRepresentable { +} diff --git a/src/main/java/org/spongepowered/api/entity/projectile/arrow/Arrow.java b/src/main/java/org/spongepowered/api/entity/projectile/arrow/Arrow.java index 37341d82337..46f6a20c6ba 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/arrow/Arrow.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/arrow/Arrow.java @@ -31,7 +31,7 @@ /** * An arrow generally "tipped" with one or more potion effects. */ -public interface Arrow extends ArrowEntity { +public interface Arrow extends ArrowLike { /** * {@link Keys#POTION_EFFECTS} diff --git a/src/main/java/org/spongepowered/api/entity/projectile/arrow/ArrowEntity.java b/src/main/java/org/spongepowered/api/entity/projectile/arrow/ArrowLike.java similarity index 94% rename from src/main/java/org/spongepowered/api/entity/projectile/arrow/ArrowEntity.java rename to src/main/java/org/spongepowered/api/entity/projectile/arrow/ArrowLike.java index cc064c6a0af..5c79566174c 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/arrow/ArrowEntity.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/arrow/ArrowLike.java @@ -29,12 +29,12 @@ import org.spongepowered.api.data.value.MapValue; import org.spongepowered.api.data.value.Value; import org.spongepowered.api.entity.EntityType; -import org.spongepowered.api.entity.projectile.DamagingProjectile; +import org.spongepowered.api.entity.projectile.Projectile; /** - * Represents an Arrow. + * An abstract representation of an Arrow. */ -public interface ArrowEntity extends DamagingProjectile { +public interface ArrowLike extends Projectile { /** * {@link Keys#PICKUP_RULE} diff --git a/src/main/java/org/spongepowered/api/entity/projectile/arrow/SpectralArrow.java b/src/main/java/org/spongepowered/api/entity/projectile/arrow/SpectralArrow.java index 563611c4c38..ccb6c71ac8b 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/arrow/SpectralArrow.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/arrow/SpectralArrow.java @@ -27,9 +27,9 @@ import org.spongepowered.api.effect.potion.PotionEffectTypes; /** - * An {@link ArrowEntity} which applies the {@link PotionEffectTypes#GLOWING} + * An {@link ArrowLike} which applies the {@link PotionEffectTypes#GLOWING} * effect on hit. */ -public interface SpectralArrow extends ArrowEntity { +public interface SpectralArrow extends ArrowLike { } diff --git a/src/main/java/org/spongepowered/api/entity/projectile/arrow/Trident.java b/src/main/java/org/spongepowered/api/entity/projectile/arrow/Trident.java index 0d6fbc2c2e1..56ec48a1b1b 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/arrow/Trident.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/arrow/Trident.java @@ -24,5 +24,5 @@ */ package org.spongepowered.api.entity.projectile.arrow; -public interface Trident extends ArrowEntity { +public interface Trident extends ArrowLike { } 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 ae394a811c9..90d8f073513 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 @@ -27,6 +27,7 @@ import org.spongepowered.api.data.Keys; import org.spongepowered.api.data.value.ListValue; import org.spongepowered.api.data.value.Value; +import org.spongepowered.api.entity.ItemRepresentable; import org.spongepowered.api.entity.explosive.fused.FusedExplosive; import org.spongepowered.api.entity.projectile.Projectile; import org.spongepowered.api.item.FireworkEffect; @@ -37,7 +38,7 @@ /** * Represents a Firework. */ -public interface FireworkRocket extends Projectile, FusedExplosive { +public interface FireworkRocket extends Projectile, FusedExplosive, ItemRepresentable { /** * {@link Keys#FIREWORK_EFFECTS} diff --git a/src/main/java/org/spongepowered/api/entity/projectile/explosive/WitherSkull.java b/src/main/java/org/spongepowered/api/entity/projectile/explosive/WitherSkull.java index 47909f38c28..926b5beaf78 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/explosive/WitherSkull.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/explosive/WitherSkull.java @@ -25,11 +25,11 @@ package org.spongepowered.api.entity.projectile.explosive; import org.spongepowered.api.entity.explosive.Explosive; -import org.spongepowered.api.entity.projectile.DamagingProjectile; +import org.spongepowered.api.entity.projectile.AcceleratingProjectile; /** * Represents a Wither Skull. */ -public interface WitherSkull extends DamagingProjectile, Explosive { +public interface WitherSkull extends AcceleratingProjectile, Explosive { } diff --git a/src/main/java/org/spongepowered/api/entity/projectile/explosive/fireball/DragonFireball.java b/src/main/java/org/spongepowered/api/entity/projectile/explosive/fireball/DragonFireball.java index 24060391117..4bf9fe21b1c 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/explosive/fireball/DragonFireball.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/explosive/fireball/DragonFireball.java @@ -24,8 +24,8 @@ */ package org.spongepowered.api.entity.projectile.explosive.fireball; -import org.spongepowered.api.entity.projectile.DamagingProjectile; +import org.spongepowered.api.entity.projectile.AcceleratingProjectile; -public interface DragonFireball extends DamagingProjectile { +public interface DragonFireball extends AcceleratingProjectile { } 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 3ab50a37961..cf1a82630ce 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 @@ -24,7 +24,8 @@ */ package org.spongepowered.api.entity.projectile.windcharge; -import org.spongepowered.api.entity.projectile.DamagingProjectile; +import org.spongepowered.api.entity.ItemRepresentable; +import org.spongepowered.api.entity.projectile.AcceleratingProjectile; -public interface WindChargeLike extends DamagingProjectile { +public interface WindChargeLike extends AcceleratingProjectile, ItemRepresentable { } diff --git a/src/main/java/org/spongepowered/api/event/entity/AttackEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/AttackEntityEvent.java index af39e58ab8a..208f68a4108 100644 --- a/src/main/java/org/spongepowered/api/event/entity/AttackEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/AttackEntityEvent.java @@ -30,7 +30,7 @@ import org.spongepowered.api.entity.living.Living; import org.spongepowered.api.entity.living.monster.skeleton.Skeleton; import org.spongepowered.api.entity.living.player.Player; -import org.spongepowered.api.entity.projectile.arrow.ArrowEntity; +import org.spongepowered.api.entity.projectile.arrow.ArrowLike; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Cause; import org.spongepowered.api.event.Event; @@ -64,7 +64,7 @@ * Due to this ambiguous variety of information that is possible to provide, * the {@link AttackEntityEvent} can be summarized as so: * - *

An {@link ArrowEntity}, + *

An {@link ArrowLike}, * that was shot by a {@link Skeleton}, * with an enchanted {@link ItemTypes#BOW} {@link ItemStack}, * when the {@link World} {@link Difficulty} was set to @@ -85,7 +85,7 @@ * be included in order of "priority of relation" to "attacking" the entity. In * short, if another {@link Entity} is considered a "team member" to the * attacking {@link Entity}, the "team member" may be a second element within - * the {@link Cause}. The same can be said if an {@link ArrowEntity} was shot from + * the {@link Cause}. The same can be said if an {@link ArrowLike} was shot from * a {@link Dispenser} that was triggered by a {@link Player} flipping a * switch.

* diff --git a/src/main/java/org/spongepowered/api/event/entity/DamageEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/DamageEntityEvent.java index 93c16567730..990a05a1deb 100644 --- a/src/main/java/org/spongepowered/api/event/entity/DamageEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/DamageEntityEvent.java @@ -28,7 +28,7 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.entity.living.monster.skeleton.Skeleton; import org.spongepowered.api.entity.living.player.Player; -import org.spongepowered.api.entity.projectile.arrow.ArrowEntity; +import org.spongepowered.api.entity.projectile.arrow.ArrowLike; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Cause; import org.spongepowered.api.event.Event; @@ -60,7 +60,7 @@ * Due to this ambiguous variety of information that is possible to provide, * the {@link DamageEntityEvent} can be summarized as so: * - *

An {@link ArrowEntity}, + *

An {@link ArrowLike}, * that was shot by a {@link Skeleton}, * with an enchanted {@link ItemTypes#BOW} {@link ItemStack}, * when the {@link World} {@link Difficulty} was set to @@ -81,7 +81,7 @@ * be included in order of "priority of relation" to "attacking" the entity. In * short, if another {@link Entity} is considered a "team member" to the * attacking {@link Entity}, the "team member" may be a second element within - * the {@link Cause}. The same can be said if an {@link ArrowEntity} was shot from + * the {@link Cause}. The same can be said if an {@link ArrowLike} was shot from * a {@link Dispenser} that was triggered by a {@link Player} flipping a * switch.

*