Skip to content

Commit 5932d4d

Browse files
author
Daniel Naylor
committed
Merge branch 'api-8' into api-9
2 parents dd25001 + a7ee7bd commit 5932d4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1061
-232
lines changed

src/main/java/org/spongepowered/api/command/manager/CommandMapping.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.spongepowered.api.command.registrar.CommandRegistrar;
2828
import org.spongepowered.plugin.PluginContainer;
2929

30+
import java.util.Optional;
3031
import java.util.Set;
3132

3233
/**
@@ -59,11 +60,11 @@ public interface CommandMapping {
5960
Set<String> allAliases();
6061

6162
/**
62-
* Gets the plugin that owns the command.
63+
* Gets the plugin that owns the command, if known.
6364
*
6465
* @return The plugin.
6566
*/
66-
PluginContainer plugin();
67+
Optional<PluginContainer> plugin();
6768

6869
/**
6970
* Gets the {@link CommandRegistrar} that registered this command.

src/main/java/org/spongepowered/api/data/Keys.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ public final class Keys {
443443

444444
/**
445445
* The {@link BossBar} displayed to the client by a {@link Boss}.
446-
* Readonly but mutable?
446+
* TODO Readonly but mutable?
447447
*/
448448
public static final Key<Value<BossBar>> BOSS_BAR = Keys.key(ResourceKey.sponge("boss_bar"), BossBar.class);
449449

