Add/move/fix default data methods of all entities
* Keys.POTION_EFFECTS now always present, but may be empty * Do not consider ourselves as a base vehicle
This commit is contained in:
1 parent
0c268e3895
commit
a7ee7bd3d7
61 files changed
+1071
-243
No files matched your search
@@ -443,7 +443,7 @@ public final class Keys {
|
||||
|
||||
/**
|
||||
* The {@link BossBar} displayed to the client by a {@link Boss}.
|
||||
* Readonly but mutable?
|
||||
* TODO Readonly but mutable?
|
||||
*/
|
||||
public static final Key<Value<BossBar>> BOSS_BAR = Keys.key(ResourceKey.sponge("boss_bar"), BossBar.class);
|
||||
|
||||
@@ -603,11 +603,11 @@ public final class Keys {
|
||||
public static final Key<Value<SpellType>> CURRENT_SPELL = Keys.key(ResourceKey.sponge("current_spell"), SpellType.class);
|
||||
|
||||
/**
|
||||
* The damage dealt towards entities of a specific {@link EntityType} by a {@link DamagingProjectile}.
|
||||
* The damage dealt towards entities of a specific {@link EntityType} by a {@link ArrowEntity}.
|
||||
*
|
||||
* <p>Note that in events, the damage defined for the provided
|
||||
* {@link EntityType} will take priority over the "default" damage as
|
||||
* defined from {@link DamagingProjectile#attackDamage()}.</p>
|
||||
* defined from {@link ArrowEntity#attackDamage()}.</p>
|
||||
*
|
||||
* <p>Types not present in this mapping will be
|
||||
* dealt damage to according to {@link #ATTACK_DAMAGE}.</p>
|
||||
@@ -2585,7 +2585,7 @@ public final class Keys {
|
||||
public static final Key<Value<Boolean>> TRACKS_OUTPUT = Keys.key(ResourceKey.sponge("tracks_output"), Boolean.class);
|
||||
|
||||
/**
|
||||
* Tge {@link TradeOffer}s offered by a {@link Trader}.
|
||||
* The {@link TradeOffer}s offered by a {@link Trader}.
|
||||
*/
|
||||
public static final Key<ListValue<TradeOffer>> TRADE_OFFERS = Keys.listKey(ResourceKey.sponge("trade_offers"), TradeOffer.class);
|
||||
|
||||
|
||||
@@ -128,14 +128,4 @@ public interface AreaEffectCloud extends Entity {
|
||||
default ListValue.Mutable<PotionEffect> effects() {
|
||||
return this.requireValue(Keys.POTION_EFFECTS).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#AGE}
|
||||
*
|
||||
* @return The age of this cloud
|
||||
*/
|
||||
default Value.Mutable<Integer> age() {
|
||||
return this.requireValue(Keys.AGE).asMutable();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import net.kyori.adventure.text.event.HoverEventSource;
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.SerializableDataHolder;
|
||||
import org.spongepowered.api.data.value.ListValue;
|
||||
import org.spongepowered.api.data.value.SetValue;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.event.cause.entity.damage.source.DamageSource;
|
||||
import org.spongepowered.api.projectile.source.EntityProjectileSource;
|
||||
@@ -376,7 +377,7 @@ public interface Entity extends Identifiable, HoverEventSource<HoverEvent.ShowEn
|
||||
*
|
||||
* @return The "base vehicle" of the entity vehicle riding chain
|
||||
*/
|
||||
default Optional<Value.Mutable<Entity>> baseVehicle() {
|
||||
default Optional<Value<Entity>> baseVehicle() {
|
||||
return this.getValue(Keys.BASE_VEHICLE).map(Value::asMutable);
|
||||
}
|
||||
|
||||
@@ -385,7 +386,7 @@ public interface Entity extends Identifiable, HoverEventSource<HoverEvent.ShowEn
|
||||
*
|
||||
* @return Whether this entity is on the ground
|
||||
*/
|
||||
default Value.Mutable<Boolean> onGround() {
|
||||
default Value<Boolean> onGround() {
|
||||
return this.requireValue(Keys.ON_GROUND).asMutable();
|
||||
}
|
||||
|
||||
@@ -437,7 +438,7 @@ public interface Entity extends Identifiable, HoverEventSource<HoverEvent.ShowEn
|
||||
/**
|
||||
* {@link Keys#FIRE_TICKS}
|
||||
*
|
||||
* @return The amount of time in ticks an Entity is will continue burn for.
|
||||
* @return The amount of time in ticks the entity is will continue burn for
|
||||
*/
|
||||
default Optional<Value.Mutable<Ticks>> fireTicks() {
|
||||
return this.getValue(Keys.FIRE_TICKS).map(Value::asMutable);
|
||||
@@ -446,10 +447,10 @@ public interface Entity extends Identifiable, HoverEventSource<HoverEvent.ShowEn
|
||||
/**
|
||||
* {@link Keys#FIRE_DAMAGE_DELAY}
|
||||
*
|
||||
* @return The amount of time to delay in ticks before an Entity will be burned by fire.
|
||||
* @return The amount of time to delay in ticks before the entity will be burned by fire
|
||||
*/
|
||||
default Optional<Value.Mutable<Ticks>> fireImmuneTicks() {
|
||||
return this.getValue(Keys.FIRE_DAMAGE_DELAY).map(Value::asMutable);
|
||||
default Value.Mutable<Ticks> fireImmuneTicks() {
|
||||
return this.requireValue(Keys.FIRE_DAMAGE_DELAY).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -457,8 +458,197 @@ public interface Entity extends Identifiable, HoverEventSource<HoverEvent.ShowEn
|
||||
*
|
||||
* @return The transient state
|
||||
*/
|
||||
default Optional<Value.Mutable<Boolean>> isTransient() {
|
||||
return this.getValue(Keys.TRANSIENT).map(Value::asMutable);
|
||||
default Value.Mutable<Boolean> isTransient() {
|
||||
return this.requireValue(Keys.TRANSIENT).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#AGE}
|
||||
*
|
||||
* @return The age of this entity
|
||||
*/
|
||||
default Value.Mutable<Integer> age() {
|
||||
return this.requireValue(Keys.AGE).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#BASE_SIZE}
|
||||
*
|
||||
* @return The base size of the entity
|
||||
*/
|
||||
default Value<Double> baseSize() {
|
||||
return this.requireValue(Keys.BASE_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#EYE_HEIGHT}
|
||||
*
|
||||
* @return The height of the eyes
|
||||
*/
|
||||
default Value<Double> eyeHeight() {
|
||||
return this.requireValue(Keys.EYE_HEIGHT);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#EYE_POSITION}
|
||||
*
|
||||
* @return The position of the eyes
|
||||
*/
|
||||
default Value<Vector3d> eyePosition() {
|
||||
return this.requireValue(Keys.EYE_POSITION);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#HEIGHT}
|
||||
*
|
||||
* @return The height of the entity
|
||||
*/
|
||||
default Value<Double> height() {
|
||||
return this.requireValue(Keys.HEIGHT);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#INVULNERABILITY_TICKS}
|
||||
*
|
||||
* @return The amount of ticks the entity will remain invulnerable for
|
||||
*/
|
||||
default Value.Mutable<Ticks> invulnerabilityTicks() {
|
||||
return this.requireValue(Keys.INVULNERABILITY_TICKS).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_CUSTOM_NAME_VISIBLE}
|
||||
*
|
||||
* @return Whether a custom name is visible on the entity
|
||||
*/
|
||||
default Value.Mutable<Boolean> customNameVisible() {
|
||||
return this.requireValue(Keys.IS_CUSTOM_NAME_VISIBLE).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_GLOWING}
|
||||
*
|
||||
* @return Whether the entity has a glowing outline
|
||||
*/
|
||||
default Value.Mutable<Boolean> glowing() {
|
||||
return this.requireValue(Keys.IS_GLOWING).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_INVISIBLE}
|
||||
*
|
||||
* @return Whether the entity is currently invisible
|
||||
*/
|
||||
default Value.Mutable<Boolean> invisible() {
|
||||
return this.requireValue(Keys.IS_INVISIBLE).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#INVULNERABLE}
|
||||
*
|
||||
* @return Whether the entity is invulnerable
|
||||
*/
|
||||
default Value.Mutable<Boolean> invulnerable() {
|
||||
return this.requireValue(Keys.INVULNERABLE).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_SNEAKING}
|
||||
*
|
||||
* @return Whether the entity is sneaking
|
||||
*/
|
||||
default Value.Mutable<Boolean> sneaking() {
|
||||
return this.requireValue(Keys.IS_SNEAKING).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_SPRINTING}
|
||||
*
|
||||
* @return Whether the entity is sprinting
|
||||
*/
|
||||
default Value.Mutable<Boolean> sprinting() {
|
||||
return this.requireValue(Keys.IS_SPRINTING).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_WET}
|
||||
*
|
||||
* @return Whether the entity is wet
|
||||
*/
|
||||
default Value<Boolean> wet() {
|
||||
return this.requireValue(Keys.IS_WET).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#MAX_AIR}
|
||||
*
|
||||
* @return The max air supply
|
||||
*/
|
||||
default Value.Mutable<Integer> maxAir() {
|
||||
return this.requireValue(Keys.MAX_AIR).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#REMAINING_AIR}
|
||||
*
|
||||
* @return The remaining air supply
|
||||
*/
|
||||
default Value.Mutable<Integer> remainingAir() {
|
||||
return this.requireValue(Keys.REMAINING_AIR).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#SCOREBOARD_TAGS}
|
||||
*
|
||||
* @return The scoreboard tags applied to the entity
|
||||
*/
|
||||
default SetValue.Mutable<String> scoreboardTags() {
|
||||
return this.requireValue(Keys.SCOREBOARD_TAGS).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#VANISH}
|
||||
*
|
||||
* @return Whether the entity is vanished
|
||||
*/
|
||||
default Value.Mutable<Boolean> vanish() {
|
||||
return this.requireValue(Keys.VANISH).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#VANISH_IGNORES_COLLISION}
|
||||
*
|
||||
* @return Whether the entity ignores collision with other entities
|
||||
*/
|
||||
default Value.Mutable<Boolean> vanishIgnoresCollision() {
|
||||
return this.requireValue(Keys.VANISH_IGNORES_COLLISION).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#VANISH_PREVENTS_TARGETING}
|
||||
*
|
||||
* @return Whether the entity can be targeted for attack by another entity
|
||||
*/
|
||||
default Value.Mutable<Boolean> vanishPreventsTargeting() {
|
||||
return this.requireValue(Keys.VANISH_PREVENTS_TARGETING).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#CUSTOM_NAME}
|
||||
*
|
||||
* @return The custom name of the entity
|
||||
*/
|
||||
default Optional<Value.Mutable<Component>> customName() {
|
||||
return this.getValue(Keys.CUSTOM_NAME).map(Value::asMutable);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#SWIFTNESS}
|
||||
*
|
||||
* @return The current swiftness of the entity
|
||||
*/
|
||||
default Optional<Value.Mutable<Double>> swiftness() {
|
||||
return this.getValue(Keys.SWIFTNESS).map(Value::asMutable);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,7 +38,7 @@ public interface FallingBlock extends Entity {
|
||||
/**
|
||||
* {@link Keys#BLOCK_STATE}
|
||||
*
|
||||
* @return The blockstate
|
||||
* @return The block state of the falling block
|
||||
*/
|
||||
default Value.Mutable<BlockState> blockState() {
|
||||
return this.requireValue(Keys.BLOCK_STATE).asMutable();
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.item.ItemType;
|
||||
import org.spongepowered.api.item.inventory.ItemStack;
|
||||
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
|
||||
import org.spongepowered.api.util.Ticks;
|
||||
|
||||
/**
|
||||
* Represents an Item.
|
||||
@@ -43,4 +44,40 @@ public interface Item extends Entity {
|
||||
default Value.Mutable<ItemStackSnapshot> item() {
|
||||
return this.requireValue(Keys.ITEM_STACK_SNAPSHOT).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#DESPAWN_DELAY}
|
||||
*
|
||||
* @return The despawn delay (in ticks) of the item
|
||||
*/
|
||||
default Value.Mutable<Ticks> despawnDelay() {
|
||||
return this.requireValue(Keys.DESPAWN_DELAY).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#INFINITE_DESPAWN_DELAY}
|
||||
*
|
||||
* @return Whether the item will not despawn for an infinite time
|
||||
*/
|
||||
default Value.Mutable<Boolean> infiniteDespawnDelay() {
|
||||
return this.requireValue(Keys.INFINITE_DESPAWN_DELAY).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#INFINITE_PICKUP_DELAY}
|
||||
*
|
||||
* @return Whether the item has an infinite pickup delay
|
||||
*/
|
||||
default Value.Mutable<Boolean> infinitePickupDelay() {
|
||||
return this.requireValue(Keys.INFINITE_PICKUP_DELAY).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#PICKUP_DELAY}
|
||||
*
|
||||
* @return The pickup delay (in ticks) of the item
|
||||
*/
|
||||
default Value.Mutable<Ticks> pickupDelay() {
|
||||
return this.requireValue(Keys.PICKUP_DELAY).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -52,4 +52,13 @@ public interface EndCrystal extends Explosive {
|
||||
default Value.Mutable<Boolean> showBottom() {
|
||||
return this.requireValue(Keys.SHOW_BOTTOM).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#HEALTH}
|
||||
*
|
||||
* @return The health of the end crystal
|
||||
*/
|
||||
default Value.Mutable<Double> health() {
|
||||
return this.requireValue(Keys.HEALTH).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -52,4 +52,13 @@ public interface FusedExplosive extends Explosive {
|
||||
default Value.Mutable<Ticks> fuseDuration() {
|
||||
return this.requireValue(Keys.FUSE_DURATION).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#TICKS_REMAINING}
|
||||
*
|
||||
* @return The remaining fuse time in ticks of the fused explosive
|
||||
*/
|
||||
default Value.Mutable<Ticks> ticksRemaining() {
|
||||
return this.requireValue(Keys.TICKS_REMAINING).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,8 @@ public interface PrimedTNT extends FusedExplosive {
|
||||
|
||||
/**
|
||||
* {@link Keys#DETONATOR}
|
||||
* @return The living entity that primed this tnt
|
||||
*
|
||||
* @return The living entity that primed this TNT
|
||||
*/
|
||||
default Optional<Value.Mutable<Living>> detonator() {
|
||||
return this.getValue(Keys.DETONATOR).map(Value::asMutable);
|
||||
|
||||
@@ -36,6 +36,7 @@ public interface Hanging extends Entity {
|
||||
|
||||
/**
|
||||
* {@link Keys#DIRECTION}
|
||||
*
|
||||
* @return The direction the hanging entity is facing
|
||||
*/
|
||||
default Value.Mutable<Direction> hangingDirection() {
|
||||
|
||||
@@ -28,6 +28,8 @@ import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.util.Ticks;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Represents an {@link Agent} that produces offspring and grows into an adult
|
||||
*/
|
||||
@@ -47,8 +49,26 @@ public interface Ageable extends Agent {
|
||||
*
|
||||
* @return The ticks until this entity turns into an adult
|
||||
*/
|
||||
default Value.Mutable<Ticks> babyTicks() {
|
||||
return this.requireValue(Keys.BABY_TICKS).asMutable();
|
||||
default Optional<Value.Mutable<Ticks>> babyTicks() {
|
||||
return this.getValue(Keys.BABY_TICKS).map(Value::asMutable);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#CAN_BREED}
|
||||
*
|
||||
* @return Whether the entity can breed
|
||||
*/
|
||||
default Value.Mutable<Boolean> canBreed() {
|
||||
return this.requireValue(Keys.CAN_BREED).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#BREEDING_COOLDOWN}
|
||||
*
|
||||
* @return The ticks until the entity can breed again
|
||||
*/
|
||||
default Optional<Value.Mutable<Ticks>> breedingCooldown() {
|
||||
return this.getValue(Keys.BREEDING_COOLDOWN).map(Value::asMutable);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
package org.spongepowered.api.entity.living;
|
||||
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.type.HandPreference;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.entity.Entity;
|
||||
import org.spongepowered.api.entity.ai.goal.GoalExecutor;
|
||||
@@ -42,6 +43,7 @@ public interface Agent extends Living, ArmorEquipable {
|
||||
|
||||
/**
|
||||
* {@link Keys#TARGET_ENTITY}
|
||||
*
|
||||
* @return The targeted entity
|
||||
* @see TargetGoal
|
||||
*/
|
||||
@@ -51,12 +53,40 @@ public interface Agent extends Living, ArmorEquipable {
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_AI_ENABLED}
|
||||
* @return Whether ai modules are enabled on this entity or it's a "dumb" entity
|
||||
*
|
||||
* @return Whether AI modules are enabled on this entity or it's a "dumb" entity
|
||||
*/
|
||||
default Value.Mutable<Boolean> aiEnabled() {
|
||||
return this.requireValue(Keys.IS_AI_ENABLED).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#DOMINANT_HAND}
|
||||
*
|
||||
* @return The dominant HandPreference of the agent
|
||||
*/
|
||||
default Value.Mutable<HandPreference> dominantHand() {
|
||||
return this.requireValue(Keys.DOMINANT_HAND).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_PERSISTENT}
|
||||
*
|
||||
* @return Whether the entity will be prevented from despawning
|
||||
*/
|
||||
default Value.Mutable<Boolean> persistent() {
|
||||
return this.requireValue(Keys.IS_PERSISTENT).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#LEASH_HOLDER}
|
||||
*
|
||||
* @return The holder of the leashed agent
|
||||
*/
|
||||
default Optional<Value.Mutable<Entity>> leashHolder() {
|
||||
return this.getValue(Keys.LEASH_HOLDER).map(Value::asMutable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a {@link GoalExecutor} based on the {@link GoalExecutorType}.
|
||||
*
|
||||
|
||||
@@ -26,10 +26,10 @@ package org.spongepowered.api.entity.living;
|
||||
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.MapValue;
|
||||
import org.spongepowered.api.data.value.SetValue;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.item.inventory.ArmorEquipable;
|
||||
import org.spongepowered.api.item.inventory.equipment.EquipmentType;
|
||||
import org.spongepowered.math.vector.Vector3d;
|
||||
|
||||
/**
|
||||
* Represents an Armor Stand.
|
||||
@@ -57,7 +57,7 @@ public interface ArmorStand extends Living, ArmorEquipable {
|
||||
/**
|
||||
* {@link Keys#HAS_BASE_PLATE}
|
||||
*
|
||||
* @return Whether this armorstand has a base plate or not
|
||||
* @return Whether this armor stand has a visible base plate
|
||||
*/
|
||||
default Value.Mutable<Boolean> basePlate() {
|
||||
return this.requireValue(Keys.HAS_BASE_PLATE).asMutable();
|
||||
@@ -66,7 +66,7 @@ public interface ArmorStand extends Living, ArmorEquipable {
|
||||
/**
|
||||
* {@link Keys#HAS_ARMS}
|
||||
*
|
||||
* @return Whether arms are visible or not
|
||||
* @return Whether the arms of this armor stand are visible
|
||||
*/
|
||||
default Value.Mutable<Boolean> arms() {
|
||||
return this.requireValue(Keys.HAS_ARMS).asMutable();
|
||||
@@ -89,4 +89,40 @@ public interface ArmorStand extends Living, ArmorEquipable {
|
||||
default MapValue.Mutable<EquipmentType, Boolean> takingDisabled() {
|
||||
return this.requireValue(Keys.IS_TAKING_DISABLED).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#LEFT_ARM_ROTATION}
|
||||
*
|
||||
* @return The left arm rotation of the armor stand
|
||||
*/
|
||||
default Value.Mutable<Vector3d> leftArmRotation() {
|
||||
return this.requireValue(Keys.LEFT_ARM_ROTATION).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#LEFT_LEG_ROTATION}
|
||||
*
|
||||
* @return The left leg rotation of the armor stand
|
||||
*/
|
||||
default Value.Mutable<Vector3d> leftLegRotation() {
|
||||
return this.requireValue(Keys.LEFT_LEG_ROTATION).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#RIGHT_ARM_ROTATION}
|
||||
*
|
||||
* @return The right arm rotation of the armor stand
|
||||
*/
|
||||
default Value.Mutable<Vector3d> rightArmRotation() {
|
||||
return this.requireValue(Keys.RIGHT_ARM_ROTATION).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#RIGHT_LEG_ROTATION}
|
||||
*
|
||||
* @return The right leg rotation of the armor stand
|
||||
*/
|
||||
default Value.Mutable<Vector3d> rightLegRotation() {
|
||||
return this.requireValue(Keys.RIGHT_LEG_ROTATION).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -24,9 +24,20 @@
|
||||
*/
|
||||
package org.spongepowered.api.entity.living;
|
||||
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
|
||||
/**
|
||||
* Represents a Bat.
|
||||
*/
|
||||
public interface Bat extends Ambient, Aerial {
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_SLEEPING}
|
||||
*
|
||||
* @return Whether the bat is sleeping
|
||||
*/
|
||||
default Value.Mutable<Boolean> sleeping() {
|
||||
return this.requireValue(Keys.IS_SLEEPING).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -30,44 +30,19 @@ import org.spongepowered.api.entity.Tamer;
|
||||
import org.spongepowered.api.entity.living.player.Player;
|
||||
import org.spongepowered.api.entity.living.player.gamemode.GameMode;
|
||||
import org.spongepowered.api.item.inventory.ArmorEquipable;
|
||||
import org.spongepowered.api.profile.property.ProfileProperty;
|
||||
|
||||
/**
|
||||
* Represents a human-like entity in game, such as {@link Player} or {@link Human}s.
|
||||
*/
|
||||
public interface Humanoid extends Living, ArmorEquipable, Tamer {
|
||||
/**
|
||||
* {@link Keys#FOOD_LEVEL}
|
||||
*
|
||||
* @return The human's food level
|
||||
*/
|
||||
default Value.Mutable<Integer> foodLevel() {
|
||||
return this.requireValue(Keys.FOOD_LEVEL).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#EXHAUSTION}
|
||||
* {@link Keys#SKIN_PROFILE_PROPERTY}
|
||||
*
|
||||
* @return The human's exhaustion
|
||||
* @return The skin of the humanoid
|
||||
*/
|
||||
default Value.Mutable<Double> exhaustion() {
|
||||
return this.requireValue(Keys.EXHAUSTION).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#SATURATION}
|
||||
*
|
||||
* @return The human's saturation
|
||||
*/
|
||||
default Value.Mutable<Double> saturation() {
|
||||
return this.requireValue(Keys.SATURATION).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#GAME_MODE}
|
||||
*
|
||||
* @return The gamemode
|
||||
*/
|
||||
default Value.Mutable<GameMode> gameMode() {
|
||||
return this.requireValue(Keys.GAME_MODE).asMutable();
|
||||
default Value.Mutable<ProfileProperty> skinProfile() {
|
||||
return this.requireValue(Keys.SKIN_PROFILE_PROPERTY).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,9 @@
|
||||
package org.spongepowered.api.entity.living;
|
||||
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.type.BodyPart;
|
||||
import org.spongepowered.api.data.value.ListValue;
|
||||
import org.spongepowered.api.data.value.MapValue;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.effect.potion.PotionEffect;
|
||||
import org.spongepowered.api.entity.Entity;
|
||||
@@ -87,8 +90,8 @@ public interface Living extends AttributeHolder, Entity, TeamMember {
|
||||
*
|
||||
* @return The last attacker who attacked this entity
|
||||
*/
|
||||
default Value.Mutable<Entity> lastAttacker() {
|
||||
return this.requireValue(Keys.LAST_ATTACKER).asMutable();
|
||||
default Optional<Value.Mutable<Entity>> lastAttacker() {
|
||||
return this.getValue(Keys.LAST_ATTACKER).map(Value::asMutable);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,49 +103,13 @@ public interface Living extends AttributeHolder, Entity, TeamMember {
|
||||
return this.requireValue(Keys.HEAD_ROTATION).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#EYE_HEIGHT}
|
||||
*
|
||||
* @return The height of the eyes
|
||||
*/
|
||||
default Value<Double> eyeHeight() {
|
||||
return this.requireValue(Keys.EYE_HEIGHT);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#EYE_POSITION}
|
||||
*
|
||||
* @return The position of the eyes
|
||||
*/
|
||||
default Value<Vector3d> eyePosition() {
|
||||
return this.requireValue(Keys.EYE_POSITION);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#LAST_DAMAGE_RECEIVED}
|
||||
*
|
||||
* @return The last damage received
|
||||
*/
|
||||
default Optional<Value<Double>> lastDamageReceived() {
|
||||
return this.getValue(Keys.LAST_DAMAGE_RECEIVED);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#MAX_AIR}
|
||||
*
|
||||
* @return The max air supply
|
||||
*/
|
||||
default Value.Mutable<Integer> maxAir() {
|
||||
return this.requireValue(Keys.MAX_AIR).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#REMAINING_AIR}
|
||||
*
|
||||
* @return The remaining air supply
|
||||
*/
|
||||
default Value.Mutable<Integer> remainingAir() {
|
||||
return this.requireValue(Keys.REMAINING_AIR).asMutable();
|
||||
default Value.Mutable<Double> lastDamageReceived() {
|
||||
return this.requireValue(Keys.LAST_DAMAGE_RECEIVED).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,6 +130,51 @@ public interface Living extends AttributeHolder, Entity, TeamMember {
|
||||
return this.requireValue(Keys.WALKING_SPEED).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#BODY_ROTATIONS}
|
||||
*
|
||||
* @return The rotation of specific body parts of the living
|
||||
*/
|
||||
default MapValue.Mutable<BodyPart, Vector3d> bodyRotations() {
|
||||
return this.requireValue(Keys.BODY_ROTATIONS).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#CHEST_ROTATION}
|
||||
*
|
||||
* @return The chest rotation of the entity
|
||||
*/
|
||||
default Value.Mutable<Vector3d> chestRotation() {
|
||||
return this.requireValue(Keys.CHEST_ROTATION).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_ELYTRA_FLYING}
|
||||
*
|
||||
* @return Whether the entity (or player) is flying with an elytra
|
||||
*/
|
||||
default Value.Mutable<Boolean> elytraFlying() {
|
||||
return this.requireValue(Keys.IS_ELYTRA_FLYING).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#CAN_GRIEF}
|
||||
*
|
||||
* @return Whether the living entity may change blocks
|
||||
*/
|
||||
default Optional<Value.Mutable<Boolean>> canGrief() {
|
||||
return this.getValue(Keys.CAN_GRIEF).map(Value::asMutable);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#POTION_EFFECTS}
|
||||
*
|
||||
* @return The potion effects that are present on the living entity
|
||||
*/
|
||||
default ListValue.Mutable<PotionEffect> potionEffects() {
|
||||
return this.requireValue(Keys.POTION_EFFECTS).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the {@link Living}'s head rotation into a quaternion direction unit vector.
|
||||
*
|
||||
|
||||
@@ -43,30 +43,12 @@ public interface Animal extends Ageable {
|
||||
/**
|
||||
* {@link Keys#BREEDER}
|
||||
*
|
||||
* @return The breeder's unique id
|
||||
* @return The current breeder of the animal
|
||||
*/
|
||||
default Optional<Value.Mutable<UUID>> breeder() {
|
||||
return this.getValue(Keys.BREEDER).map(Value::asMutable);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#BREEDING_COOLDOWN}
|
||||
*
|
||||
* @return The current breeding cooldown
|
||||
*/
|
||||
default Value.Mutable<Ticks> breedingCooldown() {
|
||||
return this.requireValue(Keys.BREEDING_COOLDOWN).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#CAN_BREED}
|
||||
*
|
||||
* @return If animal can breed
|
||||
*/
|
||||
default Value.Mutable<Boolean> canBreed() {
|
||||
return this.requireValue(Keys.CAN_BREED).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the {@link ItemStack} is considered to be food by this animal.
|
||||
*
|
||||
|
||||
@@ -35,7 +35,7 @@ import java.util.Optional;
|
||||
/**
|
||||
* Represents a Cat, meow.
|
||||
*/
|
||||
public interface Cat extends TameableAnimal, Sittable {
|
||||
public interface Cat extends TameableAnimal {
|
||||
|
||||
/**
|
||||
* {@link Keys#CAT_TYPE}
|
||||
@@ -108,7 +108,7 @@ public interface Cat extends TameableAnimal, Sittable {
|
||||
*
|
||||
* <p>In vanilla, a cat hisses when a {@link Phantom} is detected near it.</p>
|
||||
*
|
||||
* @return Whether this cat is purring
|
||||
* @return Whether this cat is hissing
|
||||
*/
|
||||
default Value.Mutable<Boolean> hissing() {
|
||||
return this.requireValue(Keys.IS_HISSING).asMutable();
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Represents a Fox.
|
||||
*/
|
||||
public interface Fox extends Animal {
|
||||
public interface Fox extends Animal, Sittable {
|
||||
|
||||
/**
|
||||
* {@link Keys#FOX_TYPE}
|
||||
@@ -64,15 +64,6 @@ public interface Fox extends Animal {
|
||||
return this.getValue(Keys.SECOND_TRUSTED).map(Value::asMutable);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_SITTING}
|
||||
*
|
||||
* @return Whether this fox is sitting
|
||||
*/
|
||||
default Value.Mutable<Boolean> sitting() {
|
||||
return this.requireValue(Keys.IS_SITTING).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_FACEPLANTED}
|
||||
*
|
||||
|
||||
@@ -132,7 +132,7 @@ public interface Panda extends Animal, Sittable {
|
||||
*
|
||||
* @return Whether this panda is frightened
|
||||
*/
|
||||
default Value.Mutable<Boolean> frightened() {
|
||||
return this.requireValue(Keys.IS_FRIGHTENED).asMutable();
|
||||
default Value<Boolean> frightened() {
|
||||
return this.requireValue(Keys.IS_FRIGHTENED);
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import org.spongepowered.api.data.value.Value;
|
||||
/**
|
||||
* Represents a Parrot.
|
||||
*/
|
||||
public interface Parrot extends TameableAnimal, Sittable {
|
||||
public interface Parrot extends TameableAnimal {
|
||||
|
||||
/**
|
||||
* {@link Keys#PARROT_TYPE}
|
||||
|
||||
@@ -34,6 +34,7 @@ public interface Pig extends Animal {
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_SADDLED}
|
||||
*
|
||||
* @return Whether this pig has a saddle, and ready to be ridden
|
||||
*/
|
||||
default Value.Mutable<Boolean> saddled() {
|
||||
|
||||
@@ -34,6 +34,7 @@ public interface PolarBear extends Animal {
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_STANDING}
|
||||
*
|
||||
* @return Whether this polar bear is standing
|
||||
*/
|
||||
default Value.Mutable<Boolean> standing() {
|
||||
|
||||
@@ -35,6 +35,7 @@ public interface Rabbit extends Animal {
|
||||
|
||||
/**
|
||||
* {@link Keys#RABBIT_TYPE}
|
||||
*
|
||||
* @return The type of rabbit
|
||||
* @see org.spongepowered.api.data.type.RabbitTypes
|
||||
*/
|
||||
|
||||
@@ -30,14 +30,23 @@ import org.spongepowered.api.data.value.Value;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface TameableAnimal extends Animal {
|
||||
public interface TameableAnimal extends Animal, Sittable {
|
||||
|
||||
/**
|
||||
* {@link Keys#TAMER}
|
||||
*
|
||||
* @return The unique id of the tamer
|
||||
* @return The tamer of the animal
|
||||
*/
|
||||
default Optional<Value.Mutable<UUID>> tamer() {
|
||||
return this.getValue(Keys.TAMER).map(Value::asMutable);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_TAMED}
|
||||
*
|
||||
* @return Whether the animal is currently tamed
|
||||
*/
|
||||
default Value.Mutable<Boolean> tamed() {
|
||||
return this.requireValue(Keys.IS_TAMED).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -31,11 +31,12 @@ import org.spongepowered.api.data.value.Value;
|
||||
/**
|
||||
* Represents a Wolf.
|
||||
*/
|
||||
public interface Wolf extends TameableAnimal, Sittable {
|
||||
public interface Wolf extends TameableAnimal {
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_ANGRY}
|
||||
* @return Whether this wolf is angry
|
||||
*
|
||||
* @return Whether this wolf is currently aggressive
|
||||
*/
|
||||
default Value.Mutable<Boolean> angry() {
|
||||
return this.requireValue(Keys.IS_ANGRY).asMutable();
|
||||
|
||||
@@ -36,6 +36,7 @@ public interface Horse extends TameableHorse {
|
||||
|
||||
/**
|
||||
* {@link Keys#HORSE_COLOR}
|
||||
*
|
||||
* @return The horse's color
|
||||
*/
|
||||
default Value.Mutable<HorseColor> color() {
|
||||
@@ -44,6 +45,7 @@ public interface Horse extends TameableHorse {
|
||||
|
||||
/**
|
||||
* {@link Keys#HORSE_STYLE}
|
||||
*
|
||||
* @return The horse's style
|
||||
*/
|
||||
default Value.Mutable<HorseStyle> style() {
|
||||
|
||||
@@ -24,12 +24,44 @@
|
||||
*/
|
||||
package org.spongepowered.api.entity.living.animal.horse;
|
||||
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.entity.living.animal.Animal;
|
||||
import org.spongepowered.api.item.inventory.Carrier;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* An abstract representation of a Horse.
|
||||
*/
|
||||
public interface HorseLike extends Animal, Carrier {
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_SADDLED}
|
||||
*
|
||||
* @return Whether the horse is saddled
|
||||
*/
|
||||
default Value.Mutable<Boolean> saddled() {
|
||||
return this.requireValue(Keys.IS_SADDLED).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_TAMED}
|
||||
*
|
||||
* @return Whether the horse is currently tamed
|
||||
*/
|
||||
default Value.Mutable<Boolean> tamed() {
|
||||
return this.requireValue(Keys.IS_TAMED).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#TAMER}
|
||||
*
|
||||
* @return The tamer of the horse
|
||||
*/
|
||||
default Optional<Value.Mutable<UUID>> tamer() {
|
||||
return this.getValue(Keys.TAMER).map(Value::asMutable);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,8 +24,32 @@
|
||||
*/
|
||||
package org.spongepowered.api.entity.living.animal.horse;
|
||||
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.entity.living.animal.TameableAnimal;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface TameableHorse extends HorseLike, TameableAnimal {
|
||||
|
||||
/**
|
||||
* {@link Keys#TAMER}
|
||||
*
|
||||
* @return The tamer of the horse
|
||||
*/
|
||||
@Override
|
||||
default Optional<Value.Mutable<UUID>> tamer() {
|
||||
return this.getValue(Keys.TAMER).map(Value::asMutable);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_TAMED}
|
||||
*
|
||||
* @return Whether the horse is currently tamed
|
||||
*/
|
||||
@Override
|
||||
default Value.Mutable<Boolean> tamed() {
|
||||
return this.requireValue(Keys.IS_TAMED).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ public interface Llama extends LlamaLike, TameableHorse, PackHorse {
|
||||
|
||||
/**
|
||||
* {@link Keys#LLAMA_TYPE}
|
||||
*
|
||||
* @return The llama type
|
||||
* @see org.spongepowered.api.data.type.LlamaTypes
|
||||
*/
|
||||
@@ -48,6 +49,7 @@ public interface Llama extends LlamaLike, TameableHorse, PackHorse {
|
||||
|
||||
/**
|
||||
* {@link Keys#STRENGTH}
|
||||
*
|
||||
* @return The strength of this llama, determines how big of an inventory they can carry
|
||||
*/
|
||||
default Value.Mutable<Integer> strength() {
|
||||
|
||||
+3
-3
@@ -34,7 +34,7 @@ public interface TropicalFish extends SchoolingFish {
|
||||
/**
|
||||
* {@link Keys#DYE_COLOR}
|
||||
*
|
||||
* @return The base color of this tropical fish.
|
||||
* @return The base color of this tropical fish
|
||||
*/
|
||||
default Value.Mutable<DyeColor> baseColor() {
|
||||
return this.requireValue(Keys.DYE_COLOR).asMutable();
|
||||
@@ -43,7 +43,7 @@ public interface TropicalFish extends SchoolingFish {
|
||||
/**
|
||||
* {@link Keys#PATTERN_COLOR}
|
||||
*
|
||||
* @return The pattern color of this tropical fish.
|
||||
* @return The pattern color of this tropical fish
|
||||
*/
|
||||
default Value.Mutable<DyeColor> patternColor() {
|
||||
return this.requireValue(Keys.PATTERN_COLOR).asMutable();
|
||||
@@ -52,7 +52,7 @@ public interface TropicalFish extends SchoolingFish {
|
||||
/**
|
||||
* {@link Keys#TROPICAL_FISH_SHAPE}
|
||||
*
|
||||
* @return The shape of this tropical fish.
|
||||
* @return The shape of this tropical fish
|
||||
*/
|
||||
default Value.Mutable<TropicalFishShape> shape() {
|
||||
return this.requireValue(Keys.TROPICAL_FISH_SHAPE).asMutable();
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.entity.living.Monster;
|
||||
import org.spongepowered.api.util.Ticks;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Represents an Endermite.
|
||||
@@ -41,7 +41,7 @@ public interface Endermite extends Monster {
|
||||
*
|
||||
* @return The despawn delay
|
||||
*/
|
||||
default Value.Mutable<Ticks> expirationDelay() {
|
||||
return this.requireValue(Keys.DESPAWN_DELAY).asMutable();
|
||||
default Optional<Value.Mutable<Ticks>> expirationDelay() {
|
||||
return this.getValue(Keys.DESPAWN_DELAY).map(Value::asMutable);
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public interface Vex extends Monster {
|
||||
/**
|
||||
* {@link Keys#LIFE_TICKS}
|
||||
*
|
||||
* @return The amount of ticks till this Vex starts dying.
|
||||
* @return The amount of ticks till this vex starts dying
|
||||
*/
|
||||
default Value.Mutable<Ticks> lifeTicks() {
|
||||
return this.requireValue(Keys.LIFE_TICKS).asMutable();
|
||||
|
||||
@@ -40,7 +40,7 @@ public interface Boss extends Hostile {
|
||||
*
|
||||
* @return The boss bar
|
||||
*/
|
||||
default Value.Mutable<BossBar> bossBar() {
|
||||
return this.requireValue(Keys.BOSS_BAR).asMutable();
|
||||
default Value<BossBar> bossBar() {
|
||||
return this.requireValue(Keys.BOSS_BAR);
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ public interface Wither extends Monster, Ranger, Boss, Aerial, FusedExplosive {
|
||||
|
||||
/**
|
||||
* {@link Keys#WITHER_TARGETS}
|
||||
*
|
||||
* @return The list of targeted entities, if available
|
||||
*/
|
||||
default ListValue.Mutable<Entity> targetEntities() {
|
||||
|
||||
@@ -35,6 +35,7 @@ public interface Raider extends Patroller {
|
||||
|
||||
/**
|
||||
* {@link Keys#CAN_JOIN_RAID}
|
||||
*
|
||||
* @return Whether this raider can join a raid
|
||||
*/
|
||||
default Value.Mutable<Boolean> canJoinRaid() {
|
||||
@@ -43,14 +44,16 @@ public interface Raider extends Patroller {
|
||||
|
||||
/**
|
||||
* {@link Keys#RAID_WAVE}
|
||||
*
|
||||
* @return The raid wave of this raider
|
||||
*/
|
||||
default Optional<Value.Immutable<RaidWave>> raidWave() {
|
||||
return this.getValue(Keys.RAID_WAVE).map(Value::asImmutable);
|
||||
default Optional<Value<RaidWave>> raidWave() {
|
||||
return this.getValue(Keys.RAID_WAVE);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_CELEBRATING}
|
||||
*
|
||||
* @return Whether this raider is celebrating
|
||||
*/
|
||||
default Value.Mutable<Boolean> celebrating() {
|
||||
|
||||
@@ -70,8 +70,8 @@ public interface Ravager extends Raider {
|
||||
*
|
||||
* @return Whether this ravager is immobilized
|
||||
*/
|
||||
default Value.Mutable<Boolean> immobilized() {
|
||||
return this.requireValue(Keys.IS_IMMOBILIZED).asMutable();
|
||||
default Value<Boolean> immobilized() {
|
||||
return this.requireValue(Keys.IS_IMMOBILIZED);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,8 +84,8 @@ public interface Ravager extends Raider {
|
||||
*
|
||||
* @return Whether this ravager is roaring
|
||||
*/
|
||||
default Value.Mutable<Boolean> roaring() {
|
||||
return this.requireValue(Keys.IS_ROARING).asMutable();
|
||||
default Value<Boolean> roaring() {
|
||||
return this.requireValue(Keys.IS_ROARING);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +98,7 @@ public interface Ravager extends Raider {
|
||||
*
|
||||
* @return Whether this ravager is stunned
|
||||
*/
|
||||
default Value.Mutable<Boolean> stunned() {
|
||||
return this.requireValue(Keys.IS_STUNNED).asMutable();
|
||||
default Value<Boolean> stunned() {
|
||||
return this.requireValue(Keys.IS_STUNNED);
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -34,8 +34,9 @@ import org.spongepowered.api.item.inventory.Carrier;
|
||||
public interface Pillager extends Illager, Carrier {
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_CHARGING_CROSSBOW}.
|
||||
* @return whether this pillager is charging a crossbow
|
||||
* {@link Keys#IS_CHARGING_CROSSBOW}
|
||||
*
|
||||
* @return Whether this pillager is charging a crossbow
|
||||
*/
|
||||
default Value.Mutable<Boolean> chargingCrossbow() {
|
||||
return this.requireValue(Keys.IS_CHARGING_CROSSBOW).asMutable();
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ public interface Vindicator extends Illager {
|
||||
/**
|
||||
* {@link Keys#IS_JOHNNY}
|
||||
*
|
||||
* @return whether this is a johnny vindicator
|
||||
* @return Whether this is a johnny vindicator
|
||||
*/
|
||||
default Value.Mutable<Boolean> johnny() {
|
||||
return this.requireValue(Keys.IS_JOHNNY).asMutable();
|
||||
|
||||
+5
-3
@@ -34,16 +34,18 @@ import java.util.Optional;
|
||||
public interface Spellcaster extends Illager {
|
||||
|
||||
/**
|
||||
* {@link Keys#CURRENT_SPELL}.
|
||||
* {@link Keys#CURRENT_SPELL}
|
||||
*
|
||||
* @return The current spell being casted
|
||||
* @see org.spongepowered.api.data.type.SpellTypes
|
||||
*/
|
||||
default Optional<Value.Mutable<SpellType>> currentSpell() {
|
||||
return this.getValue(Keys.CURRENT_SPELL).map(Value::asMutable);
|
||||
default Value.Mutable<SpellType> currentSpell() {
|
||||
return this.requireValue(Keys.CURRENT_SPELL).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#CASTING_TIME}
|
||||
*
|
||||
* @return The time to cast
|
||||
*/
|
||||
default Value.Mutable<Integer> castingTime() {
|
||||
|
||||
@@ -35,9 +35,10 @@ public interface Spider extends Monster {
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_CLIMBING}
|
||||
* @return True if this spider is climbing
|
||||
*
|
||||
* @return Whether the spider is currently climbing
|
||||
*/
|
||||
default Value.Immutable<Boolean> climbing() {
|
||||
return this.requireValue(Keys.IS_CLIMBING).asImmutable();
|
||||
default Value.Mutable<Boolean> climbing() {
|
||||
return this.requireValue(Keys.IS_CLIMBING).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -24,11 +24,20 @@
|
||||
*/
|
||||
package org.spongepowered.api.entity.living.monster.zombie;
|
||||
|
||||
import org.spongepowered.api.entity.living.Ageable;
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
|
||||
/**
|
||||
* Represents a Zombie.
|
||||
*/
|
||||
public interface Zombie extends ZombieLike, Ageable {
|
||||
public interface Zombie extends ZombieLike {
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_ADULT}
|
||||
*
|
||||
* @return Whether this zombie is an adult or not
|
||||
*/
|
||||
default Value.Mutable<Boolean> adult() {
|
||||
return this.requireValue(Keys.IS_ADULT).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -51,4 +51,13 @@ public interface ZombieVillager extends ZombieLike {
|
||||
default Value.Mutable<ProfessionType> profession() {
|
||||
return this.requireValue(Keys.PROFESSION_TYPE).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#PROFESSION_LEVEL}
|
||||
*
|
||||
* @return The profession level of this zombie villager
|
||||
*/
|
||||
default Value.Mutable<Integer> professionLevel() {
|
||||
return this.requireValue(Keys.PROFESSION_LEVEL).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -41,4 +41,13 @@ public interface ZombifiedPiglin extends ZombieLike {
|
||||
return this.requireValue(Keys.ANGER_LEVEL).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_ANGRY}
|
||||
*
|
||||
* @return Whether this zombified piglin is currently aggressive
|
||||
*/
|
||||
default Value.Mutable<Boolean> angry() {
|
||||
return this.requireValue(Keys.IS_ANGRY).asMutable();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,6 +26,9 @@ package org.spongepowered.api.entity.living.player;
|
||||
|
||||
import net.kyori.adventure.identity.Identified;
|
||||
import org.spongepowered.api.block.entity.EnderChest;
|
||||
import org.spongepowered.api.data.Keys;
|
||||
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.living.Humanoid;
|
||||
import org.spongepowered.api.item.inventory.Carrier;
|
||||
@@ -61,4 +64,166 @@ public interface Player extends Humanoid, Identified, LocaleSource, Viewer, Carr
|
||||
* @return The ender chest inventory
|
||||
*/
|
||||
Inventory enderChestInventory();
|
||||
|
||||
/**
|
||||
* {@link Keys#AFFECTS_SPAWNING}
|
||||
*
|
||||
* @return Whether the player affects spawning
|
||||
*/
|
||||
default Value.Mutable<Boolean> affectsSpawning() {
|
||||
return this.requireValue(Keys.AFFECTS_SPAWNING).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#CAN_FLY}
|
||||
*
|
||||
* @return Whether the player can fly
|
||||
*/
|
||||
default Value.Mutable<Boolean> canFly() {
|
||||
return this.requireValue(Keys.CAN_FLY).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#DOMINANT_HAND}
|
||||
*
|
||||
* @return The dominant HandPreference of the player
|
||||
*/
|
||||
default Value.Mutable<HandPreference> dominantHand() {
|
||||
return this.requireValue(Keys.DOMINANT_HAND).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#EXHAUSTION}
|
||||
*
|
||||
* @return The player's exhaustion
|
||||
*/
|
||||
default Value.Mutable<Double> exhaustion() {
|
||||
return this.requireValue(Keys.EXHAUSTION).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#EXPERIENCE}
|
||||
*
|
||||
* @return The amount of experience the player has
|
||||
*/
|
||||
default Value.Mutable<Integer> experience() {
|
||||
return this.requireValue(Keys.EXPERIENCE).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#EXPERIENCE_FROM_START_OF_LEVEL}
|
||||
*
|
||||
* @return The experience requires to advance from the current level to the next one
|
||||
*/
|
||||
default Value<Integer> experienceFromStartToLevel() {
|
||||
return this.requireValue(Keys.EXPERIENCE_FROM_START_OF_LEVEL).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#EXPERIENCE_LEVEL}
|
||||
*
|
||||
* @return The current level the player has
|
||||
*/
|
||||
default Value.Mutable<Integer> experienceLevel() {
|
||||
return this.requireValue(Keys.EXPERIENCE_LEVEL).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#EXPERIENCE_SINCE_LEVEL}
|
||||
*
|
||||
* @return The amount of experience the player has collected towards the next level
|
||||
*/
|
||||
default Value.Mutable<Integer> experienceSinceLevel() {
|
||||
return this.requireValue(Keys.EXPERIENCE_SINCE_LEVEL).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#FLYING_SPEED}
|
||||
*
|
||||
* @return The speed at which the player flies
|
||||
*/
|
||||
default Value.Mutable<Double> flyingSpeed() {
|
||||
return this.requireValue(Keys.FLYING_SPEED).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#FOOD_LEVEL}
|
||||
*
|
||||
* @return The player's food level
|
||||
*/
|
||||
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}
|
||||
*
|
||||
* @return Whether the player is sleeping
|
||||
*/
|
||||
default Value<Boolean> sleeping() {
|
||||
return this.requireValue(Keys.IS_SLEEPING);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_SLEEPING_IGNORED}
|
||||
*
|
||||
* @return Whether this player is going to be ignored for sleeping to "reset" the day
|
||||
*/
|
||||
default Value<Boolean> sleepingIgnored() {
|
||||
return this.requireValue(Keys.IS_SLEEPING_IGNORED);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#MAX_EXHAUSTION}
|
||||
*
|
||||
* @return The maximum exhaustion of the player
|
||||
*/
|
||||
default Value<Double> maxExhaustion() {
|
||||
return this.requireValue(Keys.MAX_EXHAUSTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#MAX_FOOD_LEVEL}
|
||||
*
|
||||
* @return The maximum food level of the player
|
||||
*/
|
||||
default Value<Integer> maxFoodLevel() {
|
||||
return this.requireValue(Keys.MAX_FOOD_LEVEL);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#MAX_SATURATION}
|
||||
*
|
||||
* @return The maximum saturation of the player
|
||||
*/
|
||||
default Value<Double> maxSaturation() {
|
||||
return this.requireValue(Keys.MAX_SATURATION);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#SATURATION}
|
||||
*
|
||||
* @return The player's saturation
|
||||
*/
|
||||
default Value.Mutable<Double> saturation() {
|
||||
return this.requireValue(Keys.SATURATION).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#SLEEP_TIMER}
|
||||
*
|
||||
* @return The sleep timer of the player
|
||||
*/
|
||||
default Value.Mutable<Integer> sleepTimer() {
|
||||
return this.requireValue(Keys.SLEEP_TIMER).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,9 @@ package org.spongepowered.api.entity.living.player;
|
||||
import org.spongepowered.api.ResourceKey;
|
||||
import org.spongepowered.api.block.entity.EnderChest;
|
||||
import org.spongepowered.api.data.DataHolder;
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.MapValue;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.entity.Entity;
|
||||
import org.spongepowered.api.entity.Tamer;
|
||||
import org.spongepowered.api.entity.living.player.server.ServerPlayer;
|
||||
@@ -38,10 +41,12 @@ import org.spongepowered.api.item.inventory.entity.UserInventory;
|
||||
import org.spongepowered.api.item.inventory.type.CarriedInventory;
|
||||
import org.spongepowered.api.profile.GameProfile;
|
||||
import org.spongepowered.api.service.permission.Subject;
|
||||
import org.spongepowered.api.util.RespawnLocation;
|
||||
import org.spongepowered.api.util.annotation.DoNotStore;
|
||||
import org.spongepowered.api.world.server.ServerLocation;
|
||||
import org.spongepowered.math.vector.Vector3d;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@@ -147,4 +152,76 @@ public interface User extends DataHolder.Mutable, ArmorEquipable, Tamer, Subject
|
||||
* @return The ender chest inventory
|
||||
*/
|
||||
Inventory enderChestInventory();
|
||||
|
||||
/**
|
||||
* {@link Keys#RESPAWN_LOCATIONS}
|
||||
*
|
||||
* @return The spawn locations of the user may have for various worlds
|
||||
*/
|
||||
default MapValue.Mutable<ResourceKey, RespawnLocation> respawnLocations() {
|
||||
return this.requireValue(Keys.RESPAWN_LOCATIONS).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#FIRST_DATE_JOINED}
|
||||
*
|
||||
* @return The timestamp value when this user first joined
|
||||
*/
|
||||
default Optional<Value.Mutable<Instant>> firstJoined() {
|
||||
return this.getValue(Keys.FIRST_DATE_JOINED).map(Value::asMutable);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#LAST_DATE_JOINED}
|
||||
*
|
||||
* @return The last timestamp value when this user has joined
|
||||
*/
|
||||
default Optional<Value.Mutable<Instant>> lastJoined() {
|
||||
return this.getValue(Keys.LAST_DATE_JOINED).map(Value::asMutable);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#INVULNERABLE}
|
||||
*
|
||||
* @return Whether the user is invulnerable
|
||||
*/
|
||||
default Value.Mutable<Boolean> invulnerable() {
|
||||
return this.requireValue(Keys.INVULNERABLE).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_INVISIBLE}
|
||||
*
|
||||
* @return Whether the user is invisible
|
||||
*/
|
||||
default Value.Mutable<Boolean> invisible() {
|
||||
return this.requireValue(Keys.IS_INVISIBLE).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#VANISH}
|
||||
*
|
||||
* @return Whether the user is vanished
|
||||
*/
|
||||
default Value.Mutable<Boolean> vanish() {
|
||||
return this.requireValue(Keys.VANISH).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#VANISH_IGNORES_COLLISION}
|
||||
*
|
||||
* @return Whether the user ignores collision with other entities
|
||||
*/
|
||||
default Value.Mutable<Boolean> vanishIgnoresCollision() {
|
||||
return this.requireValue(Keys.VANISH_IGNORES_COLLISION).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#VANISH_PREVENTS_TARGETING}
|
||||
*
|
||||
* @return Whether the user can be targeted for attack by another entity
|
||||
*/
|
||||
default Value.Mutable<Boolean> vanishPreventsTargeting() {
|
||||
return this.requireValue(Keys.VANISH_PREVENTS_TARGETING).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import org.spongepowered.api.advancement.AdvancementProgress;
|
||||
import org.spongepowered.api.advancement.AdvancementTree;
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.type.SkinPart;
|
||||
import org.spongepowered.api.data.value.MapValue;
|
||||
import org.spongepowered.api.data.value.SetValue;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.entity.Entity;
|
||||
@@ -41,6 +42,7 @@ import org.spongepowered.api.entity.living.player.Player;
|
||||
import org.spongepowered.api.entity.living.player.PlayerChatFormatter;
|
||||
import org.spongepowered.api.entity.living.player.User;
|
||||
import org.spongepowered.api.entity.living.player.chat.ChatVisibility;
|
||||
import org.spongepowered.api.entity.living.player.gamemode.GameMode;
|
||||
import org.spongepowered.api.entity.living.player.tab.TabList;
|
||||
import org.spongepowered.api.event.Cause;
|
||||
import org.spongepowered.api.event.message.PlayerChatEvent;
|
||||
@@ -50,6 +52,7 @@ import org.spongepowered.api.network.ServerPlayerConnection;
|
||||
import org.spongepowered.api.resourcepack.ResourcePack;
|
||||
import org.spongepowered.api.scoreboard.Scoreboard;
|
||||
import org.spongepowered.api.service.permission.Subject;
|
||||
import org.spongepowered.api.statistic.Statistic;
|
||||
import org.spongepowered.api.world.border.WorldBorder;
|
||||
import org.spongepowered.api.world.server.ServerWorld;
|
||||
import org.spongepowered.plugin.PluginContainer;
|
||||
@@ -170,6 +173,7 @@ public interface ServerPlayer extends Player, Subject {
|
||||
|
||||
/**
|
||||
* {@link Keys#SKIN_PARTS}
|
||||
*
|
||||
* @return A set of skin parts displayed
|
||||
*/
|
||||
default SetValue.Mutable<SkinPart> displayedSkinParts() {
|
||||
@@ -289,33 +293,6 @@ public interface ServerPlayer extends Player, Subject {
|
||||
*/
|
||||
Collection<AdvancementTree> unlockedAdvancementTrees();
|
||||
|
||||
/**
|
||||
* {@link Keys#FIRST_DATE_JOINED}
|
||||
*
|
||||
* @return The timestamp value when this player first joined
|
||||
*/
|
||||
default Value.Mutable<Instant> firstJoined() {
|
||||
return this.requireValue(Keys.FIRST_DATE_JOINED).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#LAST_DATE_JOINED}
|
||||
*
|
||||
* @return The last timestamp value when this player has joined
|
||||
*/
|
||||
default Value.Mutable<Instant> lastJoined() {
|
||||
return this.requireValue(Keys.LAST_DATE_JOINED).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#LAST_DATE_PLAYED}
|
||||
*
|
||||
* @return The last timestamp value when this player has played
|
||||
*/
|
||||
default Value.Mutable<Instant> lastPlayed() {
|
||||
return this.requireValue(Keys.LAST_DATE_PLAYED).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#HAS_VIEWED_CREDITS}
|
||||
*
|
||||
@@ -335,22 +312,13 @@ public interface ServerPlayer extends Player, Subject {
|
||||
return !this.firstJoined().equals(this.lastPlayed());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_SLEEPING_IGNORED}
|
||||
*
|
||||
* @return Whether this player is going to be ignored for sleeping to "reset" the day
|
||||
*/
|
||||
default Value.Mutable<Boolean> sleepingIgnored() {
|
||||
return this.requireValue(Keys.IS_SLEEPING_IGNORED).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#SPECTATOR_TARGET}
|
||||
*
|
||||
* @return The entity this player is "spectating"
|
||||
*/
|
||||
default Optional<Value.Mutable<Entity>> spectatorTarget() {
|
||||
return this.getValue(Keys.SPECTATOR_TARGET).map(Value::asMutable);
|
||||
default Value.Mutable<Entity> spectatorTarget() {
|
||||
return this.requireValue(Keys.SPECTATOR_TARGET).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,4 +334,58 @@ public interface ServerPlayer extends Player, Subject {
|
||||
* @param router the chat router
|
||||
*/
|
||||
void setChatFormatter(final PlayerChatFormatter router);
|
||||
|
||||
/**
|
||||
* {@link Keys#GAME_MODE}
|
||||
*
|
||||
* @return The game mode the player has
|
||||
*/
|
||||
default Value.Mutable<GameMode> gameMode() {
|
||||
return this.requireValue(Keys.GAME_MODE).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#STATISTICS}
|
||||
*
|
||||
* @return The statistics of the player
|
||||
*/
|
||||
default MapValue.Mutable<Statistic, Long> statistics() {
|
||||
return this.requireValue(Keys.STATISTICS).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#HEALTH_SCALE}
|
||||
*
|
||||
* @return The value the player max-health (excluding absorption) in the GUI will scale to
|
||||
*/
|
||||
default Optional<Value.Mutable<Double>> healthScale() {
|
||||
return this.getValue(Keys.HEALTH_SCALE).map(Value::asMutable);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#FIRST_DATE_JOINED}
|
||||
*
|
||||
* @return The timestamp value when this player first joined
|
||||
*/
|
||||
default Optional<Value.Mutable<Instant>> firstJoined() {
|
||||
return this.getValue(Keys.FIRST_DATE_JOINED).map(Value::asMutable);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#LAST_DATE_JOINED}
|
||||
*
|
||||
* @return The last timestamp value when this player has joined
|
||||
*/
|
||||
default Optional<Value.Mutable<Instant>> lastJoined() {
|
||||
return this.getValue(Keys.LAST_DATE_JOINED).map(Value::asMutable);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#LAST_DATE_PLAYED}
|
||||
*
|
||||
* @return The last timestamp value when this player has played
|
||||
*/
|
||||
default Optional<Value.Mutable<Instant>> lastPlayed() {
|
||||
return this.getValue(Keys.LAST_DATE_PLAYED).map(Value::asMutable);
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public interface Trader extends Creature, Merchant {
|
||||
*
|
||||
* @return Whether this trader is currently trading with a player
|
||||
*/
|
||||
default Value.Immutable<Boolean> trading() {
|
||||
return this.requireValue(Keys.IS_TRADING).asImmutable();
|
||||
default Value<Boolean> trading() {
|
||||
return this.requireValue(Keys.IS_TRADING);
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,7 @@ public interface Villager extends Trader, Ageable {
|
||||
|
||||
/**
|
||||
* {@link Keys#PROFESSION_TYPE}
|
||||
*
|
||||
* @return The profession of this villager
|
||||
* @see ProfessionTypes
|
||||
*/
|
||||
@@ -63,4 +64,13 @@ public interface Villager extends Trader, Ageable {
|
||||
default Value.Mutable<Integer> professionLevel() {
|
||||
return this.requireValue(Keys.PROFESSION_LEVEL).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#EXPERIENCE}
|
||||
*
|
||||
* @return The experience of the villager
|
||||
*/
|
||||
default Value.Mutable<Integer> experience() {
|
||||
return this.requireValue(Keys.EXPERIENCE).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,8 @@
|
||||
package org.spongepowered.api.entity.projectile;
|
||||
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.MapValue;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.entity.EntityType;
|
||||
import org.spongepowered.math.vector.Vector3d;
|
||||
|
||||
/**
|
||||
* Represents a {@link Projectile} that inflicts damage.
|
||||
@@ -35,20 +34,12 @@ import org.spongepowered.api.entity.EntityType;
|
||||
public interface DamagingProjectile extends Projectile {
|
||||
|
||||
/**
|
||||
* {@link Keys#ATTACK_DAMAGE}
|
||||
* {@link Keys#ACCELERATION}
|
||||
*
|
||||
* @return The attack damage
|
||||
* @return The acceleration of the damaging projectile
|
||||
*/
|
||||
default Value.Mutable<Double> attackDamage() {
|
||||
return this.requireValue(Keys.ATTACK_DAMAGE).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#CUSTOM_ATTACK_DAMAGE}
|
||||
* @return The attack damage per type
|
||||
*/
|
||||
default MapValue.Mutable<EntityType<?>, Double> customAttackDamage() {
|
||||
return this.requireValue(Keys.CUSTOM_ATTACK_DAMAGE).asMutable();
|
||||
default Value.Mutable<Vector3d> acceleration() {
|
||||
return this.requireValue(Keys.ACCELERATION).asMutable();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@ package org.spongepowered.api.entity.projectile;
|
||||
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.util.Ticks;
|
||||
import org.spongepowered.math.vector.Vector3d;
|
||||
|
||||
/**
|
||||
@@ -33,6 +34,15 @@ import org.spongepowered.math.vector.Vector3d;
|
||||
*/
|
||||
public interface EyeOfEnder extends Projectile {
|
||||
|
||||
/**
|
||||
* {@link Keys#DESPAWN_DELAY}
|
||||
*
|
||||
* @return The despawn delay (in ticks) of the eye of ender
|
||||
*/
|
||||
default Value.Mutable<Ticks> despawnDelay() {
|
||||
return this.requireValue(Keys.DESPAWN_DELAY).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#TARGET_LOCATION}
|
||||
*
|
||||
@@ -42,4 +52,13 @@ public interface EyeOfEnder extends Projectile {
|
||||
return this.requireValue(Keys.TARGET_LOCATION).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#WILL_SHATTER}
|
||||
*
|
||||
* @return Whether the thrown eye of ender will shatter
|
||||
*/
|
||||
default Value.Mutable<Boolean> willShatter() {
|
||||
return this.requireValue(Keys.WILL_SHATTER).asMutable();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,7 +38,6 @@ public interface FishingBobber extends Projectile {
|
||||
/**
|
||||
* {@link Keys#TARGET_ENTITY}
|
||||
*
|
||||
* @see Keys#TARGET_ENTITY
|
||||
* @return The targeted entity, if available
|
||||
*/
|
||||
default Optional<Value.Mutable<Entity>> targetEntity() {
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
package org.spongepowered.api.entity.projectile;
|
||||
|
||||
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.ItemStack;
|
||||
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
|
||||
|
||||
@@ -36,10 +38,19 @@ public interface Potion extends Projectile {
|
||||
|
||||
/**
|
||||
* {@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}
|
||||
*
|
||||
* @return The potion effects of the thrown potion
|
||||
*/
|
||||
default ListValue.Mutable<PotionEffect> effects() {
|
||||
return this.requireValue(Keys.POTION_EFFECTS).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -24,9 +24,23 @@
|
||||
*/
|
||||
package org.spongepowered.api.entity.projectile.arrow;
|
||||
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.ListValue;
|
||||
import org.spongepowered.api.effect.potion.PotionEffect;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* An arrow generally "tipped" with one or more potion effects.
|
||||
*/
|
||||
public interface Arrow extends ArrowEntity {
|
||||
|
||||
/**
|
||||
* {@link Keys#POTION_EFFECTS}
|
||||
*
|
||||
* @return The potion effects that are applied to the arrow
|
||||
*/
|
||||
default ListValue.Mutable<PotionEffect> potionEffects() {
|
||||
return this.requireValue(Keys.POTION_EFFECTS).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,9 @@ package org.spongepowered.api.entity.projectile.arrow;
|
||||
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.type.PickupRule;
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -52,4 +54,31 @@ public interface ArrowEntity extends DamagingProjectile {
|
||||
default Value.Mutable<Double> knockbackStrength() {
|
||||
return this.requireValue(Keys.KNOCKBACK_STRENGTH).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#ATTACK_DAMAGE}
|
||||
*
|
||||
* @return The attack damage
|
||||
*/
|
||||
default Value.Mutable<Double> attackDamage() {
|
||||
return this.requireValue(Keys.ATTACK_DAMAGE).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#CUSTOM_ATTACK_DAMAGE}
|
||||
*
|
||||
* @return The attack damage per type
|
||||
*/
|
||||
default MapValue.Mutable<EntityType<?>, Double> customAttackDamage() {
|
||||
return this.requireValue(Keys.CUSTOM_ATTACK_DAMAGE).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_CRITICAL_HIT}
|
||||
*
|
||||
* @return Whether the arrow will cause a critical hit
|
||||
*/
|
||||
default Value.Mutable<Boolean> criticalHit() {
|
||||
return this.requireValue(Keys.IS_CRITICAL_HIT).asMutable();
|
||||
}
|
||||
}
|
||||
@@ -26,10 +26,15 @@ package org.spongepowered.api.entity.projectile.explosive;
|
||||
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.ListValue;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.data.value.Value.Mutable;
|
||||
import org.spongepowered.api.entity.explosive.fused.FusedExplosive;
|
||||
import org.spongepowered.api.entity.projectile.Projectile;
|
||||
import org.spongepowered.api.item.FireworkEffect;
|
||||
import org.spongepowered.api.item.ItemTypes;
|
||||
import org.spongepowered.api.util.Ticks;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Represents a Firework.
|
||||
@@ -45,4 +50,12 @@ public interface FireworkRocket extends Projectile, FusedExplosive {
|
||||
return this.requireValue(Keys.FIREWORK_EFFECTS).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#FIREWORK_FLIGHT_MODIFIER}
|
||||
*
|
||||
* @return The flight duration of the firework rocket
|
||||
*/
|
||||
default Optional<Value.Mutable<Ticks>> flightModifier() {
|
||||
return this.getValue(Keys.FIREWORK_FLIGHT_MODIFIER).map(Value::asMutable);
|
||||
}
|
||||
}
|
||||
-8
@@ -34,12 +34,4 @@ import org.spongepowered.math.vector.Vector3d;
|
||||
*/
|
||||
public interface FireballEntity extends DamagingProjectile {
|
||||
|
||||
/**
|
||||
* {@link Keys#ACCELERATION}
|
||||
*
|
||||
* @return The fireball's acceleration
|
||||
*/
|
||||
default Value.Mutable<Vector3d> acceleration() {
|
||||
return this.requireValue(Keys.ACCELERATION).asMutable();
|
||||
}
|
||||
}
|
||||
+14
-3
@@ -28,14 +28,25 @@ import org.spongepowered.api.block.BlockState;
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface BlockOccupiedMinecart extends MinecartLike {
|
||||
|
||||
/**
|
||||
* {@link Keys#MINECART_BLOCK_OFFSET}
|
||||
*
|
||||
* @return The represented block's offset of the minecart
|
||||
*/
|
||||
default Value.Mutable<Integer> blockOffset() {
|
||||
return this.requireValue(Keys.MINECART_BLOCK_OFFSET).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#BLOCK_STATE}
|
||||
*
|
||||
* @return The block state in this minecart
|
||||
* @return The block state of the block occupied minecart
|
||||
*/
|
||||
default Value.Immutable<BlockState> block() {
|
||||
return this.requireValue(Keys.BLOCK_STATE).asImmutable();
|
||||
default Optional<Value.Mutable<BlockState>> block() {
|
||||
return this.getValue(Keys.BLOCK_STATE).map(Value::asMutable);
|
||||
}
|
||||
}
|
||||
@@ -24,13 +24,65 @@
|
||||
*/
|
||||
package org.spongepowered.api.entity.vehicle.minecart;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.spongepowered.api.block.entity.CommandBlock;
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.service.permission.Subject;
|
||||
import org.spongepowered.api.util.locale.LocaleSource;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Represents a {@link Minecart} with a {@link CommandBlock} inside it.
|
||||
*/
|
||||
public interface CommandBlockMinecart extends BlockOccupiedMinecart, LocaleSource, Subject {
|
||||
|
||||
/**
|
||||
* Gets the currently stored command.
|
||||
*
|
||||
* @return The command
|
||||
*/
|
||||
default Value.Mutable<String> storedCommand() {
|
||||
return this.requireValue(Keys.COMMAND).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the success count of the last executed command.
|
||||
*
|
||||
* <p>The success count is the number of times the most recently used
|
||||
* command of this command block succeeded. Most commands can only succeed
|
||||
* once per execution, but certain commands (such as those which accept
|
||||
* players as arguments) can succeed multiple times, and this value will be
|
||||
* set accordingly. This success count can also be polled via a redstone
|
||||
* comparator.</p>
|
||||
*
|
||||
* @return The last success count
|
||||
*/
|
||||
default Value.Mutable<Integer> successCount() {
|
||||
return this.requireValue(Keys.SUCCESS_COUNT).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether this command block will keep track of the output from the
|
||||
* last command it executed.
|
||||
*
|
||||
* @return Whether the command output is tracked
|
||||
*/
|
||||
default Value.Mutable<Boolean> doesTrackOutput() {
|
||||
return this.requireValue(Keys.TRACKS_OUTPUT).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last command output.
|
||||
*
|
||||
* <p>This will only be available if {@link #doesTrackOutput()} is set to
|
||||
* true, otherwise {@link Optional#empty()} will be returned.</p>
|
||||
*
|
||||
* @return The last command output, if available
|
||||
*/
|
||||
default Optional<Value.Mutable<Component>> lastOutput() {
|
||||
return this.getValue(Keys.LAST_COMMAND_OUTPUT).map(Value::asMutable);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,11 +24,14 @@
|
||||
*/
|
||||
package org.spongepowered.api.entity.vehicle.minecart;
|
||||
|
||||
import org.spongepowered.api.block.BlockState;
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.entity.Entity;
|
||||
import org.spongepowered.math.vector.Vector3d;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* An abstract representation of a Minecart.
|
||||
*/
|
||||
@@ -43,21 +46,13 @@ public interface MinecartLike extends Entity {
|
||||
return this.requireValue(Keys.IS_ON_RAIL).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#SWIFTNESS}
|
||||
*
|
||||
* @return The current swiftness of the minecart
|
||||
*/
|
||||
default Value.Mutable<Double> swiftness() {
|
||||
return this.requireValue(Keys.SWIFTNESS).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#POTENTIAL_MAX_SPEED}
|
||||
*
|
||||
* <p>This differs from {@link Minecart#swiftness()} in that its value is
|
||||
* <p>This differs from {@link Entity#swiftness()} in that its value is
|
||||
* affected by the block/rail beneath the cart. However, it is still
|
||||
* impacted and limited by the cart's swiftness.</p>
|
||||
*
|
||||
* @return The potential maximum speed
|
||||
*/
|
||||
default Value.Mutable<Double> potentialMaxSpeed() {
|
||||
|
||||
@@ -24,9 +24,30 @@
|
||||
*/
|
||||
package org.spongepowered.api.entity.weather;
|
||||
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.data.value.Value;
|
||||
import org.spongepowered.api.util.Ticks;
|
||||
|
||||
/**
|
||||
* Represents a Lighting Bolt.
|
||||
*/
|
||||
public interface LightningBolt extends WeatherEffect {
|
||||
|
||||
/**
|
||||
* {@link Keys#DESPAWN_DELAY}
|
||||
*
|
||||
* @return The despawn delay (in ticks) of the lightning bolt
|
||||
*/
|
||||
default Value.Mutable<Ticks> despawnDelay() {
|
||||
return this.requireValue(Keys.DESPAWN_DELAY).asMutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Keys#IS_EFFECT_ONLY}
|
||||
*
|
||||
* @return Whether the lightning bolt is harmful to other entities
|
||||
*/
|
||||
default Value<Boolean> effectOnly() {
|
||||
return this.requireValue(Keys.IS_EFFECT_ONLY);
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,12 @@ public interface Merchant extends DataHolder.Mutable, Carrier, Locatable {
|
||||
*/
|
||||
void setCustomer(@Nullable Humanoid humanoid);
|
||||
|
||||
default ListValue<TradeOffer> tradeOffers() {
|
||||
/**
|
||||
* {@link Keys#TRADE_OFFERS}
|
||||
*
|
||||
* @return The trade offers offered by the merchant
|
||||
*/
|
||||
default ListValue.Mutable<TradeOffer> tradeOffers() {
|
||||
return this.requireValue(Keys.TRADE_OFFERS).asMutable();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user