From 505d3e70f82fb0d4e403c82b0ccec6dad578baa8 Mon Sep 17 00:00:00 2001 From: Draylar <17728338+Draylar@users.noreply.github.com> Date: Wed, 1 Mar 2023 21:16:38 -0600 Subject: [PATCH] 1.19.2 update with maven publishing and README polishing --- README.md | 24 ++++++++++--------- build.gradle | 19 +++++++++++---- gradle.properties | 13 +++++----- .../omegaconfiggui/OmegaConfigGui.java | 7 +++--- .../draylar/omegatest/OmegaTestClient.java | 6 ++--- 5 files changed, 40 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 9fe7488..7f30e51 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ -# ΩConfig +

Omega Config Ω

+

A configuration library by Draylar

--- -*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.* --- diff --git a/build.gradle b/build.gradle index c6a1161..6049f1e 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { diff --git a/gradle.properties b/gradle.properties index 5b02cd4..68948e3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/omega-config-gui/src/main/java/draylar/omegaconfiggui/OmegaConfigGui.java b/omega-config-gui/src/main/java/draylar/omegaconfiggui/OmegaConfigGui.java index b2354ef..d5be0c6 100644 --- a/omega-config-gui/src/main/java/draylar/omegaconfiggui/OmegaConfigGui.java +++ b/omega-config-gui/src/main/java/draylar/omegaconfiggui/OmegaConfigGui.java @@ -9,8 +9,7 @@ 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 static OmegaScreenFactory getConfigScreenFactory(Config config) { 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) { diff --git a/src/testmod/java/draylar/omegatest/OmegaTestClient.java b/src/testmod/java/draylar/omegatest/OmegaTestClient.java index 9a6c743..91f8ddc 100644 --- a/src/testmod/java/draylar/omegatest/OmegaTestClient.java +++ b/src/testmod/java/draylar/omegatest/OmegaTestClient.java @@ -4,7 +4,7 @@ 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 void onInitializeClient() { 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); }); } }