Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Aerial to abstract flying trait #2540

Merged
merged 3 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,22 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.entity.living;
package org.spongepowered.api.entity;

import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.value.Value;

/**
* Represents an entity that flies, such as a bat.
* Represents an {@link Entity} which can fly.
*/
public interface Aerial extends Agent {
public interface Aerial extends Entity {

/**
* {@link Keys#IS_FLYING}
*
* @return Whether the entity is flying
*/
default Value.Mutable<Boolean> flying() {
return this.requireValue(Keys.IS_FLYING).asMutable();
}
}
1 change: 1 addition & 0 deletions src/main/java/org/spongepowered/api/entity/living/Bat.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.Aerial;

/**
* Represents a Bat.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
*/
package org.spongepowered.api.entity.living.animal;

import org.spongepowered.api.entity.Aerial;

/**
* Represents a Bee.
*/
public interface Bee extends Animal {
public interface Bee extends Animal, Aerial {
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.type.ParrotType;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.Aerial;

/**
* Represents a Parrot.
*/
public interface Parrot extends TameableAnimal {
public interface Parrot extends TameableAnimal, Aerial {

/**
* {@link Keys#PARROT_TYPE}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.living.Aerial;
import org.spongepowered.api.entity.Aerial;
import org.spongepowered.api.entity.living.Monster;
import org.spongepowered.api.entity.living.Ranger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
package org.spongepowered.api.entity.living.monster;

import org.spongepowered.api.entity.living.Aerial;
import org.spongepowered.api.entity.Aerial;
import org.spongepowered.api.entity.living.Hostile;
import org.spongepowered.api.entity.living.Ranger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.type.PhantomPhase;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.living.Aerial;
import org.spongepowered.api.entity.Aerial;
import org.spongepowered.api.entity.living.Agent;

public interface Phantom extends Agent, Aerial {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.value.ListValue;
import org.spongepowered.api.entity.Aerial;
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.entity.explosive.fused.FusedExplosive;
import org.spongepowered.api.entity.living.Aerial;
import org.spongepowered.api.entity.living.Monster;
import org.spongepowered.api.entity.living.Ranger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.Aerial;
import org.spongepowered.api.entity.explosive.EndCrystal;
import org.spongepowered.api.entity.living.Aerial;
import org.spongepowered.api.entity.living.ComplexLiving;
import org.spongepowered.api.entity.living.Monster;
import org.spongepowered.api.entity.living.Ranger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.spongepowered.api.data.type.HandPreference;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.effect.Viewer;
import org.spongepowered.api.entity.Aerial;
import org.spongepowered.api.entity.living.Humanoid;
import org.spongepowered.api.item.inventory.Carrier;
import org.spongepowered.api.item.inventory.Inventory;
Expand All @@ -40,7 +41,7 @@
/**
* A Player is the representation of an actual unit playing the game.
*/
public interface Player extends Humanoid, Identified, LocaleSource, Viewer, Carrier {
public interface Player extends Humanoid, Identified, LocaleSource, Viewer, Carrier, Aerial {

/**
* Gets the associated {@link GameProfile} of this player.
Expand Down Expand Up @@ -155,15 +156,6 @@ default Value.Mutable<Integer> foodLevel() {
return this.requireValue(Keys.FOOD_LEVEL).asMutable();
}

/**
* {@link Keys#IS_FLYING}
*
* @return Whether the entity is flying
*/
default Value.Mutable<Boolean> flying() {
return this.requireValue(Keys.IS_FLYING).asMutable();
}

/**
* {@link Keys#IS_SLEEPING}
*
Expand Down