[BUG] Fix Config watcher using too many threads and not detecting changes on Linux systems
This commit is contained in:
@@ -8,6 +8,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
@@ -19,7 +20,9 @@ public final class ConfigController implements Serializable {
|
||||
* Cache of registered configs
|
||||
*/
|
||||
@Getter
|
||||
private static final HashMap<String, Pair<AbstractConfig, FileWatcher>> watchedConfigs = new HashMap<>();
|
||||
private static final HashMap<String, AbstractConfig> watchedConfigs = new HashMap<>();
|
||||
|
||||
private static FileWatcher watcher = new FileWatcher(e -> CraterConstants.LOG.error("Config Watcher Error", e));
|
||||
|
||||
/**
|
||||
* INTERNAL METHOD - Register and watch the config
|
||||
@@ -42,9 +45,8 @@ public final class ConfigController implements Serializable {
|
||||
if (watchedConfigs.containsKey(config.getConfigPath().toString())) {
|
||||
CraterConstants.LOG.error("Failed to register {}. Config already registered", config.getConfigPath().getName());
|
||||
} else {
|
||||
FileWatcher configWatcher = new FileWatcher();
|
||||
try {
|
||||
configWatcher.setWatch(config.getConfigPath(), () -> {
|
||||
watcher.addWatch(config.getConfigPath(), () -> {
|
||||
if (!config.isWasSaveCalled()) {
|
||||
CraterConstants.LOG.info("Sending Reload Event for: {}", config.getConfigPath().getName());
|
||||
config.configReloaded();
|
||||
@@ -53,7 +55,7 @@ public final class ConfigController implements Serializable {
|
||||
} catch (Exception e) {
|
||||
CraterConstants.LOG.error("Failed to register {} for auto reloading. {}", config.getConfigPath().getName(), e.getMessage());
|
||||
}
|
||||
watchedConfigs.put(config.getConfigPath().toString(), Pair.of(config, configWatcher));
|
||||
watchedConfigs.put(config.getConfigPath().toString(), config);
|
||||
CraterConstants.LOG.info("Registered {} successfully!", config.getConfigPath().getName());
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,6 @@
|
||||
package com.hypherionmc.craterlib;
|
||||
|
||||
import com.hypherionmc.craterlib.client.gui.config.ClothConfigScreenBuilder;
|
||||
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||
import com.hypherionmc.craterlib.core.config.AbstractConfig;
|
||||
import com.hypherionmc.craterlib.core.config.ConfigController;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.ClothScreen;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.NoConfigScreen;
|
||||
@@ -27,12 +25,11 @@ public class CraterLibModMenuIntegration implements ModMenuApi {
|
||||
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
|
||||
Map<String, ConfigScreenFactory<?>> configScreens = new HashMap<>();
|
||||
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
configScreens.put(config.getModId(), screen -> ClothConfigScreenBuilder.buildConfigScreen(config, screen));
|
||||
} else {
|
||||
configScreens.put(config.getModId(), screen -> BridgedMinecraft.getInstance().buildWarningScreen(
|
||||
|
@@ -32,7 +32,6 @@ public class ConfigScreenHandlerMixin {
|
||||
@Inject(at = @At("RETURN"), method = "getGuiFactoryFor", cancellable = true, remap = false)
|
||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
|
@@ -1,7 +1,12 @@
|
||||
**Bug Fixes**:
|
||||
|
||||
- Fixed LuckPerms breaking commands on Paper
|
||||
- Fix Config watcher using too many threads and not detecting changes on Linux systems
|
||||
|
||||
**New Features**:
|
||||
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
|
||||
**Dev Changes**:
|
||||
|
||||
- Bumped MoonConfig - `1.0.10` -> `1.0.11`
|
@@ -2,7 +2,7 @@
|
||||
version_major=2
|
||||
version_minor=1
|
||||
version_patch=4
|
||||
version_build=0
|
||||
version_build=1
|
||||
|
||||
#Mod
|
||||
mod_author=HypherionSA
|
||||
@@ -21,7 +21,7 @@ fabric_api=0.76.0+1.18.2
|
||||
forge_version=40.2.0
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
lombok=1.18.32
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
@@ -8,6 +8,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
@@ -19,7 +20,9 @@ public final class ConfigController implements Serializable {
|
||||
* Cache of registered configs
|
||||
*/
|
||||
@Getter
|
||||
private static final HashMap<String, Pair<AbstractConfig, FileWatcher>> watchedConfigs = new HashMap<>();
|
||||
private static final HashMap<String, AbstractConfig> watchedConfigs = new HashMap<>();
|
||||
|
||||
private static FileWatcher watcher = new FileWatcher(e -> CraterConstants.LOG.error("Config Watcher Error", e));
|
||||
|
||||
/**
|
||||
* INTERNAL METHOD - Register and watch the config
|
||||
@@ -42,9 +45,8 @@ public final class ConfigController implements Serializable {
|
||||
if (watchedConfigs.containsKey(config.getConfigPath().toString())) {
|
||||
CraterConstants.LOG.error("Failed to register {}. Config already registered", config.getConfigPath().getName());
|
||||
} else {
|
||||
FileWatcher configWatcher = new FileWatcher();
|
||||
try {
|
||||
configWatcher.setWatch(config.getConfigPath(), () -> {
|
||||
watcher.addWatch(config.getConfigPath(), () -> {
|
||||
if (!config.isWasSaveCalled()) {
|
||||
CraterConstants.LOG.info("Sending Reload Event for: {}", config.getConfigPath().getName());
|
||||
config.configReloaded();
|
||||
@@ -53,7 +55,7 @@ public final class ConfigController implements Serializable {
|
||||
} catch (Exception e) {
|
||||
CraterConstants.LOG.error("Failed to register {} for auto reloading. {}", config.getConfigPath().getName(), e.getMessage());
|
||||
}
|
||||
watchedConfigs.put(config.getConfigPath().toString(), Pair.of(config, configWatcher));
|
||||
watchedConfigs.put(config.getConfigPath().toString(), config);
|
||||
CraterConstants.LOG.info("Registered {} successfully!", config.getConfigPath().getName());
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,6 @@
|
||||
package com.hypherionmc.craterlib;
|
||||
|
||||
import com.hypherionmc.craterlib.client.gui.config.ClothConfigScreenBuilder;
|
||||
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||
import com.hypherionmc.craterlib.core.config.AbstractConfig;
|
||||
import com.hypherionmc.craterlib.core.config.ConfigController;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.ClothScreen;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.NoConfigScreen;
|
||||
@@ -27,12 +25,11 @@ public class CraterLibModMenuIntegration implements ModMenuApi {
|
||||
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
|
||||
Map<String, ConfigScreenFactory<?>> configScreens = new HashMap<>();
|
||||
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
configScreens.put(config.getModId(), screen -> ClothConfigScreenBuilder.buildConfigScreen(config, screen));
|
||||
} else {
|
||||
configScreens.put(config.getModId(), screen -> BridgedMinecraft.getInstance().buildWarningScreen(
|
||||
|
@@ -32,7 +32,6 @@ public class ConfigScreenHandlerMixin {
|
||||
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
|
@@ -1,7 +1,12 @@
|
||||
**Bug Fixes**:
|
||||
|
||||
- Fixed LuckPerms breaking commands on Paper
|
||||
- Fix Config watcher using too many threads and not detecting changes on Linux systems
|
||||
|
||||
**New Features**:
|
||||
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
|
||||
**Dev Changes**:
|
||||
|
||||
- Bumped MoonConfig - `1.0.10` -> `1.0.11`
|
@@ -2,7 +2,7 @@
|
||||
version_major=2
|
||||
version_minor=1
|
||||
version_patch=4
|
||||
version_build=0
|
||||
version_build=1
|
||||
|
||||
#Mod
|
||||
mod_author=HypherionSA
|
||||
@@ -21,7 +21,7 @@ fabric_api=0.76.0+1.19.2
|
||||
forge_version=43.4.0
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
lombok=1.18.32
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
@@ -8,6 +8,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
@@ -19,7 +20,9 @@ public final class ConfigController implements Serializable {
|
||||
* Cache of registered configs
|
||||
*/
|
||||
@Getter
|
||||
private static final HashMap<String, Pair<AbstractConfig, FileWatcher>> watchedConfigs = new HashMap<>();
|
||||
private static final HashMap<String, AbstractConfig> watchedConfigs = new HashMap<>();
|
||||
|
||||
private static FileWatcher watcher = new FileWatcher(e -> CraterConstants.LOG.error("Config Watcher Error", e));
|
||||
|
||||
/**
|
||||
* INTERNAL METHOD - Register and watch the config
|
||||
@@ -42,9 +45,8 @@ public final class ConfigController implements Serializable {
|
||||
if (watchedConfigs.containsKey(config.getConfigPath().toString())) {
|
||||
CraterConstants.LOG.error("Failed to register {}. Config already registered", config.getConfigPath().getName());
|
||||
} else {
|
||||
FileWatcher configWatcher = new FileWatcher();
|
||||
try {
|
||||
configWatcher.setWatch(config.getConfigPath(), () -> {
|
||||
watcher.addWatch(config.getConfigPath(), () -> {
|
||||
if (!config.isWasSaveCalled()) {
|
||||
CraterConstants.LOG.info("Sending Reload Event for: {}", config.getConfigPath().getName());
|
||||
config.configReloaded();
|
||||
@@ -53,7 +55,7 @@ public final class ConfigController implements Serializable {
|
||||
} catch (Exception e) {
|
||||
CraterConstants.LOG.error("Failed to register {} for auto reloading. {}", config.getConfigPath().getName(), e.getMessage());
|
||||
}
|
||||
watchedConfigs.put(config.getConfigPath().toString(), Pair.of(config, configWatcher));
|
||||
watchedConfigs.put(config.getConfigPath().toString(), config);
|
||||
CraterConstants.LOG.info("Registered {} successfully!", config.getConfigPath().getName());
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,6 @@
|
||||
package com.hypherionmc.craterlib;
|
||||
|
||||
import com.hypherionmc.craterlib.client.gui.config.ClothConfigScreenBuilder;
|
||||
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||
import com.hypherionmc.craterlib.core.config.AbstractConfig;
|
||||
import com.hypherionmc.craterlib.core.config.ConfigController;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.ClothScreen;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.NoConfigScreen;
|
||||
@@ -27,12 +25,11 @@ public class CraterLibModMenuIntegration implements ModMenuApi {
|
||||
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
|
||||
Map<String, ConfigScreenFactory<?>> configScreens = new HashMap<>();
|
||||
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
configScreens.put(config.getModId(), screen -> ClothConfigScreenBuilder.buildConfigScreen(config, screen));
|
||||
} else {
|
||||
configScreens.put(config.getModId(), screen -> BridgedMinecraft.getInstance().buildWarningScreen(
|
||||
|
@@ -32,7 +32,6 @@ public class ConfigScreenHandlerMixin {
|
||||
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
|
@@ -1,7 +1,12 @@
|
||||
**Bug Fixes**:
|
||||
|
||||
- Fixed LuckPerms breaking commands on Paper
|
||||
- Fix Config watcher using too many threads and not detecting changes on Linux systems
|
||||
|
||||
**New Features**:
|
||||
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
|
||||
**Dev Changes**:
|
||||
|
||||
- Bumped MoonConfig - `1.0.10` -> `1.0.11`
|
@@ -2,7 +2,7 @@
|
||||
version_major=2
|
||||
version_minor=1
|
||||
version_patch=4
|
||||
version_build=0
|
||||
version_build=1
|
||||
|
||||
#Mod
|
||||
mod_author=HypherionSA
|
||||
@@ -21,7 +21,7 @@ fabric_api=0.87.2+1.19.4
|
||||
forge_version=45.3.0
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
lombok=1.18.32
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
@@ -8,6 +8,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
@@ -19,7 +20,9 @@ public final class ConfigController implements Serializable {
|
||||
* Cache of registered configs
|
||||
*/
|
||||
@Getter
|
||||
private static final HashMap<String, Pair<AbstractConfig, FileWatcher>> watchedConfigs = new HashMap<>();
|
||||
private static final HashMap<String, AbstractConfig> watchedConfigs = new HashMap<>();
|
||||
|
||||
private static FileWatcher watcher = new FileWatcher(e -> CraterConstants.LOG.error("Config Watcher Error", e));
|
||||
|
||||
/**
|
||||
* INTERNAL METHOD - Register and watch the config
|
||||
@@ -42,9 +45,8 @@ public final class ConfigController implements Serializable {
|
||||
if (watchedConfigs.containsKey(config.getConfigPath().toString())) {
|
||||
CraterConstants.LOG.error("Failed to register {}. Config already registered", config.getConfigPath().getName());
|
||||
} else {
|
||||
FileWatcher configWatcher = new FileWatcher();
|
||||
try {
|
||||
configWatcher.setWatch(config.getConfigPath(), () -> {
|
||||
watcher.addWatch(config.getConfigPath(), () -> {
|
||||
if (!config.isWasSaveCalled()) {
|
||||
CraterConstants.LOG.info("Sending Reload Event for: {}", config.getConfigPath().getName());
|
||||
config.configReloaded();
|
||||
@@ -53,7 +55,7 @@ public final class ConfigController implements Serializable {
|
||||
} catch (Exception e) {
|
||||
CraterConstants.LOG.error("Failed to register {} for auto reloading. {}", config.getConfigPath().getName(), e.getMessage());
|
||||
}
|
||||
watchedConfigs.put(config.getConfigPath().toString(), Pair.of(config, configWatcher));
|
||||
watchedConfigs.put(config.getConfigPath().toString(), config);
|
||||
CraterConstants.LOG.info("Registered {} successfully!", config.getConfigPath().getName());
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,6 @@
|
||||
package com.hypherionmc.craterlib;
|
||||
|
||||
import com.hypherionmc.craterlib.client.gui.config.ClothConfigScreenBuilder;
|
||||
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||
import com.hypherionmc.craterlib.core.config.AbstractConfig;
|
||||
import com.hypherionmc.craterlib.core.config.ConfigController;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.ClothScreen;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.NoConfigScreen;
|
||||
@@ -27,12 +25,11 @@ public class CraterLibModMenuIntegration implements ModMenuApi {
|
||||
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
|
||||
Map<String, ConfigScreenFactory<?>> configScreens = new HashMap<>();
|
||||
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
configScreens.put(config.getModId(), screen -> ClothConfigScreenBuilder.buildConfigScreen(config, screen));
|
||||
} else {
|
||||
configScreens.put(config.getModId(), screen -> BridgedMinecraft.getInstance().buildWarningScreen(
|
||||
|
@@ -32,7 +32,6 @@ public class ConfigScreenHandlerMixin {
|
||||
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
|
@@ -1,7 +1,12 @@
|
||||
**Bug Fixes**:
|
||||
|
||||
- Fixed LuckPerms breaking commands on Paper
|
||||
- Fix Config watcher using too many threads and not detecting changes on Linux systems
|
||||
|
||||
**New Features**:
|
||||
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
|
||||
**Dev Changes**:
|
||||
|
||||
- Bumped MoonConfig - `1.0.10` -> `1.0.11`
|
@@ -2,7 +2,7 @@
|
||||
version_major=2
|
||||
version_minor=1
|
||||
version_patch=4
|
||||
version_build=0
|
||||
version_build=1
|
||||
|
||||
#Mod
|
||||
mod_author=HypherionSA
|
||||
@@ -21,7 +21,7 @@ fabric_api=0.91.6+1.20.2
|
||||
forge_version=48.1.0
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
lombok=1.18.32
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
@@ -8,6 +8,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
@@ -19,7 +20,9 @@ public final class ConfigController implements Serializable {
|
||||
* Cache of registered configs
|
||||
*/
|
||||
@Getter
|
||||
private static final HashMap<String, Pair<AbstractConfig, FileWatcher>> watchedConfigs = new HashMap<>();
|
||||
private static final HashMap<String, AbstractConfig> watchedConfigs = new HashMap<>();
|
||||
|
||||
private static FileWatcher watcher = new FileWatcher(e -> CraterConstants.LOG.error("Config Watcher Error", e));
|
||||
|
||||
/**
|
||||
* INTERNAL METHOD - Register and watch the config
|
||||
@@ -42,9 +45,8 @@ public final class ConfigController implements Serializable {
|
||||
if (watchedConfigs.containsKey(config.getConfigPath().toString())) {
|
||||
CraterConstants.LOG.error("Failed to register {}. Config already registered", config.getConfigPath().getName());
|
||||
} else {
|
||||
FileWatcher configWatcher = new FileWatcher();
|
||||
try {
|
||||
configWatcher.setWatch(config.getConfigPath(), () -> {
|
||||
watcher.addWatch(config.getConfigPath(), () -> {
|
||||
if (!config.isWasSaveCalled()) {
|
||||
CraterConstants.LOG.info("Sending Reload Event for: {}", config.getConfigPath().getName());
|
||||
config.configReloaded();
|
||||
@@ -53,7 +55,7 @@ public final class ConfigController implements Serializable {
|
||||
} catch (Exception e) {
|
||||
CraterConstants.LOG.error("Failed to register {} for auto reloading. {}", config.getConfigPath().getName(), e.getMessage());
|
||||
}
|
||||
watchedConfigs.put(config.getConfigPath().toString(), Pair.of(config, configWatcher));
|
||||
watchedConfigs.put(config.getConfigPath().toString(), config);
|
||||
CraterConstants.LOG.info("Registered {} successfully!", config.getConfigPath().getName());
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,6 @@
|
||||
package com.hypherionmc.craterlib;
|
||||
|
||||
import com.hypherionmc.craterlib.client.gui.config.ClothConfigScreenBuilder;
|
||||
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||
import com.hypherionmc.craterlib.core.config.AbstractConfig;
|
||||
import com.hypherionmc.craterlib.core.config.ConfigController;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.ClothScreen;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.NoConfigScreen;
|
||||
@@ -27,12 +25,11 @@ public class CraterLibModMenuIntegration implements ModMenuApi {
|
||||
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
|
||||
Map<String, ConfigScreenFactory<?>> configScreens = new HashMap<>();
|
||||
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
configScreens.put(config.getModId(), screen -> ClothConfigScreenBuilder.buildConfigScreen(config, screen));
|
||||
} else {
|
||||
configScreens.put(config.getModId(), screen -> BridgedMinecraft.getInstance().buildWarningScreen(
|
||||
|
@@ -32,7 +32,6 @@ public class ConfigScreenHandlerMixin {
|
||||
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
|
@@ -29,9 +29,8 @@ public class ConfigScreenHandlerMixin {
|
||||
*/
|
||||
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
if (!conf.getClass().isAnnotationPresent(NoConfigScreen.class)) {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
if (config.getModId().equals(selectedMod.getModId())) {
|
||||
cir.setReturnValue(
|
||||
Optional.of((minecraft, screen) -> new CraterConfigScreen(config, screen))
|
||||
|
@@ -1,7 +1,12 @@
|
||||
**Bug Fixes**:
|
||||
|
||||
- Fixed LuckPerms breaking commands on Paper
|
||||
- Fix Config watcher using too many threads and not detecting changes on Linux systems
|
||||
|
||||
**New Features**:
|
||||
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
|
||||
**Dev Changes**:
|
||||
|
||||
- Bumped MoonConfig - `1.0.10` -> `1.0.11`
|
@@ -2,7 +2,7 @@
|
||||
version_major=2
|
||||
version_minor=1
|
||||
version_patch=4
|
||||
version_build=0
|
||||
version_build=1
|
||||
|
||||
#Mod
|
||||
mod_author=HypherionSA
|
||||
@@ -24,7 +24,7 @@ forge_version=49.0.49
|
||||
neoforge_version=234
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
lombok=1.18.32
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
@@ -8,6 +8,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
@@ -19,7 +20,9 @@ public final class ConfigController implements Serializable {
|
||||
* Cache of registered configs
|
||||
*/
|
||||
@Getter
|
||||
private static final HashMap<String, Pair<AbstractConfig, FileWatcher>> watchedConfigs = new HashMap<>();
|
||||
private static final HashMap<String, AbstractConfig> watchedConfigs = new HashMap<>();
|
||||
|
||||
private static FileWatcher watcher = new FileWatcher(e -> CraterConstants.LOG.error("Config Watcher Error", e));
|
||||
|
||||
/**
|
||||
* INTERNAL METHOD - Register and watch the config
|
||||
@@ -42,9 +45,8 @@ public final class ConfigController implements Serializable {
|
||||
if (watchedConfigs.containsKey(config.getConfigPath().toString())) {
|
||||
CraterConstants.LOG.error("Failed to register {}. Config already registered", config.getConfigPath().getName());
|
||||
} else {
|
||||
FileWatcher configWatcher = new FileWatcher();
|
||||
try {
|
||||
configWatcher.setWatch(config.getConfigPath(), () -> {
|
||||
watcher.addWatch(config.getConfigPath(), () -> {
|
||||
if (!config.isWasSaveCalled()) {
|
||||
CraterConstants.LOG.info("Sending Reload Event for: {}", config.getConfigPath().getName());
|
||||
config.configReloaded();
|
||||
@@ -53,7 +55,7 @@ public final class ConfigController implements Serializable {
|
||||
} catch (Exception e) {
|
||||
CraterConstants.LOG.error("Failed to register {} for auto reloading. {}", config.getConfigPath().getName(), e.getMessage());
|
||||
}
|
||||
watchedConfigs.put(config.getConfigPath().toString(), Pair.of(config, configWatcher));
|
||||
watchedConfigs.put(config.getConfigPath().toString(), config);
|
||||
CraterConstants.LOG.info("Registered {} successfully!", config.getConfigPath().getName());
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,6 @@
|
||||
package com.hypherionmc.craterlib;
|
||||
|
||||
import com.hypherionmc.craterlib.client.gui.config.ClothConfigScreenBuilder;
|
||||
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||
import com.hypherionmc.craterlib.core.config.AbstractConfig;
|
||||
import com.hypherionmc.craterlib.core.config.ConfigController;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.ClothScreen;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.NoConfigScreen;
|
||||
@@ -27,12 +25,11 @@ public class CraterLibModMenuIntegration implements ModMenuApi {
|
||||
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
|
||||
Map<String, ConfigScreenFactory<?>> configScreens = new HashMap<>();
|
||||
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
configScreens.put(config.getModId(), screen -> ClothConfigScreenBuilder.buildConfigScreen(config, screen));
|
||||
} else {
|
||||
configScreens.put(config.getModId(), screen -> BridgedMinecraft.getInstance().buildWarningScreen(
|
||||
|
@@ -32,7 +32,6 @@ public class ConfigScreenHandlerMixin {
|
||||
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
|
@@ -1,8 +1,13 @@
|
||||
**Bug Fixes**:
|
||||
|
||||
- Fixed LuckPerms breaking commands on Paper
|
||||
- Fix Config watcher using too many threads and not detecting changes on Linux systems
|
||||
- Fixed crash when trying to open config screens on NeoForge
|
||||
|
||||
**New Features**:
|
||||
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
|
||||
**Dev Changes**:
|
||||
|
||||
- Bumped MoonConfig - `1.0.10` -> `1.0.11`
|
||||
|
@@ -2,7 +2,7 @@
|
||||
version_major=2
|
||||
version_minor=1
|
||||
version_patch=4
|
||||
version_build=0
|
||||
version_build=1
|
||||
|
||||
#Mod
|
||||
mod_author=HypherionSA
|
||||
@@ -21,7 +21,7 @@ fabric_api=0.83.0+1.20
|
||||
forge_version=46.0.14
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
lombok=1.18.32
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
@@ -8,6 +8,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
@@ -19,7 +20,9 @@ public final class ConfigController implements Serializable {
|
||||
* Cache of registered configs
|
||||
*/
|
||||
@Getter
|
||||
private static final HashMap<String, Pair<AbstractConfig, FileWatcher>> watchedConfigs = new HashMap<>();
|
||||
private static final HashMap<String, AbstractConfig> watchedConfigs = new HashMap<>();
|
||||
|
||||
private static FileWatcher watcher = new FileWatcher(e -> CraterConstants.LOG.error("Config Watcher Error", e));
|
||||
|
||||
/**
|
||||
* INTERNAL METHOD - Register and watch the config
|
||||
@@ -42,9 +45,8 @@ public final class ConfigController implements Serializable {
|
||||
if (watchedConfigs.containsKey(config.getConfigPath().toString())) {
|
||||
CraterConstants.LOG.error("Failed to register {}. Config already registered", config.getConfigPath().getName());
|
||||
} else {
|
||||
FileWatcher configWatcher = new FileWatcher();
|
||||
try {
|
||||
configWatcher.setWatch(config.getConfigPath(), () -> {
|
||||
watcher.addWatch(config.getConfigPath(), () -> {
|
||||
if (!config.isWasSaveCalled()) {
|
||||
CraterConstants.LOG.info("Sending Reload Event for: {}", config.getConfigPath().getName());
|
||||
config.configReloaded();
|
||||
@@ -53,7 +55,7 @@ public final class ConfigController implements Serializable {
|
||||
} catch (Exception e) {
|
||||
CraterConstants.LOG.error("Failed to register {} for auto reloading. {}", config.getConfigPath().getName(), e.getMessage());
|
||||
}
|
||||
watchedConfigs.put(config.getConfigPath().toString(), Pair.of(config, configWatcher));
|
||||
watchedConfigs.put(config.getConfigPath().toString(), config);
|
||||
CraterConstants.LOG.info("Registered {} successfully!", config.getConfigPath().getName());
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,6 @@
|
||||
package com.hypherionmc.craterlib;
|
||||
|
||||
import com.hypherionmc.craterlib.client.gui.config.ClothConfigScreenBuilder;
|
||||
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||
import com.hypherionmc.craterlib.core.config.AbstractConfig;
|
||||
import com.hypherionmc.craterlib.core.config.ConfigController;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.ClothScreen;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.NoConfigScreen;
|
||||
@@ -27,12 +25,11 @@ public class CraterLibModMenuIntegration implements ModMenuApi {
|
||||
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
|
||||
Map<String, ConfigScreenFactory<?>> configScreens = new HashMap<>();
|
||||
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
configScreens.put(config.getModId(), screen -> ClothConfigScreenBuilder.buildConfigScreen(config, screen));
|
||||
} else {
|
||||
configScreens.put(config.getModId(), screen -> BridgedMinecraft.getInstance().buildWarningScreen(
|
||||
|
@@ -54,12 +54,11 @@ public class NeoForgeClientHelper implements ClientPlatform {
|
||||
LateInitEvent event = new LateInitEvent(new BridgedMinecraft(), BridgedOptions.of(Minecraft.getInstance().options));
|
||||
CraterEventBus.INSTANCE.postEvent(event);
|
||||
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
} else {
|
||||
//ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -1,7 +1,12 @@
|
||||
**Bug Fixes**:
|
||||
|
||||
- Fixed LuckPerms breaking commands on Paper
|
||||
- Fix Config watcher using too many threads and not detecting changes on Linux systems
|
||||
|
||||
**New Features**:
|
||||
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
|
||||
**Dev Changes**:
|
||||
|
||||
- Bumped MoonConfig - `1.0.10` -> `1.0.11`
|
@@ -2,7 +2,7 @@
|
||||
version_major=2
|
||||
version_minor=1
|
||||
version_patch=4
|
||||
version_build=0
|
||||
version_build=1
|
||||
|
||||
#Mod
|
||||
mod_author=HypherionSA
|
||||
@@ -24,7 +24,7 @@ forge_version=50.0.6
|
||||
neoforge_version=16-beta
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
lombok=1.18.32
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
@@ -8,6 +8,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
@@ -19,7 +20,9 @@ public final class ConfigController implements Serializable {
|
||||
* Cache of registered configs
|
||||
*/
|
||||
@Getter
|
||||
private static final HashMap<String, Pair<AbstractConfig, FileWatcher>> watchedConfigs = new HashMap<>();
|
||||
private static final HashMap<String, AbstractConfig> watchedConfigs = new HashMap<>();
|
||||
|
||||
private static FileWatcher watcher = new FileWatcher(e -> CraterConstants.LOG.error("Config Watcher Error", e));
|
||||
|
||||
/**
|
||||
* INTERNAL METHOD - Register and watch the config
|
||||
@@ -42,9 +45,8 @@ public final class ConfigController implements Serializable {
|
||||
if (watchedConfigs.containsKey(config.getConfigPath().toString())) {
|
||||
CraterConstants.LOG.error("Failed to register {}. Config already registered", config.getConfigPath().getName());
|
||||
} else {
|
||||
FileWatcher configWatcher = new FileWatcher();
|
||||
try {
|
||||
configWatcher.setWatch(config.getConfigPath(), () -> {
|
||||
watcher.addWatch(config.getConfigPath(), () -> {
|
||||
if (!config.isWasSaveCalled()) {
|
||||
CraterConstants.LOG.info("Sending Reload Event for: {}", config.getConfigPath().getName());
|
||||
config.configReloaded();
|
||||
@@ -53,7 +55,7 @@ public final class ConfigController implements Serializable {
|
||||
} catch (Exception e) {
|
||||
CraterConstants.LOG.error("Failed to register {} for auto reloading. {}", config.getConfigPath().getName(), e.getMessage());
|
||||
}
|
||||
watchedConfigs.put(config.getConfigPath().toString(), Pair.of(config, configWatcher));
|
||||
watchedConfigs.put(config.getConfigPath().toString(), config);
|
||||
CraterConstants.LOG.info("Registered {} successfully!", config.getConfigPath().getName());
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,6 @@
|
||||
package com.hypherionmc.craterlib;
|
||||
|
||||
import com.hypherionmc.craterlib.client.gui.config.ClothConfigScreenBuilder;
|
||||
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||
import com.hypherionmc.craterlib.core.config.AbstractConfig;
|
||||
import com.hypherionmc.craterlib.core.config.ConfigController;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.ClothScreen;
|
||||
import com.hypherionmc.craterlib.core.config.annotations.NoConfigScreen;
|
||||
@@ -27,12 +25,11 @@ public class CraterLibModMenuIntegration implements ModMenuApi {
|
||||
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
|
||||
Map<String, ConfigScreenFactory<?>> configScreens = new HashMap<>();
|
||||
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
configScreens.put(config.getModId(), screen -> ClothConfigScreenBuilder.buildConfigScreen(config, screen));
|
||||
} else {
|
||||
configScreens.put(config.getModId(), screen -> BridgedMinecraft.getInstance().buildWarningScreen(
|
||||
|
@@ -54,12 +54,11 @@ public class NeoForgeClientHelper implements ClientPlatform {
|
||||
LateInitEvent event = new LateInitEvent(new BridgedMinecraft(), BridgedOptions.of(Minecraft.getInstance().options));
|
||||
CraterEventBus.INSTANCE.postEvent(event);
|
||||
|
||||
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
} else {
|
||||
//ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -1,7 +1,12 @@
|
||||
**Bug Fixes**:
|
||||
|
||||
- Fixed LuckPerms breaking commands on Paper
|
||||
- Fix Config watcher using too many threads and not detecting changes on Linux systems
|
||||
|
||||
**New Features**:
|
||||
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
- Added Nojang API to allow mods to access GameRules (SDLink)
|
||||
|
||||
**Dev Changes**:
|
||||
|
||||
- Bumped MoonConfig - `1.0.10` -> `1.0.11`
|
@@ -2,7 +2,7 @@
|
||||
version_major=2
|
||||
version_minor=1
|
||||
version_patch=4
|
||||
version_build=0
|
||||
version_build=1
|
||||
|
||||
#Mod
|
||||
mod_author=HypherionSA
|
||||
@@ -24,7 +24,7 @@ forge_version=50.0.6
|
||||
neoforge_version=167
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
lombok=1.18.32
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
@@ -1 +1 @@
|
||||
3680e085db3b4b74a2885c79ad909e7170e71403
|
||||
b800a4ea78e2eae9b5d66af9d8c33f186b09eb26
|
@@ -18,7 +18,7 @@
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -19,24 +22,30 @@
|
||||
@@ -19,23 +22,29 @@
|
||||
/**
|
||||
* @author HypherionSA
|
||||
*/
|
||||
@@ -33,13 +33,12 @@
|
||||
- @Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
+ @Inject(at = @At("RETURN"), method = "getGuiFactoryFor", cancellable = true, remap = false)
|
||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, watcher) -> {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, config) -> {
|
||||
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -1,6 +1,6 @@
|
||||
--- a/NeoForge/src/main/java/com/hypherionmc/craterlib/client/NeoForgeClientHelper.java
|
||||
+++ /dev/null
|
||||
@@ -1,69 +1,0 @@
|
||||
@@ -1,68 +1,0 @@
|
||||
-package com.hypherionmc.craterlib.client;
|
||||
-
|
||||
-import com.hypherionmc.craterlib.api.events.client.LateInitEvent;
|
||||
@@ -57,12 +57,11 @@
|
||||
- LateInitEvent event = new LateInitEvent(new BridgedMinecraft(), BridgedOptions.of(Minecraft.getInstance().options));
|
||||
- CraterEventBus.INSTANCE.postEvent(event);
|
||||
-
|
||||
- ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
- AbstractConfig config = watcher.getLeft();
|
||||
- ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
- if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
- return;
|
||||
-
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -22,7 +22,7 @@
|
||||
+forge_version=40.2.0
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
@@ -29,23 +26,22 @@
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
@@ -14,17 +14,16 @@
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraftforge.client.ConfigScreenHandler;
|
||||
@@ -28,15 +31,21 @@
|
||||
@@ -28,14 +31,20 @@
|
||||
*/
|
||||
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, watcher) -> {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, config) -> {
|
||||
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -1,6 +1,6 @@
|
||||
--- a/NeoForge/src/main/java/com/hypherionmc/craterlib/client/NeoForgeClientHelper.java
|
||||
+++ /dev/null
|
||||
@@ -1,69 +1,0 @@
|
||||
@@ -1,68 +1,0 @@
|
||||
-package com.hypherionmc.craterlib.client;
|
||||
-
|
||||
-import com.hypherionmc.craterlib.api.events.client.LateInitEvent;
|
||||
@@ -57,12 +57,11 @@
|
||||
- LateInitEvent event = new LateInitEvent(new BridgedMinecraft(), BridgedOptions.of(Minecraft.getInstance().options));
|
||||
- CraterEventBus.INSTANCE.postEvent(event);
|
||||
-
|
||||
- ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
- AbstractConfig config = watcher.getLeft();
|
||||
- ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
- if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
- return;
|
||||
-
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -22,7 +22,7 @@
|
||||
+forge_version=43.4.0
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
@@ -29,23 +26,22 @@
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
@@ -14,17 +14,16 @@
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraftforge.client.ConfigScreenHandler;
|
||||
@@ -28,17 +31,22 @@
|
||||
@@ -28,16 +31,21 @@
|
||||
*/
|
||||
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, watcher) -> {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, config) -> {
|
||||
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -1,6 +1,6 @@
|
||||
--- a/NeoForge/src/main/java/com/hypherionmc/craterlib/client/NeoForgeClientHelper.java
|
||||
+++ /dev/null
|
||||
@@ -1,69 +1,0 @@
|
||||
@@ -1,68 +1,0 @@
|
||||
-package com.hypherionmc.craterlib.client;
|
||||
-
|
||||
-import com.hypherionmc.craterlib.api.events.client.LateInitEvent;
|
||||
@@ -57,12 +57,11 @@
|
||||
- LateInitEvent event = new LateInitEvent(new BridgedMinecraft(), BridgedOptions.of(Minecraft.getInstance().options));
|
||||
- CraterEventBus.INSTANCE.postEvent(event);
|
||||
-
|
||||
- ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
- AbstractConfig config = watcher.getLeft();
|
||||
- ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
- if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
- return;
|
||||
-
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -22,7 +22,7 @@
|
||||
+forge_version=45.3.0
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
@@ -29,23 +26,22 @@
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
@@ -14,17 +14,16 @@
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraftforge.client.ConfigScreenHandler;
|
||||
@@ -28,17 +31,22 @@
|
||||
@@ -28,16 +31,21 @@
|
||||
*/
|
||||
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, watcher) -> {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, config) -> {
|
||||
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -1,6 +1,6 @@
|
||||
--- a/NeoForge/src/main/java/com/hypherionmc/craterlib/client/NeoForgeClientHelper.java
|
||||
+++ /dev/null
|
||||
@@ -1,69 +1,0 @@
|
||||
@@ -1,68 +1,0 @@
|
||||
-package com.hypherionmc.craterlib.client;
|
||||
-
|
||||
-import com.hypherionmc.craterlib.api.events.client.LateInitEvent;
|
||||
@@ -57,12 +57,11 @@
|
||||
- LateInitEvent event = new LateInitEvent(new BridgedMinecraft(), BridgedOptions.of(Minecraft.getInstance().options));
|
||||
- CraterEventBus.INSTANCE.postEvent(event);
|
||||
-
|
||||
- ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
- AbstractConfig config = watcher.getLeft();
|
||||
- ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
- if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
- return;
|
||||
-
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -22,7 +22,7 @@
|
||||
+forge_version=48.1.0
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
@@ -29,23 +26,22 @@
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
@@ -14,17 +14,16 @@
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraftforge.client.ConfigScreenHandler;
|
||||
@@ -28,17 +31,22 @@
|
||||
@@ -28,16 +31,21 @@
|
||||
*/
|
||||
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, watcher) -> {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, config) -> {
|
||||
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -48,22 +37,5 @@
|
||||
@@ -48,21 +37,5 @@
|
||||
public Connection getClientConnection() {
|
||||
Objects.requireNonNull(Minecraft.getInstance().getConnection(), "Cannot send packets when not in game!");
|
||||
return Minecraft.getInstance().getConnection().getConnection();
|
||||
@@ -34,12 +34,11 @@
|
||||
- LateInitEvent event = new LateInitEvent(new BridgedMinecraft(), BridgedOptions.of(Minecraft.getInstance().options));
|
||||
- CraterEventBus.INSTANCE.postEvent(event);
|
||||
-
|
||||
- ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
- AbstractConfig config = watcher.getLeft();
|
||||
- ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
- if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
- return;
|
||||
-
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -1,6 +1,6 @@
|
||||
--- /dev/null
|
||||
+++ b/NeoForge/src/main/java/com/hypherionmc/craterlib/mixin/ConfigScreenHandlerMixin.java
|
||||
@@ -1,0 +1,44 @@
|
||||
@@ -1,0 +1,43 @@
|
||||
+package com.hypherionmc.craterlib.mixin;
|
||||
+
|
||||
+import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||
@@ -32,9 +32,8 @@
|
||||
+ */
|
||||
+ @Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
+ private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
+ ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
+ if (!conf.getClass().isAnnotationPresent(NoConfigScreen.class)) {
|
||||
+ AbstractConfig config = watcher.getLeft();
|
||||
+ if (config.getModId().equals(selectedMod.getModId())) {
|
||||
+ cir.setReturnValue(
|
||||
+ Optional.of((minecraft, screen) -> new CraterConfigScreen(config, screen))
|
||||
|
@@ -23,7 +23,7 @@
|
||||
+neoforge_version=234
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
@@ -29,23 +29,23 @@
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
@@ -14,17 +14,16 @@
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraftforge.client.ConfigScreenHandler;
|
||||
@@ -28,17 +31,22 @@
|
||||
@@ -28,16 +31,21 @@
|
||||
*/
|
||||
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, watcher) -> {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, config) -> {
|
||||
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
AbstractConfig config = watcher.getLeft();
|
||||
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
return;
|
||||
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -1,6 +1,6 @@
|
||||
--- a/NeoForge/src/main/java/com/hypherionmc/craterlib/client/NeoForgeClientHelper.java
|
||||
+++ /dev/null
|
||||
@@ -1,69 +1,0 @@
|
||||
@@ -1,68 +1,0 @@
|
||||
-package com.hypherionmc.craterlib.client;
|
||||
-
|
||||
-import com.hypherionmc.craterlib.api.events.client.LateInitEvent;
|
||||
@@ -57,12 +57,11 @@
|
||||
- LateInitEvent event = new LateInitEvent(new BridgedMinecraft(), BridgedOptions.of(Minecraft.getInstance().options));
|
||||
- CraterEventBus.INSTANCE.postEvent(event);
|
||||
-
|
||||
- ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
|
||||
- AbstractConfig config = watcher.getLeft();
|
||||
- ConfigController.getWatchedConfigs().forEach((conf, config) -> {
|
||||
- if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
- return;
|
||||
-
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -1,9 +1,9 @@
|
||||
--- a/changelog.md
|
||||
+++ b/changelog.md
|
||||
@@ -1,6 +1,7 @@
|
||||
**Bug Fixes**:
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
- Fixed LuckPerms breaking commands on Paper
|
||||
- Fix Config watcher using too many threads and not detecting changes on Linux systems
|
||||
+- Fixed crash when trying to open config screens on NeoForge
|
||||
|
||||
**New Features**:
|
||||
|
@@ -22,7 +22,7 @@
|
||||
+forge_version=46.0.14
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
@@ -29,23 +26,22 @@
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
--- a/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ConfigScreenHandlerMixin.java
|
||||
+++ /dev/null
|
||||
@@ -1,44 +1,0 @@
|
||||
@@ -1,43 +1,0 @@
|
||||
-package com.hypherionmc.craterlib.mixin;
|
||||
-
|
||||
-import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||
@@ -31,12 +31,11 @@
|
||||
- */
|
||||
- @Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
- private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, watcher) -> {
|
||||
- AbstractConfig config = watcher.getLeft();
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, config) -> {
|
||||
- if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
- return;
|
||||
-
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -1,6 +1,6 @@
|
||||
--- a/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ConfigScreenHandlerMixin.java
|
||||
+++ /dev/null
|
||||
@@ -1,44 +1,0 @@
|
||||
@@ -1,43 +1,0 @@
|
||||
-package com.hypherionmc.craterlib.mixin;
|
||||
-
|
||||
-import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||
@@ -31,12 +31,11 @@
|
||||
- */
|
||||
- @Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
||||
- private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, watcher) -> {
|
||||
- AbstractConfig config = watcher.getLeft();
|
||||
- ConfigController.getMonitoredConfigs().forEach((conf, config) -> {
|
||||
- if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
|
||||
- return;
|
||||
-
|
||||
- if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- if (config.getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
|
||||
- ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
|
||||
- } else {
|
||||
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
|
||||
|
@@ -22,7 +22,7 @@
|
||||
+neoforge_version=167
|
||||
|
||||
# Dependencies
|
||||
moon_config=1.0.10
|
||||
moon_config=1.0.11
|
||||
@@ -29,7 +29,7 @@
|
||||
adventure=4.17.0
|
||||
rpc_sdk=1.0
|
||||
|
Reference in New Issue
Block a user