mirror of
https://github.com/Lucaslah/WeatherChanger.git
synced 2026-01-06 13:37:50 +00:00
First progress on forge support
- add forge module - github actions build and release - aim for all-in-one jar supporting both fabric and forge **NOTICE** Forge support is not currently working. Signed-off-by: Lucas Petrino <nsx1lucas@gmail.com>
This commit is contained in:
@@ -20,8 +20,10 @@ import java.util.Objects;
|
||||
public class WeatherChanger {
|
||||
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
private static WcMode currentMode = WcMode.OFF;
|
||||
private static WeatherChangerPlatform platform;
|
||||
|
||||
public static void init() {
|
||||
public static void init(WeatherChangerPlatform platform) {
|
||||
WeatherChanger.platform = platform;
|
||||
boolean fileCreated = false;
|
||||
File configPath = getConfigFile();
|
||||
|
||||
@@ -39,7 +41,7 @@ public class WeatherChanger {
|
||||
loadConfig();
|
||||
}
|
||||
|
||||
KeybindingManager keybindingManager = WeatherChangerExpectPlatform.getKeybindingManager();
|
||||
KeybindingManager keybindingManager = platform.getKeybindingManager();
|
||||
|
||||
keybindingManager
|
||||
.add(new ToggleClearKey())
|
||||
@@ -96,7 +98,7 @@ public class WeatherChanger {
|
||||
}
|
||||
|
||||
private static File getConfigFile() {
|
||||
return WeatherChangerExpectPlatform.getConfigDirectory().resolve("weather-changer.json").toFile();
|
||||
return platform.getConfigDirectory().resolve("weather-changer.json").toFile();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package me.lucaslah.weatherchanger;
|
||||
|
||||
import dev.architectury.injectables.annotations.ExpectPlatform;
|
||||
import me.lucaslah.weatherchanger.keybinding.KeybindingManager;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class WeatherChangerExpectPlatform {
|
||||
@ExpectPlatform
|
||||
public static Path getConfigDirectory() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
public static KeybindingManager getKeybindingManager() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package me.lucaslah.weatherchanger;
|
||||
|
||||
import me.lucaslah.weatherchanger.keybinding.KeybindingManager;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
public interface WeatherChangerPlatform {
|
||||
Path getConfigDirectory();
|
||||
KeybindingManager getKeybindingManager();
|
||||
}
|
||||
Reference in New Issue
Block a user