Skip to content

Commit

Permalink
Add ItemSupplier and remove ThrowableProjectile
Browse files Browse the repository at this point in the history
  • Loading branch information
ImMorpheus committed Jul 6, 2024
1 parent a6ce6a1 commit e7285f7
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
/**
* Represents an Eye of Ender.
*/
public interface EyeOfEnder extends Projectile {
public interface EyeOfEnder extends Projectile, ItemSupplier {

/**
* {@link Keys#DESPAWN_DELAY}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<ItemStackSnapshot> item() {
return this.requireValue(Keys.ITEM_STACK_SNAPSHOT).asMutable();
}
}
11 changes: 0 additions & 11 deletions src/main/java/org/spongepowered/api/entity/projectile/Potion.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<ItemStackSnapshot> item() {
return this.requireValue(Keys.ITEM_STACK_SNAPSHOT).asMutable();
}

/**
* {@link Keys#POTION_EFFECTS}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
*/
package org.spongepowered.api.entity.projectile;

public interface ThrowableItemProjectile extends ThrowableProjectile {
public interface ThrowableItemProjectile extends Projectile, ItemSupplier {
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -37,7 +38,7 @@
/**
* Represents a Firework.
*/
public interface FireworkRocket extends Projectile, FusedExplosive {
public interface FireworkRocket extends Projectile, FusedExplosive, ItemSupplier {

/**
* {@link Keys#FIREWORK_EFFECTS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}

0 comments on commit e7285f7

Please sign in to comment.