Skip to content

Commit

Permalink
1.2.1
Browse files Browse the repository at this point in the history
Ouch!
  • Loading branch information
EnnuiL committed Oct 24, 2024
1 parent 14663ba commit ce03609
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

A mod that allows for changing the default game rule values. Meant to be used by modpacks, servers and players, because it's useful for everyone!

This mod depends on the [Quilt Standard Libraries](https://modrinth.com/mod/qsl).

## Download

This mod is available for download on the following services:
Expand All @@ -26,9 +24,8 @@ Below here is the commented format (if you are offline, the JSON Schema also con

```jsonc
{
// The file path of this mod's JSON schema. It's automatically defined by this mod and is only used by the text editor, so don't worry about this
// If needed, the path can be regenerated by using "GENERATE_ME" as its value
"$schema": "file:///path/to/.minecraft/config/boring_default_game_rules/config.schema.json",
// The file path of this mod's JSON schema. Don't worry about changing this value!
"$schema": "config.schema.json",
// A map of game rules and the new default value that will override the original
"default_game_rules": {
// This will set "keepInventory" to true as the default value
Expand All @@ -42,4 +39,4 @@ Below here is the commented format (if you are offline, the JSON Schema also con

## License

This mod is licensed under the MIT license. You can freely include the mod on any modpack with no permission. Usage of this mod's code on other projects or derivatives of this mod is allowed as long as attribution is given.
This mod is licensed under the MIT license.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = true

# Mod Properties
version = 1.2.0
version = 1.2.1
maven_group = io.github.ennuil
archives_base_name = boring_default_game_rules

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@SerializedNameConvention(NamingSchemes.SNAKE_CASE)
public class ModConfig extends ReflectiveConfig {
@SerializedName("$schema")
public final TrackedValue<String> schema = value(ModConfigManager.GENERATE_ME_MAYBE);
public final TrackedValue<String> schema = value(ModConfigManager.SCHEMA_FILE_NAME);
public final TrackedValue<ValueMap<Object>> defaultGameRules = map((Object) "").build();
public final TrackedValue<Boolean> generateJsonSchema = value(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@

@SuppressWarnings("unchecked")
public class ModConfigManager {
public static final String GENERATE_ME = "GENERATE_ME";
public static final String GENERATE_ME_MAYBE = "GENERATE_ME_MAYBE";
public static final String SCHEMA_FILE_NAME = "config.schema.json";
public static final Path SCHEMA_DIRECTORY_PATH = WrenchWrapper.getConfigDir().resolve("boring_default_game_rules");
public static final Path SCHEMA_PATH = SCHEMA_DIRECTORY_PATH.resolve(SCHEMA_FILE_NAME);
Expand Down Expand Up @@ -82,11 +80,6 @@ public static void prepareSchema(boolean client) {
}
}

switch (CONFIG.schema.value()) {
case GENERATE_ME -> CONFIG.schema.setValue(SCHEMA_FILE_NAME, false);
case GENERATE_ME_MAYBE -> CONFIG.schema.setValue(CONFIG.generateJsonSchema.value() ? SCHEMA_FILE_NAME : "", false);
}

if (generateNewSchema) {
if (!Files.isDirectory(SCHEMA_DIRECTORY_PATH)) {
LoggingUtils.LOGGER.info("A folder for saving the schema hasn't been found! Creating one...");
Expand Down Expand Up @@ -312,7 +305,8 @@ private static JsonObject createSchemaObject(String hashCode) {
var schemaPropertyObject = new JsonObject();
schemaPropertyObject.addProperty("type", "string");
schemaPropertyObject.addProperty("title", "$schema");
schemaPropertyObject.addProperty("description", "The standard method of assigning a JSON schema to a JSON file. If the value is set as \"GENERATE_ME\", Boring Default Game Rules will regenerate the path to the schema.");
schemaPropertyObject.addProperty("description", "The standard method of assigning a JSON schema to a JSON file. This should either be set as \"config.schema.json\" always!");
schemaPropertyObject.addProperty("default", SCHEMA_FILE_NAME);

propertiesObject.add("$schema", schemaPropertyObject);

Expand All @@ -328,6 +322,7 @@ private static JsonObject createSchemaObject(String hashCode) {
generateJSONSchemaObject.addProperty("type", "boolean");
generateJSONSchemaObject.addProperty("title", "Generate JSON Schema");
generateJSONSchemaObject.addProperty("description", "If enabled, this mod will generate a JSON schema in order to aid with configuration. You may disable this if you don't plan to change the settings and want to save space, and once disabled, you can safely remove both the schema and the \"$schema\" property.");
generateJSONSchemaObject.addProperty("default", true);
propertiesObject.add("generate_json_schema", generateJSONSchemaObject);

schemaObject.add("properties", propertiesObject);
Expand Down

0 comments on commit ce03609

Please sign in to comment.