diff --git a/EntityCulling-Forge/build.gradle b/EntityCulling-Forge/build.gradle index f434904..7902c43 100644 --- a/EntityCulling-Forge/build.gradle +++ b/EntityCulling-Forge/build.gradle @@ -24,7 +24,6 @@ checkPropertyExists("modName") checkPropertyExists("modId") checkPropertyExists("modGroup") checkPropertyExists("minecraftVersion") // hard-coding this makes it harder to immediately tell what version a mod is in (even though this only really supports 1.12.2) -checkPropertyExists("apiPackage") checkPropertyExists("accessTransformersFile") checkPropertyExists("usesMixins") checkPropertyExists("mixinsPackage") @@ -34,37 +33,13 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly") // Optional properties: we can assume some default behavior if these are missing propertyDefaultIfUnset("modVersion", "") propertyDefaultIfUnset("includeMCVersionJar", false) -propertyDefaultIfUnset("autoUpdateBuildScript", false) propertyDefaultIfUnset("modArchivesBaseName", project.modId) propertyDefaultIfUnsetWithEnvVar("developmentEnvironmentUserName", "Developer", "DEV_USERNAME") -propertyDefaultIfUnset("generateGradleTokenClass", "") -propertyDefaultIfUnset("gradleTokenModId", "") -propertyDefaultIfUnset("gradleTokenModName", "") -propertyDefaultIfUnset("gradleTokenVersion", "") -propertyDefaultIfUnset("useSrcApiPath", false) -propertyDefaultIfUnset("includeWellKnownRepositories", true) -propertyDefaultIfUnset("includeCommonDevEnvMods", true) propertyDefaultIfUnset("noPublishedSources", false) -propertyDefaultIfUnset("forceEnableMixins", false) -propertyDefaultIfUnsetWithEnvVar("enableCoreModDebug", false, "CORE_MOD_DEBUG") propertyDefaultIfUnset("generateMixinConfig", true) propertyDefaultIfUnset("usesShadowedDependencies", false) propertyDefaultIfUnset("minimizeShadowedDependencies", true) propertyDefaultIfUnset("relocateShadowedDependencies", true) -propertyDefaultIfUnset("separateRunDirectories", false) -propertyDefaultIfUnset("versionDisplayFormat", '$MOD_NAME \u2212 $VERSION') -propertyDefaultIfUnsetWithEnvVar("modrinthProjectId", "", "MODRINTH_PROJECT_ID") -propertyDefaultIfUnset("modrinthRelations", "") -propertyDefaultIfUnsetWithEnvVar("curseForgeProjectId", "", "CURSEFORGE_PROJECT_ID") -propertyDefaultIfUnset("curseForgeRelations", "") -propertyDefaultIfUnsetWithEnvVar("releaseType", "release", "RELEASE_TYPE") -propertyDefaultIfUnset("generateDefaultChangelog", false) -propertyDefaultIfUnset("customMavenPublishUrl", "") -propertyDefaultIfUnset("mavenArtifactGroup", getDefaultArtifactGroup()) -propertyDefaultIfUnset("enableModernJavaSyntax", false) -propertyDefaultIfUnset("enableSpotless", false) -propertyDefaultIfUnset("enableJUnit", false) -propertyDefaultIfUnsetWithEnvVar("deploymentDebug", false, "DEPLOYMENT_DEBUG") // Project property assertions @@ -72,7 +47,6 @@ propertyDefaultIfUnsetWithEnvVar("deploymentDebug", false, "DEPLOYMENT_DEBUG") final String javaSourceDir = 'src/main/java/' final String modGroupPath = modGroup.toString().replace('.' as char, '/' as char) -final String apiPackagePath = apiPackage.toString().replace('.' as char, '/' as char) String targetPackageJava = javaSourceDir + modGroupPath @@ -93,11 +67,7 @@ if (usesShadowedDependencies.toBoolean()) { java { toolchain { - if (enableModernJavaSyntax.toBoolean()) { - languageVersion.set(JavaLanguageVersion.of(17)) - } else { - languageVersion.set(JavaLanguageVersion.of(8)) - } + languageVersion.set(JavaLanguageVersion.of(8)) // Azul covers the most platforms for Java 8+ toolchains, crucially including MacOS arm64 vendor.set(JvmVendorSpec.AZUL) } @@ -108,20 +78,6 @@ java { tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' - - if (enableModernJavaSyntax.toBoolean()) { - if (it.name in ['compileMcLauncherJava', 'compilePatchedMcJava']) { - return - } - - sourceCompatibility = 17 - options.release.set(8) - - javaCompiler.set(javaToolchains.compilerFor { - languageVersion.set(JavaLanguageVersion.of(17)) - vendor.set(JvmVendorSpec.AZUL) - }) - } } tasks.withType(ScalaCompile).configureEach { @@ -161,17 +117,6 @@ minecraft { username = developmentEnvironmentUserName.toString() useDependencyAccessTransformers = true - // Automatic token injection with RetroFuturaGradle - if (gradleTokenModId) { - injectedTags.put gradleTokenModId, modId - } - if (gradleTokenModName) { - injectedTags.put gradleTokenModName, modName - } - if (gradleTokenVersion) { - injectedTags.put gradleTokenVersion, modVersion - } - // JVM arguments extraRunJvmArguments.add("-ea:${modGroup}") if (usesMixins.toBoolean()) { @@ -182,17 +127,6 @@ minecraft { ]) } - if (enableCoreModDebug.toBoolean()) { - extraRunJvmArguments.addAll([ - '-Dlegacy.debugClassLoading=true', - '-Dlegacy.debugClassLoadingFiner=true', - '-Dlegacy.debugClassLoadingSave=true' - ]) - } -} - -if (generateGradleTokenClass) { - tasks.injectTags.outputClassName.set(generateGradleTokenClass) } @@ -253,7 +187,7 @@ repositories { maven { url "https://repo.codemc.io/repository/maven-public/" } - if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { + if (usesMixins.toBoolean()) { maven { name 'Cleanroom Maven' url 'https://maven.cleanroommc.com' @@ -313,8 +247,12 @@ dependencies { transitive = false } - shadowImplementation "com.logisticscraft:occlusionculling:${project.occlusionculling_version}" +} +if (getFile('dependencies.gradle').exists()) { + apply from: 'dependencies.gradle' +} else if (getFile('dependencies.gradle.kts').exists()) { + apply from: 'dependencies.gradle.kts' } // Resource processing and jar building @@ -346,68 +284,6 @@ processResources { } } -// Automatically generate a mixin json file if it does not already exist -tasks.register('generateAssets') { - group = 'GT Buildscript' - description = 'Generates a pack.mcmeta, mcmod.info, or mixins.{modid}.json if needed' - doLast { - // pack.mcmeta - def packMcmetaFile = getFile('src/main/resources/pack.mcmeta') - if (!packMcmetaFile.exists()) { - packMcmetaFile.text = """{ - "pack": { - "pack_format": 3, - "description": "${modName} Resource Pack" - } -} -""" - } - - // mcmod.info - def mcmodInfoFile = getFile('src/main/resources/mcmod.info') - if (!mcmodInfoFile.exists()) { - mcmodInfoFile.text = """[{ - "modid": "\${modid}", - "name": "\${modname}", - "description": "An example mod for Minecraft 1.12.2 with Forge", - "version": "\${version}", - "mcversion": "\${mcversion}", - "logoFile": "", - "url": "", - "authorList": [], - "credits": "", - "dependencies": [] -}] -""" - } - - // mixins.{modid}.json - if (usesMixins.toBoolean() && generateMixinConfig.toBoolean()) { - def mixinConfigFile = getFile("src/main/resources/mixins.${modId}.json") - if (!mixinConfigFile.exists()) { - def mixinConfigRefmap = "mixins.${modId}.refmap.json" - - mixinConfigFile.text = """{ - "package": "${modGroup}.${mixinsPackage}", - "refmap": "${mixinConfigRefmap}", - "target": "@env(DEFAULT)", - "minVersion": "0.8", - "compatibilityLevel": "JAVA_8", - "mixins": [], - "client": [], - "server": [] -} -""" - } - } - } -} - -tasks.named('processResources').configure { - dependsOn('generateAssets') -} - - jar { manifest { attributes(getManifestAttributes()) @@ -473,7 +349,7 @@ def getManifestAttributes() { if (usesMixins.toBoolean()) { attributes['ForceLoadAsMod'] = !containsMixinsAndOrCoreModOnly.toBoolean() } - attributes['FMLCorePlugin'] = "dev.tr7zw.entityculling.EntityCullingEarlyLoader" + attributes['FMLCorePlugin'] = "${coreModClass}" return attributes } diff --git a/EntityCulling-Forge/dependencies.gradle b/EntityCulling-Forge/dependencies.gradle new file mode 100644 index 0000000..a1ea22d --- /dev/null +++ b/EntityCulling-Forge/dependencies.gradle @@ -0,0 +1,3 @@ +dependencies { + shadowImplementation "com.logisticscraft:occlusionculling:${project.occlusionculling_version}" +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 2678290..38fef83 100644 --- a/gradle.properties +++ b/gradle.properties @@ -30,9 +30,6 @@ includeMCVersionJar = true # The name of your jar when you produce builds, not including any versioning info modArchivesBaseName = entityculling -# Will update your build.gradle automatically whenever an update is available -autoUpdateBuildScript = false - minecraftVersion = 1.12.2 # Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you @@ -42,20 +39,6 @@ minecraftVersion = 1.12.2 # Alternatively this can be set with the 'DEV_USERNAME' environment variable. developmentEnvironmentUserName = Developer -# Generate a class with String fields for the mod id, name and version named with the fields below -generateGradleTokenClass = com.myname.mymodid.Tags -gradleTokenModId = MODID -gradleTokenModName = MODNAME -gradleTokenVersion = VERSION - -# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can -# leave this property empty. -# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api -apiPackage = - -# If you want to keep your API code in src/api instead of src/main -useSrcApiPath = false - # Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/ # There can be multiple files in a comma-separated list. # Example value: mymodid_at.cfg,jei_at.cfg @@ -69,28 +52,11 @@ mixinsPackage = dev.tr7zw.entityculling.mixins generateMixinConfig = false # Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! # Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin -coreModClass = +coreModClass = dev.tr7zw.entityculling.EntityCullingEarlyLoader # If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod (meaning that # there is no class annotated with @Mod) you want this to be true. When in doubt: leave it on false! containsMixinsAndOrCoreModOnly = false -# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins. -forceEnableMixins = false - -# Outputs pre-transformed and post-transformed loaded classes to run/CLASSLOADER_TEMP. Can be used in combination with -# diff to see exactly what your ASM or Mixins are changing in the target file. -# Optionally can be specified with the 'CORE_MOD_DEBUG' env var. Will output a lot of files! -enableCoreModDebug = false - -# Adds CurseMaven, Modrinth Maven, BlameJared maven, and some more well-known 1.12.2 repositories -includeWellKnownRepositories = true - -# Adds JEI and TheOneProbe to your development environment. Adds them as 'implementation', meaning they will -# be available at compiletime and runtime for your mod (in-game and in-code). -# Overrides the above setting to be always true, as these repositories are needed to fetch the mods -includeCommonDevEnvMods = false - - # If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your # responsibility check the licence and request permission for distribution, if required. usesShadowedDependencies = true @@ -100,14 +66,6 @@ minimizeShadowedDependencies = false # If disabled, won't rename the shadowed classes. relocateShadowedDependencies = true -# Separate run directories into "run/client" for runClient task, and "run/server" for runServer task. -# Useful for debugging a server and client simultaneously. If not enabled, it will be in the standard location "run/" -separateRunDirectories = false - -# The display name format of versions published to Curse and Modrinth. $MOD_NAME and $VERSION are available variables. -# Default: $MOD_NAME \u2212 $VERSION. \u2212 is the minus character which looks much better than the hyphen minus on Curse. -versionDisplayFormat = $MOD_NAME \u2212 $VERSION - # Gradle Settings # Effectively applies the '--stacktrace' flag by default org.gradle.logging.stacktrace = all