|
| 1 | +plugins { |
| 2 | + id 'java-library' |
| 3 | + id 'eclipse' |
| 4 | + id 'idea' |
| 5 | + id 'maven-publish' |
| 6 | + id 'net.neoforged.gradle.userdev' version '7.0.170' |
| 7 | + id "me.modmuss50.mod-publish-plugin" version "0.8.4" |
| 8 | +} |
| 9 | + |
| 10 | +tasks.named('wrapper', Wrapper).configure { |
| 11 | + distributionType = Wrapper.DistributionType.BIN |
| 12 | +} |
| 13 | + |
| 14 | +version = mod_version |
| 15 | +group = mod_group_id |
| 16 | + |
| 17 | +repositories { |
| 18 | + mavenLocal() |
| 19 | + exclusiveContent { |
| 20 | + forRepository { |
| 21 | + maven { |
| 22 | + url "https://cursemaven.com" |
| 23 | + } |
| 24 | + } |
| 25 | + filter { |
| 26 | + includeGroup "curse.maven" |
| 27 | + } |
| 28 | + } |
| 29 | + maven { |
| 30 | + url 'https://harleyoconnor.com/maven' |
| 31 | + } |
| 32 | + flatDir { |
| 33 | + dir("libs") |
| 34 | + } |
| 35 | +} |
| 36 | + |
| 37 | +base { |
| 38 | + archivesName = mod_id |
| 39 | +} |
| 40 | + |
| 41 | +java.toolchain.languageVersion = JavaLanguageVersion.of(21) |
| 42 | + |
| 43 | +//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg') |
| 44 | +//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager |
| 45 | + |
| 46 | +runs { |
| 47 | + |
| 48 | + configureEach { |
| 49 | + systemProperty 'forge.logging.markers', 'REGISTRIES' |
| 50 | + |
| 51 | + systemProperty 'forge.logging.console.level', 'debug' |
| 52 | + |
| 53 | + modSource project.sourceSets.main |
| 54 | + } |
| 55 | + |
| 56 | + client { |
| 57 | + systemProperty 'forge.enabledGameTestNamespaces', project.mod_id |
| 58 | + } |
| 59 | + |
| 60 | + server { |
| 61 | + systemProperty 'forge.enabledGameTestNamespaces', project.mod_id |
| 62 | + argument '--nogui' |
| 63 | + } |
| 64 | + |
| 65 | + gameTestServer { |
| 66 | + systemProperty 'forge.enabledGameTestNamespaces', project.mod_id |
| 67 | + } |
| 68 | + |
| 69 | + data { |
| 70 | + arguments.addAll( |
| 71 | + '--mod', project.mod_id, |
| 72 | + '--all', |
| 73 | + '--output', file('src/generated/resources/').getAbsolutePath(), |
| 74 | + '--existing', file('src/main/resources/').getAbsolutePath(), |
| 75 | + "--existing-mod", "dynamictrees") |
| 76 | + } |
| 77 | +} |
| 78 | + |
| 79 | +sourceSets.main.resources { srcDir 'src/generated/resources' } |
| 80 | + |
| 81 | +configurations { |
| 82 | + runtimeClasspath.extendsFrom localRuntime |
| 83 | +} |
| 84 | + |
| 85 | +dependencies { |
| 86 | + implementation "net.neoforged:neoforge:${neo_version}" |
| 87 | + |
| 88 | + implementation 'curse.maven:dynamictrees-252818:6360173' |
| 89 | + |
| 90 | + runtimeOnly 'curse.maven:jade-324717:6291517' |
| 91 | +} |
| 92 | + |
| 93 | +tasks.withType(ProcessResources).configureEach { |
| 94 | + var replaceProperties = [ |
| 95 | + minecraft_version : minecraft_version, |
| 96 | + minecraft_version_range: minecraft_version_range, |
| 97 | + neo_version : neo_version, |
| 98 | + neo_version_range : neo_version_range, |
| 99 | + loader_version_range : loader_version_range, |
| 100 | + mod_id : mod_id, |
| 101 | + mod_name : mod_name, |
| 102 | + mod_license : mod_license, |
| 103 | + mod_version : mod_version, |
| 104 | + mod_authors : mod_authors, |
| 105 | + mod_description : mod_description |
| 106 | + ] |
| 107 | + inputs.properties replaceProperties |
| 108 | + |
| 109 | + filesMatching(['META-INF/neoforge.mods.toml']) { |
| 110 | + expand replaceProperties |
| 111 | + } |
| 112 | +} |
| 113 | + |
| 114 | +publishing { |
| 115 | + publications { |
| 116 | + register('mavenJava', MavenPublication) { |
| 117 | + from components.java |
| 118 | + } |
| 119 | + } |
| 120 | + repositories { |
| 121 | + maven { |
| 122 | + url "file://${project.projectDir}/repo" |
| 123 | + } |
| 124 | + } |
| 125 | +} |
| 126 | + |
| 127 | +tasks.withType(JavaCompile).configureEach { |
| 128 | + options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation |
| 129 | +} |
| 130 | + |
| 131 | +idea { |
| 132 | + module { |
| 133 | + downloadSources = true |
| 134 | + downloadJavadoc = true |
| 135 | + } |
| 136 | +} |
0 commit comments