Compare commits
16
Commits
1.0.8-1.17
...
1.1.0-1.18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3cde2c8e7 | ||
|
|
6fa8e58665 | ||
|
|
ed4e9f6c19 | ||
|
|
24c0d9a039 | ||
|
|
6db4f12eed | ||
|
|
6ed97d4e00 | ||
|
|
3ecbae5593 | ||
|
|
d15fcd0732 | ||
|
|
bd2cc57eb9 | ||
|
|
539d3ee1af | ||
|
|
ebfaac9fb9 | ||
|
|
fbc0a2b354 | ||
|
|
3da79e7860 | ||
|
|
228c1bb7e6 | ||
|
|
e09f903332 | ||
|
|
1fe4d53565 |
+9
-10
@@ -14,7 +14,7 @@ buildscript {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "fabric-loom" version "0.8-SNAPSHOT"
|
||||
id "fabric-loom" version "0.10-SNAPSHOT"
|
||||
id "maven-publish"
|
||||
id "java-library"
|
||||
}
|
||||
@@ -154,8 +154,9 @@ allprojects {
|
||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
modRuntime "com.terraformersmc:modmenu:2.0.0-beta.4"
|
||||
modCompileOnly "com.terraformersmc:modmenu:2.0.0-beta.4"
|
||||
|
||||
modRuntimeOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
|
||||
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
|
||||
}
|
||||
|
||||
}
|
||||
@@ -209,10 +210,10 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(":omega-config-base")
|
||||
implementation project(":omega-config-gui")
|
||||
modRuntime "com.terraformersmc:modmenu:1.16.8"
|
||||
modCompileOnly "com.terraformersmc:modmenu:1.16.8"
|
||||
implementation project(path: ":omega-config-base", configuration: "namedElements")
|
||||
implementation project(path: ":omega-config-gui", configuration: "namedElements")
|
||||
modRuntimeOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
|
||||
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
|
||||
|
||||
afterEvaluate {
|
||||
testmodImplementation sourceSets.main.output
|
||||
@@ -222,9 +223,7 @@ dependencies {
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifact(file("${project.buildDir}/libs/${archivesBaseName}-${project.mod_version}.jar")) {
|
||||
builtBy(remapJar)
|
||||
}
|
||||
from components.java
|
||||
|
||||
pom.withXml {
|
||||
def depsNode = asNode().appendNode("dependencies")
|
||||
|
||||
+9
-7
@@ -1,14 +1,16 @@
|
||||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
# Fabric Properties
|
||||
# check these on https://modmuss50.me/fabric.html
|
||||
minecraft_version=1.17
|
||||
yarn_mappings=1.17+build.7
|
||||
loader_version=0.11.3
|
||||
# check these on https://fabricmc.net/versions.html
|
||||
minecraft_version=1.18.1
|
||||
yarn_mappings=1.18.1+build.2
|
||||
loader_version=0.12.11
|
||||
|
||||
#Fabric api
|
||||
fabric_version=0.34.10+1.17
|
||||
fabric_version=0.44.0+1.18
|
||||
# Mod Properties
|
||||
mod_version=1.0.8
|
||||
mod_version=1.1.0
|
||||
maven_group=draylar
|
||||
archives_base_name=omega-config
|
||||
|
||||
modmenu_version=3.0.0
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
before_install:
|
||||
- wget https://github.com/sormuras/bach/raw/master/install-jdk.sh
|
||||
- source install-jdk.sh --feature 16
|
||||
- source install-jdk.sh --feature 17
|
||||
- jshell --version
|
||||
@@ -23,7 +23,12 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class OmegaConfig {
|
||||
|
||||
@@ -109,10 +114,9 @@ public class OmegaConfig {
|
||||
addFieldComments(field, keyToComments);
|
||||
}
|
||||
|
||||
// get inner-class fields
|
||||
// TODO: recursively get inner classes?
|
||||
for (Class<?> innerClass : configClass.getDeclaredClasses()) {
|
||||
for (Field field : innerClass.getDeclaredFields()) {
|
||||
// "flattens" all the inner classes of the Config class into a single list
|
||||
for (Class<?> clazz : flatten(configClass.getDeclaredClasses())) {
|
||||
for (Field field : clazz.getDeclaredFields()) {
|
||||
addFieldComments(field, keyToComments);
|
||||
}
|
||||
}
|
||||
@@ -120,14 +124,18 @@ public class OmegaConfig {
|
||||
// Find areas we should insert comments into...
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
String at = lines.get(i);
|
||||
String startingWhitespace = getStartingWhitespace(at);
|
||||
|
||||
// Check if we should insert comment
|
||||
for (Map.Entry<String, String> entry : keyToComments.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String comment = entry.getValue();
|
||||
|
||||
if (at.trim().startsWith(String.format("\"%s\"", key))) {
|
||||
insertions.put(i + insertions.size(), String.format("%s//%s", getStartingWhitespace(at), comment));
|
||||
// Check if we should insert comment
|
||||
if (at.trim().startsWith(String.format("\"%s\"", entry.getKey()))) {
|
||||
if (comment.contains("\n")) {
|
||||
comment = startingWhitespace + "//" + String.join(String.format("\n%s//", startingWhitespace), comment.split("\n"));
|
||||
} else {
|
||||
comment = String.format("%s//%s", startingWhitespace, comment);
|
||||
}
|
||||
insertions.put(i + insertions.size(), comment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -154,6 +162,28 @@ public class OmegaConfig {
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Class<?>> flatten(Class<?>[] array) {
|
||||
List<Class<?>> list = new ArrayList<>();
|
||||
|
||||
for (Class<?> clazz : array) {
|
||||
populateRecursively(list, clazz);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static void populateRecursively(List<Class<?>> list, Class<?> aClass) {
|
||||
list.add(aClass);
|
||||
|
||||
Class<?>[] classes = aClass.getDeclaredClasses();
|
||||
|
||||
if (classes.length != 0) {
|
||||
for (Class<?> clazz : classes) {
|
||||
populateRecursively(list, clazz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addFieldComments(Field field, Map<String, String> keyToComments) {
|
||||
String fieldName = field.getName();
|
||||
Annotation[] annotations = field.getDeclaredAnnotations();
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "omega-config",
|
||||
"version": "1.0.8",
|
||||
"version": "1.1.0",
|
||||
"name": "OmegaConfig",
|
||||
"description": "The last config solution you will ever use.",
|
||||
"authors": [
|
||||
"Draylar",
|
||||
"Frqnny"
|
||||
],
|
||||
"contact": {},
|
||||
"contact": {
|
||||
"homepage": "https://github.com/Draylar/omega-config",
|
||||
"sources": "https://github.com/Draylar/omega-config",
|
||||
"issues": "https://github.com/Draylar/omega-config/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"environment": "*",
|
||||
"mixins": [
|
||||
@@ -18,5 +22,10 @@
|
||||
"fabricloader": "*",
|
||||
"fabric": "*",
|
||||
"minecraft": "*"
|
||||
}
|
||||
},
|
||||
"custom": {
|
||||
"modmenu": {
|
||||
"badges": [ "library" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ public class OmegaConfigScreen<T extends Config> extends Screen {
|
||||
|
||||
@Override
|
||||
public void onClose() {
|
||||
client.openScreen(parent);
|
||||
client.setScreen(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,11 @@
|
||||
"authors": [
|
||||
"Draylar"
|
||||
],
|
||||
"contact": {},
|
||||
"contact": {
|
||||
"homepage": "https://github.com/Draylar/omega-config",
|
||||
"sources": "https://github.com/Draylar/omega-config",
|
||||
"issues": "https://github.com/Draylar/omega-config/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"environment": "*",
|
||||
"mixins": [
|
||||
@@ -17,5 +21,10 @@
|
||||
"fabricloader": "*",
|
||||
"fabric": "*",
|
||||
"minecraft": "*"
|
||||
}
|
||||
},
|
||||
"custom": {
|
||||
"modmenu": {
|
||||
"badges": [ "library" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package draylar.omegatest;
|
||||
|
||||
import draylar.omegaconfig.OmegaConfig;
|
||||
import draylar.omegatest.config.ClassConfigTest;
|
||||
import draylar.omegatest.config.CommentedNestedClassConfig;
|
||||
import draylar.omegatest.config.NestedConfigTest;
|
||||
import draylar.omegatest.config.SimpleConfigTest;
|
||||
import draylar.omegatest.config.StructuresConfigTest;
|
||||
@@ -13,6 +14,7 @@ public class OmegaTestMain implements ModInitializer {
|
||||
public static final StructuresConfigTest MO_CONFIG = OmegaConfig.register(StructuresConfigTest.class);
|
||||
public static final NestedConfigTest NESTED = OmegaConfig.register(NestedConfigTest.class);
|
||||
public static final ClassConfigTest CLASS = OmegaConfig.register(ClassConfigTest.class);
|
||||
public static final CommentedNestedClassConfig COMMENTED_NESTED_CLASS = OmegaConfig.register(CommentedNestedClassConfig.class);
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package draylar.omegatest.config;
|
||||
|
||||
import draylar.omegaconfig.api.Comment;
|
||||
import draylar.omegaconfig.api.Config;
|
||||
|
||||
public class CommentedNestedClassConfig implements Config {
|
||||
|
||||
@Comment("Very nested test")
|
||||
public First first = new First();
|
||||
|
||||
@Comment("True")
|
||||
public boolean test = false;
|
||||
|
||||
@Comment("First-Level")
|
||||
public VeryNested veryNested = new VeryNested();
|
||||
|
||||
public static class First {
|
||||
@Comment("Cucumbers")
|
||||
public boolean cucumbers = true;
|
||||
|
||||
@Comment("InnerFirst")
|
||||
public InnerFirst innerFirst = new InnerFirst();
|
||||
|
||||
@Comment("InnerSecond")
|
||||
public InnerSecond innerSecond = new InnerSecond();
|
||||
|
||||
public static class InnerFirst {
|
||||
@Comment("Number of Tomatoes")
|
||||
public int numberOfTomatoes = 10;
|
||||
}
|
||||
|
||||
public static class InnerSecond {
|
||||
@Comment("Inner Second First")
|
||||
public InnerSecondFirst innerSecondFirst = new InnerSecondFirst();
|
||||
|
||||
public static class InnerSecondFirst {
|
||||
@Comment("Olive Oil")
|
||||
public String oliveOil = "oliveOil";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class VeryNested {
|
||||
@Comment("Second-Level")
|
||||
public Very very = new Very();
|
||||
public static class Very {
|
||||
@Comment("Third-Level")
|
||||
public VeryVery veryVery = new VeryVery();
|
||||
public static class VeryVery {
|
||||
@Comment("Forth-Level")
|
||||
public VeryVeryVery veryVeryVery = new VeryVeryVery();
|
||||
public static class VeryVeryVery {
|
||||
@Comment("Fifth-Level")
|
||||
public VeryVeryVeryVery veryVeryVeryVery = new VeryVeryVeryVery();
|
||||
public static class VeryVeryVeryVery {
|
||||
@Comment("Sixth-Level")
|
||||
public String last = "last";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "commented-inner-classes";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExtension() {
|
||||
return "json5";
|
||||
}
|
||||
}
|
||||
@@ -13,16 +13,16 @@ public class StructuresConfigTest implements Config {
|
||||
|
||||
@Comment("""
|
||||
Welcome to Mo'Structures Config!
|
||||
//
|
||||
// Here, you can turn off structures, change their chance, and also change their salt.
|
||||
//
|
||||
// To turn off a structure, simply go to the corresponding entry and set `activated` to false.
|
||||
//
|
||||
// Mo' Structures uses the vanilla structure spawning system. That is-
|
||||
// - Seperation is the minimum chunks between structures
|
||||
// - Spacing is the average chunks between structures
|
||||
//
|
||||
// Salt is a special field that gives structures unique spawning positions. DO NOT TOUCH IT, ONLY ADVANCED TROUBLESHOOTING!
|
||||
|
||||
Here, you can turn off structures, change their chance, and also change their salt.
|
||||
|
||||
To turn off a structure, simply go to the corresponding entry and set `activated` to false.
|
||||
|
||||
Mo' Structures uses the vanilla structure spawning system. That is-
|
||||
- Seperation is the minimum chunks between structures
|
||||
- Spacing is the average chunks between structures
|
||||
|
||||
Salt is a special field that gives structures unique spawning positions. DO NOT TOUCH IT, ONLY ADVANCED TROUBLESHOOTING!
|
||||
|
||||
""")
|
||||
public final Map<String, StructureConfigEntry> structureConfigEntries = new HashMap<>(17);
|
||||
|
||||
Reference in New Issue
Block a user