Package com.codinglitch.vibrativevoice
Class VibrativeVoiceApi
java.lang.Object
com.codinglitch.vibrativevoice.VibrativeVoiceApi
- Direct Known Subclasses:
VibrativeVoiceApiImpl
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanapplyRestriction(VibrativeVoiceApi.RestrictionType restrictionType, boolean flag) This is a way to apply a restriction based on whether or not it is enabled in the Vibrative Voice config.abstract <T> TgetConfigEntry(String path, T defaultReturn) This is a method allowing the access of the Vibrative Voice config directly from the API.abstract net.minecraft.world.level.gameevent.GameEventGets an event from a vibration type.abstract doublegetPlayerLoudness(net.minecraft.world.entity.player.Player player) Gets a rough loudness value for the specified player at this current moment.abstract VibrativeVoiceApi.VibrationTypegetQualifyingType(byte[] data) Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).abstract VibrativeVoiceApi.VibrationTypegetQualifyingType(byte[] data, float volumeFactor) Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).abstract VibrativeVoiceApi.VibrationTypegetQualifyingType(double volume) Gets a qualifying VibrationType for the specified volume level, or null if none qualifies (audio too quiet).abstract VibrativeVoiceApi.VibrationTypegetQualifyingType(short[] decoded) Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).abstract VibrativeVoiceApi.VibrationTypegetQualifyingType(short[] decoded, float volumeFactor) Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).abstract longgetTimestamp(UUID uuid) abstract doublegetVolume(byte[] data) Gets a rough volume level from the raw dataabstract doublegetVolume(short[] decoded) Gets a rough volume level from the decoded dataabstract booleanisOnCooldown(UUID uuid, net.minecraft.world.level.Level level) abstract voidsendVibration(net.minecraft.core.BlockPos location, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType vibrationType) Sends a vibration at the location with the specified type.abstract voidsendVibration(net.minecraft.world.entity.Entity entity, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType vibrationType) Sends a vibration originating from an entity with the specified type.abstract voidsetCooldown(UUID uuid, net.minecraft.world.level.Level level, int cooldown) abstract voidsetPlayerLoudness(net.minecraft.world.entity.player.Player player, double loudness, long timestamp) Sets the loudness value for the specified player.abstract voidtrySendVibration(UUID uuid, net.minecraft.core.BlockPos location, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type) Tries to send a vibration originating at the specified location, checking if it is on cooldown and using the default config cooldown duration.abstract voidtrySendVibration(UUID uuid, net.minecraft.core.BlockPos location, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type, int cooldown) Tries to send a vibration originating at the specified location, checking if it is on cooldown.abstract voidtrySendVibration(UUID uuid, net.minecraft.world.entity.Entity entity, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type) Tries to send a vibration originating from the specified entity, checking if it is on cooldown and using the default config cooldown duration.abstract voidtrySendVibration(UUID uuid, net.minecraft.world.entity.Entity entity, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type, int cooldown) Tries to send a vibration originating from the specified entity, checking if it is on cooldown.abstract voidtrySendVibration(net.minecraft.world.entity.Entity entity, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type) Tries to send a vibration originating from the specified entity, checking if it is on cooldown.
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
VibrativeVoiceApi
public VibrativeVoiceApi()
-
-
Method Details
-
applyRestriction
public abstract boolean applyRestriction(VibrativeVoiceApi.RestrictionType restrictionType, boolean flag) This is a way to apply a restriction based on whether or not it is enabled in the Vibrative Voice config.- Parameters:
restrictionType- The restriction type to applyflag- The flag of the restriction- Returns:
- If the restriction is enabled in the config and if it can apply in the context
-
getConfigEntry
This is a method allowing the access of the Vibrative Voice config directly from the API.- Parameters:
path- The path to follow to retrieve the entry, i.e. "cooldownDuration" or "restrictions.whisperFactor"defaultReturn- The default value to return. Also used to infer the type of the config.- Returns:
- If the restriction is enabled in the config and if it can apply in the context
-
trySendVibration
public abstract void trySendVibration(UUID uuid, net.minecraft.core.BlockPos location, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type) Tries to send a vibration originating at the specified location, checking if it is on cooldown and using the default config cooldown duration.- Parameters:
uuid- The UUID for the cooldownlocation- The location where the vibration originates fromlevel- The level where the vibration existstype- The vibration type to send
-
trySendVibration
public abstract void trySendVibration(UUID uuid, net.minecraft.world.entity.Entity entity, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type) Tries to send a vibration originating from the specified entity, checking if it is on cooldown and using the default config cooldown duration.- Parameters:
uuid- The UUID for the cooldownentity- The Entity that the vibration originates fromlevel- The level where the vibration existstype- The vibration type to send
-
trySendVibration
public abstract void trySendVibration(net.minecraft.world.entity.Entity entity, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type) Tries to send a vibration originating from the specified entity, checking if it is on cooldown.- Parameters:
entity- The Entity that the vibration originates from, using its UUID for the cooldownlevel- The level where the vibration existstype- The vibration type to send
-
trySendVibration
public abstract void trySendVibration(UUID uuid, net.minecraft.core.BlockPos location, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type, int cooldown) Tries to send a vibration originating at the specified location, checking if it is on cooldown.- Parameters:
uuid- The UUID for the cooldownlocation- The location where the vibration originates fromlevel- The level where the vibration existstype- The vibration type to sendcooldown- The cooldown duration (in ticks) to set
-
trySendVibration
public abstract void trySendVibration(UUID uuid, net.minecraft.world.entity.Entity entity, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type, int cooldown) Tries to send a vibration originating from the specified entity, checking if it is on cooldown.- Parameters:
uuid- The UUID for the cooldownentity- The Entity that the vibration originates fromlevel- The level where the vibration existstype- The vibration type to sendcooldown- The cooldown duration (in ticks) to set
-
sendVibration
public abstract void sendVibration(net.minecraft.core.BlockPos location, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType vibrationType) Sends a vibration at the location with the specified type.- Parameters:
location- The location to send the vibration fromlevel- The level to send the vibration invibrationType- The type of vibration to send
-
sendVibration
public abstract void sendVibration(net.minecraft.world.entity.Entity entity, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType vibrationType) Sends a vibration originating from an entity with the specified type.- Parameters:
entity- The entity the vibration originates fromlevel- The level to send the vibration invibrationType- The type of vibration to send
-
getPlayerLoudness
public abstract double getPlayerLoudness(net.minecraft.world.entity.player.Player player) Gets a rough loudness value for the specified player at this current moment.- Parameters:
player- The player to get the loudness of- Returns:
- The loudness of the player
-
setPlayerLoudness
public abstract void setPlayerLoudness(net.minecraft.world.entity.player.Player player, double loudness, long timestamp) Sets the loudness value for the specified player.- Parameters:
player- The player to set the loudness ofloudness- The loudness of the playertimestamp- The timestamp this loudness was emitted
-
getEvent
public abstract net.minecraft.world.level.gameevent.GameEvent getEvent(VibrativeVoiceApi.VibrationType type) Gets an event from a vibration type.- Parameters:
type- The vibration type- Returns:
- The GameEvent corresponding to that type
-
getQualifyingType
Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).- Parameters:
data- The raw data that will be decoded- Returns:
- The qualifying VibrationType, or null if none qualified
-
getQualifyingType
@Nullable public abstract VibrativeVoiceApi.VibrationType getQualifyingType(byte[] data, float volumeFactor) Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).- Parameters:
data- The raw data that will be decodedvolumeFactor- The multiplier to skew volume by- Returns:
- The qualifying VibrationType, or null if none qualified
-
getQualifyingType
Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).- Parameters:
decoded- The opus decoded data- Returns:
- The qualifying VibrationType, or null if none qualified
-
getQualifyingType
@Nullable public abstract VibrativeVoiceApi.VibrationType getQualifyingType(short[] decoded, float volumeFactor) Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).- Parameters:
decoded- The opus decoded datavolumeFactor- The multiplier to skew volume by- Returns:
- The qualifying VibrationType, or null if none qualified
-
getQualifyingType
Gets a qualifying VibrationType for the specified volume level, or null if none qualifies (audio too quiet).- Parameters:
volume- The volume- Returns:
- The qualifying VibrationType, or null if none qualified
-
getVolume
public abstract double getVolume(byte[] data) Gets a rough volume level from the raw data- Parameters:
data- The raw data- Returns:
- The approximate volume (in no particular measurement)
-
getVolume
public abstract double getVolume(short[] decoded) Gets a rough volume level from the decoded data- Parameters:
decoded- The opus decoded data- Returns:
- The approximate volume (in no particular measurement)
-
setCooldown
-
getTimestamp
-
isOnCooldown
-