Skip to content

Commit

Permalink
Merge branch 'api-12' into api-12-fix/raid
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHell228 committed Jul 9, 2024
2 parents f1fc080 + 96e3b65 commit 03928a1
Show file tree
Hide file tree
Showing 63 changed files with 470 additions and 263 deletions.
49 changes: 24 additions & 25 deletions src/main/java/org/spongepowered/api/data/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
import org.spongepowered.api.effect.potion.PotionEffectTypes;
import org.spongepowered.api.effect.sound.SoundType;
import org.spongepowered.api.effect.sound.music.MusicDisc;
import org.spongepowered.api.entity.Ageable;
import org.spongepowered.api.entity.Angerable;
import org.spongepowered.api.entity.AreaEffectCloud;
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.entity.EntityArchetype;
Expand All @@ -132,7 +134,6 @@
import org.spongepowered.api.entity.hanging.ItemFrame;
import org.spongepowered.api.entity.hanging.LeashKnot;
import org.spongepowered.api.entity.hanging.Painting;
import org.spongepowered.api.entity.living.Ageable;
import org.spongepowered.api.entity.living.Agent;
import org.spongepowered.api.entity.living.ArmorStand;
import org.spongepowered.api.entity.living.Bat;
Expand Down Expand Up @@ -188,19 +189,18 @@
import org.spongepowered.api.entity.living.player.gamemode.GameMode;
import org.spongepowered.api.entity.living.player.server.ServerPlayer;
import org.spongepowered.api.entity.living.slime.Slime;
import org.spongepowered.api.entity.living.trader.Trader;
import org.spongepowered.api.entity.living.trader.Villager;
import org.spongepowered.api.entity.projectile.DamagingProjectile;
import org.spongepowered.api.entity.projectile.AcceleratingProjectile;
import org.spongepowered.api.entity.projectile.EyeOfEnder;
import org.spongepowered.api.entity.projectile.FishingBobber;
import org.spongepowered.api.entity.projectile.IgnitingProjectile;
import org.spongepowered.api.entity.projectile.Potion;
import org.spongepowered.api.entity.projectile.Projectile;
import org.spongepowered.api.entity.projectile.ShulkerBullet;
import org.spongepowered.api.entity.projectile.arrow.Arrow;
import org.spongepowered.api.entity.projectile.arrow.ArrowEntity;
import org.spongepowered.api.entity.projectile.arrow.ArrowLike;
import org.spongepowered.api.entity.projectile.explosive.FireworkRocket;
import org.spongepowered.api.entity.projectile.explosive.WitherSkull;
import org.spongepowered.api.entity.projectile.explosive.fireball.FireballEntity;
import org.spongepowered.api.entity.vehicle.Boat;
import org.spongepowered.api.entity.vehicle.minecart.BlockOccupiedMinecart;
import org.spongepowered.api.entity.vehicle.minecart.CommandBlockMinecart;
Expand All @@ -225,6 +225,7 @@
import org.spongepowered.api.item.inventory.equipment.EquipmentType;
import org.spongepowered.api.item.inventory.slot.EquipmentSlot;
import org.spongepowered.api.item.inventory.type.GridInventory;
import org.spongepowered.api.item.merchant.Merchant;
import org.spongepowered.api.item.merchant.TradeOffer;
import org.spongepowered.api.item.potion.PotionType;
import org.spongepowered.api.map.MapCanvas;
Expand Down Expand Up @@ -304,7 +305,7 @@ public final class Keys {
public static final Key<Value<Double>> ABSORPTION = Keys.key(ResourceKey.sponge("absorption"), Double.class);

/**
* The acceleration of a {@link DamagingProjectile}.
* The acceleration of a {@link AcceleratingProjectile}.
*/
public static final Key<Value<Double>> ACCELERATION = Keys.key(ResourceKey.sponge("acceleration"), Double.class);

Expand Down Expand Up @@ -372,7 +373,7 @@ public final class Keys {
public static final Key<Value<SoundType>> AMBIENT_SOUND = Keys.key(ResourceKey.sponge("ambient_sound"), SoundType.class);

/**
* The anger level of a {@link ZombifiedPiglin}.
* The anger level of a {@link Angerable}.
*
* <p>Unlike {@link Keys#IS_ANGRY}, the aggressiveness represented by this key may
* fade over time and the entity will become peaceful again once its anger
Expand Down Expand Up @@ -413,7 +414,7 @@ public final class Keys {
public static final Key<Value<AttachmentSurface>> ATTACHMENT_SURFACE = Keys.key(ResourceKey.sponge("attachment_surface"), AttachmentSurface.class);

/**
* The damage dealt by an {@link ArrowEntity} on impact.
* The damage dealt by an {@link ArrowLike} on impact.
*/
public static final Key<Value<Double>> ATTACK_DAMAGE = Keys.key(ResourceKey.sponge("attack_damage"), Double.class);

Expand Down Expand Up @@ -615,7 +616,7 @@ public final class Keys {
/**
* Whether a {@link Living} entity may change blocks.
* This mostly applies to {@link Enderman} or
* {@link Creeper}s, but also to some projectiles like {@link FireballEntity}s or {@link WitherSkull}.
* {@link Creeper}s, but also to some projectiles like {@link IgnitingProjectile}s or {@link WitherSkull}.
*/
public static final Key<Value<Boolean>> CAN_GRIEF = Keys.key(ResourceKey.sponge("can_grief"), Boolean.class);

Expand Down Expand Up @@ -781,11 +782,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 ArrowEntity}.
* The damage dealt towards entities of a specific {@link EntityType} by a {@link ArrowLike}.
*
* <p>Note that in events, the damage defined for the provided
* {@link EntityType} will take priority over the "default" damage as
* defined from {@link ArrowEntity#attackDamage()}.</p>
* defined from {@link ArrowLike#attackDamage()}.</p>
*
* <p>Types not present in this mapping will be
* dealt damage to according to {@link #ATTACK_DAMAGE}.</p>
Expand All @@ -811,6 +812,11 @@ public final class Keys {
*/
public static final Key<ListValue<PotionEffect>> CUSTOM_POTION_EFFECTS = Keys.listKey(ResourceKey.sponge("custom_potion_effects"), PotionEffect.class);

/**
* The currently trading customer with this {@link Merchant}.
*/
public static final Key<Value<Player>> CUSTOMER = Keys.key(ResourceKey.sponge("customer"), Player.class);

/**
* The damage absorbed by an armor {@link ItemStack}.
* Readonly
Expand Down Expand Up @@ -1528,7 +1534,7 @@ public final class Keys {
public static final Key<Value<Boolean>> IN_WALL = Keys.key(ResourceKey.sponge("in_wall"), Boolean.class);

/**
* Whether an {@link Ageable} is considered an adult.
* Whether a {@link Living} is considered an adult.
*/
public static final Key<Value<Boolean>> IS_ADULT = Keys.key(ResourceKey.sponge("is_adult"), Boolean.class);

Expand All @@ -1546,8 +1552,7 @@ public final class Keys {
public static final Key<Value<Boolean>> IS_AI_ENABLED = Keys.key(ResourceKey.sponge("is_ai_enabled"), Boolean.class);

/**
* Whether an entity is currently aggressive.
* e.g. {@link Wolf wolves} or {@link ZombifiedPiglin}
* Whether a {@link Angerable} is currently aggressive.
*/
public static final Key<Value<Boolean>> IS_ANGRY = Keys.key(ResourceKey.sponge("is_angry"), Boolean.class);

Expand Down Expand Up @@ -2020,12 +2025,6 @@ public final class Keys {
*/
public static final Key<Value<Boolean>> IS_TAMED = Keys.key(ResourceKey.sponge("is_tamed"), Boolean.class);

/**
* Whether a {@link Trader} is currently trading with a {@link Player}.
* Readonly
*/
public static final Key<Value<Boolean>> IS_TRADING = Keys.key(ResourceKey.sponge("is_trading"), Boolean.class);

/**
* Whether a {@link Turtle} is currently traveling.
*/
Expand Down Expand Up @@ -2090,7 +2089,7 @@ public final class Keys {
public static final Key<Value<ItemStackSnapshot>> ITEM_STACK_SNAPSHOT = Keys.key(ResourceKey.sponge("item_stack_snapshot"), ItemStackSnapshot.class);

/**
* The custom knockback strength applied by an {@link ArrowEntity}.
* The custom knockback strength applied by an {@link ArrowLike}.
*
* <p>For the knockback provided by hits with a weapon according to the
* enchantment of the same name, see {@link #APPLIED_ENCHANTMENTS}.</p>
Expand Down Expand Up @@ -2134,7 +2133,7 @@ public final class Keys {
public static final Key<Value<Integer>> LAYER = Keys.key(ResourceKey.sponge("layer"), Integer.class);

/**
* The holder of a leashed {@link Agent}
* The holder of a leashed {@link Entity}
* e.g. a {@link Player} or {@link LeashKnot}.
* <p>Usually, a {@link LeashKnot} will always exist so long as there is
* a leashed {@link Entity} attached. If the leash is broken, the leash
Expand Down Expand Up @@ -2539,7 +2538,7 @@ public final class Keys {
public static final Key<Value<Ticks>> PICKUP_DELAY = Keys.key(ResourceKey.sponge("pickup_delay"), Ticks.class);

/**
* The {@link PickupRule} of an {@link ArrowEntity}.
* The {@link PickupRule} of an {@link ArrowLike}.
*/
public static final Key<Value<PickupRule>> PICKUP_RULE = Keys.key(ResourceKey.sponge("pickup_rule"), PickupRule.class);

Expand Down Expand Up @@ -2606,7 +2605,7 @@ public final class Keys {

/**
* The potion effects that are present on an {@link Entity}
* <p>or applied by an {@link AreaEffectCloud} or {@link ArrowEntity}</p>
* <p>or applied by an {@link AreaEffectCloud} or {@link ArrowLike}</p>
* <p>or stored on an {@link ItemStack}.</p>
*/
public static final Key<ListValue<PotionEffect>> POTION_EFFECTS = Keys.listKey(ResourceKey.sponge("potion_effects"), PotionEffect.class);
Expand Down Expand Up @@ -3206,7 +3205,7 @@ public final class Keys {
public static final Key<Value<Boolean>> TRACKS_OUTPUT = Keys.key(ResourceKey.sponge("tracks_output"), Boolean.class);

/**
* The {@link TradeOffer}s offered by a {@link Trader} or a {@link org.spongepowered.api.item.inventory.type.ViewableInventory.Custom}
* The {@link TradeOffer}s offered by a {@link Merchant} or a {@link org.spongepowered.api.item.inventory.type.ViewableInventory.Custom}
*/
public static final Key<ListValue<TradeOffer>> TRADE_OFFERS = Keys.listKey(ResourceKey.sponge("trade_offers"), TradeOffer.class);

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/spongepowered/api/data/type/PickupRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
*/
package org.spongepowered.api.data.type;

import org.spongepowered.api.entity.projectile.arrow.ArrowEntity;
import org.spongepowered.api.entity.projectile.arrow.ArrowLike;
import org.spongepowered.api.registry.DefaultedRegistryValue;
import org.spongepowered.api.util.annotation.CatalogedBy;

/**
* Represents a pickup rule used by {@link ArrowEntity}s.
* Represents a pickup rule used by {@link ArrowLike}s.
*/
@CatalogedBy(PickupRules.class)
public interface PickupRule extends DefaultedRegistryValue {
Expand Down
47 changes: 47 additions & 0 deletions src/main/java/org/spongepowered/api/entity/Ageable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.entity;

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 Entity} that can age
*/
public interface Ageable extends Entity {

/**
* {@link Keys#BABY_TICKS}
*
* @return The ticks until this entity turns into an adult
*/
default Optional<Value.Mutable<Ticks>> babyTicks() {
return this.getValue(Keys.BABY_TICKS).map(Value::asMutable);
}

}
49 changes: 49 additions & 0 deletions src/main/java/org/spongepowered/api/entity/Angerable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.entity;

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

public interface Angerable extends Entity {

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

/**
* {@link Keys#ANGER_LEVEL}
*
* @return The anger level, decays over time
*/
default Value.Mutable<Integer> angerLevel() {
return this.requireValue(Keys.ANGER_LEVEL).asMutable();
}
}
42 changes: 42 additions & 0 deletions src/main/java/org/spongepowered/api/entity/Attackable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.entity;

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

import java.util.Optional;

public interface Attackable extends Entity {

/**
* {@link Keys#LAST_ATTACKER}
*
* @return The last attacker who attacked this entity
*/
default Optional<Value.Mutable<Entity>> lastAttacker() {
return this.getValue(Keys.LAST_ATTACKER).map(Value::asMutable);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* 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;
Expand All @@ -31,28 +31,9 @@
import java.util.Optional;

/**
* Represents an {@link Agent} that produces offspring and grows into an adult
* Represents an {@link Entity} which can breed.
*/
public interface Ageable extends Agent {

/**
* {@link Keys#IS_ADULT}
*
* @return Whether this entity is an adult or not
*/
default Value.Mutable<Boolean> adult() {
return this.requireValue(Keys.IS_ADULT).asMutable();
}

/**
* {@link Keys#BABY_TICKS}
*
* @return The ticks until this entity turns into an adult
*/
default Optional<Value.Mutable<Ticks>> babyTicks() {
return this.getValue(Keys.BABY_TICKS).map(Value::asMutable);
}

public interface Breedable extends Entity {
/**
* {@link Keys#CAN_BREED}
*
Expand All @@ -70,5 +51,4 @@ default Value.Mutable<Boolean> canBreed() {
default Optional<Value.Mutable<Ticks>> breedingCooldown() {
return this.getValue(Keys.BREEDING_COOLDOWN).map(Value::asMutable);
}

}
Loading

0 comments on commit 03928a1

Please sign in to comment.