From 4ca5e202a2e0b221148d941f35577fcb10855fd8 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sat, 25 Jan 2025 10:37:46 -0600 Subject: [PATCH] Is this thing on? - Fix new fabric instances defaulting to flywheel:off --- .../main/java/dev/engine_room/flywheel/impl/FlwImpl.java | 2 -- .../dev/engine_room/flywheel/impl/FabricFlwConfig.java | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/dev/engine_room/flywheel/impl/FlwImpl.java b/common/src/main/java/dev/engine_room/flywheel/impl/FlwImpl.java index 3ee7c6352..a2332d4f9 100644 --- a/common/src/main/java/dev/engine_room/flywheel/impl/FlwImpl.java +++ b/common/src/main/java/dev/engine_room/flywheel/impl/FlwImpl.java @@ -18,8 +18,6 @@ public final class FlwImpl { // impl BackendManagerImpl.init(); - // lib - // backend FlwBackend.init(FlwConfig.INSTANCE.backendConfig()); } diff --git a/fabric/src/main/java/dev/engine_room/flywheel/impl/FabricFlwConfig.java b/fabric/src/main/java/dev/engine_room/flywheel/impl/FabricFlwConfig.java index 2763ae124..a6f17f39a 100644 --- a/fabric/src/main/java/dev/engine_room/flywheel/impl/FabricFlwConfig.java +++ b/fabric/src/main/java/dev/engine_room/flywheel/impl/FabricFlwConfig.java @@ -38,7 +38,8 @@ public class FabricFlwConfig implements FlwConfig { private final File file; - public Backend backend = BackendManager.defaultBackend(); + // Don't actually default to off, we'll find the true default in #load + public Backend backend = BackendManager.offBackend(); public boolean limitUpdates = LIMIT_UPDATES_DEFAULT; public int workerThreads = WORKER_THREADS_DEFAULT; @@ -69,6 +70,10 @@ public class FabricFlwConfig implements FlwConfig { } public void load() { + // Grab the default backend here because this object is constructed + // very early in flywheel loading and not all backends may be registered + backend = BackendManager.defaultBackend(); + if (file.exists()) { try (FileReader reader = new FileReader(file)) { fromJson(JsonParser.parseReader(reader));