├── .github └── workflows │ └── build.yml ├── .gitignore ├── LICENSE-TEMPLATE ├── README.md ├── build.gradle.kts ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── root.gradle.kts ├── settings.gradle.kts ├── src └── main │ ├── java │ └── org │ │ └── polyfrost │ │ └── example │ │ ├── ExampleMod.java │ │ ├── command │ │ └── ExampleCommand.java │ │ ├── config │ │ └── TestConfig.java │ │ ├── hud │ │ └── TestHud.java │ │ └── mixin │ │ └── MinecraftMixin.java │ └── resources │ ├── mcmod.info │ └── mixins.examplemod.json ├── update-to-301a6ca.md ├── update-to-fd8e095.md └── versions └── mainProject /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Build Workflow 2 | 3 | name: Build with Gradle 4 | 5 | on: 6 | pull_request: 7 | workflow_dispatch: 8 | push: 9 | 10 | concurrency: 11 | group: ${{ github.head_ref || format('{0}-{1}', github.ref, github.run_number) }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | build: 16 | name: Build 17 | 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - name: Checkout 22 | uses: actions/checkout@v2 23 | with: 24 | fetch-depth: 10 25 | 26 | - name: Set up JDK 17 27 | uses: actions/setup-java@v2 28 | with: 29 | java-version: 17 30 | distribution: temurin 31 | 32 | - uses: actions/cache@v2 33 | with: 34 | path: | 35 | ~/.gradle/caches 36 | ~/.gradle/wrapper 37 | **/loom-cache 38 | **/prebundled-jars 39 | key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} 40 | restore-keys: | 41 | ${{ runner.os }}-gradle- 42 | 43 | - name: Chmod Gradle 44 | run: chmod +x ./gradlew 45 | 46 | - name: Build 47 | run: ./gradlew build --no-daemon -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # eclipse 2 | bin 3 | *.launch 4 | .settings 5 | .metadata 6 | .classpath 7 | .project 8 | 9 | # idea 10 | out 11 | *.ipr 12 | *.iws 13 | *.iml 14 | .idea 15 | 16 | # gradle 17 | build 18 | .gradle 19 | 20 | # other 21 | eclipse 22 | run 23 | build - Copy.gradle 24 | .vscode 25 | .devauth 26 | .DS_STORE 27 | 28 | 29 | # Created by https://www.toptal.com/developers/gitignore/api/java,gradle,forgegradle,kotlin,macos,intellij,intellij+all,eclipse,visualstudiocode 30 | # Edit at https://www.toptal.com/developers/gitignore?templates=java,gradle,forgegradle,kotlin,macos,intellij,intellij+all,eclipse,visualstudiocode 31 | 32 | ### Eclipse ### 33 | .metadata 34 | bin/ 35 | tmp/ 36 | *.tmp 37 | *.bak 38 | *.swp 39 | *~.nib 40 | local.properties 41 | .settings/ 42 | .loadpath 43 | .recommenders 44 | 45 | # External tool builders 46 | .externalToolBuilders/ 47 | 48 | # Locally stored "Eclipse launch configurations" 49 | *.launch 50 | 51 | # PyDev specific (Python IDE for Eclipse) 52 | *.pydevproject 53 | 54 | # CDT-specific (C/C++ Development Tooling) 55 | .cproject 56 | 57 | # CDT- autotools 58 | .autotools 59 | 60 | # Java annotation processor (APT) 61 | .factorypath 62 | 63 | # PDT-specific (PHP Development Tools) 64 | .buildpath 65 | 66 | # sbteclipse plugin 67 | .target 68 | 69 | # Tern plugin 70 | .tern-project 71 | 72 | # TeXlipse plugin 73 | .texlipse 74 | 75 | # STS (Spring Tool Suite) 76 | .springBeans 77 | 78 | # Code Recommenders 79 | .recommenders/ 80 | 81 | # Annotation Processing 82 | .apt_generated/ 83 | .apt_generated_test/ 84 | 85 | # Scala IDE specific (Scala & Java development for Eclipse) 86 | .cache-main 87 | .scala_dependencies 88 | .worksheet 89 | 90 | # Uncomment this line if you wish to ignore the project description file. 91 | # Typically, this file would be tracked if it contains build/dependency configurations: 92 | #.project 93 | 94 | ### Eclipse Patch ### 95 | # Spring Boot Tooling 96 | .sts4-cache/ 97 | 98 | ### ForgeGradle ### 99 | # Minecraft client/server files 100 | run/ 101 | 102 | ### Intellij ### 103 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 104 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 105 | 106 | # User-specific stuff 107 | .idea/**/workspace.xml 108 | .idea/**/tasks.xml 109 | .idea/**/usage.statistics.xml 110 | .idea/**/dictionaries 111 | .idea/**/shelf 112 | 113 | # AWS User-specific 114 | .idea/**/aws.xml 115 | 116 | # Generated files 117 | .idea/**/contentModel.xml 118 | 119 | # Sensitive or high-churn files 120 | .idea/**/dataSources/ 121 | .idea/**/dataSources.ids 122 | .idea/**/dataSources.local.xml 123 | .idea/**/sqlDataSources.xml 124 | .idea/**/dynamic.xml 125 | .idea/**/uiDesigner.xml 126 | .idea/**/dbnavigator.xml 127 | 128 | # Gradle 129 | .idea/**/gradle.xml 130 | .idea/**/libraries 131 | 132 | # Gradle and Maven with auto-import 133 | # When using Gradle or Maven with auto-import, you should exclude module files, 134 | # since they will be recreated, and may cause churn. Uncomment if using 135 | # auto-import. 136 | # .idea/artifacts 137 | # .idea/compiler.xml 138 | # .idea/jarRepositories.xml 139 | # .idea/modules.xml 140 | # .idea/*.iml 141 | # .idea/modules 142 | # *.iml 143 | # *.ipr 144 | 145 | # CMake 146 | cmake-build-*/ 147 | 148 | # Mongo Explorer plugin 149 | .idea/**/mongoSettings.xml 150 | 151 | # File-based project format 152 | *.iws 153 | 154 | # IntelliJ 155 | out/ 156 | 157 | # mpeltonen/sbt-idea plugin 158 | .idea_modules/ 159 | 160 | # JIRA plugin 161 | atlassian-ide-plugin.xml 162 | 163 | # Cursive Clojure plugin 164 | .idea/replstate.xml 165 | 166 | # SonarLint plugin 167 | .idea/sonarlint/ 168 | 169 | # Crashlytics plugin (for Android Studio and IntelliJ) 170 | com_crashlytics_export_strings.xml 171 | crashlytics.properties 172 | crashlytics-build.properties 173 | fabric.properties 174 | 175 | # Editor-based Rest Client 176 | .idea/httpRequests 177 | 178 | # Android studio 3.1+ serialized cache file 179 | .idea/caches/build_file_checksums.ser 180 | 181 | ### Intellij Patch ### 182 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 183 | 184 | # *.iml 185 | # modules.xml 186 | # .idea/misc.xml 187 | # *.ipr 188 | 189 | # Sonarlint plugin 190 | # https://plugins.jetbrains.com/plugin/7973-sonarlint 191 | .idea/**/sonarlint/ 192 | 193 | # SonarQube Plugin 194 | # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin 195 | .idea/**/sonarIssues.xml 196 | 197 | # Markdown Navigator plugin 198 | # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced 199 | .idea/**/markdown-navigator.xml 200 | .idea/**/markdown-navigator-enh.xml 201 | .idea/**/markdown-navigator/ 202 | 203 | # Cache file creation bug 204 | # See https://youtrack.jetbrains.com/issue/JBR-2257 205 | .idea/$CACHE_FILE$ 206 | 207 | # CodeStream plugin 208 | # https://plugins.jetbrains.com/plugin/12206-codestream 209 | .idea/codestream.xml 210 | 211 | # Azure Toolkit for IntelliJ plugin 212 | # https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij 213 | .idea/**/azureSettings.xml 214 | 215 | ### Intellij+all ### 216 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 217 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 218 | 219 | # User-specific stuff 220 | 221 | # AWS User-specific 222 | 223 | # Generated files 224 | 225 | # Sensitive or high-churn files 226 | 227 | # Gradle 228 | 229 | # Gradle and Maven with auto-import 230 | # When using Gradle or Maven with auto-import, you should exclude module files, 231 | # since they will be recreated, and may cause churn. Uncomment if using 232 | # auto-import. 233 | # .idea/artifacts 234 | # .idea/compiler.xml 235 | # .idea/jarRepositories.xml 236 | # .idea/modules.xml 237 | # .idea/*.iml 238 | # .idea/modules 239 | # *.iml 240 | # *.ipr 241 | 242 | # CMake 243 | 244 | # Mongo Explorer plugin 245 | 246 | # File-based project format 247 | 248 | # IntelliJ 249 | 250 | # mpeltonen/sbt-idea plugin 251 | 252 | # JIRA plugin 253 | 254 | # Cursive Clojure plugin 255 | 256 | # SonarLint plugin 257 | 258 | # Crashlytics plugin (for Android Studio and IntelliJ) 259 | 260 | # Editor-based Rest Client 261 | 262 | # Android studio 3.1+ serialized cache file 263 | 264 | ### Intellij+all Patch ### 265 | # Ignore everything but code style settings and run configurations 266 | # that are supposed to be shared within teams. 267 | 268 | .idea/* 269 | 270 | !.idea/codeStyles 271 | !.idea/runConfigurations 272 | 273 | ### Java ### 274 | # Compiled class file 275 | *.class 276 | 277 | # Log file 278 | *.log 279 | 280 | # BlueJ files 281 | *.ctxt 282 | 283 | # Mobile Tools for Java (J2ME) 284 | .mtj.tmp/ 285 | 286 | # Package Files # 287 | *.jar 288 | *.war 289 | *.nar 290 | *.ear 291 | *.zip 292 | *.tar.gz 293 | *.rar 294 | 295 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 296 | hs_err_pid* 297 | replay_pid* 298 | 299 | ### Kotlin ### 300 | # Compiled class file 301 | 302 | # Log file 303 | 304 | # BlueJ files 305 | 306 | # Mobile Tools for Java (J2ME) 307 | 308 | # Package Files # 309 | 310 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 311 | 312 | ### macOS ### 313 | # General 314 | .DS_Store 315 | .AppleDouble 316 | .LSOverride 317 | 318 | # Icon must end with two \r 319 | Icon 320 | 321 | 322 | # Thumbnails 323 | ._* 324 | 325 | # Files that might appear in the root of a volume 326 | .DocumentRevisions-V100 327 | .fseventsd 328 | .Spotlight-V100 329 | .TemporaryItems 330 | .Trashes 331 | .VolumeIcon.icns 332 | .com.apple.timemachine.donotpresent 333 | 334 | # Directories potentially created on remote AFP share 335 | .AppleDB 336 | .AppleDesktop 337 | Network Trash Folder 338 | Temporary Items 339 | .apdisk 340 | 341 | ### macOS Patch ### 342 | # iCloud generated files 343 | *.icloud 344 | 345 | ### VisualStudioCode ### 346 | .vscode/* 347 | !.vscode/settings.json 348 | !.vscode/tasks.json 349 | !.vscode/launch.json 350 | !.vscode/extensions.json 351 | !.vscode/*.code-snippets 352 | 353 | # Local History for Visual Studio Code 354 | .history/ 355 | 356 | # Built Visual Studio Code Extensions 357 | *.vsix 358 | 359 | ### VisualStudioCode Patch ### 360 | # Ignore all local history of files 361 | .history 362 | .ionide 363 | 364 | # Support for Project snippet scope 365 | .vscode/*.code-snippets 366 | 367 | # Ignore code-workspaces 368 | *.code-workspace 369 | 370 | ### Gradle ### 371 | .gradle 372 | **/build/ 373 | !src/**/build/ 374 | 375 | # Ignore Gradle GUI config 376 | gradle-app.setting 377 | 378 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 379 | !gradle-wrapper.jar 380 | 381 | # Avoid ignore Gradle wrappper properties 382 | !gradle-wrapper.properties 383 | 384 | # Cache of project 385 | .gradletasknamecache 386 | 387 | # Eclipse Gradle plugin generated files 388 | # Eclipse Core 389 | .project 390 | # JDT-specific (Eclipse Java Development Tools) 391 | .classpath 392 | 393 | # End of https://www.toptal.com/developers/gitignore/api/java,gradle,forgegradle,kotlin,macos,intellij,intellij+all,eclipse,visualstudiocode 394 | -------------------------------------------------------------------------------- /LICENSE-TEMPLATE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OneConfigExampleMod 2 | 3 | ![Powered by OneConfig](https://polyfrost.org/media/branding/badges/badge_1.svg) 4 | ![Compact Powered by OneConfig](https://polyfrost.org/media/branding/badges/badge_2.svg) 5 | ![Minimal Powered by OneConfig](https://polyfrost.org/media/branding/badges/badge_3.svg) 6 | ![Minimal Compact Powered by OneConfig](https://polyfrost.org/media/branding/badges/badge_4.svg) 7 | 8 | Example mod implementing OneConfig. 9 | 10 | ## How to use 11 | 12 | - Copy the template either by using GitHub's "Use this template" feature or downloading the repo manually. 13 | - **Remove the license named "LICENSE-TEMPLATE" and choose a new one.** 14 | - Refactor the template (specifically, the modid, version and name in the gradle.properties and most of the class names) 15 | to a different name. 16 | - Have fun modding! :D 17 | 18 | ## Need to update to a newer commit of this template? 19 | 20 | Check out these update guides: 21 | - [Updating to commit `fd8e095`](update-to-fd8e095.md) (most recent update) 22 | - [Updating to commit `301a6ca`](update-to-301a6ca.md) -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | @file:Suppress("UnstableApiUsage", "PropertyName") 2 | 3 | import org.polyfrost.gradle.util.noServerRunConfigs 4 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 5 | 6 | // Adds support for kotlin, and adds the Polyfrost Gradle Toolkit 7 | // which we use to prepare the environment. 8 | plugins { 9 | kotlin("jvm") 10 | id("org.polyfrost.multi-version") 11 | id("org.polyfrost.defaults.repo") 12 | id("org.polyfrost.defaults.java") 13 | id("org.polyfrost.defaults.loom") 14 | id("com.github.johnrengelman.shadow") 15 | id("net.kyori.blossom") version "1.3.2" 16 | id("signing") 17 | java 18 | } 19 | 20 | // Gets the mod name, version and id from the `gradle.properties` file. 21 | val mod_name: String by project 22 | val mod_version: String by project 23 | val mod_id: String by project 24 | val mod_archives_name: String by project 25 | 26 | // Replaces the variables in `ExampleMod.java` to the ones specified in `gradle.properties`. 27 | blossom { 28 | replaceToken("@VER@", mod_version) 29 | replaceToken("@NAME@", mod_name) 30 | replaceToken("@ID@", mod_id) 31 | } 32 | 33 | // Sets the mod version to the one specified in `gradle.properties`. Make sure to change this following semver! 34 | version = mod_version 35 | // Sets the group, make sure to change this to your own. It can be a website you own backwards or your GitHub username. 36 | // e.g. com.github. or com. 37 | group = "org.polyfrost" 38 | 39 | // Sets the name of the output jar (the one you put in your mods folder and send to other people) 40 | // It outputs all versions of the mod into the `versions/{mcVersion}/build` directory. 41 | base { 42 | archivesName.set("$mod_archives_name-$platform") 43 | } 44 | 45 | // Configures Polyfrost Loom, our plugin fork to easily set up the programming environment. 46 | loom { 47 | // Removes the server configs from IntelliJ IDEA, leaving only client runs. 48 | noServerRunConfigs() 49 | 50 | // Adds the tweak class if we are building legacy version of forge as per the documentation (https://docs.polyfrost.org) 51 | if (project.platform.isLegacyForge) { 52 | runConfigs { 53 | "client" { 54 | programArgs("--tweakClass", "cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker") 55 | property("mixin.debug.export", "true") // Outputs all mixin changes to `versions/{mcVersion}/run/.mixin.out/class` 56 | } 57 | } 58 | } 59 | // Configures the mixins if we are building for forge 60 | if (project.platform.isForge) { 61 | forge { 62 | mixinConfig("mixins.${mod_id}.json") 63 | } 64 | } 65 | // Configures the name of the mixin "refmap" 66 | mixin.defaultRefmapName.set("mixins.${mod_id}.refmap.json") 67 | } 68 | 69 | // Creates the shade/shadow configuration, so we can include libraries inside our mod, rather than having to add them separately. 70 | val shade: Configuration by configurations.creating { 71 | configurations.implementation.get().extendsFrom(this) 72 | } 73 | val modShade: Configuration by configurations.creating { 74 | configurations.modImplementation.get().extendsFrom(this) 75 | } 76 | 77 | // Configures the output directory for when building from the `src/resources` directory. 78 | sourceSets { 79 | main { 80 | output.setResourcesDir(java.classesDirectory) 81 | } 82 | } 83 | 84 | // Adds the Polyfrost maven repository so that we can get the libraries necessary to develop the mod. 85 | repositories { 86 | maven("https://repo.polyfrost.org/releases") 87 | } 88 | 89 | // Configures the libraries/dependencies for your mod. 90 | dependencies { 91 | // Adds the OneConfig library, so we can develop with it. 92 | modCompileOnly("cc.polyfrost:oneconfig-$platform:0.2.2-alpha+") 93 | 94 | // Adds DevAuth, which we can use to log in to Minecraft in development. 95 | modRuntimeOnly("me.djtheredstoner:DevAuth-${if (platform.isFabric) "fabric" else if (platform.isLegacyForge) "forge-legacy" else "forge-latest"}:1.2.0") 96 | 97 | // If we are building for legacy forge, includes the launch wrapper with `shade` as we configured earlier, as well as mixin 0.7.11 98 | if (platform.isLegacyForge) { 99 | compileOnly("org.spongepowered:mixin:0.7.11-SNAPSHOT") 100 | shade("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta17") 101 | } 102 | } 103 | 104 | tasks { 105 | // Processes the `src/resources/mcmod.info`, `fabric.mod.json`, or `mixins.${mod_id}.json` and replaces 106 | // the mod id, name and version with the ones in `gradle.properties` 107 | processResources { 108 | inputs.property("id", mod_id) 109 | inputs.property("name", mod_name) 110 | val java = if (project.platform.mcMinor >= 18) { 111 | 17 // If we are playing on version 1.18, set the java version to 17 112 | } else { 113 | // Else if we are playing on version 1.17, use java 16. 114 | if (project.platform.mcMinor == 17) 115 | 16 116 | else 117 | 8 // For all previous versions, we **need** java 8 (for Forge support). 118 | } 119 | val compatLevel = "JAVA_${java}" 120 | inputs.property("java", java) 121 | inputs.property("java_level", compatLevel) 122 | inputs.property("version", mod_version) 123 | inputs.property("mcVersionStr", project.platform.mcVersionStr) 124 | filesMatching(listOf("mcmod.info", "mixins.${mod_id}.json", "mods.toml")) { 125 | expand( 126 | mapOf( 127 | "id" to mod_id, 128 | "name" to mod_name, 129 | "java" to java, 130 | "java_level" to compatLevel, 131 | "version" to mod_version, 132 | "mcVersionStr" to project.platform.mcVersionStr 133 | ) 134 | ) 135 | } 136 | filesMatching("fabric.mod.json") { 137 | expand( 138 | mapOf( 139 | "id" to mod_id, 140 | "name" to mod_name, 141 | "java" to java, 142 | "java_level" to compatLevel, 143 | "version" to mod_version, 144 | "mcVersionStr" to project.platform.mcVersionStr.substringBeforeLast(".") + ".x" 145 | ) 146 | ) 147 | } 148 | } 149 | 150 | // Configures the resources to include if we are building for forge or fabric. 151 | withType(Jar::class.java) { 152 | if (project.platform.isFabric) { 153 | exclude("mcmod.info", "mods.toml") 154 | } else { 155 | exclude("fabric.mod.json") 156 | if (project.platform.isLegacyForge) { 157 | exclude("mods.toml") 158 | } else { 159 | exclude("mcmod.info") 160 | } 161 | } 162 | } 163 | 164 | // Configures our shadow/shade configuration, so we can 165 | // include some dependencies within our mod jar file. 166 | named("shadowJar") { 167 | archiveClassifier.set("dev") 168 | configurations = listOf(shade, modShade) 169 | duplicatesStrategy = DuplicatesStrategy.EXCLUDE 170 | } 171 | 172 | remapJar { 173 | inputFile.set(shadowJar.get().archiveFile) 174 | archiveClassifier.set("") 175 | } 176 | 177 | jar { 178 | // Sets the jar manifest attributes. 179 | if (platform.isLegacyForge) { 180 | manifest.attributes += mapOf( 181 | "ModSide" to "CLIENT", // We aren't developing a server-side mod 182 | "ForceLoadAsMod" to true, // We want to load this jar as a mod, so we force Forge to do so. 183 | "TweakOrder" to "0", // Makes sure that the OneConfig launch wrapper is loaded as soon as possible. 184 | "MixinConfigs" to "mixins.${mod_id}.json", // We want to use our mixin configuration, so we specify it here. 185 | "TweakClass" to "cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker" // Loads the OneConfig launch wrapper. 186 | ) 187 | } 188 | dependsOn(shadowJar) 189 | archiveClassifier.set("") 190 | enabled = false 191 | } 192 | } 193 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # gradle.properties file -- CHANGE THE VALUES STARTING WITH `mod_*` AND REMOVE THIS COMMENT. 2 | 3 | # Sets the name of your mod. 4 | mod_name=ExampleMod 5 | # Sets the id of your mod that mod loaders use to recognize it. 6 | mod_id=examplemod 7 | # Sets the version of your mod. Make sure to update this when you make changes according to semver. 8 | mod_version=1.0.0 9 | # Sets the name of the jar file that you put in your 'mods' folder. 10 | mod_archives_name=ExampleMod 11 | 12 | # Gradle Configuration -- DO NOT TOUCH THESE VALUES. 13 | polyfrost.defaults.loom=3 14 | org.gradle.daemon=true 15 | org.gradle.parallel=true 16 | org.gradle.configureoncommand=true 17 | org.gradle.parallel.threads=4 18 | org.gradle.jvmargs=-Xmx2G -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polyfrost/OneConfigExampleMod/4c80e169024958c159e79c28e06ac13b7d60fd9b/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit 88 | 89 | # Use the maximum available, or set MAX_FD != -1 to use that value. 90 | MAX_FD=maximum 91 | 92 | warn () { 93 | echo "$*" 94 | } >&2 95 | 96 | die () { 97 | echo 98 | echo "$*" 99 | echo 100 | exit 1 101 | } >&2 102 | 103 | # OS specific support (must be 'true' or 'false'). 104 | cygwin=false 105 | msys=false 106 | darwin=false 107 | nonstop=false 108 | case "$( uname )" in #( 109 | CYGWIN* ) cygwin=true ;; #( 110 | Darwin* ) darwin=true ;; #( 111 | MSYS* | MINGW* ) msys=true ;; #( 112 | NONSTOP* ) nonstop=true ;; 113 | esac 114 | 115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 116 | 117 | 118 | # Determine the Java command to use to start the JVM. 119 | if [ -n "$JAVA_HOME" ] ; then 120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 121 | # IBM's JDK on AIX uses strange locations for the executables 122 | JAVACMD=$JAVA_HOME/jre/sh/java 123 | else 124 | JAVACMD=$JAVA_HOME/bin/java 125 | fi 126 | if [ ! -x "$JAVACMD" ] ; then 127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 128 | 129 | Please set the JAVA_HOME variable in your environment to match the 130 | location of your Java installation." 131 | fi 132 | else 133 | JAVACMD=java 134 | if ! command -v java >/dev/null 2>&1 135 | then 136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | fi 142 | 143 | # Increase the maximum file descriptors if we can. 144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 145 | case $MAX_FD in #( 146 | max*) 147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 148 | # shellcheck disable=SC2039,SC3045 149 | MAX_FD=$( ulimit -H -n ) || 150 | warn "Could not query maximum file descriptor limit" 151 | esac 152 | case $MAX_FD in #( 153 | '' | soft) :;; #( 154 | *) 155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 156 | # shellcheck disable=SC2039,SC3045 157 | ulimit -n "$MAX_FD" || 158 | warn "Could not set maximum file descriptor limit to $MAX_FD" 159 | esac 160 | fi 161 | 162 | # Collect all arguments for the java command, stacking in reverse order: 163 | # * args from the command line 164 | # * the main class name 165 | # * -classpath 166 | # * -D...appname settings 167 | # * --module-path (only if needed) 168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 169 | 170 | # For Cygwin or MSYS, switch paths to Windows format before running java 171 | if "$cygwin" || "$msys" ; then 172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 174 | 175 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 176 | 177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 178 | for arg do 179 | if 180 | case $arg in #( 181 | -*) false ;; # don't mess with options #( 182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 183 | [ -e "$t" ] ;; #( 184 | *) false ;; 185 | esac 186 | then 187 | arg=$( cygpath --path --ignore --mixed "$arg" ) 188 | fi 189 | # Roll the args list around exactly as many times as the number of 190 | # args, so each arg winds up back in the position where it started, but 191 | # possibly modified. 192 | # 193 | # NB: a `for` loop captures its iteration list before it begins, so 194 | # changing the positional parameters here affects neither the number of 195 | # iterations, nor the values presented in `arg`. 196 | shift # remove old arg 197 | set -- "$@" "$arg" # push replacement arg 198 | done 199 | fi 200 | 201 | 202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 204 | 205 | # Collect all arguments for the java command: 206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 207 | # and any embedded shellness will be escaped. 208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 209 | # treated as '${Hostname}' itself on the command line. 210 | 211 | set -- \ 212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 213 | -classpath "$CLASSPATH" \ 214 | org.gradle.wrapper.GradleWrapperMain \ 215 | "$@" 216 | 217 | # Stop when "xargs" is not available. 218 | if ! command -v xargs >/dev/null 2>&1 219 | then 220 | die "xargs is not available" 221 | fi 222 | 223 | # Use "xargs" to parse quoted args. 224 | # 225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 226 | # 227 | # In Bash we could simply go: 228 | # 229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 230 | # set -- "${ARGS[@]}" "$@" 231 | # 232 | # but POSIX shell has neither arrays nor command substitution, so instead we 233 | # post-process each arg (as a line of input to sed) to backslash-escape any 234 | # character that might be a shell metacharacter, then use eval to reverse 235 | # that process (while maintaining the separation between arguments), and wrap 236 | # the whole thing up as a single "set" statement. 237 | # 238 | # This will of course break if any of these variables contains a newline or 239 | # an unmatched quote. 240 | # 241 | 242 | eval "set -- $( 243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 244 | xargs -n1 | 245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 246 | tr '\n' ' ' 247 | )" '"$@"' 248 | 249 | exec "$JAVACMD" "$@" 250 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /root.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") version "1.9.10" apply false 3 | id("org.polyfrost.multi-version.root") 4 | id("com.github.johnrengelman.shadow") version "8.1.1" apply false 5 | } 6 | 7 | preprocess { 8 | "1.12.2-forge"(11202, "srg") { 9 | "1.8.9-forge"(10809, "srg") 10 | } 11 | } -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | @file:Suppress("PropertyName") 2 | 3 | pluginManagement { 4 | repositories { 5 | gradlePluginPortal() 6 | mavenCentral() 7 | maven("https://repo.polyfrost.org/releases") // Adds the Polyfrost maven repository to get Polyfrost Gradle Toolkit 8 | } 9 | plugins { 10 | val pgtVersion = "0.6.5" // Sets the default versions for Polyfrost Gradle Toolkit 11 | id("org.polyfrost.multi-version.root") version pgtVersion 12 | } 13 | } 14 | 15 | val mod_name: String by settings 16 | 17 | // Configures the root project Gradle name based on the value in `gradle.properties` 18 | rootProject.name = mod_name 19 | rootProject.buildFileName = "root.gradle.kts" 20 | 21 | // Adds all of our build target versions to the classpath if we need to add version-specific code. 22 | listOf( 23 | "1.8.9-forge", // Update this if you want to remove/add a version, along with `build.gradle.kts` and `root.gradle.kts`. 24 | //"1.12.2-forge" // uncomment if you want 1.12.2 support in your mod 25 | ).forEach { version -> 26 | include(":$version") 27 | project(":$version").apply { 28 | projectDir = file("versions/$version") 29 | buildFileName = "../../build.gradle.kts" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/polyfrost/example/ExampleMod.java: -------------------------------------------------------------------------------- 1 | package org.polyfrost.example; 2 | 3 | import org.polyfrost.example.command.ExampleCommand; 4 | import org.polyfrost.example.config.TestConfig; 5 | import cc.polyfrost.oneconfig.events.event.InitializationEvent; 6 | import net.minecraftforge.fml.common.Mod; 7 | import cc.polyfrost.oneconfig.utils.commands.CommandManager; 8 | import net.minecraftforge.fml.common.event.FMLInitializationEvent; 9 | 10 | /** 11 | * The entrypoint of the Example Mod that initializes it. 12 | * 13 | * @see Mod 14 | * @see InitializationEvent 15 | */ 16 | @Mod(modid = ExampleMod.MODID, name = ExampleMod.NAME, version = ExampleMod.VERSION) 17 | public class ExampleMod { 18 | 19 | // Sets the variables from `gradle.properties`. See the `blossom` config in `build.gradle.kts`. 20 | public static final String MODID = "@ID@"; 21 | public static final String NAME = "@NAME@"; 22 | public static final String VERSION = "@VER@"; 23 | @Mod.Instance(MODID) 24 | public static ExampleMod INSTANCE; // Adds the instance of the mod, so we can access other variables. 25 | public static TestConfig config; 26 | 27 | // Register the config and commands. 28 | @Mod.EventHandler 29 | public void onInit(FMLInitializationEvent event) { 30 | config = new TestConfig(); 31 | CommandManager.INSTANCE.registerCommand(new ExampleCommand()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/polyfrost/example/command/ExampleCommand.java: -------------------------------------------------------------------------------- 1 | package org.polyfrost.example.command; 2 | 3 | import org.polyfrost.example.ExampleMod; 4 | import cc.polyfrost.oneconfig.utils.commands.annotations.Command; 5 | import cc.polyfrost.oneconfig.utils.commands.annotations.Main; 6 | 7 | /** 8 | * An example command implementing the Command api of OneConfig. 9 | * Registered in ExampleMod.java with `CommandManager.INSTANCE.registerCommand(new ExampleCommand());` 10 | * 11 | * @see Command 12 | * @see Main 13 | * @see ExampleMod 14 | */ 15 | @Command(value = ExampleMod.MODID, description = "Access the " + ExampleMod.NAME + " GUI.") 16 | public class ExampleCommand { 17 | @Main 18 | private void handle() { 19 | ExampleMod.INSTANCE.config.openGui(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/java/org/polyfrost/example/config/TestConfig.java: -------------------------------------------------------------------------------- 1 | package org.polyfrost.example.config; 2 | 3 | import org.polyfrost.example.ExampleMod; 4 | import org.polyfrost.example.hud.TestHud; 5 | import cc.polyfrost.oneconfig.config.Config; 6 | import cc.polyfrost.oneconfig.config.annotations.Dropdown; 7 | import cc.polyfrost.oneconfig.config.annotations.HUD; 8 | import cc.polyfrost.oneconfig.config.annotations.Slider; 9 | import cc.polyfrost.oneconfig.config.annotations.Switch; 10 | import cc.polyfrost.oneconfig.config.data.Mod; 11 | import cc.polyfrost.oneconfig.config.data.ModType; 12 | import cc.polyfrost.oneconfig.config.data.OptionSize; 13 | 14 | /** 15 | * The main Config entrypoint that extends the Config type and inits the config options. 16 | * See this link for more config Options 17 | */ 18 | public class TestConfig extends Config { 19 | @HUD( 20 | name = "Example HUD" 21 | ) 22 | public TestHud hud = new TestHud(); 23 | 24 | @Switch( 25 | name = "Example Switch", 26 | size = OptionSize.SINGLE // Optional 27 | ) 28 | public static boolean exampleSwitch = false; // The default value for the boolean Switch. 29 | 30 | @Slider( 31 | name = "Example Slider", 32 | min = 0f, max = 100f, // Minimum and maximum values for the slider. 33 | step = 10 // The amount of steps that the slider should have. 34 | ) 35 | public static float exampleSlider = 50f; // The default value for the float Slider. 36 | 37 | @Dropdown( 38 | name = "Example Dropdown", // Name of the Dropdown 39 | options = {"Option 1", "Option 2", "Option 3", "Option 4"} // Options available. 40 | ) 41 | public static int exampleDropdown = 1; // Default option (in this case "Option 2") 42 | 43 | public TestConfig() { 44 | super(new Mod(ExampleMod.NAME, ModType.UTIL_QOL), ExampleMod.MODID + ".json"); 45 | initialize(); 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/main/java/org/polyfrost/example/hud/TestHud.java: -------------------------------------------------------------------------------- 1 | package org.polyfrost.example.hud; 2 | 3 | import cc.polyfrost.oneconfig.hud.SingleTextHud; 4 | import org.polyfrost.example.config.TestConfig; 5 | 6 | /** 7 | * An example OneConfig HUD that is started in the config and displays text. 8 | * 9 | * @see TestConfig#hud 10 | */ 11 | public class TestHud extends SingleTextHud { 12 | public TestHud() { 13 | super("Test", true); 14 | } 15 | 16 | @Override 17 | public String getText(boolean example) { 18 | return "I'm an example HUD"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/polyfrost/example/mixin/MinecraftMixin.java: -------------------------------------------------------------------------------- 1 | package org.polyfrost.example.mixin; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.At; 6 | import org.spongepowered.asm.mixin.injection.Inject; 7 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 8 | 9 | /** 10 | * An example mixin using SpongePowered's Mixin library 11 | * 12 | * @see Inject 13 | * @see Mixin 14 | */ 15 | @Mixin(Minecraft.class) 16 | public class MinecraftMixin { 17 | @Inject(method = "startGame", at = @At(value = "HEAD")) 18 | private void onStartGame(CallbackInfo ci) { 19 | System.out.println("This is a message from an example mod!"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "modid": "${id}", 4 | "name": "${name}", 5 | "description": "", 6 | "version": "${version}", 7 | "mcversion": "${mcVersionStr}", 8 | "url": "", 9 | "updateUrl": "", 10 | "authorList": [ 11 | "Your Name" 12 | ], 13 | "credits": "", 14 | "logoFile": "", 15 | "screenshots": [], 16 | "dependencies": [] 17 | } 18 | ] -------------------------------------------------------------------------------- /src/main/resources/mixins.examplemod.json: -------------------------------------------------------------------------------- 1 | { 2 | "compatibilityLevel": "JAVA_8", 3 | "minVersion": "0.7", 4 | "package": "org.polyfrost.example.mixin", 5 | "refmap": "mixins.${id}.refmap.json", 6 | "injectors": { 7 | "maxShiftBy": 5 8 | }, 9 | "client": [ 10 | "MinecraftMixin" 11 | ], 12 | "verbose": true 13 | } 14 | -------------------------------------------------------------------------------- /update-to-301a6ca.md: -------------------------------------------------------------------------------- 1 | # Updating to commit [`301a6ca`](https://github.com/Polyfrost/OneConfigExampleMod/commit/301a6cae2fc9b62d00e968b05eb689f3175c5f79) 2 | 3 | If you don't care to check the commit and manually apply everything, here are all the changes we made in that commit: 4 | 5 | ## build.gradle.kts 6 | 7 | ![Screenshot 2024-06-17 at 5 24 13 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/830faef9-bb86-4279-86d5-b9b7f837d1af) 8 | 9 | Updates blossom to 1.3.2 (what this template uses to automatically replace mentions of mod_id, mod_ver, etc. with the values in `gradle.properties`. unofficial Polyfrost update fixing Kotlin 1.9.x support), and removes unnecessary preprocessor variable (it's already included by PGT) 10 | 11 | ## gradle.properties 12 | 13 | ![Screenshot 2024-06-17 at 5 27 35 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/a170663b-2449-4043-9be3-865e982387c9) 14 | 15 | Updates `polyfrost.defaults.loom` (PGT's "loom revision," aka what mappings the mod uses) to `3`. This won't really affect anyone outside of modern version users, but this is just good practice. 16 | 17 | ## gradle/wrapper/gradle-wrapper.properties 18 | 19 | ![Screenshot 2024-06-17 at 5 29 02 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/ff423c15-1339-47bc-8435-e05d15181b32) 20 | 21 | Updates Gradle to 8.8. 22 | 23 | ### IMPORTANT!! 24 | 25 | This Gradle update is why some other gradle-related files in this project (`gradle-wrapper.jar`, `gradlew` and `gradlew.bat`) changed. Obviously, it would be a bit inconvenient to apply the changes to those files manually, so here's what you do to properly apply the new changes: 26 | 27 | 1. Apply the rest of the changes in this document 28 | 2. Temporarily change `gradle/wrapper/gradle-wrapper.properties` to gradle 8.6 or 8.7. This is necessary because in order for Loom to function, 8.6 or higher is required. 29 | 3. Reload the Gradle project 30 | 4. Run `gradle wrapper --gradle-version 8.8` in Terminal or through your IDE (IntelliJ users can run this through the following method:) 31 | ![Screenshot 2024-06-17 at 5 33 24 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/8df43b0f-485d-4f4b-a288-f4db2c4521fe) 32 | ![Screenshot 2024-06-17 at 5 34 05 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/0d7b0598-d486-4fa4-af07-f72b2ab77966) 33 | 5. Done! 34 | 35 | ## root.gradle.kts 36 | 37 | ![Screenshot 2024-06-17 at 5 35 02 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/b4622399-6548-47ef-9724-cfe5f2785243) 38 | 39 | Updates shadow (what Gradle uses to shade dependencies) to 8.1.1. 40 | 41 | ## settings.gradle.kts 42 | 43 | ![Screenshot 2024-06-17 at 5 36 43 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/88252eb9-3aeb-48c4-b7f0-ec1553d999a3) 44 | 45 | Updates PGT to 0.6.2 (which updates loom), and comments out 1.12.2 support in case people don't want it. 46 | 47 | ## src/resources/mcmod.info 48 | 49 | ![Screenshot 2024-06-17 at 5 38 49 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/bb721a82-edd8-4a2e-8678-3b53f3741671) 50 | 51 | Makes sure the `mcversion` field in `mcmod.info` is updated to the actual Minecraft version (in this case, either 1.8.9 or 1.12.2) 52 | -------------------------------------------------------------------------------- /update-to-fd8e095.md: -------------------------------------------------------------------------------- 1 | # Updating to commit [`fd8e095`](https://github.com/Polyfrost/OneConfigExampleMod/commit/fd8e095b2964eb0264c59d573ee3b0ca0855847f) 2 | 3 | If you don't care to check the commit and manually apply everything, here are all the changes we made in that commit: 4 | 5 | ## build.gradle.kts 6 | 7 | Screenshot 2024-07-06 at 9 19 02 PM 8 | 9 | Updates and forces OneConfig Wrapper (what is used to download and load OneConfig automatically) to 1.0.0-beta17 (fixes SSL / antivirus detections) 10 | 11 | ## src/main/resources/mixins.examplemod.json 12 | 13 | Screenshot 2024-07-06 at 9 20 43 PM 14 | 15 | Fixes the mixin json refmap not reflecting the mod id that is set in `gradle.properties`. 16 | 17 | ## settings.gradle.kts 18 | 19 | Screenshot 2024-07-14 at 8 30 40 PM 20 | 21 | Updates PGT and Loom to 0.6.5 22 | -------------------------------------------------------------------------------- /versions/mainProject: -------------------------------------------------------------------------------- 1 | 1.8.9-forge --------------------------------------------------------------------------------