mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-08 08:02:13 -07:00
#786: Add methods to get sounds from entities
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import org.bukkit.EntityEffect;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Nameable;
|
import org.bukkit.Nameable;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.PistonMoveReaction;
|
import org.bukkit.block.PistonMoveReaction;
|
||||||
@@ -447,6 +448,32 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
|||||||
@NotNull
|
@NotNull
|
||||||
public EntityType getType();
|
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.
|
* Returns whether this entity is inside a vehicle.
|
||||||
*
|
*
|
||||||
|
@@ -7,11 +7,13 @@ import java.util.UUID;
|
|||||||
import org.bukkit.FluidCollisionMode;
|
import org.bukkit.FluidCollisionMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.attribute.Attributable;
|
import org.bukkit.attribute.Attributable;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.memory.MemoryKey;
|
import org.bukkit.entity.memory.MemoryKey;
|
||||||
import org.bukkit.inventory.EntityEquipment;
|
import org.bukkit.inventory.EntityEquipment;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.projectiles.ProjectileSource;
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
@@ -588,6 +590,73 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
|||||||
*/
|
*/
|
||||||
<T> void setMemory(@NotNull MemoryKey<T> memoryKey, @Nullable T memoryValue);
|
<T> void setMemory(@NotNull MemoryKey<T> 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
|
* Returns true if this entity can breathe underwater and will not take
|
||||||
* suffocation damage when its air supply reaches zero.
|
* suffocation damage when its air supply reaches zero.
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package org.bukkit.entity;
|
package org.bukkit.entity;
|
||||||
|
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.loot.Lootable;
|
import org.bukkit.loot.Lootable;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@@ -47,4 +48,17 @@ public interface Mob extends LivingEntity, Lootable {
|
|||||||
* @return whether the mob is aware
|
* @return whether the mob is aware
|
||||||
*/
|
*/
|
||||||
public boolean isAware();
|
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();
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
package org.bukkit.entity;
|
package org.bukkit.entity;
|
||||||
|
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public interface Raider extends Monster {
|
public interface Raider extends Monster {
|
||||||
@@ -47,4 +49,12 @@ public interface Raider extends Monster {
|
|||||||
* @param join CanJoinRaid status
|
* @param join CanJoinRaid status
|
||||||
*/
|
*/
|
||||||
void setCanJoinRaid(boolean join);
|
void setCanJoinRaid(boolean join);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the {@link Sound} this entity will play when celebrating.
|
||||||
|
*
|
||||||
|
* @return the celebration sound
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
Sound getCelebrationSound();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user