Class SoundEngineExecutor

java.lang.Object
net.minecraft.util.thread.BlockableEventLoop<Runnable>
net.minecraft.client.sounds.SoundEngineExecutor
All Implemented Interfaces:
AutoCloseable, Executor, ProfilerMeasured, TaskScheduler<Runnable>

public class SoundEngineExecutor extends BlockableEventLoop<Runnable>
The SoundEngineExecutor class is responsible for executing sound-related tasks in a separate thread.

It extends the BlockableEventLoop class, providing an event loop for managing and executing tasks.

  • Field Details

    • thread

      private Thread thread
    • shutdown

      private volatile boolean shutdown
  • Constructor Details

    • SoundEngineExecutor

      public SoundEngineExecutor()
  • Method Details

    • createThread

      private Thread createThread()
    • wrapRunnable

      public Runnable wrapRunnable(Runnable pRunnable)
      Wraps the given runnable task. In this case, the original runnable is returned as-is.

      Parameters:
      pRunnable - The original runnable task
      Returns:
      The wrapped runnable task
    • shouldRun

      protected boolean shouldRun(Runnable pRunnable)
      Determines whether the given runnable task should be run or not. It depends on the shutdown state of the SoundEngineExecutor.

      Specified by:
      shouldRun in class BlockableEventLoop<Runnable>
      Parameters:
      pRunnable - The runnable task
      Returns:
      true if the task should run, false otherwise
    • getRunningThread

      protected Thread getRunningThread()
      Specified by:
      getRunningThread in class BlockableEventLoop<Runnable>
    • run

      private void run()
    • waitForTasks

      public void waitForTasks()
      Overrides:
      waitForTasks in class BlockableEventLoop<Runnable>
    • flush

      public void flush()