diff options
author | SHsuperCM <shsupercm@gmail.com> | 2022-03-05 08:56:26 +0200 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2022-03-05 08:56:26 +0200 |
commit | 7a6a31c7c5040959b47f55ec96fb614dfb4d8efb (patch) | |
tree | cd073a8c6a68d7ce133e17f7b2eec97ec90611a4 /src/main/java/shcm | |
parent | 2aeadc2dd30c23aac6bb1d0a349720f28f2609ec (diff) | |
download | CITResewn-7a6a31c7c5040959b47f55ec96fb614dfb4d8efb.tar.gz CITResewn-7a6a31c7c5040959b47f55ec96fb614dfb4d8efb.tar.bz2 CITResewn-7a6a31c7c5040959b47f55ec96fb614dfb4d8efb.zip |
Documentation (23/44, 0/35)
Diffstat (limited to 'src/main/java/shcm')
5 files changed, 80 insertions, 1 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/BrokenPaths.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/BrokenPaths.java index c89e3cb..f4b2c65 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/BrokenPaths.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/BrokenPaths.java @@ -1,5 +1,23 @@ package shcm.shsupercm.fabric.citresewn.config; +import net.minecraft.util.Identifier; +import shcm.shsupercm.fabric.citresewn.mixin.broken_paths.*; + +/** + * Broken paths are resourcepack file paths that do not follow {@link Identifier}'s specifications.<br> + * When enabled in config, CIT Resewn will forcibly allow broken paths to load.<br> + * If not enabled, broken paths has no effect on the game. + * @see CITResewnConfig#broken_paths + * @see CITResewnMixinConfiguration#broken_paths + * @see ReloadableResourceManagerImplMixin + * @see IdentifierMixin + * @see AbstractFileResourcePackMixin + */ public class BrokenPaths { + /** + * When enabled, {@link Identifier}s will not check for their path's validity. + * @see ReloadableResourceManagerImplMixin + * @see IdentifierMixin + */ public static boolean processingBrokenPaths = false; } diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java index 2f051f0..cd66fed 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java @@ -2,22 +2,54 @@ package shcm.shsupercm.fabric.citresewn.config; import com.google.gson.Gson; import com.google.gson.stream.JsonWriter; +import net.fabricmc.loader.api.FabricLoader; import org.apache.commons.io.IOUtils; import shcm.shsupercm.fabric.citresewn.CITResewn; import java.io.*; +/** + * Contains runtime representation of CIT Resewn's config, encoded using GSON. + */ public class CITResewnConfig { + /** + * Whether CIT Resewn should work or not.<br> + * Requires a restart. + */ public boolean enabled = true; + /** + * Mutes pack loading errors from logs. + */ public boolean mute_errors = false; + /** + * Mutes pack loading warnings from logs. + */ public boolean mute_warns = false; + /** + * Invalidating interval for CITs' caches in milliseconds. Set to 0 to disable caching. + */ public int cache_ms = 50; + /** + * Should broken paths be allowed in resourcepacks. Requires a restart. + * @see BrokenPaths + */ public boolean broken_paths = false; - private static final File FILE = new File("config/citresewn.json"); + /** + * CIT Resewn's config storage file. + */ + private static final File FILE = new File(FabricLoader.getInstance().getConfigDir().toFile(), "citresewn.json"); + /** + * Active instance of the current config. + */ public static final CITResewnConfig INSTANCE = read(); + /** + * Reads the stored config. + * @see #FILE + * @return the read config + */ public static CITResewnConfig read() { if (!FILE.exists()) return new CITResewnConfig().write(); @@ -33,6 +65,11 @@ public class CITResewnConfig { } } + /** + * Saves this config to file. + * @see #FILE + * @return this + */ public CITResewnConfig write() { Gson gson = new Gson(); JsonWriter writer = null; diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java index b05dc6e..c1c35b2 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java @@ -12,9 +12,22 @@ import net.minecraft.util.Formatting; import java.util.function.Function; +/** + * Cloth Config integration to CIT Resewn's config + * @see CITResewnConfig + */ public class CITResewnConfigScreenFactory { + /** + * Used to get CIT Resewn - Defaults's Cloth Config implementation. + */ public static final String DEFAULTS_CONFIG_ENTRYPOINT = "citresewn-defaults:config_screen"; + /** + * Creates a Cloth Config screen for the current active config instance. + * @param parent parent to return to from the config screen + * @return the config screen + * @throws NoClassDefFoundError if Cloth Config is not present + */ public static Screen create(Screen parent) { CITResewnConfig currentConfig = CITResewnConfig.INSTANCE, defaultConfig = new CITResewnConfig(); diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnMixinConfiguration.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnMixinConfiguration.java index 29f64e9..742b929 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnMixinConfiguration.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnMixinConfiguration.java @@ -8,9 +8,17 @@ import org.spongepowered.asm.mixin.extensibility.IMixinInfo; import java.util.List; import java.util.Set; +/** + * Mixin configuration for CIT Resewn's mixins. + */ public class CITResewnMixinConfiguration implements IMixinConfigPlugin { private static final String MIXINS_ROOT = "shcm.shsupercm.fabric.citresewn.mixin"; + /** + * Is Broken Paths enabled in config. + * @see BrokenPaths + * @see CITResewnConfig#broken_paths + */ private boolean broken_paths; @Override diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java index 521c3b6..095f0cb 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java @@ -8,6 +8,9 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.NoticeScreen; import net.minecraft.text.Text; +/** + * Mod Menu config button integration. + */ @Entrypoint("modmenu") public class CITResewnModMenu implements ModMenuApi { @Override |