Class SoundLoop

java.lang.Object
net.minecraft.client.resources.sounds.AbstractSoundInstance
net.minecraft.client.resources.sounds.AbstractTickableSoundInstance
com.binaris.wizardry.client.sound.SoundLoop
All Implemented Interfaces:
net.fabricmc.fabric.api.client.sound.v1.FabricSoundInstance, net.minecraft.client.resources.sounds.SoundInstance, net.minecraft.client.resources.sounds.TickableSoundInstance
Direct Known Subclasses:
SoundLoopSpell

public abstract class SoundLoop extends net.minecraft.client.resources.sounds.AbstractTickableSoundInstance
Handle all the active sound loops with the onClientTick(EBClientTickEvent) Saves all the info for the three basic sounds (start, loop, end) and handle all the logic in the event

This class only works as a blueprint for situations that you need to play a sound loop, for example: SpellSoundManager, all the logic here is just for simplify the process of doing a sound loop
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     

    Nested classes/interfaces inherited from interface net.minecraft.client.resources.sounds.SoundInstance

    net.minecraft.client.resources.sounds.SoundInstance.Attenuation
  • Field Summary

    Fields inherited from class net.minecraft.client.resources.sounds.AbstractSoundInstance

    attenuation, delay, location, pitch, random, relative, sound, source, volume, x, y, z

    Fields inherited from interface net.fabricmc.fabric.api.client.sound.v1.FabricSoundInstance

    EMPTY_SOUND
  • Constructor Summary

    Constructors
    Constructor
    Description
    SoundLoop(net.minecraft.sounds.SoundEvent start, net.minecraft.sounds.SoundEvent loop, net.minecraft.sounds.SoundEvent end, net.minecraft.sounds.SoundSource category, float volume, SoundLoop.ISoundFactory factory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    void
     
    protected static boolean
    Checks if there's an active loop matching the given predicate
    static void
     
    protected void
     
    void
    Used to know when the sound is ready to be looped, all the rest of the tick logic is handled in the client tick onClientTick(EBClientTickEvent)

    Methods inherited from class net.minecraft.client.resources.sounds.AbstractTickableSoundInstance

    isStopped, stop

    Methods inherited from class net.minecraft.client.resources.sounds.AbstractSoundInstance

    getAttenuation, getDelay, getLocation, getPitch, getSound, getSource, getVolume, getX, getY, getZ, isLooping, isRelative, resolve, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.fabricmc.fabric.api.client.sound.v1.FabricSoundInstance

    getAudioStream

    Methods inherited from interface net.minecraft.client.resources.sounds.SoundInstance

    canPlaySound, canStartSilent, getAttenuation, getDelay, getLocation, getPitch, getSound, getSource, getVolume, getX, getY, getZ, isLooping, isRelative, resolve
  • Constructor Details

    • SoundLoop

      public SoundLoop(net.minecraft.sounds.SoundEvent start, net.minecraft.sounds.SoundEvent loop, net.minecraft.sounds.SoundEvent end, net.minecraft.sounds.SoundSource category, float volume, SoundLoop.ISoundFactory factory)
  • Method Details

    • addLoop

      public static void addLoop(SoundLoop loop)
    • hasActiveLoopMatching

      protected static boolean hasActiveLoopMatching(Predicate<SoundLoop> predicate)
      Checks if there's an active loop matching the given predicate
    • onClientTick

      public static void onClientTick(EBClientTickEvent event)
    • tick

      public void tick()
      Used to know when the sound is ready to be looped, all the rest of the tick logic is handled in the client tick onClientTick(EBClientTickEvent)
    • endLoop

      public void endLoop()
    • stopStartAndLoop

      protected void stopStartAndLoop()