|
| 1 | +buildscript { |
| 2 | + repositories { |
| 3 | + // These repositories are only for Gradle plugins, put any other repositories in the repository block further below |
| 4 | + maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } |
| 5 | + mavenCentral() |
| 6 | + } |
| 7 | + dependencies { |
| 8 | + classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' |
| 9 | + } |
| 10 | +} |
| 11 | + |
1 | 12 | plugins { |
2 | | - id 'fabric-loom' version '0.13-SNAPSHOT' |
3 | | - id 'maven-publish' |
| 13 | + id 'net.minecraftforge.gradle' version '5.1.+' |
4 | 14 | } |
5 | 15 |
|
6 | | -version = project.mod_version |
7 | | -group = project.maven_group |
| 16 | +apply plugin: 'org.spongepowered.mixin' |
8 | 17 |
|
9 | | -repositories { |
10 | | - // Add repositories to retrieve artifacts from in here. |
11 | | - // You should only use this when depending on other mods because |
12 | | - // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. |
13 | | - // See https://docs.gradle.org/current/userguide/declaring_repositories.html |
14 | | - // for more information about repositories. |
15 | | -} |
| 18 | +jarJar.enable() |
16 | 19 |
|
17 | | -dependencies { |
18 | | - // To change the versions see the gradle.properties file |
19 | | - minecraft "com.mojang:minecraft:${project.minecraft_version}" |
20 | | - mappings loom.officialMojangMappings() |
21 | | - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" |
| 20 | +group = 'pl.panszelescik' |
| 21 | +version = '1.0.2-forge-1.19.2' |
22 | 22 |
|
23 | | - implementation group: 'io.netty', name: 'netty-codec-haproxy', version: '4.1.78.Final' |
24 | | - include group: 'io.netty', name: 'netty-codec-haproxy', version: '4.1.78.Final' |
| 23 | +java { |
| 24 | + archivesBaseName = 'proxy_protocol_support' |
| 25 | + toolchain.languageVersion = JavaLanguageVersion.of(17) |
25 | 26 | } |
26 | 27 |
|
27 | | -processResources { |
28 | | - inputs.property "version", project.version |
29 | | - filteringCharset "UTF-8" |
| 28 | +minecraft { |
| 29 | + // The mappings can be changed at any time and must be in the following format. |
| 30 | + // Channel: Version: |
| 31 | + // official MCVersion Official field/method names from Mojang mapping files |
| 32 | + // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official |
| 33 | + // |
| 34 | + // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. |
| 35 | + // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md |
| 36 | + // |
| 37 | + // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge |
| 38 | + // Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started |
| 39 | + // |
| 40 | + // Use non-default mappings at your own risk. They may not always work. |
| 41 | + // Simply re-run your setup task after changing the mappings to update your workspace. |
| 42 | + mappings channel: 'official', version: '1.19.2' |
| 43 | + |
| 44 | + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') |
| 45 | + |
| 46 | + // Default run configurations. |
| 47 | + // These can be tweaked, removed, or duplicated as needed. |
| 48 | + runs { |
| 49 | + client { |
| 50 | + workingDirectory project.file('run') |
| 51 | + |
| 52 | + // Recommended logging data for a userdev environment |
| 53 | + // The markers can be added/remove as needed separated by commas. |
| 54 | + // "SCAN": For mods scan. |
| 55 | + // "REGISTRIES": For firing of registry events. |
| 56 | + // "REGISTRYDUMP": For getting the contents of all registries. |
| 57 | + property 'forge.logging.markers', 'REGISTRIES' |
| 58 | + |
| 59 | + |
| 60 | + // Recommended logging level for the console |
| 61 | + // You can set various levels here. |
| 62 | + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels |
| 63 | + property 'forge.logging.console.level', 'debug' |
| 64 | + |
| 65 | + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. |
| 66 | + property 'forge.enabledGameTestNamespaces', 'proxy_protocol_support' |
| 67 | + |
| 68 | + mods { |
| 69 | + proxy_protocol_support { |
| 70 | + source sourceSets.main |
| 71 | + } |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + server { |
| 76 | + workingDirectory project.file('run') |
| 77 | + |
| 78 | + property 'forge.logging.markers', 'REGISTRIES' |
| 79 | + |
| 80 | + property 'forge.logging.console.level', 'debug' |
| 81 | + |
| 82 | + property 'forge.enabledGameTestNamespaces', 'proxy_protocol_support' |
| 83 | + |
| 84 | + mods { |
| 85 | + proxy_protocol_support { |
| 86 | + source sourceSets.main |
| 87 | + } |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + // This run config launches GameTestServer and runs all registered gametests, then exits. |
| 92 | + // By default, the server will crash when no gametests are provided. |
| 93 | + // The gametest system is also enabled by default for other run configs under the /test command. |
| 94 | + gameTestServer { |
| 95 | + workingDirectory project.file('run') |
| 96 | + |
| 97 | + property 'forge.logging.markers', 'REGISTRIES' |
| 98 | + |
| 99 | + property 'forge.logging.console.level', 'debug' |
| 100 | + |
| 101 | + property 'forge.enabledGameTestNamespaces', 'proxy_protocol_support' |
| 102 | + |
| 103 | + mods { |
| 104 | + proxy_protocol_support { |
| 105 | + source sourceSets.main |
| 106 | + } |
| 107 | + } |
| 108 | + } |
| 109 | + |
| 110 | + data { |
| 111 | + workingDirectory project.file('run') |
| 112 | + |
| 113 | + property 'forge.logging.markers', 'REGISTRIES' |
| 114 | + |
| 115 | + property 'forge.logging.console.level', 'debug' |
30 | 116 |
|
31 | | - filesMatching("fabric.mod.json") { |
32 | | - expand "version": project.version |
| 117 | + // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. |
| 118 | + args '--mod', 'proxy_protocol_support', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') |
| 119 | + |
| 120 | + mods { |
| 121 | + proxy_protocol_support { |
| 122 | + source sourceSets.main |
| 123 | + } |
| 124 | + } |
| 125 | + } |
33 | 126 | } |
34 | 127 | } |
35 | 128 |
|
36 | | -def targetJavaVersion = 8 |
37 | | -tasks.withType(JavaCompile).configureEach { |
38 | | - // ensure that the encoding is set to UTF-8, no matter what the system default is |
39 | | - // this fixes some edge cases with special characters not displaying correctly |
40 | | - // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html |
41 | | - // If Javadoc is generated, this must be specified in that task too. |
42 | | - it.options.encoding = "UTF-8" |
43 | | - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { |
44 | | - it.options.release = targetJavaVersion |
45 | | - } |
| 129 | +mixin { |
| 130 | + add sourceSets.main, "proxy_protocol_support.refmap.json" |
| 131 | + |
| 132 | + config "proxy_protocol_support.mixins.json" |
46 | 133 | } |
47 | 134 |
|
48 | | -java { |
49 | | - def javaVersion = JavaVersion.toVersion(targetJavaVersion) |
50 | | - if (JavaVersion.current() < javaVersion) { |
51 | | - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) |
| 135 | +// Include resources generated by data generators. |
| 136 | +sourceSets.main.resources { srcDir 'src/generated/resources' } |
| 137 | + |
| 138 | +repositories { |
| 139 | + // Put repositories for dependencies here |
| 140 | + // ForgeGradle automatically adds the Forge maven and Maven Central for you |
| 141 | + |
| 142 | + // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: |
| 143 | + // flatDir { |
| 144 | + // dir 'libs' |
| 145 | + // } |
| 146 | +} |
| 147 | + |
| 148 | +dependencies { |
| 149 | + // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft' it is assumed |
| 150 | + // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. |
| 151 | + // The userdev artifact is a special name and will get all sorts of transformations applied to it. |
| 152 | + minecraft 'net.minecraftforge:forge:1.19.2-43.0.15' |
| 153 | + |
| 154 | + // Real mod deobf dependency examples - these get remapped to your current mappings |
| 155 | + // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency |
| 156 | + // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency |
| 157 | + // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency |
| 158 | + |
| 159 | + // Examples using mod jars from ./libs |
| 160 | + // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") |
| 161 | + |
| 162 | + // For more info... |
| 163 | + // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html |
| 164 | + // http://www.gradle.org/docs/current/userguide/dependency_management.html |
| 165 | + |
| 166 | + // https://mvnrepository.com/artifact/io.netty/netty-codec-haproxy |
| 167 | + implementation group: 'io.netty', name: 'netty-codec-haproxy', version: '4.1.79.Final' |
| 168 | + jarJar(group: 'io.netty', name: 'netty-codec-haproxy', version: '[4.1.79.Final]') { |
| 169 | + jarJar.pin(it, '4.1.79.Final') |
| 170 | + transitive = false |
52 | 171 | } |
53 | | - archivesBaseName = project.archives_base_name |
54 | | - // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task |
55 | | - // if it is present. |
56 | | - // If you remove this line, sources will not be generated. |
57 | | - withSourcesJar() |
| 172 | + |
| 173 | + annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' |
58 | 174 | } |
59 | 175 |
|
| 176 | +// Example for how to get properties into the manifest for reading at runtime. |
60 | 177 | jar { |
61 | | - from("LICENSE") { |
62 | | - rename { "${it}_${project.archivesBaseName}" } |
| 178 | + manifest { |
| 179 | + attributes([ |
| 180 | + "Specification-Title" : "proxy_protocol_support", |
| 181 | + "Specification-Vendor" : "PanSzelescik", |
| 182 | + "Specification-Version" : "1", // We are version 1 of ourselves |
| 183 | + "Implementation-Title" : project.name, |
| 184 | + "Implementation-Version" : project.jar.archiveVersion, |
| 185 | + "Implementation-Vendor" : "PanSzelescik", |
| 186 | + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") |
| 187 | + ]) |
63 | 188 | } |
64 | 189 | } |
65 | 190 |
|
66 | | -// configure the maven publication |
67 | | -publishing { |
68 | | - publications { |
69 | | - mavenJava(MavenPublication) { |
70 | | - from components.java |
71 | | - } |
72 | | - } |
| 191 | +jar.finalizedBy('reobfJar') |
73 | 192 |
|
74 | | - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. |
75 | | - repositories { |
76 | | - // Add repositories to publish to here. |
77 | | - // Notice: This block does NOT have the same function as the block in the top level. |
78 | | - // The repositories here will be used for publishing your artifact, not for |
79 | | - // retrieving dependencies. |
80 | | - } |
| 193 | +build { |
| 194 | + dependsOn 'jarJar' |
| 195 | +} |
| 196 | + |
| 197 | +tasks.withType(JavaCompile).configureEach { |
| 198 | + options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation |
81 | 199 | } |
0 commit comments