diff --git a/paper-api/src/main/java/org/bukkit/entity/Entity.java b/paper-api/src/main/java/org/bukkit/entity/Entity.java index 046cf81673..4186642274 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Entity.java +++ b/paper-api/src/main/java/org/bukkit/entity/Entity.java @@ -7,6 +7,7 @@ import org.bukkit.EntityEffect; import org.bukkit.Location; import org.bukkit.Nameable; import org.bukkit.Server; +import org.bukkit.Sound; import org.bukkit.World; import org.bukkit.block.BlockFace; import org.bukkit.block.PistonMoveReaction; @@ -447,6 +448,32 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent @NotNull public EntityType getType(); + /** + * Get the {@link Sound} this entity makes while swimming. + * + * @return the swimming sound + */ + @NotNull + public Sound getSwimSound(); + + /** + * Get the {@link Sound} this entity makes when splashing in water. For most + * entities, this is just {@link Sound#ENTITY_GENERIC_SPLASH}. + * + * @return the splash sound + */ + @NotNull + public Sound getSwimSplashSound(); + + /** + * Get the {@link Sound} this entity makes when splashing in water at high + * speeds. For most entities, this is just {@link Sound#ENTITY_GENERIC_SPLASH}. + * + * @return the splash sound + */ + @NotNull + public Sound getSwimHighSpeedSplashSound(); + /** * Returns whether this entity is inside a vehicle. * diff --git a/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java b/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java index 9f876af232..2b816f0e6b 100644 --- a/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java @@ -7,11 +7,13 @@ import java.util.UUID; import org.bukkit.FluidCollisionMode; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.World; import org.bukkit.attribute.Attributable; import org.bukkit.block.Block; import org.bukkit.entity.memory.MemoryKey; import org.bukkit.inventory.EntityEquipment; +import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.projectiles.ProjectileSource; @@ -588,6 +590,73 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource */ void setMemory(@NotNull MemoryKey memoryKey, @Nullable T memoryValue); + /** + * Get the {@link Sound} this entity will make when damaged. + * + * @return the hurt sound, or null if the entity does not make any sound + */ + @Nullable + public Sound getHurtSound(); + + /** + * Get the {@link Sound} this entity will make on death. + * + * @return the death sound, or null if the entity does not make any sound + */ + @Nullable + public Sound getDeathSound(); + + /** + * Get the {@link Sound} this entity will make when falling from the given + * height (in blocks). The sound will often differ between either a small + * or a big fall damage sound if the height exceeds 4 blocks. + * + * @param fallHeight the fall height in blocks + * @return the fall damage sound + * @see #getFallDamageSoundSmall() + * @see #getFallDamageSoundBig() + */ + @NotNull + public Sound getFallDamageSound(int fallHeight); + + /** + * Get the {@link Sound} this entity will make when falling from a small + * height. + * + * @return the fall damage sound + */ + @NotNull + public Sound getFallDamageSoundSmall(); + + /** + * Get the {@link Sound} this entity will make when falling from a large + * height. + * + * @return the fall damage sound + */ + @NotNull + public Sound getFallDamageSoundBig(); + + /** + * Get the {@link Sound} this entity will make when drinking the given + * {@link ItemStack}. + * + * @param itemStack the item stack being drank + * @return the drinking sound + */ + @NotNull + public Sound getDrinkingSound(@NotNull ItemStack itemStack); + + /** + * Get the {@link Sound} this entity will make when eating the given + * {@link ItemStack}. + * + * @param itemStack the item stack being eaten + * @return the eating sound + */ + @NotNull + public Sound getEatingSound(@NotNull ItemStack itemStack); + /** * Returns true if this entity can breathe underwater and will not take * suffocation damage when its air supply reaches zero. diff --git a/paper-api/src/main/java/org/bukkit/entity/Mob.java b/paper-api/src/main/java/org/bukkit/entity/Mob.java index be9334a8b5..6f117995c3 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Mob.java +++ b/paper-api/src/main/java/org/bukkit/entity/Mob.java @@ -1,5 +1,6 @@ package org.bukkit.entity; +import org.bukkit.Sound; import org.bukkit.loot.Lootable; import org.jetbrains.annotations.Nullable; @@ -47,4 +48,17 @@ public interface Mob extends LivingEntity, Lootable { * @return whether the mob is aware */ public boolean isAware(); + + /** + * Get the {@link Sound} this makes while ambiently existing. This sound + * may change depending on the current state of the entity, and may also + * return null under specific conditions. This sound is not constant. + * For instance, villagers will make different passive noises depending + * on whether or not they are actively trading with a player, or make no + * ambient noise while sleeping. + * + * @return the ambient sound, or null if this entity is ambiently quiet + */ + @Nullable + public Sound getAmbientSound(); } diff --git a/paper-api/src/main/java/org/bukkit/entity/Raider.java b/paper-api/src/main/java/org/bukkit/entity/Raider.java index 9a99b8ca1e..987f9b0866 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Raider.java +++ b/paper-api/src/main/java/org/bukkit/entity/Raider.java @@ -1,6 +1,8 @@ package org.bukkit.entity; +import org.bukkit.Sound; import org.bukkit.block.Block; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public interface Raider extends Monster { @@ -47,4 +49,12 @@ public interface Raider extends Monster { * @param join CanJoinRaid status */ void setCanJoinRaid(boolean join); + + /** + * Get the {@link Sound} this entity will play when celebrating. + * + * @return the celebration sound + */ + @NotNull + Sound getCelebrationSound(); }