diff --git a/.gitignore b/.gitignore index 4238316..755fbb2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,83 @@ -# eclipse -bin -*.launch -.settings +.nopublish + +### Windows ### + +thumbs.db +*.db + +### Java ### + +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.war +*.ear +*.txt + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Eclipse ### + +*.pydevproject .metadata -.classpath +.gradle +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +/eclipse + +# Eclipse Core .project -# idea -out +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# Java annotation processor (APT) +.factorypath + +# PDT-specific +.buildpath + +# sbteclipse plugin +.target + +# TeXlipse plugin +.texlipse + +### Intellij IDEA ### + +*.iml *.ipr *.iws -*.iml -.idea -# gradle -build -.gradle +.idea/ +.idea_modules/ +/classes/ +/out/ +/build/ + +# Linux +*~ + +run/ -# other -eclipse -run -*.lock -*.DS_Store +logs/ diff --git a/build.gradle b/build.gradle index 0cf21fb..cc913bd 100644 --- a/build.gradle +++ b/build.gradle @@ -1,132 +1,1111 @@ -buildscript { - repositories { - maven { - // url = 'https://maven.cleanroommc.com' - url = 'https://maven.minecraftforge.net' +//version: 1689212657 +/* + * DO NOT CHANGE THIS FILE! + * Also, you may replace this file at any time if there is an update available. + * Please check https://github.com/GregTechCEu/Buildscripts/blob/master/build.gradle for updates. + * You can also run ./gradlew updateBuildScript to update your buildscript. + */ + +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar +import com.modrinth.minotaur.dependencies.ModDependency +import com.modrinth.minotaur.dependencies.VersionDependency +import org.gradle.api.tasks.testing.logging.TestExceptionFormat +import org.gradle.api.tasks.testing.logging.TestLogEvent +import org.gradle.internal.logging.text.StyledTextOutputFactory +import org.jetbrains.gradle.ext.Gradle + +import static org.gradle.internal.logging.text.StyledTextOutput.Style + +plugins { + id 'java' + id 'java-library' + id 'eclipse' + id 'maven-publish' + id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7' + id 'com.gtnewhorizons.retrofuturagradle' version '1.3.20' + id 'net.darkhax.curseforgegradle' version '1.0.14' apply false + id 'com.modrinth.minotaur' version '2.8.0' apply false + id 'com.diffplug.spotless' version '6.13.0' apply false + id 'com.palantir.git-version' version '3.0.0' apply false + id 'com.github.johnrengelman.shadow' version '8.1.1' apply false +} + +if (verifySettingsGradle()) { + throw new GradleException("Settings has been updated, please re-run task.") +} + +def out = services.get(StyledTextOutputFactory).create('an-output') + + +// Project properties + +// Required properties: we don't know how to handle these being missing gracefully +checkPropertyExists("modName") +checkPropertyExists("modId") +checkPropertyExists("modGroup") +checkPropertyExists("minecraftVersion") // hard-coding this makes it harder to immediately tell what version a mod is in (even though this only really supports 1.12.2) +checkPropertyExists("apiPackage") +checkPropertyExists("accessTransformersFile") +checkPropertyExists("usesMixins") +checkPropertyExists("mixinsPackage") +checkPropertyExists("coreModClass") +checkPropertyExists("containsMixinsAndOrCoreModOnly") + +// Optional properties: we can assume some default behavior if these are missing +propertyDefaultIfUnset("modVersion", "") +propertyDefaultIfUnset("includeMCVersionJar", false) +propertyDefaultIfUnset("autoUpdateBuildScript", false) +propertyDefaultIfUnset("modArchivesBaseName", project.modId) +propertyDefaultIfUnsetWithEnvVar("developmentEnvironmentUserName", "Developer", "DEV_USERNAME") +propertyDefaultIfUnset("generateGradleTokenClass", "") +propertyDefaultIfUnset("gradleTokenModId", "") +propertyDefaultIfUnset("gradleTokenModName", "") +propertyDefaultIfUnset("gradleTokenVersion", "") +propertyDefaultIfUnset("includeWellKnownRepositories", true) +propertyDefaultIfUnset("includeCommonDevEnvMods", true) +propertyDefaultIfUnset("noPublishedSources", false) +propertyDefaultIfUnset("forceEnableMixins", false) +propertyDefaultIfUnset("usesShadowedDependencies", false) +propertyDefaultIfUnset("minimizeShadowedDependencies", true) +propertyDefaultIfUnset("relocateShadowedDependencies", true) +propertyDefaultIfUnset("separateRunDirectories", false) +propertyDefaultIfUnsetWithEnvVar("modrinthProjectId", "", "MODRINTH_PROJECT_ID") +propertyDefaultIfUnset("modrinthRelations", "") +propertyDefaultIfUnsetWithEnvVar("curseForgeProjectId", "", "CURSEFORGE_PROJECT_ID") +propertyDefaultIfUnset("curseForgeRelations", "") +propertyDefaultIfUnsetWithEnvVar("releaseType", "release", "RELEASE_TYPE") +propertyDefaultIfUnset("generateDefaultChangelog", false) +propertyDefaultIfUnset("customMavenPublishUrl", "") +propertyDefaultIfUnset("enableModernJavaSyntax", false) +propertyDefaultIfUnset("enableSpotless", false) +propertyDefaultIfUnset("enableJUnit", false) +propertyDefaultIfUnsetWithEnvVar("deploymentDebug", false, "DEPLOYMENT_DEBUG") + + +// Project property assertions + +final String javaSourceDir = 'src/main/java/' +final String scalaSourceDir = 'src/main/scala/' +// If Kotlin is supported, add the path here + +final String modGroupPath = modGroup.toString().replace('.' as char, '/' as char) +final String apiPackagePath = apiPackage.toString().replace('.' as char, '/' as char) + +String targetPackageJava = javaSourceDir + modGroupPath +String targetPackageScala = scalaSourceDir + modGroupPath +// If Kotlin is supported, add the path here + +if (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists()) { + throw new GradleException("Could not resolve \"modGroup\"! Could not find ${targetPackageJava} or ${targetPackageScala}") +} + +if (apiPackage) { + targetPackageJava = javaSourceDir + modGroupPath + '/' + apiPackagePath + targetPackageScala = scalaSourceDir + modGroupPath + '/' + apiPackagePath + if (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists()) { + throw new GradleException("Could not resolve \"apiPackage\"! Could not find ${targetPackageJava} or ${targetPackageScala}") + } +} + +if (accessTransformersFile) { + for (atFile in accessTransformersFile.split(",")) { + String targetFile = 'src/main/resources/' + atFile.trim() + if (!getFile(targetFile).exists()) { + throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) } - maven { - url = 'https://repo.spongepowered.org/maven' + tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile) + tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile) + } +} + +if (usesMixins.toBoolean()) { + if (mixinsPackage.isEmpty()) { + throw new GradleException("\"usesMixins\" requires \"mixinsPackage\" to be set!") + } + final String mixinPackagePath = mixinsPackage.toString().replaceAll('\\.', '/') + targetPackageJava = javaSourceDir + modGroupPath + '/' + mixinPackagePath + targetPackageScala = scalaSourceDir + modGroupPath + '/' + mixinPackagePath + if (!getFile(targetPackageJava).exists()) { + throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find ${targetPackageJava} or ${targetPackageScala}") + } +} + +if (coreModClass) { + final String coreModPath = coreModClass.toString().replaceAll('\\.', '/') + String targetFileJava = javaSourceDir + modGroupPath + '/' + coreModPath + '.java' + String targetFileScala = scalaSourceDir + modGroupPath + '/' + coreModPath + '.scala' + String targetFileScalaJava = scalaSourceDir + modGroupPath + '/' + coreModPath + '.java' + if (!getFile(targetFileJava).exists() && !getFile(targetFileScala).exists() && !getFile(targetFileScalaJava).exists()) { + throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava) + } +} + + +// Plugin application + +// Scala +if (getFile('src/main/scala').exists()) { + apply plugin: 'scala' +} + +// Spotless +//noinspection GroovyAssignabilityCheck +project.extensions.add(com.diffplug.blowdryer.Blowdryer, 'Blowdryer', com.diffplug.blowdryer.Blowdryer) // make Blowdryer available in plugin application +if (enableSpotless.toBoolean()) { + apply plugin: 'com.diffplug.spotless' + + // Spotless auto-formatter + // See https://github.com/diffplug/spotless/tree/main/plugin-gradle + // Can be locally toggled via spotless:off/spotless:on comments + spotless { + encoding 'UTF-8' + + format 'misc', { + target '.gitignore' + + trimTrailingWhitespace() + indentWithSpaces(4) + endWithNewline() + } + java { + target 'src/main/java/**/*.java', 'src/test/java/**/*.java' // exclude api as they are not our files + + def orderFile = project.file('spotless.importorder') + if (!orderFile.exists()) { + orderFile = Blowdryer.file('spotless.importorder') + } + def formatFile = project.file('spotless.eclipseformat.xml') + if (!formatFile.exists()) { + formatFile = Blowdryer.file('spotless.eclipseformat.xml') + } + + toggleOffOn() + importOrderFile(orderFile) + removeUnusedImports() + endWithNewline() + //noinspection GroovyAssignabilityCheck + eclipse('4.19.0').configFile(formatFile) + } + scala { + target 'src/*/scala/**/*.scala' + scalafmt('3.7.1') } - mavenCentral() } - dependencies { - classpath 'com.anatawa12.forge:ForgeGradle:2.3-1.0.7' - if (project.use_mixins.toBoolean()) { - classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' +} + +// Git version checking, also checking for if this is a submodule +if (project.file('.git/HEAD').isFile() || project.file('.git').isFile()) { + apply plugin: 'com.palantir.git-version' +} + +// Shadowing +if (usesShadowedDependencies.toBoolean()) { + apply plugin: 'com.github.johnrengelman.shadow' +} + + +// Configure Java + +java { + toolchain { + if (enableModernJavaSyntax.toBoolean()) { + languageVersion.set(JavaLanguageVersion.of(17)) + } else { + languageVersion.set(JavaLanguageVersion.of(8)) + } + // Azul covers the most platforms for Java 8+ toolchains, crucially including MacOS arm64 + vendor.set(JvmVendorSpec.AZUL) + } + if (!noPublishedSources.toBoolean()) { + withSourcesJar() + } +} + +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' + + if (enableModernJavaSyntax.toBoolean()) { + if (it.name in ['compileMcLauncherJava', 'compilePatchedMcJava']) { + return } + + sourceCompatibility = 17 + options.release.set(8) + + javaCompiler.set(javaToolchains.compilerFor { + languageVersion.set(JavaLanguageVersion.of(17)) + vendor.set(JvmVendorSpec.AZUL) + }) } } -apply plugin: 'net.minecraftforge.gradle.forge' +tasks.withType(ScalaCompile).configureEach { + options.encoding = 'UTF-8' +} + -if (project.use_mixins.toBoolean()) { - apply plugin: 'org.spongepowered.mixin' +// Allow others using this buildscript to have custom gradle code run +if (getFile('addon.gradle').exists()) { + apply from: 'addon.gradle' +} else if (getFile('addon.gradle.kts').exists()) { + apply from: 'addon.gradle.kts' } -version = project.mod_version -group = project.maven_group -archivesBaseName = project.archives_base_name -sourceCompatibility = targetCompatibility = '1.8' +// Configure Minecraft -compileJava { - sourceCompatibility = targetCompatibility = '1.8' +// Try to gather mod version from git tags if version is not manually specified +if (!modVersion) { + try { + modVersion = gitVersion() + } catch (Exception ignored) { + out.style(Style.Failure).text( + "Mod version could not be determined! Property 'modVersion' is not set, and either git is not installed or no git tags exist.\n" + + "Either specify a mod version in 'gradle.properties', or create at least one tag in git for this project." + ) + modVersion = 'NO-GIT-TAG-SET' + } } -configurations { - embed - implementation.extendsFrom(embed) +if (includeMCVersionJar.toBoolean()){ + version = "${minecraftVersion}-${modVersion}" +} +else { + version = modVersion } +group = modGroup +archivesBaseName = modArchivesBaseName + minecraft { - version = '1.12.2-14.23.5.2847' - runDir = 'run' - mappings = 'stable_39' - def args = [] - if (project.use_coremod.toBoolean()) { - args << '-Dfml.coreMods.load=' + coremod_plugin_class_name + mcVersion = minecraftVersion + username = developmentEnvironmentUserName.toString() + useDependencyAccessTransformers = true + + // Automatic token injection with RetroFuturaGradle + if (gradleTokenModId) { + injectedTags.put gradleTokenModId, modId + } + if (gradleTokenModName) { + injectedTags.put gradleTokenModName, modName } - if (project.use_mixins.toBoolean()) { - args << '-Dmixin.hotSwap=true' - args << '-Dmixin.checks.interfaces=true' - args << '-Dmixin.debug.export=true' + if (gradleTokenVersion) { + injectedTags.put gradleTokenVersion, modVersion + } + + // JVM arguments + extraRunJvmArguments.add("-ea:${modGroup}") + if (usesMixins.toBoolean()) { + extraRunJvmArguments.addAll([ + '-Dmixin.hotSwap=true', + '-Dmixin.checks.interfaces=true', + '-Dmixin.debug.export=true' + ]) + } + if (coreModClass) { + extraRunJvmArguments.add("-Dfml.coreMods.load=${modGroup}.${coreModClass}") } - clientJvmArgs.addAll(args) - serverJvmArgs.addAll(args) +} + +if (generateGradleTokenClass) { + tasks.injectTags.outputClassName.set(generateGradleTokenClass) +} + +tasks.named('processIdeaSettings').configure { + dependsOn('injectTags') +} + + +// Repositories + +// Allow unsafe repos but warn +repositories.configureEach { repo -> + if (repo instanceof UrlArtifactRepository) { + if (repo.getUrl() != null && repo.getUrl().getScheme() == "http" && !repo.allowInsecureProtocol) { + logger.warn("Deprecated: Allowing insecure connections for repo '${repo.name}' - add 'allowInsecureProtocol = true'") + repo.allowInsecureProtocol = true + } + } +} + +// Allow adding custom repositories to the buildscript +if (getFile('repositories.gradle').exists()) { + apply from: 'repositories.gradle' +} else if (getFile('repositories.gradle.kts').exists()) { + apply from: 'repositories.gradle.kts' } repositories { - maven { - url = 'https://maven.cleanroommc.com' + if (includeWellKnownRepositories.toBoolean() || includeCommonDevEnvMods.toBoolean()) { + exclusiveContent { + forRepository { + //noinspection ForeignDelegate + maven { + name = 'Curse Maven' + url = 'https://www.cursemaven.com' + // url = 'https://beta.cursemaven.com' + } + } + filter { + includeGroup 'curse.maven' + } + } + exclusiveContent { + forRepository { + //noinspection ForeignDelegate + maven { + name = 'Modrinth' + url = 'https://api.modrinth.com/maven' + } + } + filter { + includeGroup 'maven.modrinth' + } + } + maven { + name 'Cleanroom Maven' + url 'https://maven.cleanroommc.com' + } + maven { + name 'BlameJared Maven' + url 'https://maven.blamejared.com' + } } - maven { - url = 'https://repo.spongepowered.org/maven' + if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { + // need to add this here even if we did not above + if (!includeWellKnownRepositories.toBoolean()) { + maven { + name 'Cleanroom Maven' + url 'https://maven.cleanroommc.com' + } + } } - maven { - url "https://cursemaven.com" + mavenLocal() // Must be last for caching to work +} + + +// Dependencies + +// Configure dependency configurations +configurations { + embed + implementation.extendsFrom(embed) + + if (usesShadowedDependencies.toBoolean()) { + for (config in [compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath]) { + config.extendsFrom(shadowImplementation) + config.extendsFrom(shadowCompile) + } } } dependencies { + if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { + implementation 'zone.rong:mixinbooter:8.3' + String mixin = 'zone.rong:mixinbooter:8.3' + if (usesMixins.toBoolean()) { + mixin = modUtils.enableMixins(mixin, "mixins.${modId}.refmap.json") + } + + api (mixin) { + transitive = false + } + + annotationProcessor(mixin) { + transitive = false + } + + annotationProcessor 'org.ow2.asm:asm-debug-all:5.2' + // should use 24.1.1 but 30.0+ has a vulnerability fix + annotationProcessor 'com.google.guava:guava:30.0-jre' + // should use 2.8.6 but 2.8.9+ has a vulnerability fix + annotationProcessor 'com.google.code.gson:gson:2.8.9' + } + + if (enableJUnit.toBoolean()) { + testImplementation 'org.junit.jupiter:junit-jupiter:5.9.1' + testImplementation 'org.hamcrest:hamcrest:2.2' + } + + if (enableModernJavaSyntax.toBoolean()) { + annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' + compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { + transitive = false + } + // workaround for https://github.com/bsideup/jabel/issues/174 + annotationProcessor 'net.java.dev.jna:jna-platform:5.13.0' + // Allow jdk.unsupported classes like sun.misc.Unsafe, workaround for JDK-8206937 and fixes Forge crashes in tests. + patchedMinecraft 'me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0' - if (project.use_assetmover.toBoolean()) { - compile 'com.cleanroommc:assetmover:2.0' + // allow Jabel to work in 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 + } + testCompileOnly "me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0" } - if (project.use_mixins.toBoolean()) { - compile 'zone.rong:mixinbooter:7.0' + + compileOnlyApi 'org.jetbrains:annotations:23.0.0' + annotationProcessor 'org.jetbrains:annotations:23.0.0' + + if (includeCommonDevEnvMods.toBoolean()) { + implementation 'mezz.jei:jei_1.12.2:4.16.1.302' + //noinspection DependencyNotationArgument + implementation rfg.deobf('curse.maven:top-245211:2667280') // TOP 1.4.28 } - deobfCompile "curse.maven:storage-drawers-223852:2952606" - deobfCompile "curse.maven:chameleon-230497:2450900" } +if (getFile('dependencies.gradle').exists()) { + apply from: 'dependencies.gradle' +} else if (getFile('dependencies.gradle.kts').exists()) { + apply from: 'dependencies.gradle.kts' +} + + +// Test configuration + +// Ensure tests have access to minecraft classes sourceSets { + test { + java { + compileClasspath += patchedMc.output + mcLauncher.output + runtimeClasspath += patchedMc.output + mcLauncher.output + } + } +} - main { - ext.refMap = 'mixins.' + archives_base_name + '.refmap.json' +test { + // ensure tests are run with java8 + javaLauncher = javaToolchains.launcherFor { + languageVersion = JavaLanguageVersion.of(8) + }.get() + + testLogging { + events TestLogEvent.STARTED, TestLogEvent.PASSED, TestLogEvent.FAILED + exceptionFormat TestExceptionFormat.FULL + showExceptions true + showStackTraces true + showCauses true + showStandardStreams true } + if (enableJUnit.toBoolean()) { + useJUnitPlatform() + } } + +// Resource processing and jar building + processResources { // this will ensure that this task is redone when the versions change. - inputs.property 'version', project.version - inputs.property 'mcversion', project.minecraft.version + inputs.property 'version', modVersion + inputs.property 'mcversion', minecraftVersion + // Blowdryer puts these files into the resource directory, so + // exclude them from builds (doesn't hurt to exclude even if not present) + exclude('spotless.importorder') + exclude('spotless.eclipseformat.xml') + // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version - } - // copy everything else except the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } - from(sourceSets.main.java.srcDirs) { - include '**/builtin.sdmods' + filesMatching('mcmod.info') { fcd -> + fcd.expand( + 'version': modVersion, + 'mcversion': minecraftVersion, + 'modid': modId, + 'modname': modName + ) } - from(sourceSets.main.java.srcDirs) { - exclude '**/*.bat' + if (accessTransformersFile) { + String[] ats = accessTransformersFile.split(',') + ats.each { at -> + rename "(${at})", 'META-INF/$1' + } } +} + +// Automatically generate a mixin json file if it does not already exist +tasks.register('generateAssets') { + group = 'GT Buildscript' + description = 'Generates a pack.mcmeta, mcmod.info, or mixins.{modid}.json if needed' + doLast { + // pack.mcmeta + def packMcmetaFile = getFile('src/main/resources/pack.mcmeta') + if (!packMcmetaFile.exists()) { + packMcmetaFile.text = """{ + "pack": { + "pack_format": 3, + "description": "${modName} Resource Pack" + } +} +""" + } + + // mcmod.info + def mcmodInfoFile = getFile('src/main/resources/mcmod.info') + if (!mcmodInfoFile.exists()) { + mcmodInfoFile.text = """[{ + "modid": "\${modid}", + "name": "\${modname}", + "description": "An example mod for Minecraft 1.12.2 with Forge", + "version": "\${version}", + "mcversion": "\${mcversion}", + "logoFile": "", + "url": "", + "authorList": [], + "credits": "", + "dependencies": [] +}] +""" + } - if (project.use_access_transformer.toBoolean()) { - rename '(.+_at.cfg)', 'META-INF/$1' // Access Transformers + // mixins.{modid}.json + if (usesMixins.toBoolean()) { + def mixinConfigFile = getFile("src/main/resources/mixins.${modId}.json") + if (!mixinConfigFile.exists()) { + def mixinConfigRefmap = "mixins.${modId}.refmap.json" + + mixinConfigFile.text = """{ + "package": "${modGroup}.${mixinsPackage}", + "refmap": "${mixinConfigRefmap}", + "target": "@env(DEFAULT)", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": [], + "client": [], + "server": [] +} +""" + } + } } } +tasks.named('processResources').configure { + dependsOn('generateAssets') +} + jar { manifest { - 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" + attributes(getManifestAttributes()) + } + + // Add all embedded dependencies into the jar + from provider { + configurations.embed.collect { + it.isDirectory() ? it : zipTree(it) + } + } +} + +// Configure default run tasks +if (separateRunDirectories.toBoolean()) { + runClient { + workingDir = file('run/client') + } + + runServer { + workingDir = file('run/server') + } +} + +// Create API library jar +tasks.register('apiJar', Jar) { + archiveClassifier.set 'api' + from(sourceSets.main.java) { + include "${modGroupPath}/${apiPackagePath}/**" + } + + from(sourceSets.main.output) { + include "${modGroupPath}/${apiPackagePath}/**" + } +} + +// Configure shadow jar task +if (usesShadowedDependencies.toBoolean()) { + tasks.named('shadowJar', ShadowJar).configure { + manifest { + attributes(getManifestAttributes()) + } + // Only shadow classes that are actually used, if enabled + if (minimizeShadowedDependencies.toBoolean()) { + minimize() + } + configurations = [ + project.configurations.shadowImplementation, + project.configurations.shadowCompile + ] + archiveClassifier.set('dev') + if (relocateShadowedDependencies.toBoolean()) { + relocationPrefix = modGroup + '.shadow' + enableRelocation = true + } + } + configurations.runtimeElements.outgoing.artifacts.clear() + configurations.apiElements.outgoing.artifacts.clear() + configurations.runtimeElements.outgoing.artifact(tasks.named('shadowJar', ShadowJar)) + configurations.apiElements.outgoing.artifact(tasks.named('shadowJar', ShadowJar)) + tasks.named('jar', Jar) { + enabled = false + finalizedBy(tasks.shadowJar) + } + tasks.named('reobfJar', ReobfuscatedJar) { + inputJar.set(tasks.named('shadowJar', ShadowJar).flatMap({it.archiveFile})) + } + AdhocComponentWithVariants javaComponent = (AdhocComponentWithVariants) project.components.findByName('java') + javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) { + skip() + } + for (runTask in ['runClient', 'runServer']) { + tasks.named(runTask).configure { + dependsOn('shadowJar') + } + } +} + +def getManifestAttributes() { + def attributes = [:] + if (coreModClass) { + attributes['FMLCorePlugin'] = "${modGroup}.${coreModClass}" + } + if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { + attributes['FMLCorePluginContainsFMLMod'] = true + } + if (accessTransformersFile) { + attributes['FMLAT'] = accessTransformersFile.toString() + } + + if (usesMixins.toBoolean()) { + attributes['ForceLoadAsMod'] = !containsMixinsAndOrCoreModOnly.toBoolean() + } + return attributes +} + + +// IDE Configuration + +eclipse { + classpath { + downloadSources = true + downloadJavadoc = true + } +} + +idea { + module { + inheritOutputDirs true + downloadJavadoc true + downloadSources true + } + project { + settings { + runConfigurations { + '1. Setup Workspace'(Gradle) { + taskNames = ['setupDecompWorkspace'] + } + '2. Run Client'(Gradle) { + taskNames = ['runClient'] + } + '3. Run Server'(Gradle) { + taskNames = ['runServer'] + } + '4. Run Obfuscated Client'(Gradle) { + taskNames = ['runObfClient'] + } + '5. Run Obfuscated Server'(Gradle) { + taskNames = ['runObfServer'] + } + if (enableSpotless.toBoolean()) { + '6. Apply Spotless'(Gradle) { + taskNames = ["spotlessApply"] + } + '7. Build Jars'(Gradle) { + taskNames = ['build'] + } + } else { + '6. Build Jars'(Gradle) { + taskNames = ['build'] + } + } + 'Update Buildscript'(Gradle) { + taskNames = ['updateBuildScript'] + } + 'FAQ'(Gradle) { + taskNames = ['faq'] + } + } + compiler.javac { + afterEvaluate { + javacAdditionalOptions = '-encoding utf8' + moduleJavacAdditionalOptions = [ + (project.name + '.main'): tasks.compileJava.options.compilerArgs.collect { + '"' + it + '"' + }.join(' ') + ] + } + } + } + } +} + + +// Deployment +def final modrinthApiKey = providers.environmentVariable('MODRINTH_API_KEY') +def final cfApiKey = providers.environmentVariable('CURSEFORGE_API_KEY') +final boolean isCIEnv = providers.environmentVariable('CI').getOrElse('false').toBoolean() + +if (isCIEnv || deploymentDebug.toBoolean()) { + artifacts { + if (!noPublishedSources.toBoolean()) { + archives sourcesJar + } + if (apiPackage) { + archives apiJar + } + } +} + +// Changelog generation +tasks.register('generateChangelog') { + group = 'GT Buildscript' + description = 'Generate a default changelog of all commits since the last tagged git commit' + onlyIf { + generateDefaultChangelog.toBoolean() + } + doLast { + def lastTag = getLastTag() + + def changelog = runShell(([ + "git", + "log", + "--date=format:%d %b %Y", + "--pretty=%s - **%an** (%ad)", + "${lastTag}..HEAD" + ] + (sourceSets.main.java.srcDirs + sourceSets.main.resources.srcDirs) + .collect { ['--', it] }).flatten()) + + if (changelog) { + changelog = "Changes since ${lastTag}:\n${{("\n" + changelog).replaceAll("\n", "\n* ")}}" + } + def f = getFile('build/changelog.md') + changelog = changelog ?: 'There have been no changes.' + f.write(changelog, 'UTF-8') + + // Set changelog for Modrinth + if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) { + modrinth.changelog.set(changelog) + } + } +} + +if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) { + apply plugin: 'net.darkhax.curseforgegradle' + //noinspection UnnecessaryQualifiedReference + tasks.register('curseforge', net.darkhax.curseforgegradle.TaskPublishCurseForge) { + disableVersionDetection() + debugMode = deploymentDebug.toBoolean() + apiToken = cfApiKey.getOrElse('debug_token') + + doFirst { + def mainFile = upload(curseForgeProjectId, reobfJar) + def changelogFile = getChangelog() + def changelogRaw = changelogFile.exists() ? changelogFile.getText('UTF-8') : "" + + mainFile.displayName = "${modName}: ${modVersion}" + mainFile.releaseType = getReleaseType() + mainFile.changelog = changelogRaw + mainFile.changelogType = 'markdown' + mainFile.addModLoader 'Forge' + mainFile.addJavaVersion "Java 8" + mainFile.addGameVersion minecraftVersion + + if (curseForgeRelations.size() != 0) { + String[] deps = curseForgeRelations.split(';') + deps.each { dep -> + if (dep.size() == 0) { + return + } + String[] parts = dep.split(':') + String type = parts[0], slug = parts[1] + if (!(type in ['requiredDependency', 'embeddedLibrary', 'optionalDependency', 'tool', 'incompatible'])) { + throw new Exception('Invalid Curseforge dependency type: ' + type) + } + mainFile.addRelation(slug, type) + } + } + + for (artifact in getSecondaryArtifacts()) { + def additionalFile = mainFile.withAdditionalFile(artifact) + additionalFile.changelog = changelogRaw + } + } + } + tasks.curseforge.dependsOn(build) + tasks.curseforge.dependsOn('generateChangelog') +} + +if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) { + apply plugin: 'com.modrinth.minotaur' + def final changelogFile = getChangelog() + + modrinth { + token = modrinthApiKey.getOrElse('debug_token') + projectId = modrinthProjectId + changelog = changelogFile.exists() ? changelogFile.getText('UTF-8') : "" + versionType = getReleaseType() + versionNumber = modVersion + gameVersions = [minecraftVersion] + loaders = ["forge"] + debugMode = deploymentDebug.toBoolean() + uploadFile = reobfJar + additionalFiles = getSecondaryArtifacts() + } + if (modrinthRelations.size() != 0) { + String[] deps = modrinthRelations.split(';') + deps.each { dep -> + if (dep.size() == 0) { + return + } + String[] parts = dep.split(':') + String[] qual = parts[0].split('-') + addModrinthDep(qual[0], qual[1], parts[1]) + } + } + tasks.modrinth.dependsOn(build) + tasks.modrinth.dependsOn('generateChangelog') +} + +def addModrinthDep(String scope, String type, String name) { + com.modrinth.minotaur.dependencies.Dependency dep + if (!(scope in ['required', 'optional', 'incompatible', 'embedded'])) { + throw new Exception('Invalid modrinth dependency scope: ' + scope) + } + switch (type) { + case 'project': + dep = new ModDependency(name, scope) + break + case 'version': + dep = new VersionDependency(name, scope) + break + default: + throw new Exception('Invalid modrinth dependency type: ' + type) + } + project.modrinth.dependencies.add(dep) +} + +if (customMavenPublishUrl) { + String publishedVersion = modVersion + + publishing { + publications { + create('maven', MavenPublication) { + //noinspection GroovyAssignabilityCheck + from components.java + + if (apiPackage) { + artifact apiJar + } + + // providers is not available here, use System for getting env vars + groupId = System.getenv('ARTIFACT_GROUP_ID') ?: project.group + artifactId = System.getenv('ARTIFACT_ID') ?: project.name + version = System.getenv('RELEASE_VERSION') ?: publishedVersion + } + } + + repositories { + maven { + url = customMavenPublishUrl + allowInsecureProtocol = !customMavenPublishUrl.startsWith('https') + credentials { + username = providers.environmentVariable('MAVEN_USER').getOrElse('NONE') + password = providers.environmentVariable('MAVEN_PASSWORD').getOrElse('NONE') + } } } - if (project.use_access_transformer.toBoolean()) { - attribute_map['FMLAT'] = project.archives_base_name + '_at.cfg' + } +} + +def getSecondaryArtifacts() { + def secondaryArtifacts = [usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar] + if (!noPublishedSources.toBoolean()) secondaryArtifacts += [sourcesJar] + if (apiPackage) secondaryArtifacts += [apiJar] + return secondaryArtifacts +} + +def getReleaseType() { + String type = project.releaseType + if (!(type in ['release', 'beta', 'alpha'])) { + throw new Exception("Release type invalid! Found \"" + type + "\", allowed: \"release\", \"beta\", \"alpha\"") + } + return type +} + +/* + * If CHANGELOG_LOCATION env var is set, that takes highest precedence. + * Next, if 'generateDefaultChangelog' option is enabled, use that. + * Otherwise, try to use a CHANGELOG.md file at root directory. + */ +def getChangelog() { + def final changelogEnv = providers.environmentVariable('CHANGELOG_LOCATION') + if (changelogEnv.isPresent()) { + return new File(changelogEnv.get()) + } + if (generateDefaultChangelog.toBoolean()) { + return getFile('build/changelog.md') + } + return getFile('CHANGELOG.md') +} + + +// Buildscript updating + +def buildscriptGradleVersion = '8.1.1' + +tasks.named('wrapper', Wrapper).configure { + gradleVersion = buildscriptGradleVersion +} + +tasks.register('updateBuildScript') { + group = 'GT Buildscript' + description = 'Updates the build script to the latest version' + + if (gradle.gradleVersion != buildscriptGradleVersion && !Boolean.getBoolean('DISABLE_BUILDSCRIPT_GRADLE_UPDATE')) { + dependsOn('wrapper') + } + + doLast { + if (performBuildScriptUpdate()) return + print('Build script already up to date!') + } +} + +if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISABLE_BUILDSCRIPT_UPDATE_CHECK') && isNewBuildScriptVersionAvailable()) { + if (autoUpdateBuildScript.toBoolean()) { + performBuildScriptUpdate() + } else { + out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'") + if (gradle.gradleVersion != buildscriptGradleVersion) { + out.style(Style.SuccessHeader).println("updateBuildScript can update gradle from ${gradle.gradleVersion} to ${buildscriptGradleVersion}\n") + } + } +} + +static URL availableBuildScriptUrl() { + new URL("https://raw.githubusercontent.com/GregTechCEu/Buildscripts/master/build.gradle") +} + +static URL exampleSettingsGradleUrl() { + new URL("https://raw.githubusercontent.com/GregTechCEu/Buildscripts/master/settings.gradle") +} + +boolean verifySettingsGradle() { + def settingsFile = getFile("settings.gradle") + if (!settingsFile.exists()) { + println("Downloading default settings.gradle") + exampleSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } } + return true + } + return false +} + +boolean performBuildScriptUpdate() { + if (isNewBuildScriptVersionAvailable()) { + def buildscriptFile = getFile("build.gradle") + availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } + def out = services.get(StyledTextOutputFactory).create('buildscript-update-output') + out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!") + if (verifySettingsGradle()) { + throw new GradleException("Settings has been updated, please re-run task.") + } + return true + } + return false +} + +boolean isNewBuildScriptVersionAvailable() { + Map parameters = ["connectTimeout": 10000, "readTimeout": 10000] + + String currentBuildScript = getFile("build.gradle").getText() + String currentBuildScriptHash = getVersionHash(currentBuildScript) + String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() + String availableBuildScriptHash = getVersionHash(availableBuildScript) + + boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash + return !isUpToDate +} + +static String getVersionHash(String buildScriptContent) { + String versionLine = buildScriptContent.find("^//version: [a-z0-9]*") + if (versionLine != null) { + return versionLine.split(": ").last() + } + return "" +} + + +// Faq + +tasks.register('faq') { + group = 'GT Buildscript' + description = 'Prints frequently asked questions about building a project' + doLast { + print("\nTo update this buildscript to the latest version, run 'gradlew updateBuildScript' or run the generated run configuration if you are using IDEA.\n" + + "To set up the project, run the 'setupDecompWorkspace' task, which you can run as './gradlew setupDecompWorkspace' in a terminal, or find in the 'modded minecraft' gradle category.\n\n" + + "To add new dependencies to your project, place them in 'dependencies.gradle', NOT in 'build.gradle' as they would be replaced when the script updates.\n" + + "To add new repositories to your project, place them in 'repositories.gradle'.\n" + + "If you need additional gradle code to run, you can place it in a file named 'addon.gradle' (or either of the above, up to you for organization).\n\n" + + "If your build fails to recognize the syntax of newer Java versions, enable Jabel in your 'gradle.properties' under the option name 'enableModernJavaSyntax'.\n" + + "To see information on how to configure your IDE properly for Java 17, see https://github.com/GregTechCEu/Buildscripts/blob/master/docs/jabel.md\n\n" + + "Report any issues or feature requests you have for this build script to https://github.com/GregTechCEu/Buildscripts/issues\n") + } +} + + +// Helpers + +def getFile(String relativePath) { + return new File(projectDir, relativePath) +} + +def checkPropertyExists(String propertyName) { + if (!project.hasProperty(propertyName)) { + throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GregTechCEu/Buildscripts/blob/main/gradle.properties") + } +} + +def propertyDefaultIfUnset(String propertyName, defaultValue) { + if (!project.hasProperty(propertyName) || project.property(propertyName) == "") { + project.ext.setProperty(propertyName, defaultValue) + } +} + +def propertyDefaultIfUnsetWithEnvVar(String propertyName, defaultValue, String envVarName) { + def envVar = providers.environmentVariable(envVarName) + if (envVar.isPresent()) { + project.ext.setProperty(propertyName, envVar.get()) + } else { + propertyDefaultIfUnset(propertyName, defaultValue) + } +} + +static runShell(command) { + def process = command.execute() + def outputStream = new StringBuffer() + def errorStream = new StringBuffer() + process.waitForProcessOutput(outputStream, errorStream) + + errorStream.toString().with { + if (it) { + throw new GradleException("Error executing ${command}:\n> ${it}") } - attributes(attribute_map) } + return outputStream.toString().trim() +} + +def getLastTag() { + def githubTag = providers.environmentVariable('GITHUB_TAG') + return runShell('git describe --abbrev=0 --tags ' + + (githubTag.isPresent() ? runShell('git rev-list --tags --skip=1 --max-count=1') : '')) } diff --git a/build.gradle.old b/build.gradle.old new file mode 100644 index 0000000..0cf21fb --- /dev/null +++ b/build.gradle.old @@ -0,0 +1,132 @@ +buildscript { + repositories { + maven { + // url = 'https://maven.cleanroommc.com' + url = 'https://maven.minecraftforge.net' + } + maven { + url = 'https://repo.spongepowered.org/maven' + } + mavenCentral() + } + dependencies { + classpath 'com.anatawa12.forge:ForgeGradle:2.3-1.0.7' + if (project.use_mixins.toBoolean()) { + classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' + } + } +} + +apply plugin: 'net.minecraftforge.gradle.forge' + +if (project.use_mixins.toBoolean()) { + apply plugin: 'org.spongepowered.mixin' +} + +version = project.mod_version +group = project.maven_group +archivesBaseName = project.archives_base_name + +sourceCompatibility = targetCompatibility = '1.8' + +compileJava { + sourceCompatibility = targetCompatibility = '1.8' +} + +configurations { + embed + implementation.extendsFrom(embed) +} + +minecraft { + version = '1.12.2-14.23.5.2847' + runDir = 'run' + mappings = 'stable_39' + def args = [] + if (project.use_coremod.toBoolean()) { + args << '-Dfml.coreMods.load=' + coremod_plugin_class_name + } + if (project.use_mixins.toBoolean()) { + args << '-Dmixin.hotSwap=true' + args << '-Dmixin.checks.interfaces=true' + args << '-Dmixin.debug.export=true' + } + clientJvmArgs.addAll(args) + serverJvmArgs.addAll(args) +} + +repositories { + maven { + url = 'https://maven.cleanroommc.com' + } + maven { + url = 'https://repo.spongepowered.org/maven' + } + maven { + url "https://cursemaven.com" + } +} + +dependencies { + + if (project.use_assetmover.toBoolean()) { + compile 'com.cleanroommc:assetmover:2.0' + } + if (project.use_mixins.toBoolean()) { + compile 'zone.rong:mixinbooter:7.0' + } + deobfCompile "curse.maven:storage-drawers-223852:2952606" + deobfCompile "curse.maven:chameleon-230497:2450900" +} + +sourceSets { + + main { + ext.refMap = 'mixins.' + archives_base_name + '.refmap.json' + } + +} + +processResources { + // this will ensure that this task is redone when the versions change. + inputs.property 'version', project.version + inputs.property 'mcversion', project.minecraft.version + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + // replace version and mcversion + expand 'version':project.version, 'mcversion':project.minecraft.version + } + // copy everything else except the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } + from(sourceSets.main.java.srcDirs) { + include '**/builtin.sdmods' + } + + from(sourceSets.main.java.srcDirs) { + exclude '**/*.bat' + } + + if (project.use_access_transformer.toBoolean()) { + rename '(.+_at.cfg)', 'META-INF/$1' // Access Transformers + } +} + +jar { + manifest { + 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_access_transformer.toBoolean()) { + attribute_map['FMLAT'] = project.archives_base_name + '_at.cfg' + } + attributes(attribute_map) + } +} diff --git a/dependencies.gradle b/dependencies.gradle new file mode 100644 index 0000000..57e7a01 --- /dev/null +++ b/dependencies.gradle @@ -0,0 +1,27 @@ +//file:noinspection DependencyNotationArgument +// TODO remove when fixed in RFG ^ +/* + * Add your dependencies here. Common configurations: + * - implementation("group:name:version:classifier"): if you need this for internal implementation details of the mod. + * Available at compiletime and runtime for your environment. + * + * - compileOnlyApi("g:n:v:c"): if you need this for internal implementation details of the mod. + * Available at compiletime but not runtime for your environment. + * + * - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry + * + * - testCONFIG("g:n:v:c"): replace CONFIG by one of the above, same as above but for the test sources instead of main + * + * You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed. + * + * To add a mod with CurseMaven, replace '("g:n:v:c")' in the above with 'rfg.deobf("curse.maven:project_slug-project_id:file_id")' + * Example: implementation rfg.deobf("curse.maven:gregtech-ce-unofficial-557242:4527757") + * + * To shadow a dependency, use 'shadowImplementation'. For more info, see https://github.com/GregTechCEu/Buildscripts/blob/master/docs/shadow.md + * + * For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph + */ +dependencies { + implementation rfg.deobf("curse.maven:storage-drawers-223852:2952606") + implementation rfg.deobf("curse.maven:chameleon-230497:2450900") +} diff --git a/gradle.properties b/gradle.properties index 9e39661..7f69700 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,22 +1,162 @@ -# 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. -org.gradle.jvmargs = -Xmx3G +modName = Gregtech Drawers + +# This is a case-sensitive string to identify your mod. Convention is to use lower case. +modId = gregtechdrawers + +modGroup = com.nomiceu.gregtechdrawers + +# Version of your mod. +# This field can be left empty if you want your mod's version to be determined by the latest git tag instead. +modVersion = 1.0.5 + +# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version) +includeMCVersionJar = true + +# The name of your jar when you produce builds, not including any versioning info +modArchivesBaseName = gregtech-drawers + +# Will update your build.gradle automatically whenever an update is available +autoUpdateBuildScript = false + +minecraftVersion = 1.12.2 + +# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you +# restart Minecraft in development. Choose this dependent on your mod: +# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name +# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty +# Alternatively this can be set with the 'DEV_USERNAME' environment variable. +developmentEnvironmentUserName = Developer + +# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8. +# See https://github.com/bsideup/jabel for details on how this works. +# Using this requires that you use a Java 17 JDK for development. +enableModernJavaSyntax = true + +# Generate a class with String fields for the mod id, name and version named with the fields below +generateGradleTokenClass = com.nomiceu.gregtechdrawers.Tags +gradleTokenModId = +gradleTokenModName = +gradleTokenVersion = VERSION + +# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can +# leave this property empty. +# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api +apiPackage = + +# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/ +# There can be multiple files in a comma-separated list. +# Example value: mymodid_at.cfg,jei_at.cfg +accessTransformersFile = + +# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! +usesMixins = false +# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! +mixinsPackage = +# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! +# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin +coreModClass = +# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod (meaning that +# there is no class annotated with @Mod) you want this to be true. When in doubt: leave it on false! +containsMixinsAndOrCoreModOnly = false + +# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins. +forceEnableMixins = false + +# Adds CurseMaven, Modrinth Maven, BlameJared maven, and some more well-known 1.12.2 repositories +includeWellKnownRepositories = true + +# Adds JEI and TheOneProbe to your development environment. Adds them as 'implementation', meaning they will +# be available at compiletime and runtime for your mod (in-game and in-code). +# Overrides the above setting to be always true, as these repositories are needed to fetch the mods +includeCommonDevEnvMods = true -# Mod Information -mod_version = 1.12.2-1.0.4 -maven_group = io.github.nomiceu -archives_base_name = gregtech-drawers -# If any properties changes below this line, run `gradlew setupDecompWorkspace` and refresh gradle again to ensure everything is working correctly. +# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your +# responsibility check the licence and request permission for distribution, if required. +usesShadowedDependencies = false +# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access +# their own classes, making the minimization unreliable. +minimizeShadowedDependencies = true +# If disabled, won't rename the shadowed classes. +relocateShadowedDependencies = true -# Boilerplate Options -use_mixins = false -use_coremod = false -use_assetmover = false +# Separate run directories into "run/client" for runClient task, and "run/server" for runServer task. +# Useful for debugging a server and client simultaneously. If not enabled, it will be in the standard location "run/" +separateRunDirectories = false -# Access Transformer files should be in the root of `resources` folder and with the filename formatted as: `{archives_base_name}_at.cfg` -use_access_transformer = false -# Coremod Arguments -include_mod = true -coremod_plugin_class_name = +# Publishing to modrinth requires you to set the MODRINTH_API_KEY environment variable to your current modrinth API token. + +# The project's ID on Modrinth. Can be either the slug or the ID. +# Leave this empty if you don't want to publish on Modrinth. +# Alternatively this can be set with the 'MODRINTH_PROJECT_ID' environment variable. +modrinthProjectId = + +# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth. +# Syntax: scope1-type1:name1;scope2-type2:name2;... +# Where scope can be one of [required, optional, incompatible, embedded], +# type can be one of [project, version], +# and the name is the Modrinth project or version slug/id of the other mod. +# Example: required-project:jei;optional-project:top;incompatible-project:gregtech +modrinthRelations = + + +# Publishing to CurseForge requires you to set the CURSEFORGE_API_KEY environment variable to one of your CurseForge API tokens. + +# The project's numeric ID on CurseForge. You can find this in the About Project box. +# Leave this empty if you don't want to publish on CurseForge. +# Alternatively this can be set with the 'CURSEFORGE_PROJECT_ID' environment variable. +curseForgeProjectId = 845779 + +# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge. +# Syntax: type1:name1;type2:name2;... +# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible], +# and the name is the CurseForge project slug of the other mod. +# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft +curseForgeRelations = requiredDependency:storage-drawers;requiredDependency:chameleon;requiredDependency:gregtech-ce-unofficial; + +# This project's release type on CurseForge and/or Modrinth +# Alternatively this can be set with the 'RELEASE_TYPE' environment variable. +# Allowed types: release, beta, alpha +releaseType = release + +# Generate a default changelog for releases. Requires git to be installed, as it uses it to generate a changelog of +# commits since the last tagged release. +generateDefaultChangelog = true + +# Prevent the source code from being published +noPublishedSources = false + + +# Publish to a custom maven location. Follows a few rules: +# Group ID can be set with the 'ARTIFACT_GROUP_ID' environment variable, default to 'project.group' +# Artifact ID can be set with the 'ARTIFACT_ID' environment variable, default to 'project.name' +# Version can be set with the 'RELEASE_VERSION' environment variable, default to 'modVersion' +# For maven credentials: +# Username is set with the 'MAVEN_USER' environment variable, default to "NONE" +# Password is set with the 'MAVEN_PASSWORD' environment variable, default to "NONE" +customMavenPublishUrl = + +# Enable spotless checks +# Enforces code formatting on your source code +# By default this will use the files found here: https://github.com/GregTechCEu/Buildscripts/tree/master/spotless +# to format your code. However, you can create your own version of these files and place them in your project's +# root directory to apply your own formatting options instead. +enableSpotless = false + +# Enable JUnit testing platform used for testing your code. +# Uses JUnit 5. See guide and documentation here: https://junit.org/junit5/docs/current/user-guide/ +enableJUnit = true + +# Deployment debug setting +# Uncomment this to test deployments to CurseForge and Modrinth +# Alternatively, you can set the 'DEPLOYMENT_DEBUG' environment variable. +deploymentDebug = false + + +# Gradle Settings +# Effectively applies the '--stacktrace' flag by default +org.gradle.logging.stacktrace = all +# 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. +org.gradle.jvmargs = -Xmx3G diff --git a/gradle.properties.old b/gradle.properties.old new file mode 100644 index 0000000..9e39661 --- /dev/null +++ b/gradle.properties.old @@ -0,0 +1,22 @@ +# 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. +org.gradle.jvmargs = -Xmx3G + +# Mod Information +mod_version = 1.12.2-1.0.4 +maven_group = io.github.nomiceu +archives_base_name = gregtech-drawers + +# If any properties changes below this line, run `gradlew setupDecompWorkspace` and refresh gradle again to ensure everything is working correctly. + +# Boilerplate Options +use_mixins = false +use_coremod = false +use_assetmover = false + +# Access Transformer files should be in the root of `resources` folder and with the filename formatted as: `{archives_base_name}_at.cfg` +use_access_transformer = false + +# Coremod Arguments +include_mod = true +coremod_plugin_class_name = diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 30d399d..033e24c 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 6b071a7..80187ac 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Mon Sep 14 12:28:28 PDT 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 index 2ec45c6..fcb6fca --- a/gradlew +++ b/gradlew @@ -1,79 +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/. +# ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +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 -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # 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 -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# 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 -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - 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 @@ -82,83 +129,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - 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. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + 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 location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "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"` - - # 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 "$@" \ No newline at end of file +# 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 8a0b282..93e3f59 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 @@ -8,20 +24,24 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@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 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="-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 Windowz 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/settings.gradle b/settings.gradle new file mode 100644 index 0000000..9d2bae4 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,33 @@ +pluginManagement { + repositories { + maven { + // RetroFuturaGradle + name 'GTNH Maven' + //noinspection HttpUrlsUsage + url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' + allowInsecureProtocol = true + //noinspection GroovyAssignabilityCheck + mavenContent { + includeGroup 'com.gtnewhorizons' + includeGroup 'com.gtnewhorizons.retrofuturagradle' + } + } + gradlePluginPortal() + mavenCentral() + mavenLocal() + } +} + +plugins { + id 'com.diffplug.blowdryerSetup' version '1.6.0' + // Automatic toolchain provisioning + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' +} + +blowdryerSetup { + repoSubfolder 'spotless' + github 'GregTechCEu/Buildscripts', 'tag', 'v1.0.0' + //devLocal '.' // Use this when testing config updated locally +} + +rootProject.name = rootProject.projectDir.getName() diff --git a/src/main/java/io/github/nomiceu/GTDCreativeTabs.java b/src/main/java/com/nomiceu/gregtechdrawers/GTDCreativeTabs.java similarity index 82% rename from src/main/java/io/github/nomiceu/GTDCreativeTabs.java rename to src/main/java/com/nomiceu/gregtechdrawers/GTDCreativeTabs.java index 2b024da..1e83589 100644 --- a/src/main/java/io/github/nomiceu/GTDCreativeTabs.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/GTDCreativeTabs.java @@ -1,11 +1,10 @@ -package io.github.nomiceu; - -import static io.github.nomiceu.type.Mods.ENABLED_MODS; +package com.nomiceu.gregtechdrawers; import com.jaquadro.minecraft.storagedrawers.api.storage.EnumBasicDrawer; import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs; -import io.github.nomiceu.type.DrawerMaterial; -import io.github.nomiceu.type.Mod; +import com.nomiceu.gregtechdrawers.type.DrawerMaterial; +import com.nomiceu.gregtechdrawers.type.Mod; +import com.nomiceu.gregtechdrawers.type.Mods; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; @@ -25,7 +24,7 @@ public class GTDCreativeTabs { @Override @SideOnly(Side.CLIENT) public ItemStack createIcon() { - for(Mod mod : ENABLED_MODS) { + for(Mod mod : Mods.ENABLED_MODS) { DrawerMaterial material = mod.getDefaultMaterial(); if(material != null) return new ItemStack(material.getDrawerItem(), 1, EnumBasicDrawer.FULL1.getMetadata()); @@ -35,7 +34,7 @@ public ItemStack createIcon() { @Override public void displayAllRelevantItems(NonNullList items) { - for(Mod mod : ENABLED_MODS) { + for(Mod mod : Mods.ENABLED_MODS) { for(DrawerMaterial material : mod) { material.getDrawerItem().getSubItems(this, items); material.getTrimItem().getSubItems(this, items); diff --git a/src/main/java/io/github/nomiceu/GTDrawers.java b/src/main/java/com/nomiceu/gregtechdrawers/GTDrawers.java similarity index 91% rename from src/main/java/io/github/nomiceu/GTDrawers.java rename to src/main/java/com/nomiceu/gregtechdrawers/GTDrawers.java index a439428..263de71 100644 --- a/src/main/java/io/github/nomiceu/GTDrawers.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/GTDrawers.java @@ -1,8 +1,8 @@ -package io.github.nomiceu; +package com.nomiceu.gregtechdrawers; import org.apache.logging.log4j.Logger; -import io.github.nomiceu.proxy.CommonProxy; +import com.nomiceu.gregtechdrawers.proxy.CommonProxy; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -14,7 +14,7 @@ import net.minecraftforge.fml.common.event.FMLServerStartingEvent; @Mod(modid = GTDrawers.MODID, - version = GTDrawers.VERSION, + version = Tags.VERSION, name = GTDrawers.NAME, acceptedMinecraftVersions = "[1.12.2,1.13)", dependencies = "required:forge@[14.23.5.2847,);" @@ -22,7 +22,6 @@ + "required-after:storagedrawers;") public class GTDrawers { public static final String MODID = "gregtechdrawers"; - public static final String VERSION = "${version}"; public static final String NAME = "Gregtech Drawers"; diff --git a/src/main/java/io/github/nomiceu/block/BlockGTDrawers.java b/src/main/java/com/nomiceu/gregtechdrawers/block/BlockGTDrawers.java similarity index 89% rename from src/main/java/io/github/nomiceu/block/BlockGTDrawers.java rename to src/main/java/com/nomiceu/gregtechdrawers/block/BlockGTDrawers.java index f0841f6..353dc48 100644 --- a/src/main/java/io/github/nomiceu/block/BlockGTDrawers.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/block/BlockGTDrawers.java @@ -1,13 +1,13 @@ -package io.github.nomiceu.block; +package com.nomiceu.gregtechdrawers.block; import com.jaquadro.minecraft.storagedrawers.StorageDrawers; import com.jaquadro.minecraft.storagedrawers.api.storage.EnumBasicDrawer; import com.jaquadro.minecraft.storagedrawers.block.BlockStandardDrawers; import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers; -import io.github.nomiceu.GTDCreativeTabs; -import io.github.nomiceu.tileentity.TileEntityGTDrawers; -import io.github.nomiceu.type.DrawerMaterial; -import io.github.nomiceu.type.Mod; +import com.nomiceu.gregtechdrawers.GTDCreativeTabs; +import com.nomiceu.gregtechdrawers.tileentity.TileEntityGTDrawers; +import com.nomiceu.gregtechdrawers.type.DrawerMaterial; +import com.nomiceu.gregtechdrawers.type.Mod; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; diff --git a/src/main/java/io/github/nomiceu/block/BlockGTTrim.java b/src/main/java/com/nomiceu/gregtechdrawers/block/BlockGTTrim.java similarity index 84% rename from src/main/java/io/github/nomiceu/block/BlockGTTrim.java rename to src/main/java/com/nomiceu/gregtechdrawers/block/BlockGTTrim.java index 9451d9e..8535baf 100644 --- a/src/main/java/io/github/nomiceu/block/BlockGTTrim.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/block/BlockGTTrim.java @@ -1,10 +1,10 @@ -package io.github.nomiceu.block; +package com.nomiceu.gregtechdrawers.block; import com.jaquadro.minecraft.storagedrawers.StorageDrawers; import com.jaquadro.minecraft.storagedrawers.api.storage.INetworked; -import io.github.nomiceu.GTDCreativeTabs; -import io.github.nomiceu.type.DrawerMaterial; -import io.github.nomiceu.type.Mod; +import com.nomiceu.gregtechdrawers.type.DrawerMaterial; +import com.nomiceu.gregtechdrawers.type.Mod; +import com.nomiceu.gregtechdrawers.GTDCreativeTabs; import net.minecraft.block.Block; import net.minecraft.block.SoundType; diff --git a/src/main/java/io/github/nomiceu/block/model/GTDrawerModel.java b/src/main/java/com/nomiceu/gregtechdrawers/block/model/GTDrawerModel.java similarity index 97% rename from src/main/java/io/github/nomiceu/block/model/GTDrawerModel.java rename to src/main/java/com/nomiceu/gregtechdrawers/block/model/GTDrawerModel.java index 13be902..15f0a15 100644 --- a/src/main/java/io/github/nomiceu/block/model/GTDrawerModel.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/block/model/GTDrawerModel.java @@ -1,11 +1,12 @@ -package io.github.nomiceu.block.model; +package com.nomiceu.gregtechdrawers.block.model; import java.util.ArrayList; import java.util.List; import javax.annotation.Nonnull; -import io.github.nomiceu.GTDrawers; +import com.nomiceu.gregtechdrawers.GTDrawers; +import com.nomiceu.gregtechdrawers.block.BlockGTDrawers; import org.apache.logging.log4j.Level; import com.google.common.collect.ImmutableList; @@ -19,7 +20,6 @@ import com.jaquadro.minecraft.storagedrawers.block.modeldata.DrawerStateModelData; import com.jaquadro.minecraft.storagedrawers.client.model.component.DrawerDecoratorModel; import com.jaquadro.minecraft.storagedrawers.client.model.component.DrawerSealedModel; -import io.github.nomiceu.block.BlockGTDrawers; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; diff --git a/src/main/java/io/github/nomiceu/builtin.sdmods b/src/main/java/com/nomiceu/gregtechdrawers/builtin.sdmods similarity index 100% rename from src/main/java/io/github/nomiceu/builtin.sdmods rename to src/main/java/com/nomiceu/gregtechdrawers/builtin.sdmods diff --git a/src/main/java/io/github/nomiceu/event/RegistryEvents.java b/src/main/java/com/nomiceu/gregtechdrawers/event/RegistryEvents.java similarity index 90% rename from src/main/java/io/github/nomiceu/event/RegistryEvents.java rename to src/main/java/com/nomiceu/gregtechdrawers/event/RegistryEvents.java index 3bea415..72d27d3 100644 --- a/src/main/java/io/github/nomiceu/event/RegistryEvents.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/event/RegistryEvents.java @@ -1,16 +1,16 @@ -package io.github.nomiceu.event; +package com.nomiceu.gregtechdrawers.event; import com.jaquadro.minecraft.storagedrawers.StorageDrawers; import com.jaquadro.minecraft.storagedrawers.api.storage.EnumBasicDrawer; import com.jaquadro.minecraft.storagedrawers.config.ConfigManager; -import io.github.nomiceu.GTDrawers; -import io.github.nomiceu.block.BlockGTDrawers; -import io.github.nomiceu.block.BlockGTTrim; -import io.github.nomiceu.item.ItemGTDrawers; -import io.github.nomiceu.item.ItemGTTrim; -import io.github.nomiceu.type.DrawerMaterial; -import io.github.nomiceu.type.DrawerMaterial.AbstractItemStack; -import io.github.nomiceu.type.Mod; +import com.nomiceu.gregtechdrawers.GTDrawers; +import com.nomiceu.gregtechdrawers.block.BlockGTDrawers; +import com.nomiceu.gregtechdrawers.item.ItemGTDrawers; +import com.nomiceu.gregtechdrawers.item.ItemGTTrim; +import com.nomiceu.gregtechdrawers.type.DrawerMaterial; +import com.nomiceu.gregtechdrawers.type.Mod; +import com.nomiceu.gregtechdrawers.type.Mods; +import com.nomiceu.gregtechdrawers.block.BlockGTTrim; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -26,9 +26,6 @@ import java.util.ArrayList; import java.util.List; -import static io.github.nomiceu.type.Mods.BLOCKS; -import static io.github.nomiceu.type.Mods.ENABLED_MODS; -import static io.github.nomiceu.type.Mods.ITEMS; import static net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE; public class RegistryEvents { @@ -45,7 +42,7 @@ public void onBlockRegistryEvent(RegistryEvent.Register event) { break; } } - for(Block block : BLOCKS) { + for(Block block : Mods.BLOCKS) { boolean isDrawer = block instanceof BlockGTDrawers; boolean isTrim = block instanceof BlockGTTrim; if((!isDrawer || anyDrawerEnabled) @@ -67,7 +64,7 @@ public void onItemRegistryEvent(RegistryEvent.Register event) { break; } } - for(Item item : ITEMS) { + for(Item item : Mods.ITEMS) { boolean isDrawer = item instanceof ItemGTDrawers; boolean isTrim = item instanceof ItemGTTrim; if ((!isDrawer || anyDrawerEnabled) @@ -84,11 +81,11 @@ else if (isTrim) @SubscribeEvent public void onCraftingRegistryEvent(RegistryEvent.Register event) { IForgeRegistry registry = event.getRegistry(); - for (Mod mod : ENABLED_MODS) { + for (Mod mod : Mods.ENABLED_MODS) { for (DrawerMaterial material : mod) { int count = 0; List planks = new ArrayList<>(material.planks.length); - for (AbstractItemStack plankAbstract : material.planks) { + for (DrawerMaterial.AbstractItemStack plankAbstract : material.planks) { ItemStack plank = plankAbstract.toItemStack(mod); if (plank.isEmpty()) { GTDrawers.logger.warn("One of the planks for drawer material " + material.getName() + " is missing: " + plankAbstract); @@ -98,7 +95,7 @@ public void onCraftingRegistryEvent(RegistryEvent.Register event) { } } count = 0; - for (AbstractItemStack slabAbstract : material.slabs) { + for (DrawerMaterial.AbstractItemStack slabAbstract : material.slabs) { ItemStack slab = slabAbstract.toItemStack(mod); if (slab.isEmpty()) { GTDrawers.logger.warn("One of the slabs for drawer material " + material.getName() + " is missing: " + slabAbstract); diff --git a/src/main/java/io/github/nomiceu/event/RenderEvents.java b/src/main/java/com/nomiceu/gregtechdrawers/event/RenderEvents.java similarity index 77% rename from src/main/java/io/github/nomiceu/event/RenderEvents.java rename to src/main/java/com/nomiceu/gregtechdrawers/event/RenderEvents.java index 22f681d..2cdc9e0 100644 --- a/src/main/java/io/github/nomiceu/event/RenderEvents.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/event/RenderEvents.java @@ -1,16 +1,14 @@ -package io.github.nomiceu.event; - -import static io.github.nomiceu.type.Mods.DRAWERS_BLOCKS; -import static io.github.nomiceu.type.Mods.TRIM_ITEMS; +package com.nomiceu.gregtechdrawers.event; import com.jaquadro.minecraft.chameleon.Chameleon; import com.jaquadro.minecraft.chameleon.resources.ModelRegistry; -import io.github.nomiceu.GTDrawers; -import io.github.nomiceu.block.BlockGTDrawers; -import io.github.nomiceu.block.model.GTDrawerModel; -import io.github.nomiceu.item.ItemGTTrim; -import io.github.nomiceu.render.tileentity.TileEntityGTDrawersRenderer; -import io.github.nomiceu.tileentity.TileEntityGTDrawers; +import com.nomiceu.gregtechdrawers.GTDrawers; +import com.nomiceu.gregtechdrawers.block.BlockGTDrawers; +import com.nomiceu.gregtechdrawers.item.ItemGTTrim; +import com.nomiceu.gregtechdrawers.type.Mods; +import com.nomiceu.gregtechdrawers.block.model.GTDrawerModel; +import com.nomiceu.gregtechdrawers.render.tileentity.TileEntityGTDrawersRenderer; +import com.nomiceu.gregtechdrawers.tileentity.TileEntityGTDrawers; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -28,12 +26,12 @@ public class RenderEvents { @SubscribeEvent public void onModelRegistryEvent(ModelRegistryEvent event) { - for(ItemGTTrim trim : TRIM_ITEMS) { + for(ItemGTTrim trim : Mods.TRIM_ITEMS) { registerItem(trim); } ModelRegistry modelRegistry = Chameleon.instance.modelRegistry; - for(BlockGTDrawers drawers : DRAWERS_BLOCKS) { + for(BlockGTDrawers drawers : Mods.DRAWERS_BLOCKS) { //registerBlock(drawers); drawers.initDynamic(); modelRegistry.registerModel(new GTDrawerModel.Register(drawers)); diff --git a/src/main/java/io/github/nomiceu/item/ItemGTDrawers.java b/src/main/java/com/nomiceu/gregtechdrawers/item/ItemGTDrawers.java similarity index 94% rename from src/main/java/io/github/nomiceu/item/ItemGTDrawers.java rename to src/main/java/com/nomiceu/gregtechdrawers/item/ItemGTDrawers.java index b0943f7..af12af5 100644 --- a/src/main/java/io/github/nomiceu/item/ItemGTDrawers.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/item/ItemGTDrawers.java @@ -1,4 +1,4 @@ -package io.github.nomiceu.item; +package com.nomiceu.gregtechdrawers.item; import java.util.Arrays; import java.util.List; @@ -7,10 +7,10 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -import io.github.nomiceu.GTDrawers; -import io.github.nomiceu.block.BlockGTDrawers; -import io.github.nomiceu.type.DrawerMaterial; -import io.github.nomiceu.type.Mod; +import com.nomiceu.gregtechdrawers.GTDrawers; +import com.nomiceu.gregtechdrawers.block.BlockGTDrawers; +import com.nomiceu.gregtechdrawers.type.DrawerMaterial; +import com.nomiceu.gregtechdrawers.type.Mod; import org.apache.commons.lang3.tuple.Pair; import com.jaquadro.minecraft.chameleon.resources.IItemMeshMapper; diff --git a/src/main/java/io/github/nomiceu/item/ItemGTTrim.java b/src/main/java/com/nomiceu/gregtechdrawers/item/ItemGTTrim.java similarity index 85% rename from src/main/java/io/github/nomiceu/item/ItemGTTrim.java rename to src/main/java/com/nomiceu/gregtechdrawers/item/ItemGTTrim.java index ebf36fb..0a64efe 100644 --- a/src/main/java/io/github/nomiceu/item/ItemGTTrim.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/item/ItemGTTrim.java @@ -1,13 +1,13 @@ -package io.github.nomiceu.item; +package com.nomiceu.gregtechdrawers.item; import java.util.List; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import io.github.nomiceu.block.BlockGTTrim; -import io.github.nomiceu.type.DrawerMaterial; -import io.github.nomiceu.type.Mod; +import com.nomiceu.gregtechdrawers.block.BlockGTTrim; +import com.nomiceu.gregtechdrawers.type.DrawerMaterial; +import com.nomiceu.gregtechdrawers.type.Mod; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; diff --git a/src/main/java/io/github/nomiceu/proxy/ClientProxy.java b/src/main/java/com/nomiceu/gregtechdrawers/proxy/ClientProxy.java similarity index 76% rename from src/main/java/io/github/nomiceu/proxy/ClientProxy.java rename to src/main/java/com/nomiceu/gregtechdrawers/proxy/ClientProxy.java index 203ec79..f16a84b 100644 --- a/src/main/java/io/github/nomiceu/proxy/ClientProxy.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/proxy/ClientProxy.java @@ -1,6 +1,6 @@ -package io.github.nomiceu.proxy; +package com.nomiceu.gregtechdrawers.proxy; -import io.github.nomiceu.event.RenderEvents; +import com.nomiceu.gregtechdrawers.event.RenderEvents; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; diff --git a/src/main/java/io/github/nomiceu/proxy/CommonProxy.java b/src/main/java/com/nomiceu/gregtechdrawers/proxy/CommonProxy.java similarity index 78% rename from src/main/java/io/github/nomiceu/proxy/CommonProxy.java rename to src/main/java/com/nomiceu/gregtechdrawers/proxy/CommonProxy.java index 0d2b283..4b4c507 100644 --- a/src/main/java/io/github/nomiceu/proxy/CommonProxy.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/proxy/CommonProxy.java @@ -1,10 +1,10 @@ -package io.github.nomiceu.proxy; +package com.nomiceu.gregtechdrawers.proxy; -import io.github.nomiceu.GTDrawers; -import io.github.nomiceu.event.RegistryEvents; -import io.github.nomiceu.tileentity.GTDTileEntities; -import io.github.nomiceu.tileentity.TileEntityGTDrawers; -import io.github.nomiceu.type.Mods; +import com.nomiceu.gregtechdrawers.GTDrawers; +import com.nomiceu.gregtechdrawers.type.Mods; +import com.nomiceu.gregtechdrawers.event.RegistryEvents; +import com.nomiceu.gregtechdrawers.tileentity.GTDTileEntities; +import com.nomiceu.gregtechdrawers.tileentity.TileEntityGTDrawers; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/io/github/nomiceu/render/tileentity/TileEntityGTDrawersRenderer.java b/src/main/java/com/nomiceu/gregtechdrawers/render/tileentity/TileEntityGTDrawersRenderer.java similarity index 99% rename from src/main/java/io/github/nomiceu/render/tileentity/TileEntityGTDrawersRenderer.java rename to src/main/java/com/nomiceu/gregtechdrawers/render/tileentity/TileEntityGTDrawersRenderer.java index 2a2911b..95ccb22 100644 --- a/src/main/java/io/github/nomiceu/render/tileentity/TileEntityGTDrawersRenderer.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/render/tileentity/TileEntityGTDrawersRenderer.java @@ -1,4 +1,4 @@ -package io.github.nomiceu.render.tileentity; +package com.nomiceu.gregtechdrawers.render.tileentity; import java.util.List; @@ -21,7 +21,7 @@ import com.jaquadro.minecraft.storagedrawers.item.EnumUpgradeStatus; import com.jaquadro.minecraft.storagedrawers.util.CountFormatter; -import io.github.nomiceu.block.BlockGTDrawers; +import com.nomiceu.gregtechdrawers.block.BlockGTDrawers; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; diff --git a/src/main/java/io/github/nomiceu/tileentity/GTDTileEntities.java b/src/main/java/com/nomiceu/gregtechdrawers/tileentity/GTDTileEntities.java similarity index 60% rename from src/main/java/io/github/nomiceu/tileentity/GTDTileEntities.java rename to src/main/java/com/nomiceu/gregtechdrawers/tileentity/GTDTileEntities.java index 1fa2ad1..652aadc 100644 --- a/src/main/java/io/github/nomiceu/tileentity/GTDTileEntities.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/tileentity/GTDTileEntities.java @@ -1,4 +1,4 @@ -package io.github.nomiceu.tileentity; +package com.nomiceu.gregtechdrawers.tileentity; public class GTDTileEntities { diff --git a/src/main/java/io/github/nomiceu/tileentity/TileEntityGTDrawers.java b/src/main/java/com/nomiceu/gregtechdrawers/tileentity/TileEntityGTDrawers.java similarity index 99% rename from src/main/java/io/github/nomiceu/tileentity/TileEntityGTDrawers.java rename to src/main/java/com/nomiceu/gregtechdrawers/tileentity/TileEntityGTDrawers.java index 762368f..fc18f02 100644 --- a/src/main/java/io/github/nomiceu/tileentity/TileEntityGTDrawers.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/tileentity/TileEntityGTDrawers.java @@ -1,4 +1,4 @@ -package io.github.nomiceu.tileentity; +package com.nomiceu.gregtechdrawers.tileentity; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/src/main/java/io/github/nomiceu/type/DrawerMaterial.java b/src/main/java/com/nomiceu/gregtechdrawers/type/DrawerMaterial.java similarity index 96% rename from src/main/java/io/github/nomiceu/type/DrawerMaterial.java rename to src/main/java/com/nomiceu/gregtechdrawers/type/DrawerMaterial.java index 507ab17..e905036 100644 --- a/src/main/java/io/github/nomiceu/type/DrawerMaterial.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/type/DrawerMaterial.java @@ -1,4 +1,4 @@ -package io.github.nomiceu.type; +package com.nomiceu.gregtechdrawers.type; import static net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE; @@ -9,10 +9,10 @@ import java.util.Objects; import java.util.Optional; -import io.github.nomiceu.block.BlockGTDrawers; -import io.github.nomiceu.block.BlockGTTrim; -import io.github.nomiceu.item.ItemGTDrawers; -import io.github.nomiceu.item.ItemGTTrim; +import com.nomiceu.gregtechdrawers.block.BlockGTDrawers; +import com.nomiceu.gregtechdrawers.item.ItemGTDrawers; +import com.nomiceu.gregtechdrawers.item.ItemGTTrim; +import com.nomiceu.gregtechdrawers.block.BlockGTTrim; import net.minecraft.block.Block; import net.minecraft.item.Item; diff --git a/src/main/java/io/github/nomiceu/type/FilterableIterable.java b/src/main/java/com/nomiceu/gregtechdrawers/type/FilterableIterable.java similarity index 93% rename from src/main/java/io/github/nomiceu/type/FilterableIterable.java rename to src/main/java/com/nomiceu/gregtechdrawers/type/FilterableIterable.java index 6792400..5a2fdcf 100644 --- a/src/main/java/io/github/nomiceu/type/FilterableIterable.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/type/FilterableIterable.java @@ -1,4 +1,4 @@ -package io.github.nomiceu.type; +package com.nomiceu.gregtechdrawers.type; import java.util.Iterator; import java.util.function.Predicate; diff --git a/src/main/java/io/github/nomiceu/type/Mod.java b/src/main/java/com/nomiceu/gregtechdrawers/type/Mod.java similarity index 98% rename from src/main/java/io/github/nomiceu/type/Mod.java rename to src/main/java/com/nomiceu/gregtechdrawers/type/Mod.java index 6d951c3..b227194 100644 --- a/src/main/java/io/github/nomiceu/type/Mod.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/type/Mod.java @@ -1,4 +1,4 @@ -package io.github.nomiceu.type; +package com.nomiceu.gregtechdrawers.type; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/io/github/nomiceu/type/ModListParser.java b/src/main/java/com/nomiceu/gregtechdrawers/type/ModListParser.java similarity index 98% rename from src/main/java/io/github/nomiceu/type/ModListParser.java rename to src/main/java/com/nomiceu/gregtechdrawers/type/ModListParser.java index 9d4235a..b1a4103 100644 --- a/src/main/java/io/github/nomiceu/type/ModListParser.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/type/ModListParser.java @@ -1,4 +1,4 @@ -package io.github.nomiceu.type; +package com.nomiceu.gregtechdrawers.type; import static java.lang.Character.isWhitespace; @@ -14,7 +14,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import io.github.nomiceu.GTDrawers; +import com.nomiceu.gregtechdrawers.GTDrawers; import org.apache.commons.lang3.StringUtils; import net.minecraftforge.oredict.OreDictionary; diff --git a/src/main/java/io/github/nomiceu/type/Mods.java b/src/main/java/com/nomiceu/gregtechdrawers/type/Mods.java similarity index 98% rename from src/main/java/io/github/nomiceu/type/Mods.java rename to src/main/java/com/nomiceu/gregtechdrawers/type/Mods.java index 1020d9b..74dcbb9 100644 --- a/src/main/java/io/github/nomiceu/type/Mods.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/type/Mods.java @@ -1,16 +1,16 @@ -package io.github.nomiceu.type; +package com.nomiceu.gregtechdrawers.type; import java.util.Map; import java.util.Scanner; import java.util.stream.Collectors; -import io.github.nomiceu.GTDrawers; -import io.github.nomiceu.block.BlockGTDrawers; -import io.github.nomiceu.block.BlockGTTrim; +import com.nomiceu.gregtechdrawers.GTDrawers; +import com.nomiceu.gregtechdrawers.block.BlockGTDrawers; +import com.nomiceu.gregtechdrawers.block.BlockGTTrim; import org.apache.commons.lang3.tuple.Pair; -import io.github.nomiceu.item.ItemGTDrawers; -import io.github.nomiceu.item.ItemGTTrim; +import com.nomiceu.gregtechdrawers.item.ItemGTDrawers; +import com.nomiceu.gregtechdrawers.item.ItemGTTrim; import net.minecraft.block.Block; import net.minecraft.item.Item; diff --git a/src/main/java/io/github/nomiceu/type/NestedIterator.java b/src/main/java/com/nomiceu/gregtechdrawers/type/NestedIterator.java similarity index 78% rename from src/main/java/io/github/nomiceu/type/NestedIterator.java rename to src/main/java/com/nomiceu/gregtechdrawers/type/NestedIterator.java index cbee6b1..3e62659 100644 --- a/src/main/java/io/github/nomiceu/type/NestedIterator.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/type/NestedIterator.java @@ -1,6 +1,4 @@ -package io.github.nomiceu.type; - -import static io.github.nomiceu.type.DrawerMaterial.emptyIterator; +package com.nomiceu.gregtechdrawers.type; import java.util.Iterator; @@ -10,7 +8,7 @@ class NestedIterator implements Iterator { NestedIterator(Iterator> iterators) { this.iterators = iterators; - this.iter = iterators.hasNext()? iterators.next() : emptyIterator(); + this.iter = iterators.hasNext()? iterators.next() : DrawerMaterial.emptyIterator(); } @Override diff --git a/src/main/java/io/github/nomiceu/type/StreamableFilterableIterable.java b/src/main/java/com/nomiceu/gregtechdrawers/type/StreamableFilterableIterable.java similarity index 96% rename from src/main/java/io/github/nomiceu/type/StreamableFilterableIterable.java rename to src/main/java/com/nomiceu/gregtechdrawers/type/StreamableFilterableIterable.java index 762696e..4d40bfe 100644 --- a/src/main/java/io/github/nomiceu/type/StreamableFilterableIterable.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/type/StreamableFilterableIterable.java @@ -1,4 +1,4 @@ -package io.github.nomiceu.type; +package com.nomiceu.gregtechdrawers.type; import java.util.Collection; import java.util.Iterator; diff --git a/src/main/java/io/github/nomiceu/type/StreamableIterable.java b/src/main/java/com/nomiceu/gregtechdrawers/type/StreamableIterable.java similarity index 95% rename from src/main/java/io/github/nomiceu/type/StreamableIterable.java rename to src/main/java/com/nomiceu/gregtechdrawers/type/StreamableIterable.java index f313fc2..8264136 100644 --- a/src/main/java/io/github/nomiceu/type/StreamableIterable.java +++ b/src/main/java/com/nomiceu/gregtechdrawers/type/StreamableIterable.java @@ -1,4 +1,4 @@ -package io.github.nomiceu.type; +package com.nomiceu.gregtechdrawers.type; import java.util.Collection; import java.util.Iterator;