Class VibrativeVoiceApiImpl

java.lang.Object
com.codinglitch.vibrativevoice.VibrativeVoiceApi
com.codinglitch.vibrativevoice.VibrativeVoiceApiImpl

public class VibrativeVoiceApiImpl extends VibrativeVoiceApi
  • Field Details

  • Constructor Details

    • VibrativeVoiceApiImpl

      public VibrativeVoiceApiImpl()
  • Method Details

    • applyRestriction

      public boolean applyRestriction(VibrativeVoiceApi.RestrictionType restrictionType, boolean flag)
      Description copied from class: VibrativeVoiceApi
      This is a way to apply a restriction based on whether or not it is enabled in the Vibrative Voice config.
      Specified by:
      applyRestriction in class VibrativeVoiceApi
      Parameters:
      restrictionType - The restriction type to apply
      flag - The flag of the restriction
      Returns:
      If the restriction is enabled in the config and if it can apply in the context
    • getConfigEntry

      public <T> T getConfigEntry(String path, T defaultReturn)
      Description copied from class: VibrativeVoiceApi
      This is a method allowing the access of the Vibrative Voice config directly from the API.
      Specified by:
      getConfigEntry in class VibrativeVoiceApi
      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: VibrativeVoiceApi
      Tries to send a vibration originating at the specified location, checking if it is on cooldown and using the default config cooldown duration.
      Specified by:
      trySendVibration in class VibrativeVoiceApi
      Parameters:
      uuid - The UUID for the cooldown
      location - The location where the vibration originates from
      level - The level where the vibration exists
      type - 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: VibrativeVoiceApi
      Tries to send a vibration originating from the specified entity, checking if it is on cooldown and using the default config cooldown duration.
      Specified by:
      trySendVibration in class VibrativeVoiceApi
      Parameters:
      uuid - The UUID for the cooldown
      entity - The Entity that the vibration originates from
      level - The level where the vibration exists
      type - 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: VibrativeVoiceApi
      Tries to send a vibration originating from the specified entity, checking if it is on cooldown.
      Specified by:
      trySendVibration in class VibrativeVoiceApi
      Parameters:
      entity - The Entity that the vibration originates from, using its UUID for the cooldown
      level - The level where the vibration exists
      type - 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: VibrativeVoiceApi
      Tries to send a vibration originating at the specified location, checking if it is on cooldown.
      Specified by:
      trySendVibration in class VibrativeVoiceApi
      Parameters:
      uuid - The UUID for the cooldown
      location - The location where the vibration originates from
      level - The level where the vibration exists
      type - The vibration type to send
      cooldown - 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: VibrativeVoiceApi
      Tries to send a vibration originating from the specified entity, checking if it is on cooldown.
      Specified by:
      trySendVibration in class VibrativeVoiceApi
      Parameters:
      uuid - The UUID for the cooldown
      entity - The Entity that the vibration originates from
      level - The level where the vibration exists
      type - The vibration type to send
      cooldown - 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: VibrativeVoiceApi
      Sends a vibration at the location with the specified type.
      Specified by:
      sendVibration in class VibrativeVoiceApi
      Parameters:
      location - The location to send the vibration from
      level - The level to send the vibration in
      vibrationType - 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: VibrativeVoiceApi
      Sends a vibration originating from an entity with the specified type.
      Specified by:
      sendVibration in class VibrativeVoiceApi
      Parameters:
      entity - The entity the vibration originates from
      level - The level to send the vibration in
      vibrationType - The type of vibration to send
    • getEvent

      public net.minecraft.world.level.gameevent.GameEvent getEvent(VibrativeVoiceApi.VibrationType type)
      Description copied from class: VibrativeVoiceApi
      Gets an event from a vibration type.
      Specified by:
      getEvent in class VibrativeVoiceApi
      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: VibrativeVoiceApi
      Gets a rough loudness value for the specified player at this current moment.
      Specified by:
      getPlayerLoudness in class VibrativeVoiceApi
      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: VibrativeVoiceApi
      Sets the loudness value for the specified player.
      Specified by:
      setPlayerLoudness in class VibrativeVoiceApi
      Parameters:
      player - The player to set the loudness of
      loudness - The loudness of the player
      timestamp - The timestamp this loudness was emitted
    • getQualifyingType

      @Nullable public VibrativeVoiceApi.VibrationType getQualifyingType(byte[] data)
      Description copied from class: VibrativeVoiceApi
      Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).
      Specified by:
      getQualifyingType in class VibrativeVoiceApi
      Parameters:
      data - The raw data that will be decoded
      Returns:
      The qualifying VibrationType, or null if none qualified
    • getQualifyingType

      @Nullable public VibrativeVoiceApi.VibrationType getQualifyingType(byte[] data, float volumeFactor)
      Description copied from class: VibrativeVoiceApi
      Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).
      Specified by:
      getQualifyingType in class VibrativeVoiceApi
      Parameters:
      data - The raw data that will be decoded
      volumeFactor - The multiplier to skew volume by
      Returns:
      The qualifying VibrationType, or null if none qualified
    • getQualifyingType

      @Nullable public VibrativeVoiceApi.VibrationType getQualifyingType(short[] decoded)
      Description copied from class: VibrativeVoiceApi
      Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).
      Specified by:
      getQualifyingType in class VibrativeVoiceApi
      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: VibrativeVoiceApi
      Gets a qualifying VibrationType for the volume level of the data, or null if none qualifies (audio too quiet).
      Specified by:
      getQualifyingType in class VibrativeVoiceApi
      Parameters:
      decoded - The opus decoded data
      volumeFactor - The multiplier to skew volume by
      Returns:
      The qualifying VibrationType, or null if none qualified
    • getQualifyingType

      @Nullable public VibrativeVoiceApi.VibrationType getQualifyingType(double volume)
      Description copied from class: VibrativeVoiceApi
      Gets a qualifying VibrationType for the specified volume level, or null if none qualifies (audio too quiet).
      Specified by:
      getQualifyingType in class VibrativeVoiceApi
      Parameters:
      volume - The volume
      Returns:
      The qualifying VibrationType, or null if none qualified
    • getVolume

      public double getVolume(byte[] data)
      Description copied from class: VibrativeVoiceApi
      Gets a rough volume level from the raw data
      Specified by:
      getVolume in class VibrativeVoiceApi
      Parameters:
      data - The raw data
      Returns:
      The approximate volume (in no particular measurement)
    • getVolume

      public double getVolume(short[] decoded)
      Description copied from class: VibrativeVoiceApi
      Gets a rough volume level from the decoded data
      Specified by:
      getVolume in class VibrativeVoiceApi
      Parameters:
      decoded - The opus decoded data
      Returns:
      The approximate volume (in no particular measurement)
    • setCooldown

      public void setCooldown(UUID uuid, net.minecraft.world.level.Level level, int cooldown)
      Specified by:
      setCooldown in class VibrativeVoiceApi
    • getTimestamp

      public long getTimestamp(UUID uuid)
      Specified by:
      getTimestamp in class VibrativeVoiceApi
    • isOnCooldown

      public boolean isOnCooldown(UUID uuid, net.minecraft.world.level.Level level)
      Specified by:
      isOnCooldown in class VibrativeVoiceApi