diff --git a/build.gradle b/build.gradle index 6866c84..e57a16f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,1608 +1,5 @@ -//version: 1700844281 -/* - 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/GTNewHorizons/ExampleMod1.7.10/blob/master/build.gradle for updates. - */ +//version: 1707058017 - -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -import com.gtnewhorizons.retrofuturagradle.ObfuscationAttribute -import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar -import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask -import com.gtnewhorizons.retrofuturagradle.util.Distribution -import com.matthewprenger.cursegradle.CurseArtifact -import com.matthewprenger.cursegradle.CurseRelation -import com.modrinth.minotaur.dependencies.ModDependency -import com.modrinth.minotaur.dependencies.VersionDependency -import org.gradle.internal.logging.text.StyledTextOutput.Style -import org.gradle.internal.logging.text.StyledTextOutputFactory -import org.gradle.internal.xml.XmlTransformer -import org.jetbrains.gradle.ext.Application -import org.jetbrains.gradle.ext.Gradle - -import javax.inject.Inject -import java.nio.file.Files -import java.nio.file.Paths -import java.util.concurrent.TimeUnit - -buildscript { - repositories { - maven { - // GTNH RetroFuturaGradle and ASM Fork - name "GTNH Maven" - url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" - allowInsecureProtocol = true - } - mavenLocal() - } -} plugins { - id 'java-library' - id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7" - id 'eclipse' - id 'scala' - id 'maven-publish' - id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false - id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false - id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false - id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle - id 'com.github.johnrengelman.shadow' version '8.1.1' apply false - id 'com.palantir.git-version' version '3.0.0' apply false - id 'de.undercouch.download' version '5.4.0' - id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle - id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version - id 'com.modrinth.minotaur' version '2.+' apply false - id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.3.24' -} - -print("You might want to check out './gradlew :faq' if your build fails.\n") - -boolean settingsupdated = verifySettingsGradle() -settingsupdated = verifyGitAttributes() || settingsupdated -if (settingsupdated) - throw new GradleException("Settings has been updated, please re-run task.") - -// In submodules, .git is a file pointing to the real git dir -if (project.file('.git/HEAD').isFile() || project.file('.git').isFile()) { - apply plugin: 'com.palantir.git-version' -} - -def out = services.get(StyledTextOutputFactory).create('an-output') - -def projectJavaVersion = JavaLanguageVersion.of(8) - -boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false -boolean disableCheckstyle = project.hasProperty("disableCheckstyle") ? project.disableCheckstyle.toBoolean() : false - -final String CHECKSTYLE_CONFIG = """ - - - - - - - - - - - -""" - -checkPropertyExists("modName") -checkPropertyExists("modId") -checkPropertyExists("modGroup") -checkPropertyExists("autoUpdateBuildScript") -checkPropertyExists("minecraftVersion") -checkPropertyExists("forgeVersion") -checkPropertyExists("replaceGradleTokenInFile") -checkPropertyExists("gradleTokenVersion") -checkPropertyExists("apiPackage") -checkPropertyExists("accessTransformersFile") -checkPropertyExists("usesMixins") -checkPropertyExists("mixinPlugin") -checkPropertyExists("mixinsPackage") -checkPropertyExists("coreModClass") -checkPropertyExists("containsMixinsAndOrCoreModOnly") -checkPropertyExists("usesShadowedDependencies") -checkPropertyExists("developmentEnvironmentUserName") - -propertyDefaultIfUnset("generateGradleTokenClass", "") -propertyDefaultIfUnset("includeWellKnownRepositories", true) -propertyDefaultIfUnset("noPublishedSources", false) -propertyDefaultIfUnset("usesMixinDebug", project.usesMixins) -propertyDefaultIfUnset("forceEnableMixins", false) -propertyDefaultIfUnset("channel", "stable") -propertyDefaultIfUnset("mappingsVersion", "12") -propertyDefaultIfUnset("usesMavenPublishing", true) -propertyDefaultIfUnset("mavenPublishUrl", "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases") -propertyDefaultIfUnset("modrinthProjectId", "") -propertyDefaultIfUnset("modrinthRelations", "") -propertyDefaultIfUnset("curseForgeProjectId", "") -propertyDefaultIfUnset("curseForgeRelations", "") -propertyDefaultIfUnset("minimizeShadowedDependencies", true) -propertyDefaultIfUnset("relocateShadowedDependencies", true) -// Deprecated properties (kept for backwards compat) -propertyDefaultIfUnset("gradleTokenModId", "") -propertyDefaultIfUnset("gradleTokenModName", "") -propertyDefaultIfUnset("gradleTokenGroupName", "") - -propertyDefaultIfUnset("enableModernJavaSyntax", false) // On by default for new projects only -propertyDefaultIfUnset("enableGenericInjection", false) // On by default for new projects only - -// this is meant to be set using the user wide property file. by default we do nothing. -propertyDefaultIfUnset("ideaOverrideBuildType", "") // Can be nothing, "gradle" or "idea" - -project.extensions.add(com.diffplug.blowdryer.Blowdryer, "Blowdryer", com.diffplug.blowdryer.Blowdryer) // Make blowdryer available in "apply from:" scripts -if (!disableSpotless) { - apply plugin: 'com.diffplug.spotless' - apply from: Blowdryer.file('spotless.gradle') -} - -if (!disableCheckstyle) { - apply plugin: 'checkstyle' - tasks.named("checkstylePatchedMc") { enabled = false } - tasks.named("checkstyleMcLauncher") { enabled = false } - tasks.named("checkstyleIdeVirtualMain") { enabled = false } - tasks.named("checkstyleInjectedTags") { enabled = false } - checkstyle { - config = resources.text.fromString(CHECKSTYLE_CONFIG) - } -} - -String javaSourceDir = "src/main/java/" -String scalaSourceDir = "src/main/scala/" -String kotlinSourceDir = "src/main/kotlin/" - -if (usesShadowedDependencies.toBoolean()) { - apply plugin: "com.github.johnrengelman.shadow" -} - -java { - toolchain { - if (enableModernJavaSyntax.toBoolean()) { - languageVersion.set(JavaLanguageVersion.of(17)) - } else { - languageVersion.set(projectJavaVersion) - } - vendor.set(JvmVendorSpec.AZUL) - } - if (!noPublishedSources) { - withSourcesJar() - } -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = "UTF-8" -} - -tasks.withType(ScalaCompile).configureEach { - options.encoding = "UTF-8" -} - -pluginManager.withPlugin('org.jetbrains.kotlin.jvm') { - // If Kotlin is enabled in the project - kotlin { - jvmToolchain(8) - } - // Kotlin hacks our source sets, so we hack Kotlin's tasks - def disabledKotlinTaskList = [ - "kaptGenerateStubsMcLauncherKotlin", - "kaptGenerateStubsPatchedMcKotlin", - "kaptGenerateStubsInjectedTagsKotlin", - "compileMcLauncherKotlin", - "compilePatchedMcKotlin", - "compileInjectedTagsKotlin", - "kaptMcLauncherKotlin", - "kaptPatchedMcKotlin", - "kaptInjectedTagsKotlin", - "kspMcLauncherKotlin", - "kspPatchedMcKotlin", - "kspInjectedTagsKotlin", - ] - tasks.configureEach { task -> - if (task.name in disabledKotlinTaskList) { - task.enabled = false - } - } -} - -configurations { - create("runtimeOnlyNonPublishable") { - description = "Runtime only dependencies that are not published alongside the jar" - canBeConsumed = false - canBeResolved = false - } - - create("devOnlyNonPublishable") { - description = "Runtime and compiletime dependencies that are not published alongside the jar (compileOnly + runtimeOnlyNonPublishable)" - canBeConsumed = false - canBeResolved = false - } - compileOnly.extendsFrom(devOnlyNonPublishable) - runtimeOnlyNonPublishable.extendsFrom(devOnlyNonPublishable) -} - -if (enableModernJavaSyntax.toBoolean()) { - repositories { - mavenCentral { - mavenContent { - includeGroup("me.eigenraven.java8unsupported") - } - } - } - - dependencies { - annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' - // workaround for https://github.com/bsideup/jabel/issues/174 - annotationProcessor 'net.java.dev.jna:jna-platform:5.13.0' - compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { - transitive = false // We only care about the 1 annotation class - } - // Allow using jdk.unsupported classes like sun.misc.Unsafe in the compiled code, working around JDK-8206937. - patchedMinecraft('me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0') - } - - tasks.withType(JavaCompile).configureEach { - if (it.name in ["compileMcLauncherJava", "compilePatchedMcJava"]) { - return - } - sourceCompatibility = 17 // for the IDE support - options.release.set(8) - - javaCompiler.set(javaToolchains.compilerFor { - languageVersion.set(JavaLanguageVersion.of(17)) - vendor.set(JvmVendorSpec.AZUL) - }) - } -} - -eclipse { - classpath { - downloadSources = true - downloadJavadoc = true - } -} - -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 -String targetPackageKotlin = kotlinSourceDir + modGroupPath -if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { - throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) -} - -if (apiPackage) { - targetPackageJava = javaSourceDir + modGroupPath + "/" + apiPackagePath - targetPackageScala = scalaSourceDir + modGroupPath + "/" + apiPackagePath - targetPackageKotlin = kotlinSourceDir + modGroupPath + "/" + apiPackagePath - if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { - throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) - } -} - -if (accessTransformersFile) { - for (atFile in accessTransformersFile.split(" ")) { - String targetFile = "src/main/resources/META-INF/" + atFile.trim() - if (!getFile(targetFile).exists()) { - throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) - } - tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile) - tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile) - } -} else { - boolean atsFound = false - for (File at : sourceSets.getByName("main").resources.files) { - if (at.name.toLowerCase().endsWith("_at.cfg")) { - atsFound = true - tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at) - tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at) - } - } - for (File at : sourceSets.getByName("api").resources.files) { - if (at.name.toLowerCase().endsWith("_at.cfg")) { - atsFound = true - tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at) - tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at) - } - } - if (atsFound) { - logger.warn("Found and added access transformers in the resources folder, please configure gradle.properties to explicitly mention them by name") - } -} - -if (usesMixins.toBoolean()) { - if (mixinsPackage.isEmpty()) { - throw new GradleException("\"usesMixins\" requires \"mixinsPackage\" to be set!") - } - final String mixinPackagePath = mixinsPackage.toString().replaceAll("\\.", "/") - final String mixinPluginPath = mixinPlugin.toString().replaceAll("\\.", "/") - - targetPackageJava = javaSourceDir + modGroupPath + "/" + mixinPackagePath - targetPackageScala = scalaSourceDir + modGroupPath + "/" + mixinPackagePath - targetPackageKotlin = kotlinSourceDir + modGroupPath + "/" + mixinPackagePath - if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { - throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) - } - - if (!mixinPlugin.isEmpty()) { - String targetFileJava = javaSourceDir + modGroupPath + "/" + mixinPluginPath + ".java" - String targetFileScala = scalaSourceDir + modGroupPath + "/" + mixinPluginPath + ".scala" - String targetFileScalaJava = scalaSourceDir + modGroupPath + "/" + mixinPluginPath + ".java" - String targetFileKotlin = kotlinSourceDir + modGroupPath + "/" + mixinPluginPath + ".kt" - if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { - throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) - } - } -} - -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" - String targetFileKotlin = kotlinSourceDir + modGroupPath + "/" + coreModPath + ".kt" - if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { - throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) - } -} - -configurations.configureEach { - resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) - - // Make sure GregTech build won't time out - System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String) - System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String) -} - -// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version -try { - 'git config core.fileMode false'.execute() -} -catch (Exception ignored) { - out.style(Style.Failure).println("git isn't installed at all") -} - -// Pulls version first from the VERSION env and then git tag -String identifiedVersion -String versionOverride = System.getenv("VERSION") ?: null -try { - // Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty - if (versionOverride == null) { - def gitDetails = versionDetails() - def isDirty = gitVersion().endsWith(".dirty") // No public API for this, isCleanTag has a different meaning - String branchName = gitDetails.branchName ?: (System.getenv('GIT_BRANCH') ?: 'git') - if (branchName.startsWith('origin/')) { - branchName = branchName.minus('origin/') - } - branchName = branchName.replaceAll("[^a-zA-Z0-9-]+", "-") // sanitize branch names for semver - identifiedVersion = gitDetails.lastTag ?: '${gitDetails.gitHash}' - if (gitDetails.commitDistance > 0) { - identifiedVersion += "-${branchName}.${gitDetails.commitDistance}+${gitDetails.gitHash}" - if (isDirty) { - identifiedVersion += "-dirty" - } - } else if (isDirty) { - identifiedVersion += "-${branchName}+${gitDetails.gitHash}-dirty" - } - } else { - identifiedVersion = versionOverride - } -} -catch (Exception ignored) { - out.style(Style.Failure).text( - 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + - 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + - 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' - ) - versionOverride = 'NO-GIT-TAG-SET' - identifiedVersion = versionOverride -} -version = identifiedVersion -ext { - modVersion = identifiedVersion -} - -if (identifiedVersion == versionOverride) { - out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7') -} - -group = "com.github.GTNewHorizons" -if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { - base { - archivesName = customArchiveBaseName - } -} else { - base { - archivesName = modId - } -} - - -minecraft { - if (replaceGradleTokenInFile) { - for (f in replaceGradleTokenInFile.split(',')) { - tagReplacementFiles.add f - } - } - if (gradleTokenModId) { - injectedTags.put gradleTokenModId, modId - } - if (gradleTokenModName) { - injectedTags.put gradleTokenModName, modName - } - if (gradleTokenVersion) { - injectedTags.put gradleTokenVersion, modVersion - } - if (gradleTokenGroupName) { - injectedTags.put gradleTokenGroupName, modGroup - } - if (enableGenericInjection.toBoolean()) { - injectMissingGenerics.set(true) - } - - username = developmentEnvironmentUserName.toString() - - lwjgl3Version = "3.3.2" - - // Enable assertions in the current mod - extraRunJvmArguments.add("-ea:${modGroup}") - - if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - if (usesMixinDebug.toBoolean()) { - extraRunJvmArguments.addAll([ - "-Dmixin.debug.countInjections=true", - "-Dmixin.debug.verbose=true", - "-Dmixin.debug.export=true" - ]) - } - } - - // Blowdryer is present in some old mod builds, do not propagate it further as a dependency - // IC2 has no reobf jars in its Maven - groupsToExcludeFromAutoReobfMapping.addAll(["com.diffplug", "com.diffplug.durian", "net.industrial-craft"]) -} - -if (generateGradleTokenClass) { - tasks.injectTags.outputClassName.set(generateGradleTokenClass) -} - -// Custom reobf auto-mappings -configurations.configureEach { - dependencies.configureEach { dep -> - if (dep instanceof org.gradle.api.artifacts.ExternalModuleDependency) { - if (dep.group == "net.industrial-craft" && dep.name == "industrialcraft-2") { - // https://www.curseforge.com/minecraft/mc-mods/industrial-craft/files/2353971 - project.dependencies.reobfJarConfiguration("curse.maven:ic2-242638:2353971") - } - } - } - def obfuscationAttr = it.attributes.getAttribute(ObfuscationAttribute.OBFUSCATION_ATTRIBUTE) - if (obfuscationAttr != null && obfuscationAttr.name == ObfuscationAttribute.SRG) { - resolutionStrategy.eachDependency { DependencyResolveDetails details -> - // Remap CoFH core cursemaven dev jar to the obfuscated version for runObfClient/Server - if (details.requested.group == 'curse.maven' && details.requested.name.endsWith('-69162') && details.requested.version == '2388751') { - details.useVersion '2388750' - details.because 'Pick obfuscated jar' - } - } - } -} - -// Ensure tests have access to minecraft classes -sourceSets { - test { - java { - compileClasspath += sourceSets.patchedMc.output + sourceSets.mcLauncher.output - runtimeClasspath += sourceSets.patchedMc.output + sourceSets.mcLauncher.output - } - } -} - -if (file('addon.gradle.kts').exists()) { - apply from: 'addon.gradle.kts' -} else if (file('addon.gradle').exists()) { - apply from: 'addon.gradle' -} - -// File for local tweaks not commited to Git -if (file('addon.local.gradle.kts').exists()) { - apply from: 'addon.local.gradle.kts' -} else if (file('addon.local.gradle').exists()) { - apply from: 'addon.local.gradle' -} - -// Allow unsafe repos but warn -repositories.configureEach { repo -> - if (repo instanceof org.gradle.api.artifacts.repositories.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 - } - } -} - -if (file('repositories.gradle.kts').exists()) { - apply from: 'repositories.gradle.kts' -} else if (file('repositories.gradle').exists()) { - apply from: 'repositories.gradle' -} else { - logger.error("Neither repositories.gradle.kts nor repositories.gradle was found, make sure you extracted the full ExampleMod template.") - throw new RuntimeException("Missing repositories.gradle[.kts]") -} - -configurations { - runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable) - testRuntimeClasspath.extendsFrom(runtimeOnlyNonPublishable) - for (config in [compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath]) { - if (usesShadowedDependencies.toBoolean()) { - config.extendsFrom(shadowImplementation) - // TODO: remove Compile after all uses are refactored to Implementation - config.extendsFrom(shadeCompile) - config.extendsFrom(shadowCompile) - } - } - // A "bag-of-dependencies"-style configuration for backwards compatibility, gets put in "api" - create("compile") { - description = "Deprecated: use api or implementation instead, gets put in api" - canBeConsumed = false - canBeResolved = false - visible = false - } - create("testCompile") { - description = "Deprecated: use testImplementation instead" - canBeConsumed = false - canBeResolved = false - visible = false - } - api.extendsFrom(compile) - testImplementation.extendsFrom(testCompile) -} - -afterEvaluate { - if (!configurations.compile.allDependencies.empty || !configurations.testCompile.allDependencies.empty) { - logger.warn("This project uses deprecated `compile` dependencies, please migrate to using `api` and `implementation`") - logger.warn("For more details, see https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/dependencies.gradle") - } -} - -repositories { - maven { - name 'Overmind forge repo mirror' - url 'https://gregtech.overminddl1.com/' - } - maven { - name = "GTNH Maven" - url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" - allowInsecureProtocol = true - } - maven { - name 'sonatype' - url 'https://oss.sonatype.org/content/repositories/snapshots/' - content { - includeGroup "org.lwjgl" - } - } - if (includeWellKnownRepositories.toBoolean()) { - exclusiveContent { - forRepository { - maven { - name "CurseMaven" - url "https://cursemaven.com" - } - } - filter { - includeGroup "curse.maven" - } - } - exclusiveContent { - forRepository { - maven { - name = "Modrinth" - url = "https://api.modrinth.com/maven" - } - } - filter { - includeGroup "maven.modrinth" - } - } - maven { - name = "ic2" - url = getURL("https://maven.ic2.player.to/", "https://maven2.ic2.player.to/") - content { - includeGroup "net.industrial-craft" - } - metadataSources { - mavenPom() - artifact() - } - } - maven { - name "MMD Maven" - url "https://maven.mcmoddev.com/" - } - } -} - -def mixinProviderGroup = "io.github.legacymoddingmc" -def mixinProviderModule = "unimixins" -def mixinProviderVersion = "0.1.13" -def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}" -def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev" -ext.mixinProviderSpec = mixinProviderSpec - -def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' - -dependencies { - if (usesMixins.toBoolean()) { - annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') - annotationProcessor('com.google.guava:guava:24.1.1-jre') - annotationProcessor('com.google.code.gson:gson:2.8.6') - annotationProcessor(mixinProviderSpec) - if (usesMixinDebug.toBoolean()) { - runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16') - } - } - if (usesMixins.toBoolean()) { - implementation(modUtils.enableMixins(mixinProviderSpec, mixingConfigRefMap)) - } else if (forceEnableMixins.toBoolean()) { - runtimeOnlyNonPublishable(mixinProviderSpec) - } -} - -pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { - if (usesMixins.toBoolean()) { - dependencies { - kapt(mixinProviderSpec) - } - } -} - -// Replace old mixin mods with unimixins -// https://docs.gradle.org/8.0.2/userguide/resolution_rules.html#sec:substitution_with_classifier -configurations.all { - resolutionStrategy.dependencySubstitution { - substitute module('com.gtnewhorizon:gtnhmixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") - substitute module('com.github.GTNewHorizons:Mixingasm') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") - substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") - substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") - substitute module('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier") - } -} - -dependencies { - constraints { - def minGtnhLibVersion = "0.0.13" - implementation("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { - because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") - } - runtimeOnly("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { - because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") - } - devOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { - because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") - } - runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { - because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") - } - } -} - -if (file('dependencies.gradle.kts').exists()) { - apply from: 'dependencies.gradle.kts' -} else if (file('dependencies.gradle').exists()) { - apply from: 'dependencies.gradle' -} else { - logger.error("Neither dependencies.gradle.kts nor dependencies.gradle was found, make sure you extracted the full ExampleMod template.") - throw new RuntimeException("Missing dependencies.gradle[.kts]") -} - -tasks.register('generateAssets') { - group = "GTNH Buildscript" - description = "Generates a mixin config file at /src/main/resources/mixins.modid.json if needed" - onlyIf { usesMixins.toBoolean() } - doLast { - def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json") - if (!mixinConfigFile.exists()) { - def mixinPluginLine = "" - if (!mixinPlugin.isEmpty()) { - // We might not have a mixin plugin if we're using early/late mixins - mixinPluginLine += """\n "plugin": "${modGroup}.${mixinPlugin}", """ - } - - mixinConfigFile.text = """{ - "required": true, - "minVersion": "0.8.5-GTNH", - "package": "${modGroup}.${mixinsPackage}",${mixinPluginLine} - "refmap": "${mixingConfigRefMap}", - "target": "@env(DEFAULT)", - "compatibilityLevel": "JAVA_8", - "mixins": [], - "client": [], - "server": [] -} -""" - } - } -} - -if (usesMixins.toBoolean()) { - tasks.named("processResources").configure { - dependsOn("generateAssets") - } - - tasks.named("compileJava", JavaCompile).configure { - options.compilerArgs += [ - // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code - "-XDenableSunApiLintControl", - "-XDignore.symbol.file" - ] - } -} - -tasks.named("processResources", ProcessResources).configure { - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.mcVersion - exclude("spotless.gradle") - - // replace stuff in mcmod.info, nothing else. replaces ${key} with value in text - filesMatching("mcmod.info") { - expand "minecraftVersion": project.minecraft.mcVersion, - "modVersion": modVersion, - "modId": modId, - "modName": modName - } - - if (usesMixins.toBoolean()) { - dependsOn("compileJava", "compileScala") - } -} - -ext.java17Toolchain = (JavaToolchainSpec spec) -> { - spec.languageVersion.set(JavaLanguageVersion.of(17)) - spec.vendor.set(JvmVendorSpec.matching("jetbrains")) -} - -ext.java17DependenciesCfg = configurations.create("java17Dependencies") { - extendsFrom(configurations.getByName("runtimeClasspath")) // Ensure consistent transitive dependency resolution - canBeConsumed = false -} -ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies") { - canBeConsumed = false -} - -dependencies { - def lwjgl3ifyVersion = '1.5.7' - if (modId != 'lwjgl3ify') { - java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") - } - if (modId != 'hodgepodge') { - java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.35') - } - - java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false} -} - -ext.java17JvmArgs = [ - // Java 9+ support - "--illegal-access=warn", - "-Djava.security.manager=allow", - "-Dfile.encoding=UTF-8", - "--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED", - "--add-opens", "java.base/java.net=ALL-UNNAMED", - "--add-opens", "java.base/java.nio=ALL-UNNAMED", - "--add-opens", "java.base/java.io=ALL-UNNAMED", - "--add-opens", "java.base/java.lang=ALL-UNNAMED", - "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", - "--add-opens", "java.base/java.text=ALL-UNNAMED", - "--add-opens", "java.base/java.util=ALL-UNNAMED", - "--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED", - "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", - "--add-opens", "jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED,java.naming", - "--add-opens", "java.desktop/sun.awt.image=ALL-UNNAMED", - "--add-modules", "jdk.dynalink", - "--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED", - "--add-modules", "java.sql.rowset", - "--add-opens", "java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED" -] - -ext.hotswapJvmArgs = [ - // DCEVM advanced hot reload - "-XX:+AllowEnhancedClassRedefinition", - "-XX:HotswapAgent=fatjar" -] - -ext.setupHotswapAgentTask = tasks.register("setupHotswapAgent") { - group = "GTNH Buildscript" - description = "Installs a recent version of HotSwapAgent into the Java 17 JetBrains runtime directory" - def hsaUrl = 'https://github.com/HotswapProjects/HotswapAgent/releases/download/1.4.2-SNAPSHOT/hotswap-agent-1.4.2-SNAPSHOT.jar' - def targetFolderProvider = javaToolchains.launcherFor(java17Toolchain).map {it.metadata.installationPath.dir("lib/hotswap")} - def targetFilename = "hotswap-agent.jar" - onlyIf { - !targetFolderProvider.get().file(targetFilename).asFile.exists() - } - doLast { - def targetFolder = targetFolderProvider.get() - targetFolder.asFile.mkdirs() - download.run { - src hsaUrl - dest targetFolder.file(targetFilename).asFile - overwrite false - tempAndMove true - } - } -} - -public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask { - // IntelliJ doesn't seem to allow commandline arguments so we also support an env variable - private boolean enableHotswap = Boolean.valueOf(System.getenv("HOTSWAP")); - - @Input - public boolean getEnableHotswap() { return enableHotswap } - @Option(option = "hotswap", description = "Enables HotSwapAgent for enhanced class reloading under a debugger") - public boolean setEnableHotswap(boolean enable) { enableHotswap = enable } - - @Inject - public RunHotswappableMinecraftTask(Distribution side, String superTask, org.gradle.api.invocation.Gradle gradle) { - super(side, gradle) - - this.lwjglVersion = 3 - this.javaLauncher = project.javaToolchains.launcherFor(project.java17Toolchain) - this.extraJvmArgs.addAll(project.java17JvmArgs) - this.extraJvmArgs.addAll(project.provider(() -> enableHotswap ? project.hotswapJvmArgs : [])) - - this.classpath(project.java17PatchDependenciesCfg) - if (side == Distribution.CLIENT) { - this.classpath(project.minecraftTasks.lwjgl3Configuration) - } - // Use a raw provider instead of map to not create a dependency on the task - this.classpath(project.provider(() -> project.tasks.named(superTask, RunMinecraftTask).get().classpath)) - this.classpath.filter { file -> - !file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2 - } - this.classpath(project.java17DependenciesCfg) - } - - public void setup(Project project) { - super.setup(project) - if (project.usesMixins.toBoolean()) { - this.extraJvmArgs.addAll(project.provider(() -> { - def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create(project.mixinProviderSpec)) - mixinCfg.canBeConsumed = false - mixinCfg.transitive = false - enableHotswap ? ["-javaagent:" + mixinCfg.singleFile.absolutePath] : [] - })) - } - } -} - -def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient") -runClient17Task.configure { - setup(project) - group = "Modded Minecraft" - description = "Runs the modded client using Java 17, lwjgl3ify and Hodgepodge" - dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar') - mainClass = "GradleStart" - username = minecraft.username - userUUID = minecraft.userUUID -} - -def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Distribution.DEDICATED_SERVER, "runServer") -runServer17Task.configure { - setup(project) - group = "Modded Minecraft" - description = "Runs the modded server using Java 17, lwjgl3ify and Hodgepodge" - dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar') - mainClass = "GradleStartServer" - extraArgs.add("nogui") -} - -def getManifestAttributes() { - def manifestAttributes = [:] - if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { - manifestAttributes += ["FMLCorePluginContainsFMLMod": true] - } - - if (accessTransformersFile) { - manifestAttributes += ["FMLAT": accessTransformersFile.toString()] - } - - if (coreModClass) { - manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] - } - - if (usesMixins.toBoolean()) { - manifestAttributes += [ - "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs" : "mixins." + modId + ".json", - "ForceLoadAsMod": !containsMixinsAndOrCoreModOnly.toBoolean() - ] - } - return manifestAttributes -} - -tasks.named("jar", Jar).configure { - manifest { - attributes(getManifestAttributes()) - } -} - -if (usesShadowedDependencies.toBoolean()) { - tasks.named("shadowJar", ShadowJar).configure { - manifest { - attributes(getManifestAttributes()) - } - - if (minimizeShadowedDependencies.toBoolean()) { - minimize() // This will only allow shading for actually used classes - } - configurations = [ - project.configurations.shadowImplementation, - project.configurations.shadowCompile, - project.configurations.shadeCompile - ] - 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", "runClient17", "runServer17"]) { - tasks.named(runTask).configure { - dependsOn("shadowJar") - } - } -} -ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar -ext.publishableObfJar = tasks.reobfJar - -tasks.register('apiJar', Jar) { - from(sourceSets.main.allSource) { - include modGroupPath + "/" + apiPackagePath + '/**' - } - - from(sourceSets.main.output) { - include modGroupPath + "/" + apiPackagePath + '/**' - } - - from(sourceSets.main.resources.srcDirs) { - include("LICENSE") - } - - getArchiveClassifier().set('api') -} - -artifacts { - if (!noPublishedSources) { - archives tasks.named("sourcesJar") - } - if (apiPackage) { - archives tasks.named("apiJar") - } -} - -idea { - module { - downloadJavadoc = true - downloadSources = true - inheritOutputDirs = true - } - project { - settings { - if (ideaOverrideBuildType != "") { - delegateActions { - if ("gradle".equalsIgnoreCase(ideaOverrideBuildType)) { - delegateBuildRunToGradle = true - testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.GRADLE - } else if ("idea".equalsIgnoreCase(ideaOverrideBuildType)) { - delegateBuildRunToGradle = false - testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.PLATFORM - } else { - throw GradleScriptException('Accepted value for ideaOverrideBuildType is one of gradle or idea.') - } - } - } - runConfigurations { - "0. Build and Test"(Gradle) { - taskNames = ["build"] - } - "1. Run Client"(Gradle) { - taskNames = ["runClient"] - } - "2. Run Server"(Gradle) { - taskNames = ["runServer"] - } - "1a. Run Client (Java 17)"(Gradle) { - taskNames = ["runClient17"] - } - "2a. Run Server (Java 17)"(Gradle) { - taskNames = ["runServer17"] - } - "1b. Run Client (Java 17, Hotswap)"(Gradle) { - taskNames = ["runClient17"] - envs = ["HOTSWAP": "true"] - } - "2b. Run Server (Java 17, Hotswap)"(Gradle) { - taskNames = ["runServer17"] - envs = ["HOTSWAP": "true"] - } - "3. Run Obfuscated Client"(Gradle) { - taskNames = ["runObfClient"] - } - "4. Run Obfuscated Server"(Gradle) { - taskNames = ["runObfServer"] - } - if (!disableSpotless) { - "5. Apply spotless"(Gradle) { - taskNames = ["spotlessApply"] - } - } - def coreModArgs = "" - if (coreModClass) { - coreModArgs = ' "-Dfml.coreMods.load=' + modGroup + '.' + coreModClass + '"' - } - "Run Client (IJ Native)"(Application) { - mainClass = "GradleStart" - moduleName = project.name + ".ideVirtualMain" - afterEvaluate { - workingDirectory = tasks.runClient.workingDir.absolutePath - programParameters = tasks.runClient.calculateArgs(project).collect { '"' + it + '"' }.join(' ') - jvmArgs = tasks.runClient.calculateJvmArgs(project).collect { '"' + it + '"' }.join(' ') + - ' ' + tasks.runClient.systemProperties.collect { '"-D' + it.key + '=' + it.value.toString() + '"' }.join(' ') + - coreModArgs - } - } - "Run Server (IJ Native)"(Application) { - mainClass = "GradleStartServer" - moduleName = project.name + ".ideVirtualMain" - afterEvaluate { - workingDirectory = tasks.runServer.workingDir.absolutePath - programParameters = tasks.runServer.calculateArgs(project).collect { '"' + it + '"' }.join(' ') - jvmArgs = tasks.runServer.calculateJvmArgs(project).collect { '"' + it + '"' }.join(' ') + - ' ' + tasks.runServer.systemProperties.collect { '"-D' + it.key + '=' + it.value.toString() + '"' }.join(' ') + - coreModArgs - } - } - } - compiler.javac { - afterEvaluate { - javacAdditionalOptions = "-encoding utf8" - moduleJavacAdditionalOptions = [ - (project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ') - ] - } - } - withIDEADir { File ideaDir -> - if (!ideaDir.path.contains(".idea")) { - // If an .ipr file exists, the project root directory is passed here instead of the .idea subdirectory - ideaDir = new File(ideaDir, ".idea") - } - if (ideaDir.isDirectory()) { - def miscFile = new File(ideaDir, "misc.xml") - if (miscFile.isFile()) { - boolean dirty = false - def miscTransformer = new XmlTransformer() - miscTransformer.addAction { root -> - Node rootNode = root.asNode() - def rootManager = rootNode - .component.find { it.@name == 'ProjectRootManager' } - if (!rootManager) { - rootManager = rootNode.appendNode('component', ['name': 'ProjectRootManager', 'version': '2']) - dirty = true - } - def output = rootManager.output - if (!output) { - output = rootManager.appendNode('output') - dirty = true - } - if (!output.@url) { - // Only modify the output url if it doesn't yet have one, or if the existing one is blank somehow. - // This is a sensible default for most setups - output.@url = 'file://$PROJECT_DIR$/build/ideaBuild' - dirty = true - } - } - def result = miscTransformer.transform(miscFile.text) - if (dirty) { - miscFile.write(result) - } - } else { - miscFile.text = """ - - - - - -""" - } - } - } - } - } -} - -tasks.named("processIdeaSettings").configure { - dependsOn("injectTags") -} - -tasks.named("ideVirtualMainClasses").configure { - // Make IntelliJ "Build project" build the mod jars - dependsOn("jar", "reobfJar") - if (!disableSpotless) { - dependsOn("spotlessCheck") - } -} - -// workaround variable hiding in pom processing -def projectConfigs = project.configurations - -publishing { - publications { - create("maven", MavenPublication) { - from components.java - - if (apiPackage) { - artifact apiJar - } - - groupId = System.getenv("ARTIFACT_GROUP_ID") ?: project.group - artifactId = System.getenv("ARTIFACT_ID") ?: project.name - // Using the identified version, not project.version as it has the prepended 1.7.10 - version = System.getenv("RELEASE_VERSION") ?: identifiedVersion - } - } - repositories { - if (usesMavenPublishing.toBoolean() && System.getenv("MAVEN_USER") != null) { - maven { - url = mavenPublishUrl - allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven - credentials { - username = System.getenv("MAVEN_USER") ?: "NONE" - password = System.getenv("MAVEN_PASSWORD") ?: "NONE" - } - } - } - } -} - -if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) { - apply plugin: 'com.modrinth.minotaur' - - File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md") - - modrinth { - token = System.getenv("MODRINTH_TOKEN") - projectId = modrinthProjectId - versionNumber = identifiedVersion - versionType = identifiedVersion.endsWith("-pre") ? "beta" : "release" - changelog = changelogFile.exists() ? changelogFile.getText("UTF-8") : "" - uploadFile = publishableObfJar - additionalFiles = getSecondaryArtifacts() - gameVersions = [minecraftVersion] - loaders = ["forge"] - debugMode = false - } - - 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]) - } - } - if (usesMixins.toBoolean()) { - addModrinthDep("required", "project", "unimixins") - } - tasks.modrinth.dependsOn(build) - tasks.publish.dependsOn(tasks.modrinth) -} - -if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null) { - apply plugin: 'com.matthewprenger.cursegradle' - - File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md") - - curseforge { - apiKey = System.getenv("CURSEFORGE_TOKEN") - project { - id = curseForgeProjectId - if (changelogFile.exists()) { - changelogType = "markdown" - changelog = changelogFile - } - releaseType = identifiedVersion.endsWith("-pre") ? "beta" : "release" - addGameVersion minecraftVersion - addGameVersion "Forge" - mainArtifact publishableObfJar - for (artifact in getSecondaryArtifacts()) addArtifact artifact - } - - options { - javaIntegration = false - forgeGradleIntegration = false - debug = false - } - } - - if (curseForgeRelations.size() != 0) { - String[] deps = curseForgeRelations.split(";") - deps.each { dep -> - if (dep.size() == 0) { - return - } - String[] parts = dep.split(":") - addCurseForgeRelation(parts[0], parts[1]) - } - } - if (usesMixins.toBoolean()) { - addCurseForgeRelation("requiredDependency", "unimixins") - } - tasks.curseforge.dependsOn(build) - tasks.publish.dependsOn(tasks.curseforge) -} - -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) -} - -def addCurseForgeRelation(String type, String name) { - if (!(type in ["requiredDependency", "embeddedLibrary", "optionalDependency", "tool", "incompatible"])) { - throw new Exception("Invalid CurseForge relation type: " + type) - } - CurseArtifact artifact = project.curseforge.curseProjects[0].mainArtifact - CurseRelation rel = (artifact.curseRelations ?: (artifact.curseRelations = new CurseRelation())) - rel."$type"(name) -} - -// Updating - -def buildscriptGradleVersion = "8.5" - -tasks.named('wrapper', Wrapper).configure { - gradleVersion = buildscriptGradleVersion -} - -tasks.register('updateBuildScript') { - group = 'GTNH 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") - } - } -} - -// If you want to add more cases to this task, implement them as arguments if total amount to print gets too large -tasks.register('faq') { - group = 'GTNH Buildscript' - description = 'Prints frequently asked questions about building a project' - - doLast { - print("If your build fails to fetch dependencies, run './gradlew updateDependencies'. " + - "Or you can manually check if the versions are still on the distributing sites - " + - "the links can be found in repositories.gradle and build.gradle:repositories, " + - "but not build.gradle:buildscript.repositories - those ones are for gradle plugin metadata.\n\n" + - "If your build fails to recognize the syntax of new Java versions, enable Jabel in your " + - "gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties. " + - "However, keep in mind that Jabel enables only syntax features, but not APIs that were introduced in " + - "Java 9 or later.") - } -} - -static URL availableBuildScriptUrl() { - new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle") -} - -static URL exampleSettingsGradleUrl() { - new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/settings.gradle.example") -} - -static URL exampleGitAttributesUrl() { - new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/.gitattributes") -} - - -boolean verifyGitAttributes() { - def gitattributesFile = getFile(".gitattributes") - if (!gitattributesFile.exists()) { - println("Downloading default .gitattributes") - exampleGitAttributesUrl().withInputStream { i -> gitattributesFile.withOutputStream { it << i } } - exec { - workingDir '.' - commandLine 'git', 'add', '--renormalize', '.' - } - return true - } - return false -} - -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!") - boolean settingsupdated = verifySettingsGradle() - settingsupdated = verifyGitAttributes() || settingsupdated - if (settingsupdated) - throw new GradleException("Settings has been updated, please re-run task.") - return true - } - return false -} - -boolean isNewBuildScriptVersionAvailable() { - Map parameters = ["connectTimeout": 2000, "readTimeout": 2000] - - String currentBuildScript = getFile("build.gradle").getText() - String currentBuildScriptHash = getVersionHash(currentBuildScript) - String availableBuildScriptHash - try { - String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() - availableBuildScriptHash = getVersionHash(availableBuildScript) - } catch (IOException e) { - logger.warn("Could not check for buildscript update availability: {}", e.message) - return false - } - - 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 "" -} - -// Parameter Deobfuscation - -tasks.register('deobfParams') { - group = 'GTNH Buildscript' - description = 'Rename all obfuscated parameter names inherited from Minecraft classes' - doLast { // TODO - - String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion" - String mcpZIP = "$mcpDir/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" - String paramsCSV = "$mcpDir/params.csv" - - download.run { - src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion-$minecraftVersion/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" - dest mcpZIP - overwrite false - } - - if (!file(paramsCSV).exists()) { - println("Extracting MCP archive ...") - copy { - from(zipTree(mcpZIP)) - into(mcpDir) - } - } - - println("Parsing params.csv ...") - Map params = new HashMap<>() - Files.lines(Paths.get(paramsCSV)).forEach { line -> - String[] cells = line.split(",") - if (cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) { - params.put(cells[0], cells[1]) - } - } - - out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!") - out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.") - } -} - -static int replaceParams(File file, Map params) { - int fileCount = 0 - - if (file.isDirectory()) { - for (File f : file.listFiles()) { - fileCount += replaceParams(f, params) - } - return fileCount - } - println("Visiting ${file.getName()} ...") - try { - String content = new String(Files.readAllBytes(file.toPath())) - int hash = content.hashCode() - params.forEach { key, value -> - content = content.replaceAll(key, value) - } - if (hash != content.hashCode()) { - Files.write(file.toPath(), content.getBytes("UTF-8")) - return 1 - } - } catch (Exception e) { - e.printStackTrace() - } - return 0 -} - -// Dependency Deobfuscation (Deprecated, use the new RFG API documented in dependencies.gradle) - -def deobf(String sourceURL) { - try { - URL url = new URL(sourceURL) - String fileName = url.getFile() - - //get rid of directories: - int lastSlash = fileName.lastIndexOf("/") - if (lastSlash > 0) { - fileName = fileName.substring(lastSlash + 1) - } - //get rid of extension: - if (fileName.endsWith(".jar") || fileName.endsWith(".litemod")) { - fileName = fileName.substring(0, fileName.lastIndexOf(".")) - } - - String hostName = url.getHost() - if (hostName.startsWith("www.")) { - hostName = hostName.substring(4) - } - List parts = Arrays.asList(hostName.split("\\.")) - Collections.reverse(parts) - hostName = String.join(".", parts) - - return deobf(sourceURL, "$hostName/$fileName") - } catch (Exception ignored) { - return deobf(sourceURL, "deobf/${sourceURL.hashCode()}") - } -} - -def deobfMaven(String repoURL, String mavenDep) { - if (!repoURL.endsWith("/")) { - repoURL += "/" - } - String[] parts = mavenDep.split(":") - parts[0] = parts[0].replace('.', '/') - def jarURL = repoURL + parts[0] + "/" + parts[1] + "/" + parts[2] + "/" + parts[1] + "-" + parts[2] + ".jar" - return deobf(jarURL) -} - -def deobfCurse(String curseDep) { - return dependencies.rfg.deobf("curse.maven:$curseDep") -} - -// The method above is to be preferred. Use this method if the filename is not at the end of the URL. -def deobf(String sourceURL, String rawFileName) { - String bon2Version = "2.5.1" - String fileName = URLDecoder.decode(rawFileName, "UTF-8") - String cacheDir = "$project.gradle.gradleUserHomeDir/caches" - String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar" - - download.run { - src sourceURL - dest obfFile - quiet true - overwrite false - } - return dependencies.rfg.deobf(files(obfFile)) -} -// Helper methods - -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/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties") - } -} - -def propertyDefaultIfUnset(String propertyName, defaultValue) { - if (!project.hasProperty(propertyName) || project.property(propertyName) == "") { - project.ext.setProperty(propertyName, defaultValue) - } -} - -def getFile(String relativePath) { - return new File(projectDir, relativePath) -} - -def getSecondaryArtifacts() { - // Because noPublishedSources from the beginning of the script is somehow not visible here... - boolean noPublishedSources = project.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false - def secondaryArtifacts = [publishableDevJar] - if (!noPublishedSources) secondaryArtifacts += [sourcesJar] - if (apiPackage) secondaryArtifacts += [apiJar] - return secondaryArtifacts -} - -def getURL(String main, String fallback) { - return pingURL(main, 10000) ? main : fallback -} - -// credit: https://stackoverflow.com/a/3584332 -def pingURL(String url, int timeout) { - url = url.replaceFirst("^https", "http") // Otherwise an exception may be thrown on invalid SSL certificates. - try { - HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection() - connection.setConnectTimeout(timeout) - connection.setReadTimeout(timeout) - connection.setRequestMethod("HEAD") - int responseCode = connection.getResponseCode() - return 200 <= responseCode && responseCode <= 399 - } catch (IOException ignored) { - return false - } -} - -// For easier scripting of things that require variables defined earlier in the buildscript -if (file('addon.late.gradle.kts').exists()) { - apply from: 'addon.late.gradle.kts' -} else if (file('addon.late.gradle').exists()) { - apply from: 'addon.late.gradle' -} - -// File for local tweaks not commited to Git -if (file('addon.late.local.gradle.kts').exists()) { - apply from: 'addon.late.local.gradle.kts' -} else if (file('addon.late.local.gradle').exists()) { - apply from: 'addon.late.local.gradle' + id 'com.gtnewhorizons.gtnhconvention' } diff --git a/dependencies.gradle b/dependencies.gradle index ce5bfe6..1df5ac4 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -39,4 +39,8 @@ dependencies { testCompileOnly 'org.projectlombok:lombok:1.18.24' testAnnotationProcessor 'org.projectlombok:lombok:1.18.24' + + compile("com.github.GTNewHorizons:NotEnoughItems:2.5.23-GTNH:dev") + compile("com.github.GTNewHorizons:CodeChickenLib:1.2.1:dev") + compile("com.github.GTNewHorizons:waila:1.7.1:dev") } diff --git a/gradle.properties b/gradle.properties index f9dc14b..8c628d1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -modName = Alchemist +modName = \u00A7c\u00A7l\u00A7oAlchemist\u00A7r # This is a case-sensitive string to identify your mod. Convention is to use lower case. modId = alchemist diff --git a/settings.gradle b/settings.gradle index e334397..1e614a5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,10 +4,10 @@ pluginManagement { maven { // RetroFuturaGradle name "GTNH Maven" - url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" - allowInsecureProtocol = true + url "https://nexus.gtnewhorizons.com/repository/public/" mavenContent { - includeGroup("com.gtnewhorizons.retrofuturagradle") + includeGroup("com.gtnewhorizons") + includeGroupByRegex("com\\.gtnewhorizons\\..+") } } gradlePluginPortal() @@ -17,12 +17,5 @@ pluginManagement { } plugins { - id 'com.diffplug.blowdryerSetup' version '1.6.0' - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains -} - -blowdryerSetup { - repoSubfolder 'gtnhShared' - github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.2') - //devLocal '.' // Use this when testing config updates locally + id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.15' } diff --git a/src/main/java/io/github/unix_supremacist/alchemist/Alchemist.java b/src/main/java/io/github/unix_supremacist/alchemist/Alchemist.java index 55e3aa3..1848080 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/Alchemist.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/Alchemist.java @@ -1,6 +1,9 @@ package io.github.unix_supremacist.alchemist; import com.myname.mymodid.CommonProxy; +import io.github.unix_supremacist.alchemist.content.AlchemistBlocks; +import io.github.unix_supremacist.alchemist.content.AlchemistItems; +import io.github.unix_supremacist.alchemist.content.AlchemistSplashes; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -24,6 +27,10 @@ public class Alchemist { // GameRegistry." (Remove if not needed) public void preInit(FMLPreInitializationEvent event) { proxy.preInit(event); + + AlchemistSplashes.init(); + AlchemistBlocks.values(); //force the enum to load + AlchemistItems.values(); //force the enum to load } @Mod.EventHandler diff --git a/src/main/java/io/github/unix_supremacist/alchemist/block/TransmutionCircleBlock.java b/src/main/java/io/github/unix_supremacist/alchemist/block/TransmutionCircleBlock.java index 751a558..5e928e0 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/block/TransmutionCircleBlock.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/block/TransmutionCircleBlock.java @@ -1,20 +1,30 @@ package io.github.unix_supremacist.alchemist.block; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import io.github.unix_supremacist.alchemist.Tags; import io.github.unix_supremacist.alchemist.interfaces.TransmuteEntity; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import java.util.List; public class TransmutionCircleBlock extends Block implements TransmuteEntity { + @SideOnly(Side.CLIENT) + public IIcon icon; + public String name; + public TransmutionCircleBlock(Material material) { super(material); + name = "transmutation_circle"; } @Override @@ -55,4 +65,21 @@ public boolean isOpaqueCube() { public boolean renderAsNormalBlock() { return false; } + + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) + { + return icon; + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { + + } + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + super.registerBlockIcons(iconRegister); + this.icon = iconRegister.registerIcon(Tags.MODID+":"+name.toLowerCase()); + } } diff --git a/src/main/java/io/github/unix_supremacist/alchemist/content/AlchemistItems.java b/src/main/java/io/github/unix_supremacist/alchemist/content/AlchemistItems.java index 68cf75f..c155dca 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/content/AlchemistItems.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/content/AlchemistItems.java @@ -6,13 +6,14 @@ import lombok.Getter; import net.minecraft.init.Blocks; import net.minecraft.item.Item; +import net.minecraft.util.ResourceLocation; public enum AlchemistItems { alchemical_coal(25600), aeternalis_fuel(1638400), //black_hole_band, catalytic_lens(new DestructionItem(3, 10, 5).setMaxStackSize(1)), - chalk(new AlchemistBlockItem(AlchemistBlocks.transmutation_circle.getBlock()).setMaxDamage(64)), + //chalk(new AlchemistBlockItem(AlchemistBlocks.transmutation_circle.getBlock()).setMaxDamage(64)), coal_coke(3200), dark_matter, //dark_matter_pickaxe, @@ -23,7 +24,7 @@ public enum AlchemistItems { //dark_matter_shears, //dark_matter_hammer(new AlchemistHammerItem(Tiers.NETHERITE, 1, -2.8f, new Properties())), destruction_catalyst(new DestructionItem(3, 5, 1).setMaxStackSize(16)), - evertide_amulet(new AlchemistBlockItem(Blocks.water).setMaxStackSize(1)), + //evertide_amulet(new AlchemistBlockItem(Blocks.water).setMaxStackSize(1)), //gem_of_eternal_density, //harvest_goddess_band, //hyperkinetic_lens, @@ -32,7 +33,7 @@ public enum AlchemistItems { philosophers_stone(new PhilosophersStoneItem().setMaxStackSize(1)), red_matter, swiftwolfs_rending_gale(new GaleItem().setMaxStackSize(1)), - volcanite_amulet(new AlchemistBlockItem(Blocks.lava).setMaxDamage(64)), + //volcanite_amulet(new AlchemistBlockItem(Blocks.lava).setMaxDamage(64)), ; @Getter Item item; AlchemistItems(){ @@ -40,27 +41,19 @@ public enum AlchemistItems { } AlchemistItems(int burntime){ - //this(new Properties(), burntime); - } - - AlchemistItems(Properties properties){ - //this(new Item(properties), 0); - } - - AlchemistItems(Properties properties, int burntime){ - //this(new Item(properties), burntime); + this(new Item(), burntime); } AlchemistItems(Item item){ - //this(item, 0); + this(item, 0); } AlchemistItems(Item item, int burntime){ this.item = item; - FuelRegistry.INSTANCE.add(item, burntime); + //FuelRegistry.INSTANCE.add(item, burntime); GameRegistry.registerItem(item, this.name()); - ItemGroupEvents.modifyEntriesEvent(ResourceKey.create(BuiltInRegistries.CREATIVE_MODE_TAB.key(), new ResourceLocation(Tags.MODID, "tab"))).register(content -> { - content.accept(item); - }); + //ItemGroupEvents.modifyEntriesEvent(ResourceKey.create(BuiltInRegistries.CREATIVE_MODE_TAB.key(), new ResourceLocation(Tags.MODID, "tab"))).register(content -> { + // content.accept(item); + //}); } } diff --git a/src/main/java/io/github/unix_supremacist/alchemist/content/AlchemistSplashes.java b/src/main/java/io/github/unix_supremacist/alchemist/content/AlchemistSplashes.java index 6b342a7..1372938 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/content/AlchemistSplashes.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/content/AlchemistSplashes.java @@ -1,6 +1,6 @@ package io.github.unix_supremacist.alchemist.content; -public class AlchemistSplashes { +public class AlchemistSplashes { public static String[] splashes = { "Welcome to the World of Alchemy!" }; diff --git a/src/main/java/io/github/unix_supremacist/alchemist/data/BlockTag.java b/src/main/java/io/github/unix_supremacist/alchemist/data/BlockTag.java index 59d6d71..707f6e2 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/data/BlockTag.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/data/BlockTag.java @@ -1,22 +1,17 @@ package io.github.unix_supremacist.alchemist.data; -import io.github.unix_supremacist.Alchemist; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; -import net.minecraft.core.HolderLookup; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; +import io.github.unix_supremacist.alchemist.Alchemist; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.util.ResourceLocation; import java.util.ArrayList; import java.util.HashSet; import java.util.concurrent.CompletableFuture; -public class BlockTag extends FabricTagProvider.BlockTagProvider { +public class BlockTag /*extends FabricTagProvider.BlockTagProvider*/ { public static HashSet> exchanges = new HashSet<>(); - public static TagKey terratag = TagKey.create(BuiltInRegistries.BLOCK.key(), new ResourceLocation(Alchemist.MODID, "terra")); + /*public static TagKey terratag = TagKey.create(BuiltInRegistries.BLOCK.key(), new ResourceLocation(Alchemist.MODID, "terra")); public static TagKey woodtag = TagKey.create(BuiltInRegistries.BLOCK.key(), new ResourceLocation(Alchemist.MODID, "wood")); public static TagKey netherwoodtag = TagKey.create(BuiltInRegistries.BLOCK.key(), new ResourceLocation(Alchemist.MODID, "netherwood")); public static TagKey leavetag = TagKey.create(BuiltInRegistries.BLOCK.key(), new ResourceLocation(Alchemist.MODID, "leave")); @@ -47,78 +42,78 @@ public static void init(){ @Override protected void addTags(HolderLookup.Provider arg) { FabricTagBuilder terra = getOrCreateTagBuilder(terratag); - terra.add(Blocks.GRASS_BLOCK); - terra.add(Blocks.DIRT); - terra.add(Blocks.COARSE_DIRT); - terra.add(Blocks.COBBLESTONE); - terra.add(Blocks.MOSSY_COBBLESTONE); - terra.add(Blocks.COBBLED_DEEPSLATE); - terra.add(Blocks.STONE); - terra.add(Blocks.DEEPSLATE); - terra.add(Blocks.SAND); - terra.add(Blocks.RED_SAND); - terra.add(Blocks.GRAVEL); + terra.add(Blocks.grass); + terra.add(Blocks.dirt); + //terra.add(Blocks.COARSE_DIRT); + terra.add(Blocks.cobblestone); + terra.add(Blocks.mossy_cobblestone); + //terra.add(Blocks.COBBLED_DEEPSLATE); + terra.add(Blocks.stone); + //terra.add(Blocks.DEEPSLATE); + terra.add(Blocks.sand); + //terra.add(Blocks.RED_SAND); + terra.add(Blocks.gravel); FabricTagBuilder wood = getOrCreateTagBuilder(woodtag); - wood.add(Blocks.OAK_LOG); - wood.add(Blocks.ACACIA_LOG); - wood.add(Blocks.BIRCH_LOG); - wood.add(Blocks.CHERRY_LOG); - wood.add(Blocks.JUNGLE_LOG); - wood.add(Blocks.DARK_OAK_LOG); - wood.add(Blocks.MANGROVE_LOG); - wood.add(Blocks.SPRUCE_LOG); - wood.add(Blocks.STRIPPED_OAK_LOG); - wood.add(Blocks.STRIPPED_ACACIA_LOG); - wood.add(Blocks.STRIPPED_BIRCH_LOG); - wood.add(Blocks.STRIPPED_CHERRY_LOG); - wood.add(Blocks.STRIPPED_JUNGLE_LOG); - wood.add(Blocks.STRIPPED_DARK_OAK_LOG); - wood.add(Blocks.STRIPPED_MANGROVE_LOG); - wood.add(Blocks.STRIPPED_SPRUCE_LOG); - wood.add(Blocks.OAK_WOOD); - wood.add(Blocks.ACACIA_LOG); - wood.add(Blocks.BIRCH_LOG); - wood.add(Blocks.CHERRY_LOG); - wood.add(Blocks.JUNGLE_LOG); - wood.add(Blocks.DARK_OAK_LOG); - wood.add(Blocks.MANGROVE_LOG); - wood.add(Blocks.SPRUCE_LOG); + //wood.add(Blocks.OAK_LOG); + //wood.add(Blocks.ACACIA_LOG); + //wood.add(Blocks.BIRCH_LOG); + //wood.add(Blocks.CHERRY_LOG); + //wood.add(Blocks.JUNGLE_LOG); + //wood.add(Blocks.DARK_OAK_LOG); + //wood.add(Blocks.MANGROVE_LOG); + //wood.add(Blocks.SPRUCE_LOG); + //wood.add(Blocks.STRIPPED_OAK_LOG); + //wood.add(Blocks.STRIPPED_ACACIA_LOG); + //wood.add(Blocks.STRIPPED_BIRCH_LOG); + //wood.add(Blocks.STRIPPED_CHERRY_LOG); + //wood.add(Blocks.STRIPPED_JUNGLE_LOG); + //wood.add(Blocks.STRIPPED_DARK_OAK_LOG); + //wood.add(Blocks.STRIPPED_MANGROVE_LOG); + //wood.add(Blocks.STRIPPED_SPRUCE_LOG); + //wood.add(Blocks.OAK_WOOD); + //wood.add(Blocks.ACACIA_LOG); + //wood.add(Blocks.BIRCH_LOG); + //wood.add(Blocks.CHERRY_LOG); + //wood.add(Blocks.JUNGLE_LOG); + //wood.add(Blocks.DARK_OAK_LOG); + //wood.add(Blocks.MANGROVE_LOG); + //wood.add(Blocks.SPRUCE_LOG); FabricTagBuilder netherwood = getOrCreateTagBuilder(netherwoodtag); - netherwood.add(Blocks.CRIMSON_STEM); - netherwood.add(Blocks.WARPED_STEM); - netherwood.add(Blocks.STRIPPED_CRIMSON_STEM); - netherwood.add(Blocks.STRIPPED_WARPED_STEM); + //netherwood.add(Blocks.CRIMSON_STEM); + //netherwood.add(Blocks.WARPED_STEM); + //netherwood.add(Blocks.STRIPPED_CRIMSON_STEM); + //netherwood.add(Blocks.STRIPPED_WARPED_STEM); FabricTagBuilder leave = getOrCreateTagBuilder(leavetag); - leave.add(Blocks.OAK_LEAVES); - leave.add(Blocks.ACACIA_LEAVES); - leave.add(Blocks.BIRCH_LEAVES); - leave.add(Blocks.CHERRY_LEAVES); - leave.add(Blocks.JUNGLE_LEAVES); - leave.add(Blocks.DARK_OAK_LEAVES); - leave.add(Blocks.MANGROVE_LEAVES); - leave.add(Blocks.SPRUCE_LEAVES); - leave.add(Blocks.NETHER_WART_BLOCK); - leave.add(Blocks.WARPED_WART_BLOCK); + //leave.add(Blocks.OAK_LEAVES); + //leave.add(Blocks.ACACIA_LEAVES); + //leave.add(Blocks.BIRCH_LEAVES); + //leave.add(Blocks.CHERRY_LEAVES); + //leave.add(Blocks.JUNGLE_LEAVES); + //leave.add(Blocks.DARK_OAK_LEAVES); + //leave.add(Blocks.MANGROVE_LEAVES); + //leave.add(Blocks.SPRUCE_LEAVES); + //leave.add(Blocks.NETHER_WART_BLOCK); + //leave.add(Blocks.WARPED_WART_BLOCK); FabricTagBuilder stone = getOrCreateTagBuilder(stonetag); - stone.add(Blocks.ANDESITE); - stone.add(Blocks.DIORITE); - stone.add(Blocks.GRANITE); - stone.add(Blocks.SANDSTONE); - stone.add(Blocks.RED_SANDSTONE); - stone.add(Blocks.CLAY); + //stone.add(Blocks.ANDESITE); + //stone.add(Blocks.DIORITE); + //stone.add(Blocks.GRANITE); + stone.add(Blocks.sandstone); + //stone.add(Blocks.RED_SANDSTONE); + stone.add(Blocks.clay); FabricTagBuilder obsidian = getOrCreateTagBuilder(obsidiantag); - obsidian.add(Blocks.OBSIDIAN); - obsidian.add(Blocks.CRYING_OBSIDIAN); + obsidian.add(Blocks.obsidian); + //obsidian.add(Blocks.CRYING_OBSIDIAN); FabricTagBuilder stonebricks = getOrCreateTagBuilder(stonebrickstag); - stonebricks.add(Blocks.STONE_BRICKS); - stonebricks.add(Blocks.MOSSY_STONE_BRICKS); - } + stonebricks.add(Blocks.stonebrick); + //stonebricks.add(Blocks.MOSSY_STONE_BRICKS); + }*/ public static Block getBlockWithOffset(Block b, ArrayList exchange, int o){ int id = exchange.indexOf(b); diff --git a/src/main/java/io/github/unix_supremacist/alchemist/data/Datagen.java b/src/main/java/io/github/unix_supremacist/alchemist/data/Datagen.java deleted file mode 100644 index 4530168..0000000 --- a/src/main/java/io/github/unix_supremacist/alchemist/data/Datagen.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.github.unix_supremacist.alchemist.data; - -import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; -import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; - -public class Datagen implements DataGeneratorEntrypoint { - @Override - public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { - FabricDataGenerator.Pack pack = fabricDataGenerator.createPack(); - pack.addProvider(ItemTag::new); - pack.addProvider(BlockTag::new); - pack.addProvider(Recipe::new); - pack.addProvider(Language::new); - } -} diff --git a/src/main/java/io/github/unix_supremacist/alchemist/data/ItemTag.java b/src/main/java/io/github/unix_supremacist/alchemist/data/ItemTag.java index 140753d..b07c2c7 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/data/ItemTag.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/data/ItemTag.java @@ -1,19 +1,10 @@ package io.github.unix_supremacist.alchemist.data; -import dev.emi.trinkets.TrinketsMain; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; -import net.minecraft.core.HolderLookup; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.Item; +import net.minecraft.item.Item; +import net.minecraft.util.ResourceLocation; -import java.util.concurrent.CompletableFuture; - -import static io.github.unix_supremacist.content.AlchemistItems.*; - -public class ItemTag extends FabricTagProvider.ItemTagProvider { +public class ItemTag /*extends FabricTagProvider.ItemTagProvider*/ { + /* public static String common = "c"; public static TagKey handring = TagKey.create(BuiltInRegistries.ITEM.key(), new ResourceLocation(TrinketsMain.MOD_ID, "hand/ring")); public static TagKey offhandring = TagKey.create(BuiltInRegistries.ITEM.key(), new ResourceLocation(TrinketsMain.MOD_ID, "offhand/ring")); @@ -30,5 +21,5 @@ protected void addTags(HolderLookup.Provider arg) { getOrCreateTagBuilder(offhandring).add(swiftwolfs_rending_gale.getItem()); getOrCreateTagBuilder(water_bucket).add(evertide_amulet.getItem()); getOrCreateTagBuilder(lava_bucket).add(volcanite_amulet.getItem()); - } + }*/ } diff --git a/src/main/java/io/github/unix_supremacist/alchemist/data/Language.java b/src/main/java/io/github/unix_supremacist/alchemist/data/Language.java index 4da017b..58367e7 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/data/Language.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/data/Language.java @@ -1,18 +1,11 @@ package io.github.unix_supremacist.alchemist.data; -import io.github.unix_supremacist.Alchemist; -import io.github.unix_supremacist.content.AlchemistBlocks; -import io.github.unix_supremacist.content.AlchemistItems; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ResourceLocation; import org.apache.commons.lang3.text.WordUtils; -public class Language extends FabricLanguageProvider { - protected Language(FabricDataOutput dataOutput) { +public class Language /*extends FabricLanguageProvider*/ { + /*protected Language(FabricDataOutput dataOutput) { super(dataOutput, "en_us"); } @@ -28,5 +21,5 @@ public void generateTranslations(TranslationBuilder translationBuilder) { translationBuilder.add("key.categories.alchemist", WordUtils.capitalize(Alchemist.MODID.replace("_", " "))); translationBuilder.add("key.alchemist.empower", "Empower"); - } + }*/ } diff --git a/src/main/java/io/github/unix_supremacist/alchemist/data/Recipe.java b/src/main/java/io/github/unix_supremacist/alchemist/data/Recipe.java index c992490..957a5bf 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/data/Recipe.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/data/Recipe.java @@ -1,18 +1,7 @@ package io.github.unix_supremacist.alchemist.data; -import io.github.unix_supremacist.Alchemist; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.data.recipes.*; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.Items; - -import static io.github.unix_supremacist.content.AlchemistItems.*; - -public class Recipe extends FabricRecipeProvider { - public Recipe(FabricDataOutput generator) { +public class Recipe /*extends FabricRecipeProvider*/ { + /*public Recipe(FabricDataOutput generator) { super(generator); } @@ -30,10 +19,10 @@ public void buildRecipes(RecipeOutput recipeoutput) { .pattern("III") .pattern("ILI") .pattern("III") - .define('I', Items.IRON_INGOT) + .define('I', Items.iron_ingot) .define('L', ItemTag.lava_bucket) - .unlockedBy(RecipeProvider.getHasName(Items.IRON_INGOT), RecipeProvider.has(Items.IRON_INGOT)) - .unlockedBy(RecipeProvider.getHasName(Items.LAVA_BUCKET), RecipeProvider.has(Items.LAVA_BUCKET)) + .unlockedBy(RecipeProvider.getHasName(Items.iron_ingot), RecipeProvider.has(Items.iron_ingot)) + .unlockedBy(RecipeProvider.getHasName(Items.lava_bucket), RecipeProvider.has(Items.lava_bucket)) .save(recipeoutput); ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, catalytic_lens.getItem()) .pattern("DDD") @@ -48,11 +37,11 @@ public void buildRecipes(RecipeOutput recipeoutput) { .pattern("FRF") .pattern("ASA") .pattern("FRF") - .define('F', Items.FLINT_AND_STEEL) + .define('F', Items.flint_and_steel) .define('A', aeternalis_fuel.getItem()) .define('S', philosophers_stone.getItem()) .define('R', red_matter.getItem()) - .unlockedBy(RecipeProvider.getHasName(Items.FLINT_AND_STEEL), RecipeProvider.has(Items.FLINT_AND_STEEL)) + .unlockedBy(RecipeProvider.getHasName(Items.flint_and_steel), RecipeProvider.has(Items.flint_and_steel)) .unlockedBy(RecipeProvider.getHasName(aeternalis_fuel.getItem()), RecipeProvider.has(aeternalis_fuel.getItem())) .unlockedBy(RecipeProvider.getHasName(philosophers_stone.getItem()), RecipeProvider.has(philosophers_stone.getItem())) .unlockedBy(RecipeProvider.getHasName(red_matter.getItem()), RecipeProvider.has(red_matter.getItem())) @@ -64,7 +53,7 @@ public void buildRecipes(RecipeOutput recipeoutput) { .define('D', dark_matter.getItem()) .define('L', ItemTag.lava_bucket) .unlockedBy(RecipeProvider.getHasName(dark_matter.getItem()), RecipeProvider.has(dark_matter.getItem())) - .unlockedBy(RecipeProvider.getHasName(Items.LAVA_BUCKET), RecipeProvider.has(Items.LAVA_BUCKET)) + .unlockedBy(RecipeProvider.getHasName(Items.lava_bucket), RecipeProvider.has(Items.lava_bucket)) .save(recipeoutput); ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, evertide_amulet.getItem()) .pattern("WWW") @@ -73,23 +62,23 @@ public void buildRecipes(RecipeOutput recipeoutput) { .define('D', dark_matter.getItem()) .define('W', ItemTag.water_bucket) .unlockedBy(RecipeProvider.getHasName(dark_matter.getItem()), RecipeProvider.has(dark_matter.getItem())) - .unlockedBy(RecipeProvider.getHasName(Items.WATER_BUCKET), RecipeProvider.has(Items.WATER_BUCKET)) + .unlockedBy(RecipeProvider.getHasName(Items.water_bucket), RecipeProvider.has(Items.water_bucket)) .save(recipeoutput); ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, chalk.getItem()) .pattern("CD") .pattern("D ") .define('D', Items.DIORITE) - .define('C', Items.CLAY_BALL) + .define('C', Items.clay_ball) .unlockedBy(RecipeProvider.getHasName(Items.DIORITE), RecipeProvider.has(Items.DIORITE)) - .unlockedBy(RecipeProvider.getHasName(Items.CLAY_BALL), RecipeProvider.has(Items.CLAY_BALL)) + .unlockedBy(RecipeProvider.getHasName(Items.clay_ball), RecipeProvider.has(Items.clay_ball)) .save(recipeoutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.COBBLESTONE) .pattern("WPL") .define('W', ItemTag.water_bucket) .define('P', philosophers_stone.getItem()) .define('L', ItemTag.lava_bucket) - .unlockedBy(RecipeProvider.getHasName(Items.LAVA_BUCKET), RecipeProvider.has(Items.LAVA_BUCKET)) - .unlockedBy(RecipeProvider.getHasName(Items.WATER_BUCKET), RecipeProvider.has(Items.WATER_BUCKET)) + .unlockedBy(RecipeProvider.getHasName(Items.lava_bucket), RecipeProvider.has(Items.lava_bucket)) + .unlockedBy(RecipeProvider.getHasName(Items.water_bucket), RecipeProvider.has(Items.water_bucket)) .unlockedBy(RecipeProvider.getHasName(philosophers_stone.getItem()), RecipeProvider.has(philosophers_stone.getItem())) .save(recipeoutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.OBSIDIAN) @@ -97,8 +86,8 @@ public void buildRecipes(RecipeOutput recipeoutput) { .define('W', ItemTag.water_bucket) .define('P', philosophers_stone.getItem()) .define('L', ItemTag.lava_bucket) - .unlockedBy(RecipeProvider.getHasName(Items.LAVA_BUCKET), RecipeProvider.has(Items.LAVA_BUCKET)) - .unlockedBy(RecipeProvider.getHasName(Items.WATER_BUCKET), RecipeProvider.has(Items.WATER_BUCKET)) + .unlockedBy(RecipeProvider.getHasName(Items.lava_bucket), RecipeProvider.has(Items.lava_bucket)) + .unlockedBy(RecipeProvider.getHasName(Items.water_bucket), RecipeProvider.has(Items.water_bucket)) .unlockedBy(RecipeProvider.getHasName(philosophers_stone.getItem()), RecipeProvider.has(philosophers_stone.getItem())) .save(recipeoutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.STONE) @@ -106,8 +95,8 @@ public void buildRecipes(RecipeOutput recipeoutput) { .define('W', ItemTag.water_bucket) .define('P', philosophers_stone.getItem()) .define('L', ItemTag.lava_bucket) - .unlockedBy(RecipeProvider.getHasName(Items.LAVA_BUCKET), RecipeProvider.has(Items.LAVA_BUCKET)) - .unlockedBy(RecipeProvider.getHasName(Items.WATER_BUCKET), RecipeProvider.has(Items.WATER_BUCKET)) + .unlockedBy(RecipeProvider.getHasName(Items.lava_bucket), RecipeProvider.has(Items.lava_bucket)) + .unlockedBy(RecipeProvider.getHasName(Items.water_bucket), RecipeProvider.has(Items.water_bucket)) .unlockedBy(RecipeProvider.getHasName(philosophers_stone.getItem()), RecipeProvider.has(philosophers_stone.getItem())) .save(recipeoutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, dark_matter.getItem()) @@ -129,25 +118,25 @@ public void buildRecipes(RecipeOutput recipeoutput) { .unlockedBy(RecipeProvider.getHasName(aeternalis_fuel.getItem()), RecipeProvider.has(aeternalis_fuel.getItem())) .save(recipeoutput); twoWayPhilStoneRecipe(Items.COAL, Items.CHARCOAL, 1, recipeoutput); - philStoneRecipe(coal_coke.getItem(), 2, Items.COAL, 2, recipeoutput); + philStoneRecipe(coal_coke.getItem(), 2, Items.coal, 2, recipeoutput); twoWayPhilStoneRecipe(alchemical_coal.getItem(), coal_coke.getItem(), 8, recipeoutput); twoWayPhilStoneRecipe(mobius_fuel.getItem(), alchemical_coal.getItem(), 8, recipeoutput); twoWayPhilStoneRecipe(aeternalis_fuel.getItem(), mobius_fuel.getItem(), 8, recipeoutput); twoWayPhilStoneRecipe(Items.COPPER_INGOT, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:tin_ingot")), 1, recipeoutput); - twoWayPhilStoneRecipe(Items.IRON_INGOT, Items.COPPER_INGOT, 8, recipeoutput); + twoWayPhilStoneRecipe(Items.iron_ingot, Items.COPPER_INGOT, 8, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:aluminum_ingot")), Items.IRON_INGOT, 2, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:nickel_ingot")), BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:aluminum_ingot")), 2, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:silver_ingot")), BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:lead_ingot")), 2, recipeoutput); - twoWayPhilStoneRecipe(Items.GOLD_INGOT, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:silver_ingot")), 2, recipeoutput); + twoWayPhilStoneRecipe(Items.gold_ingot, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:silver_ingot")), 2, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:peridot_gem")), BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:yellow_garnet_gem")), 2, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:ruby_gem")), BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:red_garnet_gem")), 2, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:peridot_gem")), 6, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:ruby_gem")), 6, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:peridot_gem")), 8, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:sapphire_gem")), 8, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:ruby_gem")), 4, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:sapphire_gem")), 4, recipeoutput); - twoWayPhilStoneRecipe(Items.DIAMOND, Items.GOLD_INGOT, 4, recipeoutput); - twoWayPhilStoneRecipe(Items.DIAMOND,2, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:ruby_gem")), 8, recipeoutput); + twoWayPhilStoneRecipe(Items.diamond, Items.gold_ingot, 4, recipeoutput); + twoWayPhilStoneRecipe(Items.diamond,2, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:ruby_gem")), 8, recipeoutput); twoWayPhilStoneRecipe(Items.NETHERITE_SCRAP, Items.DIAMOND, 4, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:platinum_ingot")), BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:titanium_ingot")), 2, recipeoutput); @@ -155,12 +144,12 @@ public void buildRecipes(RecipeOutput recipeoutput) { twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:tungsten_ingot")), Items.NETHERITE_INGOT, 2, recipeoutput); twoWayPhilStoneRecipe(BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:iridium_ingot")), BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:tungsten_ingot")), 2, recipeoutput); - philStoneRecipe(Items.FLINT, 3, Items.GRAVEL, 3, recipeoutput); + philStoneRecipe(Items.flint, 3, Items.GRAVEL, 3, recipeoutput); twoWayPhilStoneRecipe(Items.GRAVEL, 4, Items.COBBLESTONE, 4, recipeoutput); twoWayPhilStoneRecipe(Items.DIRT, 4, Items.SAND, 4, recipeoutput); twoWayPhilStoneRecipe(Items.GRAVEL, 8, Items.DIRT, 8, recipeoutput); twoWayPhilStoneRecipe(Items.COBBLESTONE, 8, Items.SAND, 8, recipeoutput); - twoWayPhilStoneRecipe(Items.CLAY_BALL, Items.STONE, 4, recipeoutput); + twoWayPhilStoneRecipe(Items.clay_ball, Items.STONE, 4, recipeoutput); twoWayPhilStoneRecipe(Items.RAW_COPPER, 2, BuiltInRegistries.ITEM.get(new ResourceLocation("techreborn:raw_tin")), 2, recipeoutput); twoWayPhilStoneRecipe(Items.RAW_COPPER, Items.CLAY, 4, recipeoutput); twoWayPhilStoneRecipe(Items.RAW_IRON, Items.RAW_COPPER, 8, recipeoutput); @@ -188,5 +177,5 @@ public void philStoneRecipe(Item output, int outputcount, Item input, int inputc .requires(input, inputcount) .unlockedBy(RecipeProvider.getHasName(philosophers_stone.getItem()), RecipeProvider.has(philosophers_stone.getItem())) .save(recipeoutput, new ResourceLocation(Alchemist.MODID, output +"_to_"+input)); - } + }*/ } diff --git a/src/main/java/io/github/unix_supremacist/alchemist/interfaces/AreaBox.java b/src/main/java/io/github/unix_supremacist/alchemist/interfaces/AreaBox.java index 3dfdec5..98edb02 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/interfaces/AreaBox.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/interfaces/AreaBox.java @@ -1,37 +1,40 @@ package io.github.unix_supremacist.alchemist.interfaces; import io.github.unix_supremacist.alchemist.Alchemist; -import net.minecraft.util.Direction; - +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.EnumFacing; import java.util.ArrayList; public interface AreaBox { - default ArrayList getArea(Direction dir, BlockPos anchor, BlockPos negative, BlockPos positive){ - ArrayList blocks = new ArrayList<>(); + default ArrayList getArea(EnumFacing dir, ChunkCoordinates anchor, ChunkCoordinates negative, ChunkCoordinates positive){ + ArrayList blocks = new ArrayList<>(); + + for(int x = negative.posX; x <= positive.posX; x++) + for (int y = negative.posY; y <= positive.posY; y++) + for (int z = negative.posZ; z <= positive.posZ; z++){ + anchor.set(anchor.posX+x, anchor.posY+y, anchor.posY+z); + blocks.add(anchor); + } - for(int x = negative.getX(); x <= positive.getX(); x++) - for (int y = negative.getY(); y <= positive.getY(); y++) - for (int z = negative.getZ(); z <= positive.getZ(); z++) - blocks.add(anchor.offset(x, y, z)); return blocks; } - default ArrayList getAreaFromFacing(Direction dir, BlockPos anchor, int size, int depth){ + default ArrayList getAreaFromFacing(EnumFacing dir, ChunkCoordinates anchor, int size, int depth){ switch(dir) { case SOUTH: - return getArea(dir, anchor, new BlockPos(-size, -size, -depth), new BlockPos(size, size, 0)); + return getArea(dir, anchor, new ChunkCoordinates(-size, -size, -depth), new ChunkCoordinates(size, size, 0)); case NORTH: - return getArea(dir, anchor, new BlockPos(-size, -size, 0), new BlockPos(size, size, depth)); + return getArea(dir, anchor, new ChunkCoordinates(-size, -size, 0), new ChunkCoordinates(size, size, depth)); case EAST: - return getArea(dir, anchor, new BlockPos(-depth, -size, -size), new BlockPos(0, size, size)); + return getArea(dir, anchor, new ChunkCoordinates(-depth, -size, -size), new ChunkCoordinates(0, size, size)); case WEST: - return getArea(dir, anchor, new BlockPos(0, -size, -size), new BlockPos(depth, size, size)); + return getArea(dir, anchor, new ChunkCoordinates(0, -size, -size), new ChunkCoordinates(depth, size, size)); case UP: - return getArea(dir, anchor, new BlockPos(-size, -depth, -size), new BlockPos(size, 0, size)); + return getArea(dir, anchor, new ChunkCoordinates(-size, -depth, -size), new ChunkCoordinates(size, 0, size)); case DOWN: - return getArea(dir, anchor, new BlockPos(-size, 0, -size), new BlockPos(size, depth, size)); + return getArea(dir, anchor, new ChunkCoordinates(-size, 0, -size), new ChunkCoordinates(size, depth, size)); default: - Alchemist.LOGGER.error("HOW DID YOU CLICK A DIRECTION THAT ISN'T NORTH SOUTH EAST WEST UP OR DOWN"); + Alchemist.LOGGER.error("HOW DID YOU CLICK A EnumFacing THAT ISN'T NORTH SOUTH EAST WEST UP OR DOWN"); return null; } } diff --git a/src/main/java/io/github/unix_supremacist/alchemist/interfaces/Destroyer.java b/src/main/java/io/github/unix_supremacist/alchemist/interfaces/Destroyer.java index b237755..3b720c5 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/interfaces/Destroyer.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/interfaces/Destroyer.java @@ -1,26 +1,26 @@ package io.github.unix_supremacist.alchemist.interfaces; -import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; import java.util.ArrayList; public interface Destroyer { - default void destroy(World level, BlockPos pos, EntityLivingBase entity){ - if(!level.isRemote && !(level.getBlockState(pos).getBlock().defaultDestroyTime() < 0)){ + default void destroy(World level, ChunkCoordinates pos, EntityLivingBase entity){ + /*if(!level.isRemote && !(level.getBlockState(pos).getBlock().defaultDestroyTime() < 0)){ if (entity instanceof EntityPlayer) - level.destroyBlock(pos, !((EntityPlayer) entity).isCreative()); + level.destroyBlock(pos, !((EntityPlayer) entity).capabilities.isCreativeMode); else level.destroyBlock(pos, true); - } + }*/ } - default boolean destroyArea(World level, ArrayList blocks, EntityLivingBase entity){ + default boolean destroyArea(World level, ArrayList blocks, EntityLivingBase entity){ if(!level.isRemote){ if(!blocks.isEmpty()){ - for (BlockPos b : blocks){ + for (ChunkCoordinates b : blocks){ destroy(level, b, entity); } return true; diff --git a/src/main/java/io/github/unix_supremacist/alchemist/interfaces/DurablityBar.java b/src/main/java/io/github/unix_supremacist/alchemist/interfaces/DurablityBar.java index 0527ee9..4fd413c 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/interfaces/DurablityBar.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/interfaces/DurablityBar.java @@ -1,8 +1,11 @@ package io.github.unix_supremacist.alchemist.interfaces; +import net.minecraft.util.MathHelper; + public interface DurablityBar { default int getColor(int max, int current) { float f = Math.max(0.0F, ((float)max - (float)current) / (float)max); - return Mth.hsvToRgb(f / 1.1F, 1.0F, 1.0F); + //return MathHelper.hsvToRgb(f / 1.1F, 1.0F, 1.0F); + return 0; } } diff --git a/src/main/java/io/github/unix_supremacist/alchemist/interfaces/TransmuteEntity.java b/src/main/java/io/github/unix_supremacist/alchemist/interfaces/TransmuteEntity.java index f9b58c3..c38d827 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/interfaces/TransmuteEntity.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/interfaces/TransmuteEntity.java @@ -11,7 +11,7 @@ public interface TransmuteEntity { default boolean transmuteEntity(EntityLiving entity, World level){ if(entity instanceof EntityVillager){ level.spawnEntityInWorld(new EntityItem(level, entity.getPosition(0).xCoord, entity.getPosition(0).yCoord, entity.getPosition(0).zCoord, new ItemStack(AlchemistItems.philosophers_stone.getItem()))); - entity.kill(); + //entity.kill(); return true; } return false; diff --git a/src/main/java/io/github/unix_supremacist/alchemist/item/AbstractEmpowerableItem.java b/src/main/java/io/github/unix_supremacist/alchemist/item/AbstractEmpowerableItem.java index b5e2bc3..7653ece 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/item/AbstractEmpowerableItem.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/item/AbstractEmpowerableItem.java @@ -1,9 +1,11 @@ package io.github.unix_supremacist.alchemist.item; import io.github.unix_supremacist.alchemist.interfaces.DurablityBar; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; public class AbstractEmpowerableItem extends Item implements DurablityBar { protected final int maxPower; @@ -12,46 +14,46 @@ public AbstractEmpowerableItem(int maxPower) { this.maxPower = maxPower; } - @Override + //@Override public int getBarColor(ItemStack item) { return getColor(this.maxPower, getPower(item)); } @Override - public boolean isBarVisible(ItemStack item) { + public boolean showDurabilityBar(ItemStack item) { return getPower(item) > 0; } public int getPower(ItemStack item){ - if (item.getTag() != null){ - return item.getTag().getInt("alchemist.empowered"); + if (item.getTagCompound() != null){ + return item.getTagCompound().getInteger("alchemist.empowered"); } else { - item.setTag(new CompoundTag()); + item.setTagCompound(new NBTTagCompound()); return 0; } } public void setPower(ItemStack item, int i){ - if (item.getTag() != null){ - item.getTag().putInt("alchemist.empowered", i); + if (item.getTagCompound() != null){ + item.getTagCompound().setInteger("alchemist.empowered", i); } else { - CompoundTag tag = new CompoundTag(); - tag.putInt("alchemist.empowered", i); - item.setTag(tag); + NBTTagCompound tag = new NBTTagCompound(); + tag.setInteger("alchemist.empowered", i); + item.setTagCompound(tag); } } - public void empower(ItemStack item, Player p){ - if(isBarVisible(item)) + public void empower(ItemStack item, EntityPlayer p){ + if(showDurabilityBar(item)) setPower(item, getPower(item)-1); else setPower(item,maxPower-1); } - @Override + /*@Override public int getBarWidth(ItemStack item) { return Math.round(13.0F - (float)getPower(item) * 13.0F / (float)this.maxPower); - } + }*/ @Override public EnumRarity getRarity(ItemStack s){ diff --git a/src/main/java/io/github/unix_supremacist/alchemist/item/AlchemistBlockItem.java b/src/main/java/io/github/unix_supremacist/alchemist/item/AlchemistBlockItem.java index 975d035..8e1852a 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/item/AlchemistBlockItem.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/item/AlchemistBlockItem.java @@ -2,23 +2,24 @@ import io.github.unix_supremacist.alchemist.interfaces.DurablityBar; import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemBlock; -import static io.github.unix_supremacist.alchemist.content.AlchemistItems.chalk; +//import static io.github.unix_supremacist.alchemist.content.AlchemistItems.chalk; public class AlchemistBlockItem extends ItemBlock implements DurablityBar { public AlchemistBlockItem(Block block) { super(block); } - @Override + /*@Override public InteractionResult useOn(UseOnContext context) { InteractionResult interactionResult; ItemStack item = context.getItemInHand(); - if(context.getLevel().getBlockState(context.getClickedPos().relative(context.getClickedFace())) == Blocks.LAVA.defaultBlockState() && item.getDamageValue() < this.getMaxDamage()){ - context.getLevel().setBlock(context.getClickedPos().relative(context.getClickedFace()), Blocks.AIR.defaultBlockState(), 0); + if(context.getLevel().getBlockState(context.getClickedPos().relative(context.getClickedFace())) == Blocks.lava.defaultBlockState() && item.getDamageValue() < this.getMaxDamage()){ + context.getLevel().setBlock(context.getClickedPos().relative(context.getClickedFace()), Blocks.air.defaultBlockState(), 0); context.getItemInHand().setDamageValue(item.getDamageValue()+1); interactionResult = InteractionResult.SUCCESS; } else { @@ -29,9 +30,9 @@ public InteractionResult useOn(UseOnContext context) { } return interactionResult; - } + }*/ - @Override + //@Override public int getBarColor(ItemStack item) { return getColor(item.getMaxDamage(), item.getItemDamage()); } @@ -42,18 +43,18 @@ public ItemStack getRecipeRemainder(ItemStack stack) { return stack.copy(); } - @Override + /*@Override public String getDescriptionId() { return this.getOrCreateDescriptionId(); - } + }*/ /*@Override public boolean isValidRepairItem(ItemStack itemStack2, ItemStack itemStack) { return itemStack.getItem() == Items.BLAZE_POWDER || super.isValidRepairItem(itemStack2, itemStack); }*/ - @Override + /*@Override public EnumRarity getRarity(ItemStack s){ return s.getItem()==chalk.getItem() ? EnumRarity.common : EnumRarity.epic; - } + }*/ } diff --git a/src/main/java/io/github/unix_supremacist/alchemist/item/AlchemistDiggerItem.java b/src/main/java/io/github/unix_supremacist/alchemist/item/AlchemistDiggerItem.java index 168e81d..9cba920 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/item/AlchemistDiggerItem.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/item/AlchemistDiggerItem.java @@ -3,20 +3,28 @@ import io.github.unix_supremacist.alchemist.interfaces.AreaBox; import io.github.unix_supremacist.alchemist.interfaces.Destroyer; import io.github.unix_supremacist.alchemist.interfaces.DurablityBar; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3; import java.util.ArrayList; -public class AlchemistDiggerItem extends DiggerItem implements AreaBox, Destroyer, DurablityBar { - public AlchemistDiggerItem(float f, float g, Tier tier, TagKey tagKey, Properties properties) { +public class AlchemistDiggerItem extends /*Digger*/Item implements AreaBox, Destroyer, DurablityBar { + /*public AlchemistDiggerItem(float f, float g, Tier tier, TagKey tagKey, Properties properties) { super(f, g, tier, tagKey, properties); } @Override - public boolean mineBlock(ItemStack itemStack, World level, BlockState state, BlockPos pos, LivingEntity entity) { - Vec3 look = entity.getLookAngle(); - ArrayList blocks = getAreaFromFacing(Direction.getNearest(look.x(), look.y(), look.z()), pos, 1, 0); + public boolean mineBlock(ItemStack itemStack, World level, BlockState state, ChunkCoordinates pos, EntityLivingBase entity) { + Vec3 look = entity.getLookVec(); + ArrayList blocks = getAreaFromFacing(EnumFacing.getNearest(look.xCoord, look.yCoord, look.zCoord), pos, 1, 0); destroyArea(level, blocks, entity); return super.mineBlock(itemStack, level, state, pos, entity); } @@ -27,7 +35,7 @@ public int getBarColor(ItemStack item) { } @Override - public Rarity getRarity(ItemStack s){ - return Rarity.EPIC; - } + public EnumRarity getRarity(ItemStack s){ + return EnumRarity.epic; + }*/ } diff --git a/src/main/java/io/github/unix_supremacist/alchemist/item/AlchemistHammerItem.java b/src/main/java/io/github/unix_supremacist/alchemist/item/AlchemistHammerItem.java index 87a89a4..da54fe8 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/item/AlchemistHammerItem.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/item/AlchemistHammerItem.java @@ -5,21 +5,24 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3; import java.util.ArrayList; public class AlchemistHammerItem extends AlchemistDiggerItem implements AreaBox, Destroyer { - + /* public AlchemistHammerItem(Tier tier, int i, float f, Properties properties) { super(i, f, tier, BlockTags.MINEABLE_WITH_PICKAXE, properties); } @Override - public boolean mineBlock(ItemStack itemStack, World level, BlockState state, BlockPos pos, EntityLivingBase entity) { - Vec3 look = entity.getLookAngle(); - Direction dir = Direction.getNearest(look.x(), look.y(), look.z()); - ArrayList blocks = getAreaFromFacing(dir, pos, 1, 0); + public boolean mineBlock(ItemStack itemStack, World level, BlockState state, ChunkCoordinates pos, EntityLivingBase entity) { + Vec3 look = entity.getLookVec(); + EnumFacing dir = EnumFacing.getNearest(look.xCoord, look.yCoord, look.zCoord); + ArrayList blocks = getAreaFromFacing(dir, pos, 1, 0); destroyArea(level, blocks, entity); return super.mineBlock(itemStack, level, state, pos, entity); - } + }*/ } diff --git a/src/main/java/io/github/unix_supremacist/alchemist/item/DestructionItem.java b/src/main/java/io/github/unix_supremacist/alchemist/item/DestructionItem.java index c020151..ea6c9d7 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/item/DestructionItem.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/item/DestructionItem.java @@ -1,9 +1,12 @@ package io.github.unix_supremacist.alchemist.item; -import ibxm.Player; import io.github.unix_supremacist.alchemist.interfaces.AreaBox; import io.github.unix_supremacist.alchemist.interfaces.Destroyer; import net.minecraft.item.ItemStack; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.IChatComponent; import java.util.ArrayList; @@ -27,14 +30,14 @@ public DestructionItem(int maxWidth, int maxDepth, int mult) { } @Override - public void empower(ItemStack item, Player p){ + public void empower(ItemStack item, EntityPlayer p){ super.empower(item, p); - p.displayClientMessage(Component.literal("Width: "+((maxWidth-1)*2-MODES[getPower(item)*2]*2+1)+" and Depth: "+((maxDepth-1-MODES[getPower(item)*2+1])*mult+1)), true); + //p.displayClientMessage(IChatComponent.literal("Width: "+((maxWidth-1)*2-MODES[getPower(item)*2]*2+1)+" and Depth: "+((maxDepth-1-MODES[getPower(item)*2+1])*mult+1)), true); } - @Override + /*@Override public InteractionResult useOn(UseOnContext context) { - ArrayList blocks = getAreaFromFacing(context.getClickedFace(), context.getClickedPos(), maxWidth-1-MODES[getPower(context.getItemInHand())*2], (maxDepth-1-MODES[getPower(context.getItemInHand())*2+1])*mult); + ArrayList blocks = getAreaFromFacing(context.getClickedFace(), context.getClickedPos(), maxWidth-1-MODES[getPower(context.getItemInHand())*2], (maxDepth-1-MODES[getPower(context.getItemInHand())*2+1])*mult); return destroyArea(context.getLevel(), blocks, context.getPlayer()); - } + }*/ } diff --git a/src/main/java/io/github/unix_supremacist/alchemist/item/GaleItem.java b/src/main/java/io/github/unix_supremacist/alchemist/item/GaleItem.java index fe84d6b..761c973 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/item/GaleItem.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/item/GaleItem.java @@ -1,31 +1,34 @@ package io.github.unix_supremacist.alchemist.item; import io.github.unix_supremacist.alchemist.Tags; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class GaleItem extends TrinketItem { +public class GaleItem extends /*Trinket*/Item { public GaleItem() { super(); } - public static final AbilitySource gale_ability = Pal.getAbilitySource(Tags.MODID, "swiftwolfs_rending_gale"); + /*public static final AbilitySource gale_ability = Pal.getAbilitySource(Tags.MODID, "swiftwolfs_rending_gale"); @Override - public void onEquip(ItemStack stack, SlotReference slot, LivingEntity entity) { + public void onEquip(ItemStack stack, SlotReference slot, EntityLivingBase entity) { if (!entity.level().isClientSide()) - if (entity instanceof Player) - gale_ability.grantTo((Player) entity, VanillaAbilities.ALLOW_FLYING); + if (entity instanceof EntityPlayer) + gale_ability.grantTo((EntityPlayer) entity, VanillaAbilities.ALLOW_FLYING); } @Override - public void onUnequip(ItemStack stack, SlotReference slot, LivingEntity entity) { + public void onUnequip(ItemStack stack, SlotReference slot, EntityLivingBase entity) { if (!entity.level().isClientSide()) - if (entity instanceof Player) - gale_ability.revokeFrom((Player) entity, VanillaAbilities.ALLOW_FLYING); + if (entity instanceof EntityPlayer) + gale_ability.revokeFrom((EntityPlayer) entity, VanillaAbilities.ALLOW_FLYING); } @Override public EnumRarity getRarity(ItemStack s){ return EnumRarity.epic; - } + }*/ } diff --git a/src/main/java/io/github/unix_supremacist/alchemist/item/PhilosophersStoneItem.java b/src/main/java/io/github/unix_supremacist/alchemist/item/PhilosophersStoneItem.java index 43dca9b..982d9b3 100644 --- a/src/main/java/io/github/unix_supremacist/alchemist/item/PhilosophersStoneItem.java +++ b/src/main/java/io/github/unix_supremacist/alchemist/item/PhilosophersStoneItem.java @@ -1,23 +1,33 @@ package io.github.unix_supremacist.alchemist.item; -import ibxm.Player; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import io.github.unix_supremacist.alchemist.Tags; import io.github.unix_supremacist.alchemist.data.BlockTag; import io.github.unix_supremacist.alchemist.interfaces.AreaBox; import io.github.unix_supremacist.alchemist.interfaces.TransmuteEntity; +import java.util.ArrayList; import net.minecraft.block.Block; -import net.minecraft.entity.EntityLiving; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; - -import java.util.ArrayList; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.IIcon; public class PhilosophersStoneItem extends AbstractEmpowerableItem implements AreaBox, TransmuteEntity { + @SideOnly(Side.CLIENT) + public IIcon icon; + public String name; + public PhilosophersStoneItem() { super(3); + name = "philosophers_stone"; } - @Override + /*@Override public InteractionResult useOn(UseOnContext context) { - ArrayList blocks = getAreaFromFacing(context.getClickedFace(), context.getClickedPos(), 2 - getPower(context.getItemInHand()), 0); + ArrayList blocks = getAreaFromFacing(context.getClickedFace(), context.getClickedPos(), 2 - getPower(context.getItemInHand()), 0); ArrayList exchange = new ArrayList<>(); InteractionResult result = InteractionResult.PASS; for (ArrayList e : BlockTag.exchanges){ @@ -28,11 +38,11 @@ public InteractionResult useOn(UseOnContext context) { } } if(!blocks.isEmpty()){ - if (!context.getLevel().isClientSide()) for (BlockPos b : blocks){ + if (!context.getLevel().isClientSide()) for (ChunkCoordinates b : blocks){ Block block = context.getLevel().getBlockState(b).getBlock(); if (exchange.contains(block)) { Block newBlock; - if(context.getPlayer().isShiftKeyDown()) + if(context.getPlayer().isSneaking()) newBlock = BlockTag.getBlockWithOffset(block, exchange,-1); else newBlock = BlockTag.getBlockWithOffset(block, exchange,+1); @@ -46,11 +56,22 @@ public InteractionResult useOn(UseOnContext context) { return result; } - public InteractionResult interactLivingEntity(ItemStack stack, Player player, EntityLiving entity, InteractionHand hand) { + public InteractionResult interactLivingEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity, InteractionHand hand) { return transmuteEntity(entity, player.level()); + }*/ + + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + return icon; + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { + super.registerIcons(iconRegister); + this.icon = iconRegister.registerIcon(Tags.MODID+":"+name.toLowerCase()); } - @Override + //@Override public ItemStack getRecipeRemainder(ItemStack stack) { return stack.copy(); } diff --git a/src/main/resources/assets/alchemist/blockstates/transmutation_circle.json b/src/main/resources/assets/alchemist/blockstates/transmutation_circle.json new file mode 100644 index 0000000..f82c943 --- /dev/null +++ b/src/main/resources/assets/alchemist/blockstates/transmutation_circle.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "alchemist:block/transmutation_circle" } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/icon.png b/src/main/resources/assets/alchemist/icon.png new file mode 100644 index 0000000..eb6723d Binary files /dev/null and b/src/main/resources/assets/alchemist/icon.png differ diff --git a/src/main/resources/assets/alchemist/models/block/transmutation_circle.bbmodel b/src/main/resources/assets/alchemist/models/block/transmutation_circle.bbmodel new file mode 100644 index 0000000..a662353 --- /dev/null +++ b/src/main/resources/assets/alchemist/models/block/transmutation_circle.bbmodel @@ -0,0 +1 @@ +{"meta":{"format_version":"4.5","model_format":"java_block","box_uv":false},"name":"transmutation_circle","parent":"","ambientocclusion":true,"front_gui_light":false,"visible_box":[1,1,0],"variable_placeholders":"","variable_placeholder_buttons":[],"unhandled_root_fields":{},"resolution":{"width":48,"height":48},"elements":[{"name":"cube","box_uv":false,"rescale":false,"locked":false,"render_order":"default","allow_mirror_modeling":true,"from":[0,0.1,0],"to":[16,0.1,16],"autouv":0,"color":7,"origin":[0,0,0],"uv_offset":[0,16],"faces":{"north":{"uv":[72,120,144,120]},"east":{"uv":[0,120,72,120]},"south":{"uv":[216,120,288,120]},"west":{"uv":[144,120,216,120]},"up":{"uv":[48,48,0,0],"texture":0},"down":{"uv":[216,48,144,120]}},"type":"cube","uuid":"97a5efc1-d401-c7ca-f644-8161c0f98515"}],"outliner":["97a5efc1-d401-c7ca-f644-8161c0f98515"],"textures":[{"path":"/home/unix/src/Alchemist/src/main/resources/assets/alchemist/textures/block/transmutation_circle.png","name":"transmutation_circle.png","folder":"block","namespace":"alchemist","id":"0","particle":true,"render_mode":"default","render_sides":"auto","frame_time":1,"frame_order_type":"loop","frame_order":"","frame_interpolate":false,"visible":true,"mode":"bitmap","saved":true,"uuid":"c8960306-1d2e-0de1-a324-b731b97907ba","relative_path":"../../../textures/block/transmutation_circle.png","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAIdJREFUOE+tU0EOgDAIcwc/4dn/v8izn/CgYUlJbWDEuF22lFLKAm0JznFed4Tv29oUfwGcqOQs5gJGsCS9reIo1gWiJOB2sxvlugCIIEQCnAx+txxVYWzEKXvOnOG/XEAtaytIUGfzBKqKWfz/J1a9a8+YCTiaM0jVuHL/zLX3vGXiNf2yzg+pqhqIRbVzBwAAAABJRU5ErkJggg=="}]} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/block/transmutation_circle.json b/src/main/resources/assets/alchemist/models/block/transmutation_circle.json new file mode 100644 index 0000000..e157249 --- /dev/null +++ b/src/main/resources/assets/alchemist/models/block/transmutation_circle.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "texture_size": [48, 48], + "textures": { + "0": "alchemist:block/transmutation_circle", + "particle": "alchemist:block/transmutation_circle" + }, + "elements": [ + { + "from": [0, 0.1, 0], + "to": [16, 0.1, 16], + "faces": { + "north": {"uv": [24, 40, 48, 40], "texture": "#missing"}, + "east": {"uv": [0, 40, 24, 40], "texture": "#missing"}, + "south": {"uv": [72, 40, 96, 40], "texture": "#missing"}, + "west": {"uv": [48, 40, 72, 40], "texture": "#missing"}, + "up": {"uv": [16, 16, 0, 0], "texture": "#0"}, + "down": {"uv": [72, 16, 48, 40], "texture": "#missing"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/aeternalis_fuel.json b/src/main/resources/assets/alchemist/models/item/aeternalis_fuel.json new file mode 100644 index 0000000..7773e1b --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/aeternalis_fuel.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/aeternalis_fuel" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/alchemical_coal.json b/src/main/resources/assets/alchemist/models/item/alchemical_coal.json new file mode 100644 index 0000000..aa98066 --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/alchemical_coal.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/alchemical_coal" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/catalytic_lens.json b/src/main/resources/assets/alchemist/models/item/catalytic_lens.json new file mode 100644 index 0000000..8aab774 --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/catalytic_lens.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/catalytic_lens" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/chalk.json b/src/main/resources/assets/alchemist/models/item/chalk.json new file mode 100644 index 0000000..b63c9c7 --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/chalk.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/chalk" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/coal_coke.json b/src/main/resources/assets/alchemist/models/item/coal_coke.json new file mode 100644 index 0000000..dd600de --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/coal_coke.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/coal_coke" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/dark_matter.json b/src/main/resources/assets/alchemist/models/item/dark_matter.json new file mode 100644 index 0000000..e592fb0 --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/dark_matter.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/dark_matter" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/dark_matter_hammer.json b/src/main/resources/assets/alchemist/models/item/dark_matter_hammer.json new file mode 100644 index 0000000..465c872 --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/dark_matter_hammer.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/dark_matter_hammer" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/destruction_catalyst.json b/src/main/resources/assets/alchemist/models/item/destruction_catalyst.json new file mode 100644 index 0000000..b04ebf2 --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/destruction_catalyst.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/destruction_catalyst" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/evertide_amulet.json b/src/main/resources/assets/alchemist/models/item/evertide_amulet.json new file mode 100644 index 0000000..5cc80f6 --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/evertide_amulet.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/evertide_amulet" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/iron_band.json b/src/main/resources/assets/alchemist/models/item/iron_band.json new file mode 100644 index 0000000..53a07a0 --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/iron_band.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/iron_band" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/mobius_fuel.json b/src/main/resources/assets/alchemist/models/item/mobius_fuel.json new file mode 100644 index 0000000..1c2214a --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/mobius_fuel.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/mobius_fuel" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/philosophers_stone.json b/src/main/resources/assets/alchemist/models/item/philosophers_stone.json new file mode 100644 index 0000000..ae81651 --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/philosophers_stone.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/philosophers_stone" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/red_matter.json b/src/main/resources/assets/alchemist/models/item/red_matter.json new file mode 100644 index 0000000..b2262ab --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/red_matter.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/red_matter" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/swiftwolfs_rending_gale.json b/src/main/resources/assets/alchemist/models/item/swiftwolfs_rending_gale.json new file mode 100644 index 0000000..c607996 --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/swiftwolfs_rending_gale.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/swiftwolfs_rending_gale" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/models/item/volcanite_amulet.json b/src/main/resources/assets/alchemist/models/item/volcanite_amulet.json new file mode 100644 index 0000000..f9437b8 --- /dev/null +++ b/src/main/resources/assets/alchemist/models/item/volcanite_amulet.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "alchemist:item/volcanite_amulet" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/alchemist/textures/blocks/transmutation_circle.png b/src/main/resources/assets/alchemist/textures/blocks/transmutation_circle.png new file mode 100644 index 0000000..6567b73 Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/blocks/transmutation_circle.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/aeternalis_fuel.png b/src/main/resources/assets/alchemist/textures/items/aeternalis_fuel.png new file mode 100644 index 0000000..9188b3e Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/aeternalis_fuel.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/alchemical_coal.png b/src/main/resources/assets/alchemist/textures/items/alchemical_coal.png new file mode 100644 index 0000000..a6a6451 Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/alchemical_coal.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/catalytic_lens.png b/src/main/resources/assets/alchemist/textures/items/catalytic_lens.png new file mode 100644 index 0000000..e30c893 Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/catalytic_lens.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/chalk.png b/src/main/resources/assets/alchemist/textures/items/chalk.png new file mode 100644 index 0000000..e23d9ce Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/chalk.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/coal_coke.png b/src/main/resources/assets/alchemist/textures/items/coal_coke.png new file mode 100644 index 0000000..dc6b9aa Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/coal_coke.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/dark_matter.png b/src/main/resources/assets/alchemist/textures/items/dark_matter.png new file mode 100644 index 0000000..f8398b2 Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/dark_matter.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/dark_matter_hammer.png b/src/main/resources/assets/alchemist/textures/items/dark_matter_hammer.png new file mode 100644 index 0000000..3af012d Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/dark_matter_hammer.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/destruction_catalyst.png b/src/main/resources/assets/alchemist/textures/items/destruction_catalyst.png new file mode 100644 index 0000000..7cfb5dd Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/destruction_catalyst.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/evertide_amulet.png b/src/main/resources/assets/alchemist/textures/items/evertide_amulet.png new file mode 100644 index 0000000..3f6d6b4 Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/evertide_amulet.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/iron_band.png b/src/main/resources/assets/alchemist/textures/items/iron_band.png new file mode 100644 index 0000000..06945db Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/iron_band.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/mobius_fuel.png b/src/main/resources/assets/alchemist/textures/items/mobius_fuel.png new file mode 100644 index 0000000..1444d29 Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/mobius_fuel.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/philosophers_stone.png b/src/main/resources/assets/alchemist/textures/items/philosophers_stone.png new file mode 100644 index 0000000..1ce336e Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/philosophers_stone.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/red_matter.png b/src/main/resources/assets/alchemist/textures/items/red_matter.png new file mode 100644 index 0000000..eb6723d Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/red_matter.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/swiftwolfs_rending_gale.png b/src/main/resources/assets/alchemist/textures/items/swiftwolfs_rending_gale.png new file mode 100644 index 0000000..c07c078 Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/swiftwolfs_rending_gale.png differ diff --git a/src/main/resources/assets/alchemist/textures/items/volcanite_amulet.png b/src/main/resources/assets/alchemist/textures/items/volcanite_amulet.png new file mode 100644 index 0000000..bdba301 Binary files /dev/null and b/src/main/resources/assets/alchemist/textures/items/volcanite_amulet.png differ diff --git a/src/main/resources/assets/spritesheet.ase b/src/main/resources/assets/spritesheet.ase new file mode 100644 index 0000000..f777666 Binary files /dev/null and b/src/main/resources/assets/spritesheet.ase differ