Skip to content

Commit

Permalink
working on 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamalam360 committed Oct 29, 2023
1 parent e7d863d commit 9f4dcf5
Show file tree
Hide file tree
Showing 16 changed files with 116 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Rewrite on Architectury. Not backwards-compatible (see README).
First round of bugfixes.
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ allprojects {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}

maven {
name = "Jamalam's Maven"
url = "https://maven.jamalam.tech/releases"
}
}

tasks.withType(JavaCompile) {
Expand All @@ -78,7 +83,6 @@ allprojects {

tasks.publish {
dependsOn(":githubRelease")
dependsOn(":publishAllPublicationsToMavenRepository")
dependsOn("fabric:publishUnified")
dependsOn("quilt:publishUnified")
dependsOn("forge:publishUnified")
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/java/io/github/jamalam360/jamlib/JamLib.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.github.jamalam360.jamlib;

import blue.endless.jankson.Jankson;
import blue.endless.jankson.api.SyntaxError;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.ApiStatus;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import blue.endless.jankson.Jankson;
import blue.endless.jankson.JsonElement;
import blue.endless.jankson.JsonGrammar;
import blue.endless.jankson.JsonObject;
import dev.architectury.platform.Platform;
import io.github.jamalam360.jamlib.JamLib;
Expand Down Expand Up @@ -106,7 +107,8 @@ public void save() {
File f = this.configPath.toFile();
JsonElement json = JANKSON.toJson(this.config);
transformJsonBeforeSave(json);
String stringifiedJson = json.toJson(true, true);
JsonGrammar grammar = JsonGrammar.builder().bareRootObject(false).bareSpecialNumerics(false).printCommas(true).printWhitespace(true).printUnquotedKeys(true).withComments(true).build();
String stringifiedJson = json.toJson(grammar);

try {
f.createNewFile();
Expand All @@ -122,8 +124,10 @@ public void save() {
*/
public void reloadFromDisk() {
try {
this.config = JANKSON.fromJsonCarefully(
Files.readString(this.configPath), this.configClass);
String json = Files.readString(this.configPath);
System.out.println(json);
System.out.println(JANKSON.load(json));
this.config = JANKSON.fromJson(json, this.configClass);
} catch (Exception e) {
JamLib.LOGGER.error("Failed to read config file at " + configPath, e);
JamLib.LOGGER.error("Resetting to defaults; a backup will be written to " + configPath + ".broken");
Expand Down
1 change: 0 additions & 1 deletion common/src/main/resources/jamlib.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@
"defaultRequire": 1
}
}

13 changes: 13 additions & 0 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ if (System.getenv("CURSEFORGE_API_KEY") != null && System.getenv("MODRINTH_API_K

mainPublication tasks.remapJar

relations {
depends {
curseforge = "fabric-api"
modrinth = "fabric-api"
}

depends {
curseforge = "architectury-api"
modrinth = "architectury-api"
}
}


curseforge {
token = System.getenv("CURSEFORGE_API_KEY")
id = "623764"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package io.github.jamalam360.jamlib.fabric;

public class QuiltExpectPlatformImpl {
public class JamLibPlatformImpl {

}
11 changes: 10 additions & 1 deletion forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ loom {
extraAccessWideners.add loom.accessWidenerPath.get().asFile.name

mixinConfig "jamlib.mixins.json"
mixinConfig "jamlib.forge.mixins.json"
}
}

Expand Down Expand Up @@ -51,7 +52,15 @@ if (System.getenv("CURSEFORGE_API_KEY") != null && System.getenv("MODRINTH_API_K
gameVersions = [project.minecraft_version]
gameLoaders = ["forge"]

mainPublication tasks.jar
mainPublication tasks.remapJar

relations {
depends {
curseforge = "architectury-api"
modrinth = "architectury-api"
}
}


curseforge {
token = System.getenv("CURSEFORGE_API_KEY")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package io.github.jamalam360.jamlib.forge;

public class ForgeExpectPlatformImpl {
public class JamLibPlatformImpl {

}
16 changes: 16 additions & 0 deletions forge/src/main/resources/jamlib.forge.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"required": true,
"minVersion": "0.8",
"package": "io.github.jamalam360.jamlib.forge.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
],
"client": [
"ConfigScreenHandlerMixin"
],
"server": [
],
"injectors": {
"defaultRequire": 1
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.parallel=true
version=1.0.0
version=1.0.1
minecraft_version=1.20.2
branch=1.20.2
group=io.github.jamalam360
Expand Down
12 changes: 12 additions & 0 deletions quilt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ if (System.getenv("CURSEFORGE_API_KEY") != null && System.getenv("MODRINTH_API_K

mainPublication tasks.remapJar

relations {
depends {
curseforge = "qsl"
modrinth = "qsl"
}

depends {
curseforge = "architectury-api"
modrinth = "architectury-api"
}
}

curseforge {
token = System.getenv("CURSEFORGE_API_KEY")
id = "623764"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package io.github.jamalam360.jamlib.fabric;

public class FabricExpectPlatformImpl {
public class JamLibPlatformImpl {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package io.github.jamalam360.testmod;

import blue.endless.jankson.Comment;
import io.github.jamalam360.jamlib.config.ConfigExtensions;
import io.github.jamalam360.jamlib.config.MatchesRegex;
import io.github.jamalam360.jamlib.config.WithinRange;
import net.minecraft.network.chat.Component;

import java.util.List;

public class QuickerConnectButtonTestConfig implements ConfigExtensions<QuickerConnectButtonTestConfig> {
@MatchesRegex("^((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^[a-zA-Z0-9.-]+)?$")
@Comment("Leave empty to disable the quick connect button")
public String ip = "";
@WithinRange(min = 0, max = 65535)
public int port = 25565;
public boolean replaceMultiplayerButton = false;
public String text = "";

public boolean enabled() {
return this.ip != null && !this.ip.equals("");
}

public Component getButtonText() {
if (this.text != null && !this.text.equals("")) {
return Component.literal(this.text);
} else {
return Component.translatable("menu.quickerconnectbutton.connect");
}
}

@Override
public List<ConfigExtensions.Link> getLinks() {
return List.of(
new ConfigExtensions.Link(ConfigExtensions.Link.DISCORD, "https://jamalam.tech/Discord", Component.translatable("config.quickerconnectbutton.discord")),
new ConfigExtensions.Link(ConfigExtensions.Link.GITHUB, "https://github.com/JamCoreModding/quicker-connect-button", Component.translatable("config.quickerconnectbutton.github")),
new ConfigExtensions.Link(ConfigExtensions.Link.GENERIC_LINK, "https://modrinth.com/mod/quicker-connect-button", Component.translatable("config.quickerconnectbutton.modrinth"))
);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.github.jamalam360.testmod;

import blue.endless.jankson.Jankson;
import blue.endless.jankson.api.SyntaxError;
import io.github.jamalam360.jamlib.JamLibPlatform;
import io.github.jamalam360.jamlib.config.ConfigManager;
import org.slf4j.Logger;
Expand All @@ -11,9 +13,12 @@ public class TestMod {
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_NAME);
public static final ConfigManager<TestConfig> CONFIG_MANAGER = new ConfigManager<>(MOD_ID, "first_config", TestConfig.class);
public static final ConfigManager<TestConfig> CONFIG_MANAGER_2 = new ConfigManager<>(MOD_ID, "second_config", TestConfig.class);
public static final ConfigManager<QuickerConnectButtonTestConfig> QCB_CONFIG = new ConfigManager<>(MOD_ID, "quickerconnectbutton", QuickerConnectButtonTestConfig.class);


public static void init() {
LOGGER.info("Initializing JamLib Test Mod on " + JamLibPlatform.getPlatform());
System.out.println(CONFIG_MANAGER.get());
System.out.println(QCB_CONFIG.get());
}
}
1 change: 1 addition & 0 deletions testmod-forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ configurations {

dependencies {
forge libs.forge
forgeRuntimeLibrary libs.jankson

implementation project(path: ":forge", configuration: "namedElements")
common(project(path: ":common", configuration: "namedElements")) { transitive false }
Expand Down

0 comments on commit 9f4dcf5

Please sign in to comment.