1.19.2 update with maven publishing and README polishing
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
# ΩConfig
|
||||
<h1 align="center">Omega Config Ω </h1>
|
||||
<p align="center">A configuration library by <a href="https://github.com/Draylar">Draylar</a></p>
|
||||
|
||||
---
|
||||
|
||||
*The last config library you will ever use.*
|
||||
|
||||
ΩConfig is a hyper-minimal config library based on [Auto Config](https://github.com/shedaniel/AutoConfig). It aims to
|
||||
achieve the following goals:
|
||||
|
||||
@@ -20,6 +19,10 @@ public class TestConfig implements Config {
|
||||
@Comment(value = "Hello!")
|
||||
boolean value = false;
|
||||
|
||||
@Syncing
|
||||
@Comment(value = "This value will sync to the client!")
|
||||
boolean syncableValue = false;
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return "test-config";
|
||||
@@ -63,12 +66,12 @@ you can use the following gradle declarations:
|
||||
|
||||
```groovy
|
||||
repositories {
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url 'https://maven.draylar.dev/releases' }
|
||||
}
|
||||
|
||||
// 1.19.2 version: 1.3.0+1.19.2
|
||||
dependencies {
|
||||
include("com.github.Draylar.omega-config:omega-config-base:${project.omega_config_version}")
|
||||
modImplementation("com.github.Draylar.omega-config:omega-config-base:${project.omega_config_version}")
|
||||
modImplementation include("dev.draylar.omega-config:omega-config-base:${project.omega_config_version}")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -95,8 +98,7 @@ repositories {
|
||||
dependencies {
|
||||
... (including the base declarations)
|
||||
|
||||
include("com.github.Draylar.omega-config:omega-config-gui:${project.omega_config_version}")
|
||||
modImplementation("com.github.Draylar.omega-config:omega-config-gui:${project.omega_config_version}")
|
||||
modImplementation include("dev.draylar.omega-config:omega-config-gui:${project.omega_config_version}")
|
||||
modRuntimeOnly ("com.terraformersmc:modmenu:${project.modmenu_version}") // 3.0.1 for 1.18.1
|
||||
}
|
||||
```
|
||||
@@ -110,12 +112,12 @@ dependencies {
|
||||
**save()** - *saves a modified configuration instance to disk*
|
||||
|
||||
```java
|
||||
MyModInitializer.CONFIG.value=false;
|
||||
MyModInitializer.CONFIG.save(); // writes the new value to disk
|
||||
MyModInitializer.CONFIG.value = false;
|
||||
MyModInitializer.CONFIG.save(); // writes the new value to disk
|
||||
```
|
||||
|
||||
|
||||
**@Syncing** - *configuration options marked with this annotation will automatically sync to the client when they join a server.*
|
||||
`@Syncing` - *configuration options marked with this annotation will automatically sync to the client when they join a server.*
|
||||
|
||||
---
|
||||
|
||||
|
||||
+15
-4
@@ -1,10 +1,10 @@
|
||||
plugins {
|
||||
id "fabric-loom" version "0.10-SNAPSHOT"
|
||||
id "fabric-loom" version "1.1-SNAPSHOT"
|
||||
id "maven-publish"
|
||||
id "java-library"
|
||||
}
|
||||
|
||||
group = "draylar"
|
||||
group = "dev.draylar"
|
||||
archivesBaseName = "omega-config"
|
||||
|
||||
subprojects {
|
||||
@@ -12,10 +12,21 @@ subprojects {
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
archivesBaseName = project.name
|
||||
group = "draylar.${project.group}"
|
||||
group = "dev.draylar.${project.group}"
|
||||
|
||||
// Only publish for submodules (not the root project) - add standard jar, + sources & development jar
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "draylarRepository"
|
||||
url = "https://maven.draylar.dev/releases"
|
||||
credentials(PasswordCredentials)
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
@@ -33,7 +44,7 @@ subprojects {
|
||||
allprojects {
|
||||
apply plugin: "fabric-loom"
|
||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
|
||||
version = project.mod_version + "-" + project.minecraft_version
|
||||
version = project.mod_version + "+" + project.minecraft_version
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
|
||||
+6
-7
@@ -2,15 +2,14 @@
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/versions.html
|
||||
minecraft_version=1.18.1
|
||||
yarn_mappings=1.18.1+build.12
|
||||
loader_version=0.12.12
|
||||
minecraft_version=1.19.2
|
||||
yarn_mappings=1.19.2+build.28
|
||||
loader_version=0.14.14
|
||||
fabric_version=0.75.1+1.19.2
|
||||
|
||||
#Fabric api
|
||||
fabric_version=0.45.0+1.18
|
||||
# Mod Properties
|
||||
mod_version=1.2.3
|
||||
maven_group=draylar
|
||||
mod_version=1.3.0
|
||||
maven_group=dev.draylar
|
||||
archives_base_name=omega-config
|
||||
|
||||
modmenu_version=3.0.1
|
||||
|
||||
@@ -9,8 +9,7 @@ import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -56,12 +55,12 @@ public class OmegaConfigGui {
|
||||
return parent -> {
|
||||
try {
|
||||
Config defaultConfig = config.getClass().getDeclaredConstructor().newInstance();
|
||||
ConfigScreen screen = ConfigScreen.create(new TranslatableText(String.format("config.%s.%s", config.getModid(), config.getName())), parent);
|
||||
ConfigScreen screen = ConfigScreen.create(Text.translatable(String.format("config.%s.%s", config.getModid(), config.getName())), parent);
|
||||
|
||||
// Fields
|
||||
for (Field field : config.getClass().getDeclaredFields()) {
|
||||
try {
|
||||
screen.add(new LiteralText(field.getName()), field.get(config), () -> {
|
||||
screen.add(Text.of(field.getName()), field.get(config), () -> {
|
||||
try {
|
||||
return field.get(defaultConfig);
|
||||
} catch (IllegalAccessException e) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import draylar.omegaconfiggui.OmegaConfigGui;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class OmegaTestClient implements ClientModInitializer {
|
||||
|
||||
@@ -13,8 +13,8 @@ public class OmegaTestClient implements ClientModInitializer {
|
||||
OmegaConfigGui.registerConfigScreen(OmegaTestMain.CONFIG);
|
||||
|
||||
HudRenderCallback.EVENT.register((stack, delta) -> {
|
||||
MinecraftClient.getInstance().textRenderer.draw(stack, new LiteralText(String.valueOf(OmegaTestMain.CONFIG.v)), 15, 15, 0xffffff);
|
||||
MinecraftClient.getInstance().textRenderer.draw(stack, new LiteralText(String.valueOf(OmegaTestMain.CONFIG.doubleTest)), 15, 30, 0xffffff);
|
||||
MinecraftClient.getInstance().textRenderer.draw(stack, Text.literal(String.valueOf(OmegaTestMain.CONFIG.v)), 15, 15, 0xffffff);
|
||||
MinecraftClient.getInstance().textRenderer.draw(stack, Text.literal(String.valueOf(OmegaTestMain.CONFIG.doubleTest)), 15, 30, 0xffffff);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user