forked from YoungSoulluoS/cem_Fork
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add config file system
- Loading branch information
Showing
11 changed files
with
190 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
# Fabric Properties | ||
# check these on https://modmuss50.me/fabric.html | ||
minecraft_version = 1.17 | ||
yarn_mappings = 1.17+build.13 | ||
loader_version = 0.11.6 | ||
fabric_version = 0.36.0 | ||
loom_version = 0.8-SNAPSHOT | ||
minecraft_version = 1.17 | ||
yarn_mappings = 1.17+build.13 | ||
loader_version = 0.11.6 | ||
fabric_version = 0.36.0 | ||
loom_version = 0.8-SNAPSHOT | ||
complete_config_version = 1.0.0 | ||
# Mod Properties | ||
mod_version = 0.3.3 | ||
maven_group = net.dorianpb | ||
archives_base_name = cem | ||
mod_version = 0.4.0 | ||
maven_group = net.dorianpb | ||
archives_base_name = cem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/net/dorianpb/cem/internal/config/CemConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package net.dorianpb.cem.internal.config; | ||
|
||
import me.lortseam.completeconfig.api.ConfigContainer; | ||
import me.lortseam.completeconfig.api.ConfigEntry; | ||
import me.lortseam.completeconfig.data.Config; | ||
import me.lortseam.completeconfig.gui.ConfigScreenBuilder; | ||
import me.lortseam.completeconfig.gui.cloth.ClothConfigScreenBuilder; | ||
import net.fabricmc.loader.api.FabricLoader; | ||
|
||
@SuppressWarnings({"FieldMayBeFinal"}) | ||
public final class CemConfig extends Config implements ConfigContainer, CemOptions{ | ||
@ConfigEntry | ||
private boolean use_optifine_folder = false; | ||
@ConfigEntry | ||
private boolean use_new_model_creation_fix = true; | ||
|
||
private CemConfig(){ | ||
super("cem"); | ||
} | ||
|
||
public static CemConfig getConfig(){ | ||
CemConfig hello = new CemConfig(); | ||
hello.load(); | ||
return hello; | ||
} | ||
|
||
public static void createScreen(){ | ||
if(FabricLoader.getInstance().isModLoaded("cloth-config2")){ | ||
ConfigScreenBuilder.setMain("cem", new ClothConfigScreenBuilder()); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean useOptifineFolder(){ | ||
return this.use_optifine_folder; | ||
} | ||
|
||
@Override | ||
public boolean useTransparentParts(){ | ||
return this.use_new_model_creation_fix; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/net/dorianpb/cem/internal/config/CemConfigFairy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package net.dorianpb.cem.internal.config; | ||
|
||
import net.dorianpb.cem.internal.util.CemFairy; | ||
import net.fabricmc.loader.api.FabricLoader; | ||
|
||
public class CemConfigFairy{ | ||
private static CemOptions config; | ||
|
||
public static void loadConfig(){ | ||
if(FabricLoader.getInstance().isModLoaded("completeconfig")){ | ||
config = CemConfig.getConfig(); | ||
CemConfig.createScreen(); | ||
} | ||
else{ | ||
CemFairy.getLogger().warn("Unable to set up config due to missing dependencies; using defaults!"); | ||
config = new CemOptions(){ | ||
}; | ||
} | ||
} | ||
|
||
public static CemOptions getConfig(){ | ||
return config; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/net/dorianpb/cem/internal/config/CemOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package net.dorianpb.cem.internal.config; | ||
|
||
@SuppressWarnings("unused") | ||
public interface CemOptions{ | ||
|
||
default boolean useOptifineFolder(){ | ||
return false; | ||
} | ||
|
||
default boolean useTransparentParts(){ | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"config.cem.use_optifine_folder": "Use \"assets/minecraft/optifine/cem\"?", | ||
"config.cem.use_optifine_folder.tooltip.0": "This will load CEM models from ", | ||
"config.cem.use_optifine_folder.tooltip.1": "assets/minecraft/optifine/cem,", | ||
"config.cem.use_optifine_folder.tooltip.2": "which is exactly what optifine does.", | ||
"config.cem.use_optifine_folder.tooltip.3": "Reload resources (F3 + T) for", | ||
"config.cem.use_optifine_folder.tooltip.4": "this to take effect!", | ||
"config.cem.use_new_model_creation_fix": "Use model creation fix?", | ||
"config.cem.use_new_model_creation_fix.tooltip.0": "This prevents minecraft from", | ||
"config.cem.use_new_model_creation_fix.tooltip.1": "directly moving your model parts", | ||
"config.cem.use_new_model_creation_fix.tooltip.2": "around when animating. This breaks", | ||
"config.cem.use_new_model_creation_fix.tooltip.3": "a few models but fixes other ones.", | ||
"config.cem.use_new_model_creation_fix.tooltip.4": "Please use if possible.", | ||
"config.cem.use_new_model_creation_fix.tooltip.5": "Reload resources (F3 + T) for", | ||
"config.cem.use_new_model_creation_fix.tooltip.6": "this to take effect!" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters