diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dc170ea..bd39fe9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,15 +3,30 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Forge Recommended Versioning](https://docs.minecraftforge.net/en/1.12.x/conventions/versioning/). -## [1.12.2-1.0.7.1] -- build.gradle changes from CleanRooms template on github. -- Fixed Example Baubles Ring translation key for item name. -- Fix mod versioning, I forgot the API Identifier `0` within the jar, my bad. -- Added `IBauble#playEquipSound` for Server side eqipping sound identifiers which defaults to `Generic armor equip` sound. +## Unreleased + +### Added +- Added `IBauble#playEquipSound` for Server side equipping sound identifiers which defaults to Generic armor equip sound. - Added `IBauble#canRightClickEquip`, default true, almost all baubles should be right click equip-able now. -- The beginning of Curio GUI implementations controlled by boolean config option, defaults to false(disabled) `Alpha State` +- `Alpha` Curio GUI implementation, default disabled, __Expect Bugs__ + +### Changed +- Updated dev environment to the latest CleanRoom changes. +- Mod versioning to include API Identifier. +- updated pt_br.lang [#343](https://github.com/Azanor/Baubles/pull/343) + +### Deprecated + +### Removed + +### Fixed +- Fixed Example Baubles Ring translation key for item name. +- Fix mod versioning to include API Identifier. +- + +### Security -## [1.12.2-1.0.6.0] +## 1.12.2-1.0.6.0 - XNiter(Me) Created fork of Baubles - Maintaining group & class schema to allow drop in replacement - Forge Gradle Update to 5 @@ -27,7 +42,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a - Added en_ud.lang Thanks to(The-Fireplace, X_Niter fixed spelling) - Added ja_jp.lang Thanks to(2z6c) - Added sv_se.lang, Thanks to(Regnander) -- Added BaubleEquipmentChangeEvent for other mods to work with +- Added BaubleEquipmentChangeEvent [#292](https://github.com/Azanor/Baubles/pull/292) - Maintaining the [License](https://creativecommons.org/licenses/by-nc-sa/3.0/) - Credit: [Original Baubles BY:Azanor13](https://www.curseforge.com/minecraft/mc-mods/baubles) diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 93ef958d..00000000 --- a/LICENSE +++ /dev/null @@ -1,6 +0,0 @@ -This work is licensed under the Creative Commons -Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a -copy of this license, visit -http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to -Creative Commons, 444 Castro Street, Suite 900, Mountain View, -California, 94041, USA. diff --git a/build.gradle b/build.gradle index e6168363..ffabd314 100644 --- a/build.gradle +++ b/build.gradle @@ -1,232 +1,336 @@ -buildscript { - repositories { - maven { - name 'MixinGradle' - url 'https://repo.spongepowered.org/repository/maven-public' - } - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true - if (project.use_mixins.toBoolean()) { - classpath 'org.spongepowered:mixingradle:0.7.32' - } - } -} +/** + * It is advised that you do not edit anything in the build.gradle; unless you are sure of what you are doing + */ +import com.gtnewhorizons.retrofuturagradle.mcp.InjectTagsTask +import org.jetbrains.changelog.Changelog +import org.jetbrains.gradle.ext.Gradle plugins { - id 'wtf.gofancy.fancygradle' version '1.+' + id 'java' + id 'java-library' + id 'maven-publish' + id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7' + id 'com.gtnewhorizons.retrofuturagradle' version '1.3.35' + id 'com.matthewprenger.cursegradle' version '1.4.0' apply false + id 'com.modrinth.minotaur' version '2.+' apply false + id 'org.jetbrains.changelog' version '2.2.0' } -apply plugin: 'net.minecraftforge.gradle' -// apply plugin: 'maven-publish' -if (project.use_mixins.toBoolean()) { - apply plugin: 'org.spongepowered.mixin' +apply from: 'gradle/scripts/helpers.gradle' + +// Early Assertions +assertProperty 'mod_version' +assertProperty 'root_package' +assertProperty 'mod_id' +assertProperty 'mod_name' + +assertSubProperties 'use_tags', 'tag_class_name' +assertSubProperties 'use_access_transformer', 'access_transformer_locations' +assertSubProperties 'use_mixins', 'mixin_booter_version', 'mixin_refmap' +assertSubProperties 'is_coremod', 'coremod_includes_mod', 'coremod_plugin_class_name' +assertSubProperties 'use_asset_mover', 'asset_mover_version' + +setDefaultProperty 'use_modern_java_syntax', false, false +setDefaultProperty 'generate_sources_jar', true, false +setDefaultProperty 'generate_javadocs_jar', true, false +setDefaultProperty 'mapping_channel', true, 'stable' +setDefaultProperty 'mapping_version', true, '39' +setDefaultProperty 'use_dependency_at_files', true, true +setDefaultProperty 'minecraft_username', true, 'Developer' +setDefaultProperty 'extra_jvm_args', false, '' +setDefaultProperty 'extra_tweak_classes', false, '' +setDefaultProperty 'change_minecraft_sources', false, false + +version = propertyString('mod_version') +group = propertyString('root_package') + +base { + archivesName.set(propertyString('mod_id')) } -version = "${mod_version}" -group = project.maven_group -archivesBaseName = "${project.archives_base_name}-1.12.2" - -java.toolchain.languageVersion = JavaLanguageVersion.of(8) +tasks.decompressDecompiledSources.enabled !propertyBool('change_minecraft_sources') -if (project.use_lntellij_idea.toBoolean()) { - apply { - plugin 'java' - plugin 'idea' +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(propertyBool('use_modern_java_syntax') ? 16 : 8)) + // Azul covers the most platforms for Java 8 toolchains, crucially including MacOS arm64 + vendor.set(JvmVendorSpec.AZUL) } - - - idea { - module { - downloadJavadoc = true - downloadSources = true - } + if (propertyBool('generate_sources_jar')) { + withSourcesJar() } -} - -if (project.use_eclipse.toBoolean()) { - apply { - plugin 'java' - plugin 'eclipse' + if (propertyBool('generate_javadocs_jar')) { + withJavadocJar() } +} - - eclipse { - module { - downloadJavadoc = true - downloadSources = true - } - } +configurations { + embed + implementation.extendsFrom(embed) } minecraft { + mcVersion.set('1.12.2') - mappings channel: 'stable', version: '39-1.12' + mcpMappingChannel.set(propertyString('mapping_channel')) + mcpMappingVersion.set(propertyString('mapping_version')) - if (project.has_access_transformer.toBoolean()) { - accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') - } + useDependencyAccessTransformers.set(propertyBool('use_dependency_at_files')) - runs { - client { - workingDirectory project.file('run/client') - if (project.use_coremod.toBoolean()) { - jvmArg '-Dfml.coreMods.load=' + coremod_plugin_class_name - } - if (project.use_mixins.toBoolean()) { - jvmArg '-Dmixin.hotSwap=true' - jvmArg '-Dmixin.checks.interfaces=true' - jvmArg '-Dmixin.debug=true' - } - property 'forge.logging.markers', 'REGISTRIES' - property 'forge.logging.console.level', 'debug' - } + username.set(propertyString('minecraft_username')) - server { - workingDirectory project.file('run/server') - if (project.use_coremod.toBoolean()) { - jvmArg '-Dfml.coreMods.load=' + coremod_plugin_class_name - } - if (project.use_mixins.toBoolean()) { - jvmArg '-Dmixin.hotSwap=true' - jvmArg '-Dmixin.checks.interfaces=true' - } - property 'forge.logging.markers', 'REGISTRIES' - property 'forge.logging.console.level', 'debug' - mods { - '${archives_base_name}' { - source sourceSets.main - } + // Add any additional tweaker classes here + extraTweakClasses.addAll(propertyStringList('extra_tweak_classes')) + + // Add various JVM arguments here for runtime + def args = ['-ea:' + group] + if (propertyBool('use_mixins')) { + args << '-Dmixin.hotSwap=true' + args << '-Dmixin.checks.interfaces=true' + args << '-Dmixin.debug.export=true' + } + extraRunJvmArguments.addAll(args) + extraRunJvmArguments.addAll(propertyStringList('extra_jvm_args')) + + if (propertyBool('use_tags')) { + if (file('tags.properties').exists()) { + Properties props = new Properties().tap { it.load(file('tags.properties').newInputStream()); it } + if (!props.isEmpty()) { + injectedTags.set(props.collectEntries { k, v -> [(k): interpolate(v)] }) } } } } - repositories { maven { - url = 'https://maven.cleanroommc.com' - } - maven { - url = 'https://repo.spongepowered.org/maven' + name 'CleanroomMC Maven' + url 'https://maven.cleanroommc.com' } } dependencies { - minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2860' - - if (project.use_mixins.toBoolean()) { - compileOnly fg.deobf('zone.rong:mixinbooter:5.0') - runtimeOnly 'zone.rong:mixinbooter:5.0' + if (propertyBool('use_modern_java_syntax')) { + annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' + // Workaround for https://github.com/bsideup/jabel/issues/174 + annotationProcessor 'net.java.dev.jna:jna-platform:5.13.0' + compileOnly ('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { + transitive = false + } + // Allow jdk.unsupported classes like sun.misc.Unsafe, workaround for JDK-8206937 and fixes crashes in tests + patchedMinecraft 'me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0' + // Include for tests + testAnnotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' + testCompileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { + transitive = false // We only care about the 1 annotation class + } + } + if (propertyBool('use_asset_mover')) { + implementation "com.cleanroommc:assetmover:${propertyString('asset_mover_version')}" + } + if (propertyBool('use_mixins')) { + String mixin = modUtils.enableMixins("zone.rong:mixinbooter:${propertyString('mixin_booter_version')}", propertyString('mixin_refmap')) + api (mixin) { + transitive = false + } + annotationProcessor 'org.ow2.asm:asm-debug-all:5.2' + annotationProcessor 'com.google.guava:guava:24.1.1-jre' + annotationProcessor 'com.google.code.gson:gson:2.8.6' + annotationProcessor (mixin) { + transitive = false + } } } -fancyGradle { - patches { - resources - coremods - asm +apply from: 'gradle/scripts/dependencies.gradle' + +// Adds Access Transformer files to tasks +if (propertyBool('use_access_transformer')) { + for (def location : propertyStringList('access_transformer_locations')) { + def fileLocation = file("${projectDir}/src/main/resources/${location}") + if (fileLocation.exists()) { + tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(fileLocation) + tasks.srgifyBinpatchedJar.accessTransformerFiles.from(fileLocation) + } else { + throw new GradleException("Access Transformer file [$fileLocation] does not exist!") + } } } +processResources { -// Create deobf dev jars -task deobfJar(type: Jar) { - from sourceSets.main.output - classifier = 'deobf' -} - -// Create API library jar -task apiZip(type: Jar) { - duplicatesStrategy = 'include' - from(sourceSets.main.java) { - include "baubles/api/**" + def filterList = ['mcmod.info', 'pack.mcmeta'] + filterList.addAll(propertyStringList('mixin_configs').collect(config -> "mixins.${config}.json" as String)) + + filesMatching(filterList) { fcd -> + fcd.expand( + 'mod_id': propertyString('mod_id'), + 'mod_name': propertyString('mod_name'), + 'mod_version': propertyString('mod_version'), + 'mod_description': propertyString('mod_description'), + 'mod_authors': "[${propertyStringList('mod_authors', ',').join(', ')}]", + 'mod_credits': propertyString('mod_credits'), + 'mod_url': propertyString('mod_url'), + 'mod_update_json': propertyString('mod_update_json'), + 'mod_logo_path': propertyString('mod_logo_path'), + 'mixin_refmap': propertyString('mixin_refmap'), + 'mixin_package': propertyString('mixin_package') + ) } - from(sourceSets.main.output) { - include "baubles/api/**" + + if (propertyBool('use_access_transformer')) { + rename '(.+_at.cfg)', 'META-INF/$1' } - classifier = 'api' } -task sourcesJar(type: Jar) { - from sourceSets.main.allJava - classifier = 'sources' +jar { + manifest { + def attribute_map = [:] + if (propertyBool('is_coremod')) { + attribute_map['FMLCorePlugin'] = propertyString('coremod_plugin_class_name') + if (propertyBool('coremod_includes_mod')) { + attribute_map['FMLCorePluginContainsFMLMod'] = true + def currentTasks = gradle.startParameter.taskNames + if (currentTasks[0] == 'build' || currentTasks[0] == 'prepareObfModsFolder' || currentTasks[0] == 'runObfClient') { + attribute_map['ForceLoadAsMod'] = true + } + } + } + if (propertyBool('use_access_transformer')) { + attribute_map['FMLAT'] = propertyString('access_transformer_locations') + } + attributes(attribute_map) + } + // Add all embedded dependencies into the jar + from(provider{ configurations.embed.collect {it.isDirectory() ? it : zipTree(it)} }) } -sourceSets { - main { - if (project.use_mixins.toBoolean()) { - ext.refMap = 'mixins.' + project.archives_base_name + '.refmap.json' +idea { + module { + inheritOutputDirs = true + } + project { + settings { + runConfigurations { + "1. Run Client"(Gradle) { + taskNames = ["runClient"] + } + "2. Run Server"(Gradle) { + taskNames = ["runServer"] + } + "3. Run Obfuscated Client"(Gradle) { + taskNames = ["runObfClient"] + } + "4. Run Obfuscated Server"(Gradle) { + taskNames = ["runObfServer"] + } + } + compiler.javac { + afterEvaluate { + javacAdditionalOptions = "-encoding utf8" + moduleJavacAdditionalOptions = [ + (project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ') + ] + } + } } + } +} - java { - srcDirs = ["src/main/java"] - } +compileTestJava { + sourceCompatibility = targetCompatibility = 8 +} - resources { - srcDirs = ["src/main/java", "src/main/resources"] - } +test { + javaLauncher.set(javaToolchains.launcherFor { + languageVersion = JavaLanguageVersion.of(8) + }) +} + +String parserChangelog() { + if (!file('CHANGELOG.md').exists()) { + throw new GradleException('publish_with_changelog is true, but CHANGELOG.md does not exist in the workspace!') + } + String parsedChangelog = changelog.renderItem( + changelog.get(propertyString('mod_version')).withHeader(false).withEmptySections(false), + Changelog.OutputType.MARKDOWN) + if (parsedChangelog.isEmpty()) { + throw new GradleException('publish_with_changelog is true, but the changelog for the latest version is empty!') } + return parsedChangelog +} - test { - java { - srcDirs = ["src/test/java"] +tasks.register('generateMixinJson') { + group 'cleanroom helpers' + def missingConfig = propertyStringList('mixin_configs').findAll(config -> !file("src/main/resources/mixins.${config}.json").exists()) + onlyIf { + if (propertyBool('use_mixins') && propertyBool('generate_mixins_json')) { + return !missingConfig.empty } - resources { - srcDirs = ["src/test/resources"] + return false + } + doLast { + for (String mixinConfig : missingConfig) { + def file = file("src/main/resources/mixins.${mixinConfig}.json") + file << """{\n\t"package": "",\n\t"required": true,\n\t"refmap": "${mixin_refmap}",\n\t"target": "@env(DEFAULT)",\n\t"minVersion": "0.8.5",\n\t"compatibilityLevel": "JAVA_8",\n\t"mixins": [],\n\t"server": [],\n\t"client": []\n}""" } } - - // at compile time, put resources in same directories as classes - main.output.setResourcesDir(main.java.outputDir) } -jar { - manifest { - // noinspection GroovyAssignabilityCheck - def attribute_map = [:] - if (project.use_coremod.toBoolean()) { - attribute_map['FMLCorePlugin'] = project.coremod_plugin_class_name - if (project.include_mod.toBoolean()) { - attribute_map['FMLCorePluginContainsFMLMod'] = true - attribute_map['ForceLoadAsMod'] = project.gradle.startParameter.taskNames[0] == 'build' - } - } - if (project.use_mixins.toBoolean()) { - attribute_map['TweakClass'] = 'org.spongepowered.asm.launch.MixinTweaker' +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' + if (propertyBool('use_modern_java_syntax')) { + if (it.name in ['compileMcLauncherJava', 'compilePatchedMcJava']) { + return } - attributes(attribute_map) + sourceCompatibility = 17 + options.release.set(8) + javaCompiler.set(javaToolchains.compilerFor { + languageVersion.set(JavaLanguageVersion.of(16)) + vendor.set(JvmVendorSpec.AZUL) + }) } } -artifacts { - archives deobfJar - archives apiZip - archives sourcesJar +tasks.register('cleanroomAfterSync') { + group 'cleanroom helpers' + dependsOn 'injectTags', 'generateMixinJson' } -jar.finalizedBy('reobfJar') - -processResources { - // required to allow file expansion later - duplicatesStrategy = 'include' +if (propertyBool('use_modern_java_syntax')) { + tasks.withType(Javadoc).configureEach { + sourceCompatibility = 17 + } +} - // this will ensure that this task is redone when the versions change. - inputs.property 'version', version +tasks.named('injectTags', InjectTagsTask).configure { + onlyIf { + return propertyBool('use_tags') && !it.getTags().get().isEmpty() + } + it.outputClassName.set(propertyString('tag_class_name')) +} - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' +tasks.named('prepareObfModsFolder').configure { + finalizedBy 'prioritizeCoremods' +} - // replace version and mcversion - expand 'version': version +tasks.register('prioritizeCoremods') { + dependsOn 'prepareObfModsFolder' + doLast { + fileTree('run/obfuscated').forEach { + if (it.isFile() && it.name =~ '(mixinbooter|configanytime)(-)([0-9])+\\.+([0-9])+(.jar)') { + it.renameTo(new File(it.parentFile, "!${it.name}")) + } + } } +} - // copy everything else except the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' +idea.project.settings { + taskTriggers { + afterSync 'cleanroomAfterSync' } } - +apply from: 'gradle/scripts/publishing.gradle' +apply from: 'gradle/scripts/extra.gradle' diff --git a/gradle.properties b/gradle.properties index 32e6c10f..56c25011 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,25 +1,122 @@ -# Sets default memory used for gradle commands. Can be overridden by user or command line properties. -# This is required to provide enough memory for the Minecraft decompilation process. +# Gradle Properties org.gradle.jvmargs = -Xmx3G +# Source Options +# Use Modern Java(9+) Syntax (Courtesy of Jabel) +use_modern_java_syntax = false + +# Compilation Options +generate_sources_jar = true +generate_javadocs_jar = false + # Mod Information -mod_version = 1.0.7.1 -maven_group = com.azanor.baubles +# HIGHLY RECOMMEND complying with SemVer for mod_version: https://semver.org/ +mod_version = 1.12.2-1.0.7.0 +root_package = com.azanor.baubles +mod_id = baubles archives_base_name = Baubles -# This will downlaod sourses and Javadoc for the dependencies (for example mixins), set which ide you use -# You can look up dependencies and their available sources and Javadoc in lntellij by going to File ProjectStructure Libaries -use_lntellij_idea = true -use_eclipse = false +# Mod Metadata (Optional) +mod_description = Adding a touch of bling to Minecraft +mod_url = +mod_update_json = +# Delimit authors with commas +mod_authors = X_Niter +mod_credits = Azanor(Original Author) chicken_bones +mod_logo_path = src/main/resources/BLogo.png + +# Mapping Properties +mapping_channel = stable +mapping_version = 39 +use_dependency_at_files = true + +# Run Configurations +# If multiple arguments/tweak classes are stated, use spaces as the delimiter +minecraft_username = Developer +extra_jvm_args = +extra_tweak_classes = + +# Maven Publishing (Provide secret: MAVEN_USER, MAVEN_PASS) +publish_to_maven = false +# Good for debugging artifacts before uploading to remote maven +# GitHub actions won't run if this is true, test this by running the task `publishToMavenLocal` +publish_to_local_maven = false +maven_name = ${mod_name} +maven_url = + +# Publishing +# release_type can only be: release, beta or alpha (applies to CurseForge / Modrinth) +release_type = release +publish_with_changelog = ${{ it.file('CHANGELOG.md').exists() }} -# If any properties changes below this line, run `gradlew setupDecompWorkspace` and refresh gradle again to ensure everything is working correctly. +# Publishing to CurseForge (Provide secret: CURSEFORGE_TOKEN) +# To configure dependencies, head to publishing.gradle's curseforge block +publish_to_curseforge = false +# CurseForge project ID must be the numerical ID and not the slug +curseforge_project_id = +curseforge_debug = false -# Boilerplate Options +# Publishing to Modrinth (Provide secret: MODRINTH_TOKEN), the token must have the `CREATE_VERSION` and `PROJECT_WRITE` permissions +# To configure dependencies, head to publishing.gradle's modrinth block +publish_to_modrinth = false +modrinth_project_id = +# Allows gradle to publish updated READMEs to the project body (via the modrinthSyncBody task) +modrinth_sync_readme = false +modrinth_debug = false + +# If any properties changes below this line, refresh gradle again to ensure everything is working correctly. + +# Modify Minecraft Sources +# RetroFuturaGradle allows Minecraft sources to be edited, and have the changes reflected upon running it +# Good for previews when coremodding, or generally seeing how behaviours can change with certain code applied/unapplied +# Turning this on allows Minecraft sources to persist and not regenerate +change_minecraft_sources = false + +# Tags +# A RetroFuturaGradle concept akin to Ant ReplaceTokens +# A class is generated at build-time for compilation, to describe properties that have values that could change at build time such as versioning +# Class name is configurable with the `tag_class_name` property +# Tag properties can be stated in the `tags.properties` file, references are allowed +use_tags = true +tag_class_name = ${root_package}.${mod_id}.Tags + +# Access Transformers +# A way to change visibility of Minecraft's classes, methods and fields +# An example access transformer file is given in the path: `src/main/resources/example_at.cfg` +# AT files should be in the root of src/main/resources with the filename formatted as: `mod_id_at.cfg` +# Use the property `access_transformer_locations` to state custom AT files if you aren't using the default `mod_id_at.cfg` location +# If multiple locations are stated, use spaces as the delimiter +use_access_transformer = false +access_transformer_locations = ${mod_id}_at.cfg + +# Mixins +# Powerful tool to do runtime description changes of classes +# Wiki: https://github.com/SpongePowered/Mixin/wiki + https://github.com/CleanroomMC/MixinBooter/ + https://cleanroommc.com/wiki/forge-mod-development/mixin/preface +# Only use mixins once you understand the underlying structure use_mixins = false -use_coremod = false -use_assetmover = false -has_access_transformer = false +mixin_booter_version = 9.1 +# A configuration defines a mixin set, and you may have as many mixin sets as you require for your application. +# Each config can only have one and only one package root. +# Generate missing configs, obtain from mixin_configs and generate file base on name convention: "mixins.config_name.json" +# You should change package root once they are generated +generate_mixins_json = true +# Delimit configs with spaces. Should only put configs name instead of full file name +mixin_configs = ${mod_id} +# A refmap is a json that denotes mapping conversions, this json is generated automatically, with the name `mixins.mod_id.refmap.json` +# Use the property `mixin_refmap` if you want it to use a different name, only one name is accepted +mixin_refmap = mixins.${mod_id}.refmap.json + +# Coremods +# The most powerful way to change java classes at runtime, it is however very primitive with little documentation. +# Only make a coremod if you are absolutely sure of what you are doing +# Change the property `coremod_includes_mod` to false if your coremod doesn't have a @Mod annotation +# You MUST state a class name for `coremod_plugin_class_name` if you are making a coremod, the class should implement `IFMLLoadingPlugin` +is_coremod = false +coremod_includes_mod = true +coremod_plugin_class_name = -# Coremod Arguments -include_mod = true -coremod_plugin_class_name = \ No newline at end of file +# AssetMover +# Convenient way to allow downloading of assets from official vanilla Minecraft servers, CurseForge, or any direct links +# Documentation: https://github.com/CleanroomMC/AssetMover +use_asset_mover = false +asset_mover_version = 2.5 \ No newline at end of file diff --git a/gradle/scripts/dependencies.gradle b/gradle/scripts/dependencies.gradle new file mode 100644 index 00000000..557c7772 --- /dev/null +++ b/gradle/scripts/dependencies.gradle @@ -0,0 +1,62 @@ +apply from: 'gradle/scripts/helpers.gradle' + +repositories { + // Other repositories described by default: + // CleanroomMC: https://maven.cleanroommc.com + exclusiveContent { + forRepository { + maven { + name 'CurseMaven' + url 'https://cursemaven.com' + } + } + filter { + includeGroup 'curse.maven' + } + } + exclusiveContent { + forRepository { + maven { + name 'Modrinth' + url 'https://api.modrinth.com/maven' + } + } + filter { + includeGroup 'maven.modrinth' + } + } + mavenLocal() // Must be last for caching to work +} + +dependencies { + // Example - Dependency descriptor: + // 'com.google.code.gson:gson:2.8.6' << group: com.google.code.gson, name:gson, version:2.8.6 + // 'group:name:version:classifier' where classifier is optional + + // Example - Deobfuscating dependencies: + // rfg.deobf('curse.maven:had-enough-items-557549:4543375') + // By wrapping a dependency descriptor in rfg.deobf() method call, the dependency is queued for deobfuscation + // When deobfuscating, RFG respects the mapping_channel + mapping_version stated in gradle.properties + + // Example - CurseMaven dependencies: + // 'curse.maven:had-enough-items-557549:4543375' << had-enough-items = project slug, 557549 = project id, 4543375 = file id + // Full documentation: https://cursemaven.com/ + + // Example - Modrinth dependencies: + // 'maven.modrinth:jei:4.16.1.1000' << jei = project name, 4.16.1.1000 = file version + // Full documentation: https://docs.modrinth.com/docs/tutorials/maven/ + + // Common dependency types (configuration): + // implementation = dependency available at both compile time and runtime + // runtimeOnly = runtime dependency + // compileOnly = compile time dependency + // annotationProcessor = annotation processing dependencies + + // Transitive dependencies: + // (Dependencies that your dependency depends on) + // If you wish to exclude transitive dependencies in the described dependencies + // Use a closure as such: + // implementation ('com.google.code.gson:gson:2.8.6') { + // transitive = false + // } +} \ No newline at end of file diff --git a/gradle/scripts/extra.gradle b/gradle/scripts/extra.gradle new file mode 100644 index 00000000..a44cb8e0 --- /dev/null +++ b/gradle/scripts/extra.gradle @@ -0,0 +1,5 @@ +// You may write any gradle buildscript component in this file +// This file is automatically applied after build.gradle + dependencies.gradle is ran + +// If you wish to use the default helper methods, uncomment the line below +// apply from: 'gradle/scripts/helpers.gradle' diff --git a/gradle/scripts/helpers.gradle b/gradle/scripts/helpers.gradle new file mode 100644 index 00000000..0b3f2ee7 --- /dev/null +++ b/gradle/scripts/helpers.gradle @@ -0,0 +1,96 @@ +import groovy.text.SimpleTemplateEngine +import org.codehaus.groovy.runtime.MethodClosure + +ext.propertyString = this.&propertyString as MethodClosure +ext.propertyBool = this.&propertyBool as MethodClosure +ext.propertyStringList = this.&propertyStringList as MethodClosure +ext.interpolate = this.&interpolate as MethodClosure +ext.assertProperty = this.&assertProperty as MethodClosure +ext.assertSubProperties = this.&assertSubProperties as MethodClosure +ext.setDefaultProperty = this.&setDefaultProperty as MethodClosure +ext.assertEnvironmentVariable = this.&assertEnvironmentVariable as MethodClosure + +String propertyString(String key) { + return $property(key).toString() +} + +boolean propertyBool(String key) { + return propertyString(key).toBoolean() +} + +Collection propertyStringList(String key) { + return propertyStringList(key, ' ') +} + +Collection propertyStringList(String key, String delimit) { + return propertyString(key).split(delimit).findAll { !it.isEmpty() } +} + +private Object $property(String key) { + def value = project.findProperty(key) + if (value instanceof String) { + return interpolate(value) + } + return value +} + +String interpolate(String value) { + if (value.startsWith('${{') && value.endsWith('}}')) { + value = value.substring(3, value.length() - 2) + Binding newBinding = new Binding(this.binding.getVariables()) + newBinding.setProperty('it', this) + return new GroovyShell(this.getClass().getClassLoader(), newBinding).evaluate(value) + } + if (value.contains('${')) { + return new SimpleTemplateEngine().createTemplate(value).make(project.properties).toString() + } + return value +} + +void assertProperty(String propertyName) { + def property = property(propertyName) + if (property == null) { + throw new GradleException("Property ${propertyName} is not defined!") + } + if (property.isEmpty()) { + throw new GradleException("Property ${propertyName} is empty!") + } +} + +void assertSubProperties(String propertyName, String... subPropertyNames) { + assertProperty(propertyName) + if (propertyBool(propertyName)) { + for (String subPropertyName : subPropertyNames) { + assertProperty(subPropertyName) + } + } +} + +void setDefaultProperty(String propertyName, boolean warn, defaultValue) { + def property = property(propertyName) + def exists = true + if (property == null) { + exists = false + if (warn) { + project.logger.log(LogLevel.WARN, "Property ${propertyName} is not defined!") + } + } else if (property.isEmpty()) { + exists = false + if (warn) { + project.logger.log(LogLevel.WARN, "Property ${propertyName} is empty!") + } + } + if (!exists) { + project.setProperty(propertyName, defaultValue.toString()) + } +} + +void assertEnvironmentVariable(String propertyName) { + def property = System.getenv(propertyName) + if (property == null) { + throw new GradleException("System Environment Variable $propertyName is not defined!") + } + if (property.isEmpty()) { + throw new GradleException("Property $propertyName is empty!") + } +} diff --git a/gradle/scripts/publishing.gradle b/gradle/scripts/publishing.gradle new file mode 100644 index 00000000..c7897c93 --- /dev/null +++ b/gradle/scripts/publishing.gradle @@ -0,0 +1,107 @@ +apply from: 'gradle/scripts/helpers.gradle' + +setDefaultProperty('publish_to_maven', true, false) +setDefaultProperty('publish_to_curseforge', true, false) +setDefaultProperty('publish_to_modrinth', true, false) + +if (propertyBool('publish_to_maven')) { + assertProperty('maven_name') + assertProperty('maven_url') + publishing { + repositories { + maven { + name propertyString('maven_name').replaceAll("\\s", "") + url propertyString('maven_url') + credentials(PasswordCredentials) + } + } + publications { + mavenJava(MavenPublication) { + from components.java // Publish with standard artifacts + setGroupId(propertyString('root_package'))// Publish with root package as maven group + setArtifactId(propertyString('mod_id')) // Publish artifacts with mod id as the artifact id + + // Custom artifact: + // If you want to publish a different artifact to the one outputted when building normally + // Create a different gradle task (Jar task), in extra.gradle + // Remove the 'from components.java' line above + // Add this line (change the task name): + // artifacts task_name + } + } + } +} + +// Documentation here: https://github.com/matthewprenger/CurseGradle/wiki/ +if (propertyBool('publish_to_curseforge')) { + apply plugin: 'com.matthewprenger.cursegradle' + assertProperty('curseforge_project_id') + assertProperty('release_type') + setDefaultProperty('curseforge_debug', false, false) + curseforge { + apiKey = System.getenv('CURSEFORGE_TOKEN') == null ? "" : System.getenv('CURSEFORGE_TOKEN') + // noinspection GroovyAssignabilityCheck + project { + id = propertyString('curseforge_project_id') + addGameVersion 'Java 8' + addGameVersion 'Forge' + addGameVersion '1.12.2' + releaseType = propertyString('release_type') + if (!propertyBool('publish_with_changelog')) { + changelog = parserChangelog() + changelogType = 'markdown' + } + mainArtifact tasks.reobfJar, { + displayName = "${propertyString('mod_name')} ${propertyString('mod_version')}" + if (propertyBool('use_mixins')) { + relations { + requiredDependency 'mixin-booter' + } + } + if (propertyBool('use_asset_mover')) { + relations { + requiredDependency 'assetmover' + } + } + } + options { + debug = propertyBool('curseforge_debug') + } + } + } +} + +// Documentation here: https://github.com/modrinth/minotaur +if (propertyBool('publish_to_modrinth')) { + apply plugin: 'com.modrinth.minotaur' + assertProperty('modrinth_project_id') + assertProperty('release_type') + setDefaultProperty('modrinth_debug', false, false) + modrinth { + token = System.getenv('MODRINTH_TOKEN') ? "" : System.getenv('MODRINTH_TOKEN') + projectId = propertyString('modrinth_project_id') + versionNumber = propertyString('mod_version') + versionType = propertyString('release_type') + uploadFile = tasks.reobfJar + gameVersions = ['1.12.2'] + loaders = ['forge'] + debugMode = propertyBool('modrinth_debug') + if (propertyBool('use_mixins') || propertyBool('use_asset_mover')) { + dependencies { + if (propertyBool('use_mixins')) { + required.project 'mixinbooter' + } + if (propertyBool('use_asset_mover')) { + required.project 'assetmover' + } + } + } + if (!propertyBool('publish_with_changelog')) { + changelog = parserChangelog() + } + if (propertyBool('modrinth_sync_readme')) { + syncBodyFrom = file('README.md').text + tasks.modrinth.dependsOn(tasks.modrinthSyncBody) + } + } +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 3baa851b..c1962a79 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 0e9a6105..20db9ad5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip diff --git a/gradlew b/gradlew index 27309d92..aeb74cbb 100755 --- a/gradlew +++ b/gradlew @@ -1,78 +1,126 @@ -#!/usr/bin/env bash +#!/bin/sh + +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## -## -## 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"` -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum -warn ( ) { +warn () { echo "$*" -} +} >&2 -die ( ) { +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 - ;; - 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 + # Determine the Java command to use to start the JVM. 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 @@ -81,7 +129,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 @@ -89,76 +137,109 @@ 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" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; 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 # 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=$((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 -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# 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"' + +# 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. +# + +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 832fdb60..93e3f59f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,4 +1,20 @@ -@if "%DEBUG%" == "" @echo off +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -9,19 +25,23 @@ 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% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +55,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,44 +65,26 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :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/rebuild.bat b/rebuild.bat deleted file mode 100644 index b65c824b..00000000 --- a/rebuild.bat +++ /dev/null @@ -1 +0,0 @@ -cmd /k gradlew setupDecompWorkspace eclipse \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 6c216fd1..2c64da61 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,12 +1,25 @@ pluginManagement { repositories { - gradlePluginPortal() - maven { - url 'https://gitlab.com/api/v4/projects/26758973/packages/maven' - } maven { - name 'ForgeGradle 5' - url 'https://maven.minecraftforge.net' + // RetroFuturaGradle + name 'GTNH Maven' + url 'https://nexus.gtnewhorizons.com/repository/public/' + mavenContent { + includeGroup 'com.gtnewhorizons' + includeGroup 'com.gtnewhorizons.retrofuturagradle' + } } + gradlePluginPortal() + mavenCentral() + mavenLocal() } -} \ No newline at end of file +} + +plugins { + // Automatic toolchain provisioning + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' +} + +// Due to an IntelliJ bug, this has to be done +// rootProject.name = archives_base_name +rootProject.name = rootProject.projectDir.getName() diff --git a/src/main/resources/assets/baubles/lang/pt_br.lang b/src/main/resources/assets/baubles/lang/pt_br.lang index 6f01756e..6f53dc8a 100644 --- a/src/main/resources/assets/baubles/lang/pt_br.lang +++ b/src/main/resources/assets/baubles/lang/pt_br.lang @@ -1,10 +1,17 @@ -# -# ITEMS item.Ring.0.name=Anel do Minerador # # GUI -button.baubles=Baubles +button.baubles=Enfeites button.normal=Normal # # Keybinding -keybind.baublesinventory=Inventário das Baubles +keybind.baublesinventory=Inventário de enfeites +# +# Description +name.AMULET=Enfeites (Amuleto) +name.RING=Enfeites (Anel) +name.BELT=Enfeites (Cinto) +name.TRINKET=Enfeites (Qualquer) +name.HEAD=Enfeites (Cabeça) +name.BODY=Enfeites (Corpo) +name.CHARM=Enfeites (Charme) \ No newline at end of file diff --git a/src/main/resources/changelog.txt b/src/main/resources/changelog.txt index c3c09850..912b6e0e 100644 --- a/src/main/resources/changelog.txt +++ b/src/main/resources/changelog.txt @@ -1,3 +1,11 @@ +1.12.2-1.0.7.0 +- build.gradle changes from CleanRooms template on github. +- Fixed Example Baubles Ring translation key for item name. +- Fix mod versioning, I forgot the API Identifier 0 within the jar, my bad. +- Added IBauble#playEquipSound for Server side eqipping sound identifiers which defaults to Generic armor equip sound. +- Added IBauble#canRightClickEquip, default true, almost all baubles should be right click equip-able now. +- The beginning of Curio GUI implementations controlled by boolean config option, defaults to false(disabled) Alpha State + 1.12.2-1.6.0 - Added infinite slots and reworked the capability side of the mod Thanks to(Jubiman) - XNiter(Me) Created fork of Baubles @@ -18,7 +26,6 @@ - Added sv_se.lang, Thanks to(Regnander) - Added BaubleEquipmentChangeEvent for other mods to work with - 1.5.2 - API: added isBaubleEquipped helper method to BaublesAPI - fixed player bauble syncing (Thanks pau101) closes #235 diff --git a/src/main/resources/mixins.modid.json b/src/main/resources/mixins.modid.json new file mode 100644 index 00000000..ffbbdeec --- /dev/null +++ b/src/main/resources/mixins.modid.json @@ -0,0 +1,11 @@ +{ + "package": "", + "required": true, + "refmap": "${mixin_refmap}", + "target": "@env(DEFAULT)", + "minVersion": "0.8.5", + "compatibilityLevel": "JAVA_8", + "mixins": [], + "server": [], + "client": [] +} \ No newline at end of file diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index e1df31e5..daa17a8d 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { - "pack": { - "pack_format": 3, - "description": "Resources used for Baubles" - } + "pack": { + "description": "${mod_name} Resources", + "pack_format": 3 + } } \ No newline at end of file diff --git a/tags.properties b/tags.properties new file mode 100644 index 00000000..d795ef9d --- /dev/null +++ b/tags.properties @@ -0,0 +1,3 @@ +VERSION = ${mod_version} +MOD_ID = ${mod_id} +MOD_NAME = ${mod_name} \ No newline at end of file