Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Collateral committed Oct 6, 2022
1 parent 45551d0 commit c4a7e49
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
13 changes: 12 additions & 1 deletion src/main/java/net/vulkanmod/Initializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.nio.file.Path;

public class Initializer implements ModInitializer {
public static final Logger LOGGER = LogManager.getLogger("VulkanMod");

Expand All @@ -30,8 +32,17 @@ public void onInitialize() {
.getConfigDir()
.resolve("vulkanmod_settings.json");

CONFIG = Config.load(configPath);
CONFIG = loadConfig(configPath);

}

private static Config loadConfig(Path path) {
Config config = Config.load(path);
if(config == null) {
config = new Config();
config.write();
}
return config;
}

public static String getVersion() {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/net/vulkanmod/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public static Config load(Path path) {
}
}
else {
config = new Config();
config.write();
config = null;
}

return config;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/vulkanmod/mixin/MixinPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class MixinPlugin implements IMixinConfigPlugin {
@Override
public void onLoad(String mixinPackage) {
config = Config.load(new File("./config/vulkanmod_settings.json").toPath().toAbsolutePath());
if(config == null) config = new Config();
}

@Override
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/net/vulkanmod/mixin/WindowMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@ private void updateWindowRegion() {
}
}
else if(config.windowedFullscreen) {
if (MinecraftClient.IS_SYSTEM_MAC) {
MacWindowUtil.toggleFullscreen(this.handle);
}
// VideoMode videoMode = this.videoMode.get();

this.x = 0;
this.y = 0;
Expand Down

0 comments on commit c4a7e49

Please sign in to comment.