diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..51a48b3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,62 @@ +name: Bug Report +description: Create a report to help us improve. +title: "[Bug] " +labels: + - "bug" +body: + - type: markdown + attributes: + value: "**Note: Please search for existing issues before reporting where possible to avoid duplicate reporting.**" + - type: input + id: version_version + attributes: + label: Minecraft Version + description: | + The version of Minecraft you are running? + validations: + required: true + - type: input + id: mod_version + attributes: + label: Xaero Map Addition Version + description: | + The version of Xaero Map Addition you are running? + validations: + required: true + - type: textarea + id: description + attributes: + label: Description + description: | + Please tell us what the bug is with a clear and detailed description, put your screenshots if possible. + **Note: If this field is not filled in, it may result in the issue being closed directly.** + validations: + required: true + - type: textarea + id: to_reproduce + attributes: + label: To Reproduce + description: | + How do you trigger this bug? Please walk us through it step by step. + validations: + required: true + - type: textarea + id: expected_behavior + attributes: + label: Expected behavior + description: | + A clear and concise description of what you expected to happen. + - type: textarea + id: log + attributes: + label: Log + description: | + Please provide your log here if you can. + **Note: If this field is not filled in, it may result in the issue being closed directly.** + - type: checkboxes + id: latest_build_tested + attributes: + label: Latest CI build tested + options: + - label: I confirm that this problem still exists with the latest CI build. + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..ec4bb38 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..56412ea --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,24 @@ +name: Feature Request +description: Suggest an idea for this project. +title: "[Feature Request] " +labels: + - "enhancement" +body: + - type: markdown + attributes: + value: "**Note: Please search for existing feature requests before reporting where possible to avoid duplicate requests**" + - type: textarea + id: description + attributes: + label: What new features do you want? + description: | + What new feature or change you want? How it improves? Please tell us the requirements is with a clear and detailed description, put your screenshots if possible. + validations: + required: true + - type: checkboxes + id: latest_build_tested + attributes: + label: Latest CI build tested + options: + - label: I confirm that the feature I requested is not in the latest CI build. + required: true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 0000000..f3e9fc3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,27 @@ +name: Question +description: Anything you don't understand. +title: "[Question] " +labels: + - "question" +body: + - type: markdown + attributes: + value: "**Note: Please search for existing issues before reporting where possible to avoid duplicate reporting.**" + - type: dropdown + id: question_type + attributes: + label: Question Type + options: + - "Codes" + - "Usages" + - "Others" + validations: + required: true + - type: textarea + id: description + attributes: + label: Description + description: | + Please tell us the question is with a clear and detailed description, put your screenshots if possible. + validations: + required: true \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 438130b..d942c4a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,12 +10,13 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: validate gradle wrapper uses: gradle/wrapper-validation-action@v1 - name: setup jdk ${{ matrix.java }} - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: + distribution: 'adopt' java-version: ${{ matrix.java }} - name: Set pre_release run: | @@ -35,7 +36,7 @@ jobs: echo "::set-output name=jarname::$output" - name: capture build artifacts if: ${{ runner.os == 'Linux' && matrix.java == '17' }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: ${{ steps.findjar.outputs.jarname }} path: fabricWrapper/build/libs/${{ steps.findjar.outputs.jarname }} \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 536b0f1..fab94ac 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,12 +12,13 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: validate gradle wrapper - uses: gradle/wrapper-validation-action@v1 + uses: gradle/wrapper-validation-action@v3 - name: setup jdk ${{ matrix.java }} - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: + distribution: 'adopt' java-version: ${{ matrix.java }} - name: Set pre_release run: | @@ -30,7 +31,7 @@ jobs: ./gradlew preprocessResources ./gradlew build - name: Publish Minecraft Mods - uses: Kir-Antipov/mc-publish@v2.1 + uses: Kir-Antipov/mc-publish@v3.2 if: ${{ runner.os == 'Linux' && matrix.java == '17' }} with: modrinth-id: CTIW5eos @@ -54,7 +55,9 @@ jobs: 1.16.5 1.17.1 1.18.2 - 1.19 + 1.19.2 + 1.19.3 + 1.19.4 version-resolver: exact retry-attempts: 3 diff --git a/build.gradle b/build.gradle index 2d6621d..55f1b6f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,27 +1,28 @@ plugins { id("maven-publish") - id("fabric-loom").version("0.12-SNAPSHOT").apply(false) + id("fabric-loom").version("1.1-SNAPSHOT").apply(false) // https://github.com/Juuxel/LoomQuiltflower - id("io.github.juuxel.loom-quiltflower").version("1.7.0").apply(false) - // https://github.com/ReplayMod/preprocessor - // https://github.com/Fallen-Breath/preprocessor - id("com.replaymod.preprocess").version("b7207cffa9") - id("org.ajoberstar.grgit").version("4.1.0") + id("io.github.juuxel.loom-quiltflower").version("1.8.0").apply(false) + id("net.kyori.blossom").version("1.3.1").apply(false) + id("org.ajoberstar.grgit").version("5.0.0") + id("com.replaymod.preprocess").version("SNAPSHOT") } preprocess { - def mc114 = createNode("1.14.4", 1_14_04, "mojang") - def mc115 = createNode("1.15.2", 1_15_02, "mojang") - def mc116 = createNode("1.16.5", 1_16_05, "mojang") - def mc117 = createNode("1.17.1", 1_17_01, "mojang") - def mc118 = createNode("1.18.2", 1_18_02, "mojang") - def mc119 = createNode("1.19", 1_19_00, "mojang") // root + def mc1152 = createNode("1.15.2", 1_15_02, "mojang") + def mc1165 = createNode("1.16.5", 1_16_05, "mojang") + def mc1171 = createNode("1.17.1", 1_17_01, "mojang") + def mc1182 = createNode("1.18.2", 1_18_02, "mojang") + def mc1192 = createNode("1.19.2", 1_19_02, "mojang") + def mc1193 = createNode("1.19.3", 1_19_03, "mojang") + def mc1194 = createNode("1.19.4", 1_19_04, "mojang") - mc114.link(mc115, null) - mc115.link(mc116, null) - mc116.link(mc117, null) - mc117.link(mc118, null) - mc118.link(mc119, null) + mc1152.link(mc1165, file("versions/mapping-1.15.2-1.16.5.txt")) + mc1165.link(mc1171, null) + mc1171.link(mc1182, null) + mc1182.link(mc1192, null) + mc1192.link(mc1193, file("versions/mapping-1.19.2-1.19.3.txt")) + mc1193.link(mc1194, null) } String realVersion = "${project.mod_version}" diff --git a/common.gradle b/common.gradle index 4974eba..702954f 100644 --- a/common.gradle +++ b/common.gradle @@ -1,51 +1,154 @@ apply(plugin: "maven-publish") apply(plugin: "fabric-loom") apply(plugin: "io.github.juuxel.loom-quiltflower") +apply(plugin: "net.kyori.blossom") apply(plugin: "com.replaymod.preprocess") int mcVersion = 1 preprocess { - mcVersion = vars.get()["MC"] - tabIndentation = false + mcVersion = vars.get().get("MC") + tabIndentation.set(false) } repositories { + mavenLocal() + maven { - url 'https://www.cursemaven.com/' + name("CurseForge Maven") + url("https://www.cursemaven.com") } - maven { - url = "https://api.modrinth.com/maven" + + maven{ + name("Modrinth Maven") + url("https://api.modrinth.com/maven") } + maven { - url 'https://maven.hendrixshen.top' + name("Nyan Maven") + url("https://maven.hendrixshen.top") } + mavenCentral() - mavenLocal() } +// Module, Property prefix, Resolve condition, Transitive dependencies. +def apiDependencies = [ + ["curse.maven:xaeros-world-map-317780" , "xaero_world_map", true, false], + ["curse.maven:xaeros-minimap-263420" , "xaero_minimap" , true, false], + ["com.plusls.oh-my-minecraft-client:ommc-${project.name.replace(".", "_")}", "ommc" , true, false] +] + dependencies { + // Development environment minecraft("com.mojang:minecraft:${project.minecraft_version}") mappings(loom.officialMojangMappings()) - modImplementation("curse.maven:xaeros-world-map-317780:${project.xaero_world_map_version}") - modImplementation("curse.maven:xaeros-minimap-263420:${project.xaero_minimap_version}") - modImplementation("curse.maven:ommc-454900:${project.ommc_version}") + // Annotation processor + modCompileOnly("org.projectlombok:lombok:${project.lombok_version}") + annotationProcessor("org.projectlombok:lombok:${project.lombok_version}") + + // Dependency + modImplementation("top.hendrixshen:magiclib-${project.minecraft_version.replace(".", "_")}:${project.magiclib_version}") { + exclude(group: "curse.maven", module: "carpet-349239") + } + + // API + apiDependencies.forEach {item -> + String dependencyNotation = item[0] + String propertyPrefix = item[1] + boolean shouldResolve = item[2] + boolean shouldTransitive = item[3] - modImplementation("top.hendrixshen:magiclib-${project.name.replace(".", "_")}:${project.magiclib_version}") + if (shouldResolve) { + modApi("${dependencyNotation}:${project.property("${propertyPrefix}_version")}") { + transitive(shouldTransitive) + } + } + } + + // Misc runtimeOnly(project(path: ":fabricWrapper")) } +archivesBaseName("${project.mod_archives_base_name}-${project.minecraft_version}") +group(project.mod_maven_group) +sourceCompatibility(JavaVersion.VERSION_1_8) +targetCompatibility(JavaVersion.VERSION_1_8) +version(project.parent.version) + loom { - mixin { - // 如果使用 Legacy Mixin Ap,有时候 Mixin class remap 会有问题,该 remap 的不 remap - useLegacyMixinAp = false + interfaceInjection { + enableDependencyInterfaceInjection.set(true) } - runConfigs.all { - // to make sure it generates all "Minecraft Client (:subproject_name)" applications - // ideConfigGenerated = true + + runConfigs.configureEach { + // Dump modified classes automatically. property("mixin.debug.export", "true") - runDir "../../run" + } + + runConfigs.named("client") { + programArgs([ + "--width", + "1920", + "--height", + "1080", + ]) + runDir("run/client") + } + + runConfigs.named("server") { + runDir("run/server") + } + + runs { + mixinAuditClient { + inherit(client) + vmArgs("-Dmagiclib.mixin_audit=true") + ideConfigGenerated(false) + runDir("run/client") + } + + mixinAuditServer { + inherit(server) + vmArgs("-Dmagiclib.mixin_audit=true") + ideConfigGenerated(false) + runDir("run/server") + } + } + + // Setup client default settings. + runClient { + defaultCharacterEncoding("UTF-8") + + if (!new File("${projectDir}/run/client/options.txt").exists()) { + new File("${projectDir}/run/client").mkdirs() + BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("${projectDir}/run/client/options.txt")) + bufferedWriter.writeLine("autoJump:false") + bufferedWriter.writeLine("enableVsync:false") + bufferedWriter.writeLine("forceUnicodeFont:true") + bufferedWriter.writeLine("fov:1.0") + bufferedWriter.writeLine("gamma:16.0") + bufferedWriter.writeLine("guiScale:3") + bufferedWriter.writeLine("lang:${Locale.getDefault().toString()}") + bufferedWriter.writeLine("maxFps:260") + bufferedWriter.writeLine("renderDistance:10") + bufferedWriter.writeLine("soundCategory_master:0.0") + bufferedWriter.close() + } + } + + // Setup server default settings. + runServer { + defaultCharacterEncoding("UTF-8") + + // Agree eula before server init. + if (!new File("${projectDir}/run/server/eula.txt").exists()) { + new File("${projectDir}/run/server").mkdirs() + BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("${projectDir}/run/server/eula.txt")) + bufferedWriter.writeLine("eula=true") + bufferedWriter.close() + } } } @@ -53,72 +156,74 @@ remapJar { remapperIsolation = true } -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 +tasks.findAll { it.name in [ + "runClient", "runServer", + "runMixinAuditClient", "runMixinAuditServer", + "preprocessCode", "preprocessResources", + "preprocessTestCode", "preprocessTestResources"] }.forEach { + it.group("${project.mod_id}") +} -archivesBaseName = project.archives_base_name + "-" + project.minecraft_version -version = project.parent.version -group = project.maven_group +tasks.withType(JavaCompile).configureEach { + options.setEncoding("UTF-8") + options.getCompilerArgs().add("-Xdiags:verbose") +} + +remapJar { + remapperIsolation.set(true) +} processResources { - inputs.property("version", version) + from("${rootDir}/icon.png") { + into("assets/${project.mod_id}") + } + filesMatching("fabric.mod.json") { - expand(["mod_version" : project.version, + filter { line -> + line.trim().startsWith("//") ? "" : line + } + + expand([ + "magiclib_dependency" : project.magiclib_dependency, + "minecraft_dependency": project.minecraft_dependency, + "minecraft_version_id": project.minecraft_version.replace(".", "_"), + "minecraft_version" : project.minecraft_version, + "mod_description" : project.mod_description, + "mod_homepage" : project.mod_homepage, "mod_id" : project.mod_id, + "mod_license" : project.mod_license, "mod_name" : project.mod_name, - "mod_homepage" : project.mod_homepage, "mod_sources" : project.mod_sources, - "mod_license" : project.mod_license, - "minecraft_dependency": project.minecraft_dependency, - "minecraft_version_id": project.name.replace(".", "_"), - "minecraft_version" : project.minecraft_version, - "magiclib_version" : project.magiclib_version + "mod_version" : project.version ]) } } -// ensure that the encoding is set to UTF-8, no matter what the system default is -// this fixes some edge cases with special characters not displaying correctly -// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html -tasks.withType(JavaCompile) { - options.encoding = "UTF-8" +blossom { + replaceToken("@MOD_IDENTIFIER@" , project.mod_id) + replaceToken("@MOD_NAME@" , project.mod_name) + replaceToken("@MINECRAFT_VERSION_IDENTIFY@", project.minecraft_version.replace(".", "_")) } java { - // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task - // if it is present. - // If you remove this line, sources will not be generated. withSourcesJar() } jar { - from("../../LICENSE") + from("${rootDir}/LICENSE") } -import groovy.util.Node - publishing { publications { - mavenJava(MavenPublication) { - artifactId = "${project.mod_id}-${project.name.replace(".", "_")}" - version = "${project.version}" + create("mavenJava", MavenPublication) { + artifactId("${project.mod_id}-${project.minecraft_version.replace(".", "_")}") from(components.java) - pom.withXml { - rootNode -> - { - def depNode = new Node(null, "dependency") - depNode.appendNode("groupId", project.group) - depNode.appendNode("artifactId", project.mod_id) - depNode.appendNode("version", project.version) - depNode.appendNode("scope", "compile") - rootNode.asNode().dependencies[0].children().add(depNode) - } - } } } repositories { mavenLocal() + maven { url("$rootDir/publish") } diff --git a/fabricWrapper/build.gradle b/fabricWrapper/build.gradle index b1005b3..495477b 100644 --- a/fabricWrapper/build.gradle +++ b/fabricWrapper/build.gradle @@ -1,71 +1,83 @@ +import groovy.json.JsonBuilder + plugins { - id('java-library') + id("java-library") + id("maven-publish") } -apply(plugin: "maven-publish") - -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 - -archivesBaseName = project.archives_base_name -version = project.parent.version -group = project.maven_group +archivesBaseName("${project.mod_archives_base_name}") +group(project.mod_maven_group) +sourceCompatibility(JavaVersion.VERSION_1_8) +targetCompatibility(JavaVersion.VERSION_1_8) +version(project.parent.version) def fabric_subprojects = project.parent.subprojects.findAll({ it.name != "fabricWrapper" }) +fabric_subprojects.collect { + evaluationDependsOn(":${it.name}") +} jar { // disable cache outputs.upToDateWhen { false } + dependsOn(fabric_subprojects.collect { it.tasks.remapJar }) doFirst { delete fileTree("build/tmp/submods/META-INF/jars") + copy { from { fabric_subprojects.collect { it.remapJar.outputs.files } } + into("build/tmp/submods/META-INF/jars") } } - from("../LICENSE") + from("${rootDir}/LICENSE") from("build/tmp/submods") } -import groovy.json.JsonBuilder - processResources { // disable cache outputs.upToDateWhen { false } var jars = [] + fabric_subprojects.each({ - jars.add(["file": "META-INF/jars/${project.archives_base_name}-${it.name}-${project.version}.jar"]) + jars.add(["file": "META-INF/jars/${project.mod_archives_base_name}-${it.minecraft_version}-${project.version}.jar"]) }) + + from("${rootDir}/icon.png") { + into("assets/${project.mod_id}") + } + filesMatching("fabric.mod.json") { - expand(["mod_version" : project.version, - "mod_id" : project.mod_id, - "mod_name" : project.mod_name, - "mod_homepage": project.mod_homepage, - "mod_sources" : project.mod_sources, - "mod_license" : project.mod_license, - "magiclib_version": project.magiclib_version, - "sub_jars" : new JsonBuilder(jars).toPrettyString(), + expand([ + "magiclib_dependency": project.magiclib_dependency, + "mod_description" : project.mod_description, + "mod_homepage" : project.mod_homepage, + "mod_id" : project.mod_id, + "mod_license" : project.mod_license, + "mod_name" : project.mod_name, + "mod_version" : project.version, + "mod_sources" : project.mod_sources, + "sub_jars" : new JsonBuilder(jars).toPrettyString(), ]) } } publishing { publications { - mavenJava(MavenPublication) { - artifactId = project.mod_id - version = project.version + create("mavenJava", MavenPublication) { + artifactId("${project.mod_id}") + version("${project.version}") from(components.java) } } diff --git a/fabricWrapper/src/main/resources/assets/xaero_map_addition/icon.png b/fabricWrapper/src/main/resources/assets/xaero_map_addition/icon.png deleted file mode 120000 index 67dd532..0000000 --- a/fabricWrapper/src/main/resources/assets/xaero_map_addition/icon.png +++ /dev/null @@ -1 +0,0 @@ -../../../../../../icon.png \ No newline at end of file diff --git a/fabricWrapper/src/main/resources/fabric.mod.json b/fabricWrapper/src/main/resources/fabric.mod.json index 69261a7..7e0e297 100644 --- a/fabricWrapper/src/main/resources/fabric.mod.json +++ b/fabricWrapper/src/main/resources/fabric.mod.json @@ -4,7 +4,7 @@ "version": "${mod_version}", "icon": "assets/${mod_id}/icon.png", "name": "${mod_name}", - "description": "${mod_name}", + "description": "${mod_description}", "authors": [ { "name": "plusls", @@ -26,7 +26,8 @@ ] }, "depends": { - "magiclib": ">=${magiclib_version}" + "malilib": "*", + "magiclib": ">=${magiclib_dependency}" }, "custom": { "modmenu:clientsideOnly": true diff --git a/gradle.properties b/gradle.properties index 694f7d9..c9b1401 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,25 @@ -# Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx4G +# Gradle properties +org.gradle.jvmargs=-Xmx6G +org.gradle.parallel=true + +# Mod Properties +mod_archives_base_name=xaero-map-addition +mod_description=Added some features to xaero maps. +mod_homepage=https://blog.plusls.com/ mod_id=xaero_map_addition +mod_license=MPL-2.0 mod_name=Xaero Map Addition -mod_version=0.2.3 -mod_homepage=https://blog.plusls.com/ +mod_maven_group=com.plusls mod_sources=https://github.com/plusls/xaero-map-addition -mod_license=MPL-2.0 +mod_version=0.2.3 pre_release=alpha -maven_group=com.plusls -archives_base_name=xaero-map-addition -# Deps -magiclib_version=0.5.30 \ No newline at end of file + +# Required Libraries +# MagicLib - 0.7.283 +magiclib_dependency=0.7.289+4d66634-beta +magiclib_version=0.7.289+4d66634-beta +# Oh My Minecraft Client +ommc_version=0.5.263+0749a47-dev + +# Annotation processor +lombok_version=1.18.26 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..ccebba7 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e589..e1bef7e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 744e882..79a61d4 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MSYS* | MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,105 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 107acd3..93e3f59 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/settings.gradle b/settings.gradle index f4caa49..7233bbb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,29 +1,30 @@ pluginManagement { repositories { + mavenLocal() + + maven { + name("Fabric Maven") + url("https://maven.fabricmc.net") + } + maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' + name("Jitpack Maven") + url("https://jitpack.io") } + maven { - name = 'Jitpack' - url = "https://jitpack.io" + name("Nyan Maven") + url("https://maven.hendrixshen.top") } + maven { - name = 'Cotton' - url = 'https://server.bbkr.space/artifactory/libs-release/' + name("Cotton") + url("https://server.bbkr.space/artifactory/libs-release") } + mavenCentral() gradlePluginPortal() } - resolutionStrategy { - eachPlugin { - switch (requested.id.id) { - case "com.replaymod.preprocess": { - useModule("com.github.Fallen-Breath:preprocessor:${requested.version}") - } - } - } - } } def versions = Arrays.asList( @@ -32,13 +33,16 @@ def versions = Arrays.asList( "1.16.5", "1.17.1", "1.18.2", - "1.19", + "1.19.2", + "1.19.3", + "1.19.4", ) + for (String version : versions) { include(":$version") - def proj = project(":$version") proj.projectDir = file("versions/$version") proj.buildFileName = "../../common.gradle" } + include(":fabricWrapper") diff --git a/src/main/java/com/plusls/xma/ModInfo.java b/src/main/java/com/plusls/xma/ModInfo.java index bcddcf0..0543bc7 100644 --- a/src/main/java/com/plusls/xma/ModInfo.java +++ b/src/main/java/com/plusls/xma/ModInfo.java @@ -1,11 +1,14 @@ package com.plusls.xma; +import lombok.Getter; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.resources.language.I18n; import net.minecraft.resources.ResourceLocation; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import top.hendrixshen.magiclib.compat.minecraft.network.chat.ComponentCompatApi; +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.NotNull; +import top.hendrixshen.magiclib.compat.minecraft.api.network.chat.ComponentCompatApi; //#if MC > 11502 import net.minecraft.network.chat.MutableComponent; @@ -14,41 +17,36 @@ //#endif public class ModInfo { - public static String MOD_ID = "xaero_map_addition"; - //#if MC > 11802 - public static final String CURRENT_MOD_ID = MOD_ID + "-1_19"; - //#elseif MC > 11701 - //$$ public static final String CURRENT_MOD_ID = MOD_ID + "-1_18_2"; - //#elseif MC > 11605 - //$$ public static final String CURRENT_MOD_ID = MOD_ID + "-1_17_1"; - //#elseif MC > 11502 - //$$ public static final String CURRENT_MOD_ID = MOD_ID + "-1_16_5"; - //#elseif MC > 11404 - //$$ public static final String CURRENT_MOD_ID = MOD_ID + "-1_15_2"; - //#else - //$$ public static final String CURRENT_MOD_ID = MOD_ID + "-1_14_4"; - //#endif - public static final String MOD_NAME = FabricLoader.getInstance().getModContainer(CURRENT_MOD_ID) - .orElseThrow(RuntimeException::new).getMetadata().getName(); - public static final String MOD_VERSION = FabricLoader.getInstance().getModContainer(CURRENT_MOD_ID) - .orElseThrow(RuntimeException::new).getMetadata().getVersion().getFriendlyString(); - public static final Logger LOGGER = LogManager.getLogger(MOD_ID); + @Getter + private static final String currentModIdentifier = "@MOD_IDENTIFIER@-@MINECRAFT_VERSION_IDENTIFY@"; + @Getter + private static final String modIdentifier = "@MOD_IDENTIFIER@"; + @Getter + private static final String currentModName = FabricLoader.getInstance().getModContainer(currentModIdentifier).orElseThrow(RuntimeException::new).getMetadata().getName(); + @Getter + private static final String modName = "@MOD_NAME@"; + @Getter + private static final String modVersion = FabricLoader.getInstance().getModContainer(currentModIdentifier).orElseThrow(RuntimeException::new).getMetadata().getVersion().getFriendlyString(); + @Getter + private static final Logger logger = LogManager.getLogger(modIdentifier); - public static String translate(String key, Object... objects) { - return I18n.get(ModInfo.MOD_ID + "." + key, objects); + public static @NotNull String translate(String key, Object... objects) { + return I18n.get(ModInfo.modIdentifier + "." + key, objects); } - public static + @Contract("_, _ -> new") + public static @NotNull //#if MC > 11502 MutableComponent //#else //$$ BaseComponent //#endif translatable(String key, Object... objects) { - return ComponentCompatApi.translatable(MOD_ID + "." + key, objects); + return ComponentCompatApi.translatable(modIdentifier + "." + key, objects); } - public static ResourceLocation id(String path) { - return new ResourceLocation(MOD_ID, path); + @Contract("_ -> new") + public static @NotNull ResourceLocation id(String path) { + return new ResourceLocation(modIdentifier, path); } } \ No newline at end of file diff --git a/src/main/java/com/plusls/xma/RenderWaypointUtil.java b/src/main/java/com/plusls/xma/RenderWaypointUtil.java index 7566613..63fa65a 100644 --- a/src/main/java/com/plusls/xma/RenderWaypointUtil.java +++ b/src/main/java/com/plusls/xma/RenderWaypointUtil.java @@ -5,12 +5,12 @@ import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.math.Matrix4f; import com.plusls.ommc.feature.highlithtWaypoint.HighlightWaypointResourceLoader; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.world.inventory.InventoryMenu; -import top.hendrixshen.magiclib.compat.minecraft.blaze3d.vertex.VertexFormatCompatApi; +import org.joml.Matrix4f; +import top.hendrixshen.magiclib.compat.minecraft.api.blaze3d.vertex.VertexFormatCompatApi; //#if MC <= 11605 //$$ import net.minecraft.client.Minecraft; diff --git a/src/main/java/com/plusls/xma/ShareWaypointUtil.java b/src/main/java/com/plusls/xma/ShareWaypointUtil.java index 8cb49a9..5333473 100644 --- a/src/main/java/com/plusls/xma/ShareWaypointUtil.java +++ b/src/main/java/com/plusls/xma/ShareWaypointUtil.java @@ -6,8 +6,8 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.HoverEvent; import org.jetbrains.annotations.Nullable; -import top.hendrixshen.magiclib.compat.minecraft.network.chat.ComponentCompatApi; -import top.hendrixshen.magiclib.compat.minecraft.network.chat.StyleCompatApi; +import top.hendrixshen.magiclib.compat.minecraft.api.network.chat.ComponentCompatApi; +import top.hendrixshen.magiclib.compat.minecraft.api.network.chat.StyleCompatApi; import xaero.common.minimap.waypoints.Waypoint; //#if MC > 11502 @@ -41,7 +41,7 @@ public static Component getBetterShareText(String text, String[] args) { dimensionText = ComponentCompatApi.translatable("gui.xaero_waypoint_unknown_dimension"); } else { String dimIdPart = dimensionName.substring(4); - ModInfo.LOGGER.warn("dimIdPart: {}", dimIdPart); + ModInfo.getLogger().warn("dimIdPart: {}", dimIdPart); switch (dimIdPart) { case "0": dimId = 0; @@ -126,7 +126,7 @@ public static Component getBetterShareText(String text, String[] args) { //$$ BaseComponent //#endif posText = ComponentCompatApi.literal(String.format("[%d, %d, %d]", Integer.parseInt(args[3]), Integer.parseInt(args[4]), Integer.parseInt(args[5]))); - ModInfo.LOGGER.warn("dimId: {}", dimId); + ModInfo.getLogger().warn("dimId: {}", dimId); if (dimId == 0) { posText.withStyle(ChatFormatting.GREEN); posText.append(" -> ").append(addWaypointText).append(" ") diff --git a/src/main/java/com/plusls/xma/XaeroMapAddition.java b/src/main/java/com/plusls/xma/XaeroMapAddition.java index 1f4ea6b..fd34bc3 100644 --- a/src/main/java/com/plusls/xma/XaeroMapAddition.java +++ b/src/main/java/com/plusls/xma/XaeroMapAddition.java @@ -2,19 +2,23 @@ import com.plusls.xma.config.Configs; import net.fabricmc.api.ClientModInitializer; -import top.hendrixshen.magiclib.config.ConfigHandler; -import top.hendrixshen.magiclib.config.ConfigManager; -import top.hendrixshen.magiclib.dependency.annotation.Dependencies; -import top.hendrixshen.magiclib.dependency.annotation.Dependency; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependencies; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependency; +import top.hendrixshen.magiclib.malilib.impl.ConfigHandler; +import top.hendrixshen.magiclib.malilib.impl.ConfigManager; public class XaeroMapAddition implements ClientModInitializer { private static final int CONFIG_VERSION = 1; @Dependencies(and = { - //#if MC > 11502 - @Dependency(value = "xaerominimap", versionPredicate = ">=22.9.0", optional = true), - @Dependency(value = "xaerobetterpvp", versionPredicate = ">=22.9.0", optional = true), - @Dependency(value = "xaeroworldmap", versionPredicate = ">=1.23.1", optional = true) + //#if MC >= 11903 + @Dependency(value = "xaerominimap", versionPredicate = ">=23.1.0", optional = true), + @Dependency(value = "xaerobetterpvp", versionPredicate = ">=22.16.4", optional = true), + @Dependency(value = "xaeroworldmap", versionPredicate = ">=1.28.9", optional = true) + //#elseif MC > 11502 + //$$ @Dependency(value = "xaerominimap", versionPredicate = ">=23.1.0", optional = true), + //$$ @Dependency(value = "xaerobetterpvp", versionPredicate = ">=22.16.3", optional = true), + //$$ @Dependency(value = "xaeroworldmap", versionPredicate = ">=1.28.9", optional = true) //#elseif MC > 11404 //$$ @Dependency(value = "xaerominimap", versionPredicate = ">=21.10.0.4", optional = true), //$$ @Dependency(value = "xaerobetterpvp", versionPredicate = ">=21.10.0.4", optional = true), @@ -23,9 +27,9 @@ public class XaeroMapAddition implements ClientModInitializer { }) @Override public void onInitializeClient() { - ConfigManager cm = ConfigManager.get(ModInfo.MOD_ID); + ConfigManager cm = ConfigManager.get(ModInfo.getModIdentifier()); cm.parseConfigClass(Configs.class); - ConfigHandler.register(new ConfigHandler(ModInfo.MOD_ID, cm, CONFIG_VERSION, null, null)); + ConfigHandler.register(new ConfigHandler(ModInfo.getModIdentifier(), cm, CONFIG_VERSION)); Configs.init(cm); } } diff --git a/src/main/java/com/plusls/xma/compat/modmenu/ModMenuApiImpl.java b/src/main/java/com/plusls/xma/compat/modmenu/ModMenuApiImpl.java index 9edde13..33b7fa3 100644 --- a/src/main/java/com/plusls/xma/compat/modmenu/ModMenuApiImpl.java +++ b/src/main/java/com/plusls/xma/compat/modmenu/ModMenuApiImpl.java @@ -16,7 +16,7 @@ public ConfigScreenFactoryCompat getConfigScreenFactoryCompat() { @Override public String getModIdCompat() { - return ModInfo.CURRENT_MOD_ID; + return ModInfo.getCurrentModIdentifier(); } } \ No newline at end of file diff --git a/src/main/java/com/plusls/xma/compat/modmenu/WrapperModMenuApiImpl.java b/src/main/java/com/plusls/xma/compat/modmenu/WrapperModMenuApiImpl.java index 19806f5..3a02c6a 100644 --- a/src/main/java/com/plusls/xma/compat/modmenu/WrapperModMenuApiImpl.java +++ b/src/main/java/com/plusls/xma/compat/modmenu/WrapperModMenuApiImpl.java @@ -3,10 +3,9 @@ import com.plusls.xma.ModInfo; public class WrapperModMenuApiImpl extends ModMenuApiImpl { - @Override public String getModIdCompat() { - return ModInfo.MOD_ID; + return ModInfo.getModIdentifier(); } } \ No newline at end of file diff --git a/src/main/java/com/plusls/xma/config/Configs.java b/src/main/java/com/plusls/xma/config/Configs.java index c044994..2c326b9 100644 --- a/src/main/java/com/plusls/xma/config/Configs.java +++ b/src/main/java/com/plusls/xma/config/Configs.java @@ -6,14 +6,14 @@ import net.minecraft.client.Minecraft; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.core.config.Configurator; -import top.hendrixshen.magiclib.config.ConfigManager; -import top.hendrixshen.magiclib.config.annotation.Config; -import top.hendrixshen.magiclib.config.annotation.Hotkey; -import top.hendrixshen.magiclib.dependency.annotation.Dependencies; -import top.hendrixshen.magiclib.dependency.annotation.Dependency; +import org.jetbrains.annotations.NotNull; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependencies; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependency; +import top.hendrixshen.magiclib.malilib.api.annotation.Config; +import top.hendrixshen.magiclib.malilib.api.annotation.Hotkey; +import top.hendrixshen.magiclib.malilib.impl.ConfigManager; public class Configs { - @Config(category = ConfigCategory.GENERIC) public static boolean debug = false; @@ -21,7 +21,6 @@ public class Configs { @Config(category = ConfigCategory.GENERIC) public static ConfigHotkey openConfigGui; - @Config(category = ConfigCategory.XAERO_MINIMAP, dependencies = @Dependencies(or = { @Dependency("xaerominimap"), @Dependency("xaerobetterpvp")})) public static boolean betterWaypointSharingHandler = true; @@ -38,7 +37,7 @@ public class Configs { @Config(category = ConfigCategory.XAERO_WORLD_MAP, dependencies = @Dependencies(and = @Dependency("xaeroworldmap"))) public static boolean worldMapHighlightWaypoint = true; - public static void init(ConfigManager cm) { + public static void init(@NotNull ConfigManager cm) { openConfigGui.getKeybind().setCallback((keyAction, iKeybind) -> { GuiConfigs screen = GuiConfigs.getInstance(); screen.setParentGui(Minecraft.getInstance().screen); @@ -47,15 +46,11 @@ public static void init(ConfigManager cm) { }); cm.setValueChangeCallback("debug", option -> { - if (debug) { - Configurator.setLevel(ModInfo.MOD_ID, Level.toLevel("DEBUG")); - } else { - Configurator.setLevel(ModInfo.MOD_ID, Level.toLevel("INFO")); - } + Configurator.setLevel(ModInfo.getModIdentifier(), debug ? Level.DEBUG : Level.INFO); GuiConfigs.getInstance().reDraw(); }); if (debug) { - Configurator.setLevel(ModInfo.MOD_ID, Level.toLevel("DEBUG")); + Configurator.setLevel(ModInfo.getModIdentifier(), Level.toLevel("DEBUG")); } } diff --git a/src/main/java/com/plusls/xma/gui/GuiConfigs.java b/src/main/java/com/plusls/xma/gui/GuiConfigs.java index d521f7c..f5debf7 100644 --- a/src/main/java/com/plusls/xma/gui/GuiConfigs.java +++ b/src/main/java/com/plusls/xma/gui/GuiConfigs.java @@ -2,23 +2,16 @@ import com.plusls.xma.ModInfo; import com.plusls.xma.config.Configs; +import lombok.Getter; import net.minecraft.client.resources.language.I18n; -import top.hendrixshen.magiclib.config.ConfigManager; -import top.hendrixshen.magiclib.gui.ConfigGui; +import top.hendrixshen.magiclib.malilib.impl.ConfigManager; +import top.hendrixshen.magiclib.malilib.impl.gui.ConfigGui; public class GuiConfigs extends ConfigGui { - - private static GuiConfigs INSTANCE; + @Getter + private static final GuiConfigs instance = new GuiConfigs(ModInfo.getModIdentifier(), Configs.ConfigCategory.GENERIC, ConfigManager.get(ModInfo.getModIdentifier()));; private GuiConfigs(String identifier, String defaultTab, ConfigManager configManager) { - super(identifier, defaultTab, configManager, () -> I18n.get(String.format("%s.gui.title.configs", ModInfo.MOD_ID), ModInfo.MOD_VERSION)); - } - - - public static GuiConfigs getInstance() { - if (INSTANCE == null) { - INSTANCE = new GuiConfigs(ModInfo.MOD_ID, Configs.ConfigCategory.GENERIC, ConfigManager.get(ModInfo.MOD_ID)); - } - return INSTANCE; + super(identifier, defaultTab, configManager, () -> I18n.get(String.format("%s.gui.title.configs", ModInfo.getModIdentifier()), ModInfo.getModIdentifier())); } } \ No newline at end of file diff --git a/src/main/java/com/plusls/xma/mixin/MixinGuiMap.java b/src/main/java/com/plusls/xma/mixin/MixinGuiMap.java index 2a217ff..30fd0b9 100644 --- a/src/main/java/com/plusls/xma/mixin/MixinGuiMap.java +++ b/src/main/java/com/plusls/xma/mixin/MixinGuiMap.java @@ -16,13 +16,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import top.hendrixshen.magiclib.dependency.annotation.Dependencies; -import top.hendrixshen.magiclib.dependency.annotation.Dependency; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependencies; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependency; import xaero.map.WorldMap; import xaero.map.gui.GuiMap; import xaero.map.gui.IRightClickableElement; -import xaero.map.gui.RightClickOption; import xaero.map.gui.ScreenBase; +import xaero.map.gui.dropdown.rightclick.RightClickOption; import java.util.ArrayList; @@ -66,7 +66,7 @@ private void addHighlightOption(CallbackInfoReturnable options = cir.getReturnValue(); - options.add(new RightClickOption(ModInfo.MOD_ID + ".gui.xaero_right_click_map_highlight_location", + options.add(new RightClickOption(ModInfo.getModIdentifier() + ".gui.xaero_right_click_map_highlight_location", options.size(), this) { public void onAction(Screen screen) { HighlightWaypointUtil.highlightPos = new BlockPos(MixinGuiMap.this.rightClickX, diff --git a/src/main/java/com/plusls/xma/mixin/MixinGuiWaypoints.java b/src/main/java/com/plusls/xma/mixin/MixinGuiWaypoints.java index f8a9857..94c1bbf 100644 --- a/src/main/java/com/plusls/xma/mixin/MixinGuiWaypoints.java +++ b/src/main/java/com/plusls/xma/mixin/MixinGuiWaypoints.java @@ -11,13 +11,13 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.hendrixshen.magiclib.dependency.annotation.Dependencies; -import top.hendrixshen.magiclib.dependency.annotation.Dependency; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependencies; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependency; import xaero.common.AXaeroMinimap; import xaero.common.gui.GuiWaypoints; -import xaero.common.gui.IDropDownCallback; import xaero.common.gui.MyTinyButton; import xaero.common.gui.ScreenBase; +import xaero.common.gui.dropdown.IDropDownWidgetCallback; import xaero.common.minimap.waypoints.Waypoint; import xaero.common.minimap.waypoints.WaypointWorld; @@ -26,7 +26,7 @@ @Dependencies(or = {@Dependency("xaerominimap"), @Dependency("xaerobetterpvp")}) @Mixin(value = GuiWaypoints.class, remap = false) -public abstract class MixinGuiWaypoints extends ScreenBase implements IDropDownCallback { +public abstract class MixinGuiWaypoints extends ScreenBase implements IDropDownWidgetCallback { private Button directDeleteButton; private Button highlightButton; diff --git a/src/main/java/com/plusls/xma/mixin/MixinGuiWaypoints_List.java b/src/main/java/com/plusls/xma/mixin/MixinGuiWaypoints_List.java index e1022d4..2efdfa9 100644 --- a/src/main/java/com/plusls/xma/mixin/MixinGuiWaypoints_List.java +++ b/src/main/java/com/plusls/xma/mixin/MixinGuiWaypoints_List.java @@ -9,8 +9,8 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.hendrixshen.magiclib.dependency.annotation.Dependencies; -import top.hendrixshen.magiclib.dependency.annotation.Dependency; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependencies; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependency; import xaero.common.minimap.waypoints.Waypoint; @Dependencies(or = {@Dependency("xaerominimap"), @Dependency("xaerobetterpvp")}) diff --git a/src/main/java/com/plusls/xma/mixin/MixinMinimapElementOverMapRendererHandler.java b/src/main/java/com/plusls/xma/mixin/MixinMinimapElementOverMapRendererHandler.java index 60ba798..17a3d05 100644 --- a/src/main/java/com/plusls/xma/mixin/MixinMinimapElementOverMapRendererHandler.java +++ b/src/main/java/com/plusls/xma/mixin/MixinMinimapElementOverMapRendererHandler.java @@ -15,8 +15,8 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.hendrixshen.magiclib.dependency.annotation.Dependencies; -import top.hendrixshen.magiclib.dependency.annotation.Dependency; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependencies; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependency; import xaero.common.AXaeroMinimap; import xaero.common.graphics.renderer.multitexture.MultiTextureRenderTypeRendererProvider; import xaero.common.minimap.element.render.over.MinimapElementOverMapRendererHandler; diff --git a/src/main/java/com/plusls/xma/mixin/MixinWaypoint.java b/src/main/java/com/plusls/xma/mixin/MixinWaypoint.java index 9b0ee01..33e5c75 100644 --- a/src/main/java/com/plusls/xma/mixin/MixinWaypoint.java +++ b/src/main/java/com/plusls/xma/mixin/MixinWaypoint.java @@ -1,8 +1,8 @@ package com.plusls.xma.mixin; import org.spongepowered.asm.mixin.Mixin; -import top.hendrixshen.magiclib.dependency.annotation.Dependencies; -import top.hendrixshen.magiclib.dependency.annotation.Dependency; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependencies; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependency; import xaero.map.mods.gui.Waypoint; //#if MC <= 11502 diff --git a/src/main/java/com/plusls/xma/mixin/MixinWaypointReader.java b/src/main/java/com/plusls/xma/mixin/MixinWaypointReader.java index 54bde72..2d2445f 100644 --- a/src/main/java/com/plusls/xma/mixin/MixinWaypointReader.java +++ b/src/main/java/com/plusls/xma/mixin/MixinWaypointReader.java @@ -13,10 +13,10 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import top.hendrixshen.magiclib.dependency.annotation.Dependencies; -import top.hendrixshen.magiclib.dependency.annotation.Dependency; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependencies; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependency; import xaero.map.gui.IRightClickableElement; -import xaero.map.gui.RightClickOption; +import xaero.map.gui.dropdown.rightclick.RightClickOption; import xaero.map.mods.gui.Waypoint; import xaero.map.mods.gui.WaypointReader; import java.util.ArrayList; @@ -46,7 +46,7 @@ private void addHighlightOption(Waypoint element, IRightClickableElement target, playerY = 32767; } ArrayList options = cir.getReturnValue(); - options.add(new RightClickOption(ModInfo.MOD_ID + ".gui.xaero_right_click_map_highlight_waypoint", + options.add(new RightClickOption(ModInfo.getModIdentifier() + ".gui.xaero_right_click_map_highlight_waypoint", options.size(), target) { public void onAction(Screen screen) { HighlightWaypointUtil.highlightPos = new BlockPos(element.getX(), diff --git a/src/main/java/com/plusls/xma/mixin/MixinWaypointSharingHandler.java b/src/main/java/com/plusls/xma/mixin/MixinWaypointSharingHandler.java index 1f9c1e5..b986d7a 100644 --- a/src/main/java/com/plusls/xma/mixin/MixinWaypointSharingHandler.java +++ b/src/main/java/com/plusls/xma/mixin/MixinWaypointSharingHandler.java @@ -9,8 +9,8 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.hendrixshen.magiclib.dependency.annotation.Dependencies; -import top.hendrixshen.magiclib.dependency.annotation.Dependency; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependencies; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependency; import xaero.common.minimap.waypoints.WaypointSharingHandler; //#if MC <= 11802 diff --git a/src/main/java/com/plusls/xma/mixin/MixinWaypointsGuiRenderer.java b/src/main/java/com/plusls/xma/mixin/MixinWaypointsGuiRenderer.java index f639c60..3704c4c 100644 --- a/src/main/java/com/plusls/xma/mixin/MixinWaypointsGuiRenderer.java +++ b/src/main/java/com/plusls/xma/mixin/MixinWaypointsGuiRenderer.java @@ -1,8 +1,8 @@ package com.plusls.xma.mixin; import org.spongepowered.asm.mixin.Mixin; -import top.hendrixshen.magiclib.dependency.annotation.Dependencies; -import top.hendrixshen.magiclib.dependency.annotation.Dependency; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependencies; +import top.hendrixshen.magiclib.dependency.api.annotation.Dependency; import xaero.common.minimap.waypoints.render.WaypointsGuiRenderer; //#if MC <= 11502 diff --git a/src/main/resources/assets/xaero_map_addition/icon.png b/src/main/resources/assets/xaero_map_addition/icon.png deleted file mode 120000 index 48838a1..0000000 --- a/src/main/resources/assets/xaero_map_addition/icon.png +++ /dev/null @@ -1 +0,0 @@ -../../../../../icon.png \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index ee2e5e9..261a141 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -4,7 +4,7 @@ "version": "${mod_version}", "icon": "assets/${mod_id}/icon.png", "name": "${mod_name} for ${minecraft_version}", - "description": "${mod_name} for ${minecraft_version}", + "description": "${mod_description}", "authors": [ { "name": "plusls", @@ -32,8 +32,9 @@ "${mod_id}.mixins.json" ], "depends": { + "malilib": "*", "minecraft": "${minecraft_dependency}", - "magiclib-${minecraft_version_id}": ">=${magiclib_version}" + "magiclib-${minecraft_version_id}": ">=${magiclib_dependency}" }, "custom": { "modmenu:clientsideOnly": true, diff --git a/src/main/resources/xaero_map_addition.mixins.json b/src/main/resources/xaero_map_addition.mixins.json index 32118a0..f8b9324 100644 --- a/src/main/resources/xaero_map_addition.mixins.json +++ b/src/main/resources/xaero_map_addition.mixins.json @@ -3,7 +3,7 @@ "minVersion": "0.8", "package": "com.plusls.xma.mixin", "compatibilityLevel": "JAVA_8", - "plugin": "top.hendrixshen.magiclib.MagicMixinPlugin", + "plugin": "top.hendrixshen.magiclib.dependency.impl.MagicMixinPlugin", "client": [ "AccessorClientboundChatPacket", "MixinGuiMap", diff --git a/versions/1.15.2/gradle.properties b/versions/1.15.2/gradle.properties index 0a0922d..0b5ec8b 100644 --- a/versions/1.15.2/gradle.properties +++ b/versions/1.15.2/gradle.properties @@ -3,5 +3,4 @@ minecraft_version=1.15.2 minecraft_dependency=1.15.x # Compatible Libraries xaero_world_map_version=3321955 -xaero_minimap_version=3343161 -ommc_version=3711863 \ No newline at end of file +xaero_minimap_version=3343161 \ No newline at end of file diff --git a/versions/1.16.5/gradle.properties b/versions/1.16.5/gradle.properties index 9de9fc8..4a1a62c 100644 --- a/versions/1.16.5/gradle.properties +++ b/versions/1.16.5/gradle.properties @@ -2,7 +2,5 @@ minecraft_version=1.16.5 minecraft_dependency=1.16.x # Compatible Libraries -xaero_world_map_version=3811532 -xaero_minimap_version=3811521 -ommc_version=3711862 - +xaero_world_map_version=4381133 +xaero_minimap_version=4381114 diff --git a/versions/1.17.1/gradle.properties b/versions/1.17.1/gradle.properties index 96d7934..e7ef2d5 100644 --- a/versions/1.17.1/gradle.properties +++ b/versions/1.17.1/gradle.properties @@ -2,7 +2,5 @@ minecraft_version=1.17.1 minecraft_dependency=1.17.x # Compatible Libraries -xaero_world_map_version=3811535 -xaero_minimap_version=3811523 -ommc_version=3620802 - +xaero_world_map_version=4381139 +xaero_minimap_version=4381116 diff --git a/versions/1.18.2/gradle.properties b/versions/1.18.2/gradle.properties index a0108ee..ccf9244 100644 --- a/versions/1.18.2/gradle.properties +++ b/versions/1.18.2/gradle.properties @@ -2,6 +2,5 @@ minecraft_version=1.18.2 minecraft_dependency=1.18.x # Compatible Libraries -xaero_world_map_version=3811537 -xaero_minimap_version=3811525 -ommc_version=3711861 +xaero_world_map_version=4381141 +xaero_minimap_version=4381120 diff --git a/versions/1.19.2/gradle.properties b/versions/1.19.2/gradle.properties new file mode 100644 index 0000000..64954dc --- /dev/null +++ b/versions/1.19.2/gradle.properties @@ -0,0 +1,6 @@ +# Development Environment +minecraft_version=1.19.2 +minecraft_dependency=>1.18.2 <=1.19.2 +# Compatible Libraries +xaero_world_map_version=4424635 +xaero_minimap_version=4440695 diff --git a/versions/1.19.3/gradle.properties b/versions/1.19.3/gradle.properties new file mode 100644 index 0000000..fd25ba1 --- /dev/null +++ b/versions/1.19.3/gradle.properties @@ -0,0 +1,6 @@ +# Development Environment +minecraft_version=1.19.3 +minecraft_dependency=1.19.3 +# Compatible Libraries +xaero_world_map_version=4424637 +xaero_minimap_version=4440697 diff --git a/versions/1.19.4/gradle.properties b/versions/1.19.4/gradle.properties new file mode 100644 index 0000000..b6610b5 --- /dev/null +++ b/versions/1.19.4/gradle.properties @@ -0,0 +1,6 @@ +# Development Environment +minecraft_version=1.19.4 +minecraft_dependency=1.19.4 +# Compatible Libraries +xaero_world_map_version=4440704 +xaero_minimap_version=4440701 diff --git a/versions/1.19/gradle.properties b/versions/1.19/gradle.properties deleted file mode 100644 index 9ebc08b..0000000 --- a/versions/1.19/gradle.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Development Environment -minecraft_version=1.19 -minecraft_dependency=1.19.x -# Compatible Libraries -xaero_world_map_version=3819495 -xaero_minimap_version=3819492 -ommc_version=3711861 diff --git a/versions/mainProject b/versions/mainProject index 8068c6e..d63a25a 100644 --- a/versions/mainProject +++ b/versions/mainProject @@ -1 +1 @@ -1.19 \ No newline at end of file +1.19.4 \ No newline at end of file diff --git a/versions/mapping-1.15.2-1.16.5.txt b/versions/mapping-1.15.2-1.16.5.txt new file mode 100644 index 0000000..e58da0c --- /dev/null +++ b/versions/mapping-1.15.2-1.16.5.txt @@ -0,0 +1,2 @@ +xaero.common.gui.IDropDownCallback xaero.common.gui.dropdown.IDropDownWidgetCallback +xaero.map.gui.RightClickOption xaero.map.gui.dropdown.rightclick.RightClickOption \ No newline at end of file diff --git a/versions/mapping-1.19.2-1.19.3.txt b/versions/mapping-1.19.2-1.19.3.txt new file mode 100644 index 0000000..ef59b73 --- /dev/null +++ b/versions/mapping-1.19.2-1.19.3.txt @@ -0,0 +1 @@ +com.mojang.math.Matrix4f org.joml.Matrix4f \ No newline at end of file