mirror of
https://github.com/FalsePattern/FalsePatternLib.git
synced 2026-11-17 06:25:02 +00:00
moved async worker to public package
This commit is contained in:
5 files changed
+24
-13
No files matched your search
@@ -52,14 +52,6 @@ public class FalsePatternLib {
|
||||
@Getter private static final boolean developerEnvironment =
|
||||
(boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
|
||||
|
||||
@Getter
|
||||
private static final ExecutorService asyncWorker = Executors.newSingleThreadExecutor((runnable) -> {
|
||||
Thread thread = new Thread(runnable);
|
||||
thread.setDaemon(true);
|
||||
thread.setName(Tags.MODNAME + " Async Worker");
|
||||
return thread;
|
||||
});
|
||||
|
||||
@SidedProxy(clientSide = Tags.GROUPNAME + ".internal.proxy.ClientProxy", serverSide = Tags.GROUPNAME + ".internal.proxy.CommonProxy")
|
||||
private static CommonProxy proxy;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.falsepattern.lib.internal.proxy;
|
||||
|
||||
import com.falsepattern.lib.internal.FalsePatternLib;
|
||||
import com.falsepattern.lib.text.FormattedText;
|
||||
import com.falsepattern.lib.util.Async;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
@@ -33,7 +34,7 @@ public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent e) {
|
||||
super.postInit(e);
|
||||
chatFuture = FalsePatternLib.getAsyncWorker().submit(() -> {
|
||||
chatFuture = Async.asyncWorker.submit(() -> {
|
||||
long start = System.nanoTime();
|
||||
val updates = updatesFuture.get();
|
||||
if (updates == null || updates.size() == 0) return null;
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.falsepattern.lib.internal.LibraryConfig;
|
||||
import com.falsepattern.lib.internal.Tags;
|
||||
import com.falsepattern.lib.updates.ModUpdateInfo;
|
||||
import com.falsepattern.lib.updates.UpdateChecker;
|
||||
import com.falsepattern.lib.util.Async;
|
||||
import cpw.mods.fml.common.event.FMLConstructionEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
@@ -35,7 +36,7 @@ public class CommonProxy {
|
||||
if (LibraryConfig.ENABLE_UPDATE_CHECKER) {
|
||||
FalsePatternLib.getLog().info("Launching asynchronous update check.");
|
||||
val updateCheckFuture = UpdateChecker.fetchUpdatesAsync("https://falsepattern.com/mc/versions.json");
|
||||
updatesFuture = FalsePatternLib.getAsyncWorker().submit(() -> {
|
||||
updatesFuture = Async.asyncWorker.submit(() -> {
|
||||
if (!updateCheckFuture.isCancelled()) {
|
||||
try {
|
||||
var updates = updateCheckFuture.get();
|
||||
|
||||
Reference in new issue
Block a user