Package com.codinglitch.vibrativevoice
Class VibrativeVoiceApiImpl
java.lang.Object
com.codinglitch.vibrativevoice.VibrativeVoiceApi
com.codinglitch.vibrativevoice.VibrativeVoiceApiImpl
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.codinglitch.vibrativevoice.VibrativeVoiceApi
VibrativeVoiceApi.RestrictionType, VibrativeVoiceApi.VibrationType -
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class com.codinglitch.vibrativevoice.VibrativeVoiceApi
INSTANCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanapplyRestriction(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.<T> TgetConfigEntry(String path, T defaultReturn) This is a method allowing the access of the Vibrative Voice config directly from the API.net.minecraft.world.level.gameevent.GameEventGets an event from a vibration type.doublegetPlayerLoudness(net.minecraft.world.entity.player.Player player) Gets a rough loudness value for the specified player at this current moment.getQualifyingType(byte[] data) Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).getQualifyingType(byte[] data, float volumeFactor) Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).getQualifyingType(double volume) Gets a qualifying VibrationType for the specified volume level, or null if none qualifies (audio too quiet).getQualifyingType(short[] decoded) Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).getQualifyingType(short[] decoded, float volumeFactor) Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).longgetTimestamp(UUID uuid) doublegetVolume(byte[] data) Gets a rough volume level from the raw datadoublegetVolume(short[] decoded) Gets a rough volume level from the decoded databooleanisOnCooldown(UUID uuid, net.minecraft.world.level.Level level) 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.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.voidsetCooldown(UUID uuid, net.minecraft.world.level.Level level, int cooldown) voidsetPlayerLoudness(net.minecraft.world.entity.player.Player player, double loudness, long timestamp) Sets the loudness value for the specified player.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.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.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.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.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
-
loudnesses
-
-
Constructor Details
-
VibrativeVoiceApiImpl
public VibrativeVoiceApiImpl()
-
-
Method Details
-
applyRestriction
Description copied from class:VibrativeVoiceApiThis is a way to apply a restriction based on whether or not it is enabled in the Vibrative Voice config.- Specified by:
applyRestrictionin classVibrativeVoiceApi- 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
Description copied from class:VibrativeVoiceApiThis is a method allowing the access of the Vibrative Voice config directly from the API.- Specified by:
getConfigEntryin classVibrativeVoiceApi- 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 void trySendVibration(UUID uuid, net.minecraft.core.BlockPos location, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type) Description copied from class:VibrativeVoiceApiTries to send a vibration originating at the specified location, checking if it is on cooldown and using the default config cooldown duration.- Specified by:
trySendVibrationin classVibrativeVoiceApi- 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 void trySendVibration(UUID uuid, net.minecraft.world.entity.Entity entity, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type) Description copied from class:VibrativeVoiceApiTries to send a vibration originating from the specified entity, checking if it is on cooldown and using the default config cooldown duration.- Specified by:
trySendVibrationin classVibrativeVoiceApi- 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 void trySendVibration(net.minecraft.world.entity.Entity entity, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type) Description copied from class:VibrativeVoiceApiTries to send a vibration originating from the specified entity, checking if it is on cooldown.- Specified by:
trySendVibrationin classVibrativeVoiceApi- 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 void trySendVibration(UUID uuid, net.minecraft.core.BlockPos location, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type, int cooldown) Description copied from class:VibrativeVoiceApiTries to send a vibration originating at the specified location, checking if it is on cooldown.- Specified by:
trySendVibrationin classVibrativeVoiceApi- 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 void trySendVibration(UUID uuid, net.minecraft.world.entity.Entity entity, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType type, int cooldown) Description copied from class:VibrativeVoiceApiTries to send a vibration originating from the specified entity, checking if it is on cooldown.- Specified by:
trySendVibrationin classVibrativeVoiceApi- 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 void sendVibration(net.minecraft.core.BlockPos location, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType vibrationType) Description copied from class:VibrativeVoiceApiSends a vibration at the location with the specified type.- Specified by:
sendVibrationin classVibrativeVoiceApi- Parameters:
location- The location to send the vibration fromlevel- The level to send the vibration invibrationType- The type of vibration to send
-
sendVibration
public void sendVibration(net.minecraft.world.entity.Entity entity, net.minecraft.world.level.Level level, VibrativeVoiceApi.VibrationType vibrationType) Description copied from class:VibrativeVoiceApiSends a vibration originating from an entity with the specified type.- Specified by:
sendVibrationin classVibrativeVoiceApi- Parameters:
entity- The entity the vibration originates fromlevel- The level to send the vibration invibrationType- The type of vibration to send
-
getEvent
Description copied from class:VibrativeVoiceApiGets an event from a vibration type.- Specified by:
getEventin classVibrativeVoiceApi- Parameters:
type- The vibration type- Returns:
- The GameEvent corresponding to that type
-
getPlayerLoudness
public double getPlayerLoudness(net.minecraft.world.entity.player.Player player) Description copied from class:VibrativeVoiceApiGets a rough loudness value for the specified player at this current moment.- Specified by:
getPlayerLoudnessin classVibrativeVoiceApi- Parameters:
player- The player to get the loudness of- Returns:
- The loudness of the player
-
setPlayerLoudness
public void setPlayerLoudness(net.minecraft.world.entity.player.Player player, double loudness, long timestamp) Description copied from class:VibrativeVoiceApiSets the loudness value for the specified player.- Specified by:
setPlayerLoudnessin classVibrativeVoiceApi- Parameters:
player- The player to set the loudness ofloudness- The loudness of the playertimestamp- The timestamp this loudness was emitted
-
getQualifyingType
Description copied from class:VibrativeVoiceApiGets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).- Specified by:
getQualifyingTypein classVibrativeVoiceApi- Parameters:
data- The raw data that will be decoded- Returns:
- The qualifying VibrationType, or null if none qualified
-
getQualifyingType
Description copied from class:VibrativeVoiceApiGets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).- Specified by:
getQualifyingTypein classVibrativeVoiceApi- 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
Description copied from class:VibrativeVoiceApiGets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).- Specified by:
getQualifyingTypein classVibrativeVoiceApi- Parameters:
decoded- The opus decoded data- Returns:
- The qualifying VibrationType, or null if none qualified
-
getQualifyingType
@Nullable public VibrativeVoiceApi.VibrationType getQualifyingType(short[] decoded, float volumeFactor) Description copied from class:VibrativeVoiceApiGets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).- Specified by:
getQualifyingTypein classVibrativeVoiceApi- Parameters:
decoded- The opus decoded datavolumeFactor- The multiplier to skew volume by- Returns:
- The qualifying VibrationType, or null if none qualified
-
getQualifyingType
Description copied from class:VibrativeVoiceApiGets a qualifying VibrationType for the specified volume level, or null if none qualifies (audio too quiet).- Specified by:
getQualifyingTypein classVibrativeVoiceApi- Parameters:
volume- The volume- Returns:
- The qualifying VibrationType, or null if none qualified
-
getVolume
public double getVolume(byte[] data) Description copied from class:VibrativeVoiceApiGets a rough volume level from the raw data- Specified by:
getVolumein classVibrativeVoiceApi- Parameters:
data- The raw data- Returns:
- The approximate volume (in no particular measurement)
-
getVolume
public double getVolume(short[] decoded) Description copied from class:VibrativeVoiceApiGets a rough volume level from the decoded data- Specified by:
getVolumein classVibrativeVoiceApi- Parameters:
decoded- The opus decoded data- Returns:
- The approximate volume (in no particular measurement)
-
setCooldown
- Specified by:
setCooldownin classVibrativeVoiceApi
-
getTimestamp
- Specified by:
getTimestampin classVibrativeVoiceApi
-
isOnCooldown
- Specified by:
isOnCooldownin classVibrativeVoiceApi
-