Class DeferredWorkQueue


  • public class DeferredWorkQueue
    extends java.lang.Object
    Utility for running code on the main launch thread at the next available opportunity. There is no guaranteed order that work from various mods will be run, but your own work will be run sequentially.

    Use of this class after startup is not possible. At that point, IThreadListener should be used instead.

    Exceptions from tasks will be handled gracefully, causing a mod loading error. Tasks that take egregiously long times to run will be logged.

    • Method Detail

      • runTasks

        void runTasks()
      • enqueueWork

        public java.util.concurrent.CompletableFuture<java.lang.Void> enqueueWork​(net.minecraftforge.forgespi.language.IModInfo modInfo,
                                                                                  java.lang.Runnable work)
      • enqueueWork

        public <T> java.util.concurrent.CompletableFuture<T> enqueueWork​(net.minecraftforge.forgespi.language.IModInfo modInfo,
                                                                         java.util.function.Supplier<T> work)