@@ -603,11 +603,11 @@ public final class Keys {
603603
public static final Key<Value<SpellType>> CURRENT_SPELL = Keys.key(ResourceKey.sponge("current_spell"), SpellType.class);
604604

605605
/**
606-
* The damage dealt towards entities of a specific {@link EntityType} by a {@link DamagingProjectile}.
606+
* The damage dealt towards entities of a specific {@link EntityType} by a {@link ArrowEntity}.
607607
*
608608
* <p>Note that in events, the damage defined for the provided
609609
* {@link EntityType} will take priority over the "default" damage as
610-
* defined from {@link DamagingProjectile#attackDamage()}.</p>
610+
* defined from {@link ArrowEntity#attackDamage()}.</p>
611611
*
612612
* <p>Types not present in this mapping will be
613613
* dealt damage to according to {@link #ATTACK_DAMAGE}.</p>
@@ -2585,7 +2585,7 @@ public final class Keys {
25852585
public static final Key<Value<Boolean>> TRACKS_OUTPUT = Keys.key(ResourceKey.sponge("tracks_output"), Boolean.class);
25862586

25872587
/**
2588-
* Tge {@link TradeOffer}s offered by a {@link Trader}.
2588+
* The {@link TradeOffer}s offered by a {@link Trader}.
25892589
*/
25902590
public static final Key<ListValue<TradeOffer>> TRADE_OFFERS = Keys.listKey(ResourceKey.sponge("trade_offers"), TradeOffer.class);
25912591

src/main/java/org/spongepowered/api/entity/AreaEffectCloud.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,4 @@ default Value.Mutable<Ticks> applicationDelay() {
128128
default ListValue.Mutable<PotionEffect> effects() {
129129
return this.requireValue(Keys.POTION_EFFECTS).asMutable();
130130
}
131-
132-
/**
133-
* {@link Keys#AGE}
134-
*
135-
* @return The age of this cloud
136-
*/
137-
default Value.Mutable<Integer> age() {
138-
return this.requireValue(Keys.AGE).asMutable();
139-
}
140-
141131
}

src/main/java/org/spongepowered/api/entity/Entity.java

Lines changed: 198 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.spongepowered.api.data.Keys;
3232
import org.spongepowered.api.data.SerializableDataHolder;
3333
import org.spongepowered.api.data.value.ListValue;
34+
import org.spongepowered.api.data.value.SetValue;
3435
import org.spongepowered.api.data.value.Value;
3536
import org.spongepowered.api.event.cause.entity.damage.source.DamageSource;
3637
import org.spongepowered.api.projectile.source.EntityProjectileSource;
@@ -376,7 +377,7 @@ default Optional<Value.Mutable<Entity>> vehicle() {
376377
*
377378
* @return The "base vehicle" of the entity vehicle riding chain
378379
*/
379-
default Optional<Value.Mutable<Entity>> baseVehicle() {
380+
default Optional<Value<Entity>> baseVehicle() {
380381
return this.getValue(Keys.BASE_VEHICLE).map(Value::asMutable);
381382
}
382383

@@ -385,7 +386,7 @@ default Optional<Value.Mutable<Entity>> baseVehicle() {
385386
*
386387
* @return Whether this entity is on the ground
387388
*/
388-
default Value.Mutable<Boolean> onGround() {
389+
default Value<Boolean> onGround() {
389390
return this.requireValue(Keys.ON_GROUND).asMutable();
390391
}
391392

@@ -437,7 +438,7 @@ default Optional<Value.Mutable<UUID>> notifier() {
437438
/**
438439
* {@link Keys#FIRE_TICKS}
439440
*
440-
* @return The amount of time in ticks an Entity is will continue burn for.
441+
* @return The amount of time in ticks the entity is will continue burn for
441442
*/
442443
default Optional<Value.Mutable<Ticks>> fireTicks() {
443444
return this.getValue(Keys.FIRE_TICKS).map(Value::asMutable);
@@ -446,19 +447,208 @@ default Optional<Value.Mutable<Ticks>> fireTicks() {
446447
/**
447448
* {@link Keys#FIRE_DAMAGE_DELAY}
448449
*
449-
* @return The amount of time to delay in ticks before an Entity will be burned by fire.
450+
* @return The amount of time to delay in ticks before the entity will be burned by fire
450451
*/
451-
default Optional<Value.Mutable<Ticks>> fireImmuneTicks() {
452-
return this.getValue(Keys.FIRE_DAMAGE_DELAY).map(Value::asMutable);
452+
default Value.Mutable<Ticks> fireImmuneTicks() {
453+
return this.requireValue(Keys.FIRE_DAMAGE_DELAY).asMutable();
453454
}
454455

455456
/**
456457
* {@link Keys#TRANSIENT}
457458
*
458459
* @return The transient state
459460
*/
460-
default Optional<Value.Mutable<Boolean>> isTransient() {
461-
return this.getValue(Keys.TRANSIENT).map(Value::asMutable);
461+
default Value.Mutable<Boolean> isTransient() {
462+
return this.requireValue(Keys.TRANSIENT).asMutable();
463+
}
464+
465+
/**
466+
* {@link Keys#AGE}
467+
*
468+
* @return The age of this entity
469+
*/
470+
default Value.Mutable<Integer> age() {
471+
return this.requireValue(Keys.AGE).asMutable();
472+
}
473+
474+
/**
475+
* {@link Keys#BASE_SIZE}
476+
*
477+
* @return The base size of the entity
478+
*/
479+
default Value<Double> baseSize() {
480+
return this.requireValue(Keys.BASE_SIZE);
481+
}
482+
483+
/**
484+
* {@link Keys#EYE_HEIGHT}
485+
*
486+
* @return The height of the eyes
487+
*/
488+
default Value<Double> eyeHeight() {
489+
return this.requireValue(Keys.EYE_HEIGHT);
490+
}
491+
492+
/**
493+
* {@link Keys#EYE_POSITION}
494+
*
495+
* @return The position of the eyes
496+
*/
497+
default Value<Vector3d> eyePosition() {
498+
return this.requireValue(Keys.EYE_POSITION);
499+
}
500+
501+
/**
502+
* {@link Keys#HEIGHT}
503+
*
504+
* @return The height of the entity
505+
*/
506+
default Value<Double> height() {
507+
return this.requireValue(Keys.HEIGHT);
508+
}
509+
510+
/**
511+
* {@link Keys#INVULNERABILITY_TICKS}
512+
*
513+
* @return The amount of ticks the entity will remain invulnerable for
514+
*/
515+
default Value.Mutable<Ticks> invulnerabilityTicks() {
516+
return this.requireValue(Keys.INVULNERABILITY_TICKS).asMutable();
517+
}
518+
519+
/**
520+
* {@link Keys#IS_CUSTOM_NAME_VISIBLE}
521+
*
522+
* @return Whether a custom name is visible on the entity
523+
*/
524+
default Value.Mutable<Boolean> customNameVisible() {
525+
return this.requireValue(Keys.IS_CUSTOM_NAME_VISIBLE).asMutable();
526+
}
527+
528+
/**
529+
* {@link Keys#IS_GLOWING}
530+
*
531+
* @return Whether the entity has a glowing outline
532+
*/
533+
default Value.Mutable<Boolean> glowing() {
534+
return this.requireValue(Keys.IS_GLOWING).asMutable();
535+
}
536+
537+
/**
538+
* {@link Keys#IS_INVISIBLE}
539+
*
540+
* @return Whether the entity is currently invisible
541+
*/
542+
default Value.Mutable<Boolean> invisible() {
543+
return this.requireValue(Keys.IS_INVISIBLE).asMutable();
544+
}
545+
546+
/**
547+
* {@link Keys#INVULNERABLE}
548+
*
549+
* @return Whether the entity is invulnerable
550+
*/
551+
default Value.Mutable<Boolean> invulnerable() {
552+
return this.requireValue(Keys.INVULNERABLE).asMutable();
553+
}
554+
555+
/**
556+
* {@link Keys#IS_SNEAKING}
557+
*
558+
* @return Whether the entity is sneaking
559+
*/
560+
default Value.Mutable<Boolean> sneaking() {
561+
return this.requireValue(Keys.IS_SNEAKING).asMutable();
562+
}
563+
564+
/**
565+
* {@link Keys#IS_SPRINTING}
566+
*
567+
* @return Whether the entity is sprinting
568+
*/
569+
default Value.Mutable<Boolean> sprinting() {
570+
return this.requireValue(Keys.IS_SPRINTING).asMutable();
571+
}
572+
573+
/**
574+
* {@link Keys#IS_WET}
575+
*
576+
* @return Whether the entity is wet
577+
*/
578+
default Value<Boolean> wet() {
579+
return this.requireValue(Keys.IS_WET).asMutable();
580+
}
581+
582+
/**
583+
* {@link Keys#MAX_AIR}
584+
*
585+
* @return The max air supply
586+
*/
587+
default Value.Mutable<Integer> maxAir() {
588+
return this.requireValue(Keys.MAX_AIR).asMutable();
589+
}
590+
591+
/**
592+
* {@link Keys#REMAINING_AIR}
593+
*
594+
* @return The remaining air supply
595+
*/
596+
default Value.Mutable<Integer> remainingAir() {
597+
return this.requireValue(Keys.REMAINING_AIR).asMutable();
598+
}
599+
600+
/**
601+
* {@link Keys#SCOREBOARD_TAGS}
602+
*
603+
* @return The scoreboard tags applied to the entity
604+
*/
605+
default SetValue.Mutable<String> scoreboardTags() {
606+
return this.requireValue(Keys.SCOREBOARD_TAGS).asMutable();
607+
}
608+
609+
/**
610+
* {@link Keys#VANISH}
611+
*
612+
* @return Whether the entity is vanished
613+
*/
614+
default Value.Mutable<Boolean> vanish() {
615+
return this.requireValue(Keys.VANISH).asMutable();
616+
}
617+
618+
/**
619+
* {@link Keys#VANISH_IGNORES_COLLISION}
620+
*
621+
* @return Whether the entity ignores collision with other entities
622+
*/
623+
default Value.Mutable<Boolean> vanishIgnoresCollision() {
624+
return this.requireValue(Keys.VANISH_IGNORES_COLLISION).asMutable();
625+
}
626+
627+
/**
628+
* {@link Keys#VANISH_PREVENTS_TARGETING}
629+
*
630+
* @return Whether the entity can be targeted for attack by another entity
631+
*/
632+
default Value.Mutable<Boolean> vanishPreventsTargeting() {
633+
return this.requireValue(Keys.VANISH_PREVENTS_TARGETING).asMutable();
634+
}
635+
636+
/**
637+
* {@link Keys#CUSTOM_NAME}
638+
*
639+
* @return The custom name of the entity
640+
*/
641+
default Optional<Value.Mutable<Component>> customName() {
642+
return this.getValue(Keys.CUSTOM_NAME).map(Value::asMutable);
643+
}
644+
645+
/**
646+
* {@link Keys#SWIFTNESS}
647+
*
648+
* @return The current swiftness of the entity
649+
*/
650+
default Optional<Value.Mutable<Double>> swiftness() {
651+
return this.getValue(Keys.SWIFTNESS).map(Value::asMutable);
462652
}
463653

464654
@Override

src/main/java/org/spongepowered/api/entity/FallingBlock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public interface FallingBlock extends Entity {
3838
/**
3939
* {@link Keys#BLOCK_STATE}
4040
*
41-
* @return The blockstate
41+
* @return The block state of the falling block
4242
*/
4343
default Value.Mutable<BlockState> blockState() {
4444
return this.requireValue(Keys.BLOCK_STATE).asMutable();

src/main/java/org/spongepowered/api/entity/Item.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.spongepowered.api.item.ItemType;
3030
import org.spongepowered.api.item.inventory.ItemStack;
3131
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
32+
import org.spongepowered.api.util.Ticks;
3233

3334
/**
3435
* Represents an Item.
@@ -43,4 +44,40 @@ public interface Item extends Entity {
4344
default Value.Mutable<ItemStackSnapshot> item() {
4445
return this.requireValue(Keys.ITEM_STACK_SNAPSHOT).asMutable();
4546
}
47+
48+
/**
49+
* {@link Keys#DESPAWN_DELAY}
50+
*
51+
* @return The despawn delay (in ticks) of the item
52+
*/
53+
default Value.Mutable<Ticks> despawnDelay() {
54+
return this.requireValue(Keys.DESPAWN_DELAY).asMutable();
55+
}
56+
57+
/**
58+
* {@link Keys#INFINITE_DESPAWN_DELAY}
59+
*
60+
* @return Whether the item will not despawn for an infinite time
61+
*/
62+
default Value.Mutable<Boolean> infiniteDespawnDelay() {
63+
return this.requireValue(Keys.INFINITE_DESPAWN_DELAY).asMutable();
64+
}
65+
66+
/**
67+
* {@link Keys#INFINITE_PICKUP_DELAY}
68+
*
69+
* @return Whether the item has an infinite pickup delay
70+
*/
71+
default Value.Mutable<Boolean> infinitePickupDelay() {
72+
return this.requireValue(Keys.INFINITE_PICKUP_DELAY).asMutable();
73+
}
74+
75+
/**
76+
* {@link Keys#PICKUP_DELAY}
77+
*
78+
* @return The pickup delay (in ticks) of the item
79+
*/
80+
default Value.Mutable<Ticks> pickupDelay() {
81+
return this.requireValue(Keys.PICKUP_DELAY).asMutable();
82+
}
4683
}

src/main/java/org/spongepowered/api/entity/explosive/EndCrystal.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,13 @@ default Optional<Value.Mutable<Vector3i>> beamTarget() {
5252
default Value.Mutable<Boolean> showBottom() {
5353
return this.requireValue(Keys.SHOW_BOTTOM).asMutable();
5454
}
55+
56+
/**
57+
* {@link Keys#HEALTH}
58+
*
59+
* @return The health of the end crystal
60+
*/
61+
default Value.Mutable<Double> health() {
62+
return this.requireValue(Keys.HEALTH).asMutable();
63+
}
5564
}

0 commit comments

Comments
 (0)