Skip to content

Commit e66f12d

Browse files
changed to 1.21.1 neoforge
1 parent 975ffc5 commit e66f12d

File tree

10 files changed

+203
-135
lines changed

10 files changed

+203
-135
lines changed

build.gradle

Lines changed: 138 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
buildscript {
2-
repositories {
3-
maven { url = 'https://repo.spongepowered.org/repository/maven-public' }
4-
}
5-
dependencies {
6-
classpath "org.spongepowered:mixingradle:${mixingradle_version}"
7-
}
8-
}
91
plugins {
102
id 'idea'
113
id 'maven-publish'
12-
id 'net.minecraftforge.gradle' version '6.+'
13-
id 'org.spongepowered.mixin' version '0.7.+'
4+
id 'java-library'
5+
id 'org.jreleaser' version '1.17.0'
6+
id 'net.neoforged.moddev' version '2.0.78'
7+
148
}
159

10+
11+
import org.slf4j.event.Level
12+
1613
import java.nio.file.Files
1714
import java.nio.file.Paths
1815

@@ -38,66 +35,95 @@ base {
3835
}
3936

4037
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
41-
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
38+
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
4239

4340
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
44-
minecraft {
41+
// Specify the version of NeoForge to use.
42+
neoForge {
4543

46-
mappings channel: mapping_channel, version: minecraft_version
44+
version = project.neo_version
4745

48-
copyIdeResources = true
46+
parchment {
47+
mappingsVersion = project.parchment_mappings_version
48+
minecraftVersion = project.parchment_minecraft_version
49+
}
50+
configurations {
51+
runtimeClasspath.extendsFrom localRuntime
52+
}
4953

50-
accessTransformer = file('src/main/resources/META-INF/accesstransformers.cfg')
54+
// This line is optional. Access Transformers are automatically detected
55+
// accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
5156

57+
// Default run configurations.
58+
// These can be tweaked, removed, or duplicated as needed.
5259
runs {
53-
// applies to all the run configs below
54-
configureEach {
55-
workingDirectory project.file('run')
56-
arg '-mixin.config=formicapi.mixins.json'
57-
58-
property 'forge.logging.markers', 'REGISTRIES'
59-
60-
//property 'forge.logging.console.level', 'debug'
61-
62-
property 'mixin.env.remapRefMap', 'true'
63-
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
64-
mods {
65-
"${mod_id}" {
66-
source sourceSets.main
67-
}
68-
}
69-
}
70-
7160
client {
61+
client()
62+
7263
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
73-
property 'forge.enabledGameTestNamespaces', mod_id
64+
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
7465
}
7566

7667
server {
77-
property 'forge.enabledGameTestNamespaces', mod_id
78-
args '--nogui'
68+
server()
69+
programArgument '--nogui'
70+
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
7971
}
8072

81-
73+
// This run config launches GameTestServer and runs all registered gametests, then exits.
74+
// By default, the server will crash when no gametests are provided.
75+
// The gametest system is also enabled by default for other run configs under the /test command.
8276
gameTestServer {
83-
property 'forge.enabledGameTestNamespaces', mod_id
77+
type = "gameTestServer"
78+
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
8479
}
80+
8581
data {
86-
// example of overriding the workingDirectory set in configureEach above
87-
workingDirectory project.file('run-data')
82+
data()
83+
84+
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
85+
// gameDirectory = project.file('run-data')
8886

8987
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
90-
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
88+
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
89+
}
90+
91+
// applies to all the run configs above
92+
configureEach {
93+
// Recommended logging data for a userdev environment
94+
// The markers can be added/remove as needed separated by commas.
95+
// "SCAN": For mods scan.
96+
// "REGISTRIES": For firing of registry events.
97+
// "REGISTRYDUMP": For getting the contents of all registries.
98+
systemProperty 'forge.logging.markers', 'REGISTRIES'
99+
100+
// Recommended logging level for the console
101+
// You can set various levels here.
102+
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
103+
logLevel = Level.WARN
104+
105+
106+
}
107+
}
108+
mods {
109+
// define mod <-> source bindings
110+
// these are used to tell the game which sources are for which mod
111+
// mostly optional in a single mod project
112+
// but multi mod projects should define one per mod
113+
"${mod_id}" {
114+
sourceSet(sourceSets.main)
91115
}
92116
}
93117
}
94118

119+
120+
95121
// Include resources generated by data generators.
96122
sourceSets.main.resources { srcDir 'src/generated/resources' }
97123

98124
repositories {
99125
maven { url = "https://maven.createmod.net" } // Create, Ponder, Flywheel
100-
maven { url = "https://maven.tterrag.com" } // Registrate
126+
maven { url = "https://mvn.devos.one/snapshots" } // Registrate
101127

102128
//JEI
103129

@@ -129,29 +155,17 @@ repositories {
129155
}
130156

131157
dependencies {
132-
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
133-
//TODO make sure we only depend on catnip
134-
implementation(fg.deobf("com.simibubi.create:create-${minecraft_version}:${create_version}:slim") { transitive = false })
135-
implementation(fg.deobf("net.createmod.ponder:Ponder-Forge-${minecraft_version}:${ponder_version}"))
136-
compileOnly(fg.deobf("dev.engine-room.flywheel:flywheel-forge-api-${minecraft_version}:${flywheel_version}"))
137-
runtimeOnly(fg.deobf("dev.engine-room.flywheel:flywheel-forge-${minecraft_version}:${flywheel_version}"))
138-
implementation(fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}"))
139-
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.4.1"))
140-
implementation("io.github.llamalad7:mixinextras-forge:0.4.1")
141-
142-
//JEI
143-
// compile against the JEI API but do not include it at runtime
144-
compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"))
145-
compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}"))
146-
// at runtime, use the full JEI jar for Forge
147-
runtimeOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}"))
148-
149-
//curios
158+
implementation("com.simibubi.create:create-${minecraft_version}:${create_version}:slim"){ transitive = false }
159+
implementation("net.createmod.ponder:Ponder-NeoForge-${minecraft_version}:${ponder_version}")
160+
compileOnly("dev.engine-room.flywheel:flywheel-neoforge-api-${minecraft_version}:${flywheel_version}")
161+
runtimeOnly("dev.engine-room.flywheel:flywheel-neoforge-${minecraft_version}:${flywheel_version}")
162+
implementation("com.tterrag.registrate:Registrate:${registrate_version}")
150163

151-
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}")
152-
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api")
164+
// JEI
165+
compileOnly("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}")
166+
compileOnly("mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}")
167+
runtimeOnly("mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}")
153168

154-
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
155169

156170
//unit test tool
157171
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0'
@@ -160,13 +174,7 @@ dependencies {
160174
implementation("org.knowm.xchart:xchart:3.2.2")
161175

162176
}
163-
mixin {
164-
add sourceSets.main, 'formicapi.refmap.json'
165-
config 'formicapi.mixins.json'
166177

167-
//debug.verbose = true
168-
//debug.export = true
169-
}
170178
// This block of code expands all declared replace properties in the specified resource targets.
171179
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
172180
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
@@ -214,29 +222,76 @@ tasks.test {
214222
// dependsOn 'reobfJar'
215223
// }
216224

217-
// Example configuration to allow publishing using the maven-publish plugin
218225
publishing {
219226
publications {
220-
register('mavenJava', MavenPublication) {
221-
artifactId = 'formic-api-'+ minecraft_version // <-- valid Maven ID (no spaces)
222-
groupId = 'com.rae.formicapi' // <-- choose your group
223-
version = mod_version // <-- version of your mod/library
224-
225-
artifact jar
227+
mavenJava(MavenPublication) {
228+
from components.java
229+
}
230+
}
231+
}
226232

233+
//the jreleaser doesn't work
234+
//todo find why and fix it
235+
jreleaser {
236+
project {
237+
name = 'FormicAPI'
238+
version = mod_version
239+
description = 'A Minecraft modding API for the Engineer Colony'
240+
authors = ['RealAntEngineer']
241+
license = 'MIT'
242+
// Project homepage
243+
java {
244+
version = '17'
227245
}
246+
website = 'https://github.com/RealAntEngineer/FormicAPI'
228247
}
229-
repositories {//TODO use a more practical
248+
249+
deploy {
230250
maven {
231-
url = uri("https://maven.pkg.github.com/RealAntEngineer/Formic_API")
232-
credentials {
233-
username = System.getProperty("USERNAME")
234-
password = System.getProperty("TOKEN")
251+
mavenCentral {
252+
main {
253+
active = 'ALWAYS'
254+
url = 'https://s01.oss.sonatype.org/services/staging/deploy/maven2/' // new token-based endpoint
255+
256+
username = System.getProperty('SONATYPE_USERNAME')
257+
password = System.getProperty('SONATYPE_TOKEN')
258+
}
235259
}
236260
}
237261
}
238-
}
262+
signing {
263+
//active = 'ALWAYS'
264+
//armored = true
265+
//mode = 'MEMORY'
266+
secretKey = System.getProperty('SONATYPE_USERNAME')
267+
passphrase = System.getProperty('SONATYPE_TOKEN')
268+
}
239269

270+
distributions {
271+
main {
272+
artifact {
273+
path = "$buildDir/libs/formic-api-${minecraft_version}.jar"
274+
}
275+
extraProperties.put('groupId', 'io.github.realantengineer.formicapi')
276+
extraProperties.put('artifactId', "formic-api-${minecraft_version}")
277+
extraProperties.put('version', mod_version)
278+
}
279+
}
280+
/*release {
281+
github {
282+
active = 'NEVER'
283+
}
284+
}*/
285+
}
240286
tasks.withType(JavaCompile).configureEach {
241287
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
242-
}
288+
}
289+
290+
291+
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
292+
idea {
293+
module {
294+
downloadSources = true
295+
downloadJavadoc = true
296+
}
297+
}

gradle.properties

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,24 @@
22
org.gradle.jvmargs=-Xmx4G
33
org.gradle.daemon=false
44

5-
minecraft_version=1.20.1
6-
7-
minecraft_version_range=[1.20.1,1.21)
8-
# The Forge version must agree with the Minecraft version to get a valid artifact
9-
forge_version=47.3.0
10-
forge_version_range=[47,)
11-
12-
loader_version_range=[47,)
13-
14-
mapping_channel=official
5+
#read more on this at https://github.com/neoforged/ModDevGradle?tab=readme-ov-file#better-minecraft-parameter-names--javadoc-parchment
6+
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
7+
parchment_minecraft_version=1.21.1
8+
parchment_mappings_version=2024.11.17
9+
# Environment Properties
10+
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
11+
# The Minecraft version must agree with the Neo version to get a valid artifact
12+
minecraft_version=1.21.1
13+
# The Minecraft version range can use any release version of Minecraft as bounds.
14+
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
15+
# as they do not follow standard versioning conventions.
16+
minecraft_version_range=[1.21.1, 1.22)
17+
# The Neo version must agree with the Minecraft version to get a valid artifact
18+
neo_version=21.1.138
19+
# The Neo version range can use any version of Neo as bounds
20+
neo_version_range=[21.1.0,)
21+
# The loader version range can only use the major version of FML as bounds
22+
loader_version_range=[4,)
1523

1624
mixingradle_version=0.7-SNAPSHOT
1725
mixin_version=0.8.5
@@ -22,11 +30,12 @@ mod_license=MIT
2230

2331
mod_version=1.2
2432

25-
create_version = 6.0.2-50
26-
flywheel_version = 1.0.1
27-
ponder_version = 1.0.51
28-
registrate_version = MC1.20-1.3.3
29-
jei_version=15.19.5.99
33+
create_version = 6.0.4-55
34+
flywheel_version = 1.0.2
35+
ponder_version = 1.0.46
36+
registrate_version = MC1.21-1.3.0+62
37+
jei_version=19.10.0.126
38+
3039

3140
curios_version = 5.2.0-beta.3+1.20.1
3241

settings.gradle

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
pluginManagement {
22
repositories {
3+
mavenLocal()
34
gradlePluginPortal()
4-
maven {
5-
name = 'MinecraftForge'
6-
url = 'https://maven.minecraftforge.net/'
7-
}
8-
maven {
9-
name = "ParchmentMC"
10-
url = "https://maven.parchmentmc.org"
11-
}
12-
gradlePluginPortal()
13-
5+
maven { url = 'https://maven.neoforged.net/releases' }
146
}
157
}
168

179
plugins {
18-
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
10+
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0'
1911
}

src/main/java/com/rae/formicapi/FormicApiLang.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
import net.minecraft.network.chat.MutableComponent;
1313
import net.minecraft.world.item.ItemStack;
1414
import net.minecraft.world.level.block.state.BlockState;
15-
import net.minecraftforge.fluids.FluidStack;
15+
import net.neoforged.neoforge.fluids.FluidStack;
16+
1617

1718
import java.util.ArrayList;
1819
import java.util.List;

src/main/java/com/rae/formicapi/config/FormicAPICfgClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public class FormicAPICfgClient extends ConfigBase {
99

1010

11-
public final CROWNSUnits units = nested(0, CROWNSUnits::new, Comments.units);
11+
public final FormicAPIUnits units = nested(0, FormicAPIUnits::new, Comments.units);
1212
@Override
1313
public @NotNull String getName() {
1414
return FormicAPI.MODID +".client";

0 commit comments

Comments
 (0)