Skip to content

Commit a5215ea

Browse files
committed
port to 1.20.1
1 parent 8190c26 commit a5215ea

21 files changed

Lines changed: 291 additions & 214 deletions

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Disable autocrlf on generated files, they always generate with LF
2+
# Add any extra files or paths here to make git stop saying they
3+
# are changed when only line endings change.
4+
src/generated/**/.cache/cache text eol=lf
5+
src/generated/**/*.json text eol=lf

.github/workflows/build.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
- name: checkout repository
1111
uses: actions/checkout@v6
1212

13-
- name: setup jdk 21
13+
- name: setup jdk 17
1414
uses: actions/setup-java@v5
1515
with:
16-
java-version: 21
16+
java-version: 17
1717
distribution: 'temurin'
1818

1919
- name: build
@@ -26,13 +26,3 @@ jobs:
2626
with:
2727
path: build/libs/*
2828
archive: false
29-
30-
31-
- name: publish
32-
if: startsWith(github.ref, 'refs/tags/')
33-
uses: apehum/mc-publish@v1.2
34-
with:
35-
modrinth-id: 7FoirOzn
36-
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
37-
github-token: ${{ secrets.GITHUB_TOKEN }}
38-
game-versions: 1.21.1

TEMPLATE_LICENSE.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
MIT License
2+
3+
Copyright (c) 2023 NeoForged project
4+
5+
This license applies to the template files as supplied by github.com/NeoForged/MDK
6+
7+
8+
Permission is hereby granted, free of charge, to any person obtaining a copy
9+
of this software and associated documentation files (the "Software"), to deal
10+
in the Software without restriction, including without limitation the rights
11+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
copies of the Software, and to permit persons to whom the Software is
13+
furnished to do so, subject to the following conditions:
14+
15+
The above copyright notice and this permission notice shall be included in all
16+
copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
SOFTWARE.

build.gradle

Lines changed: 77 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
plugins {
2+
id 'idea'
23
id 'java-library'
34
id 'maven-publish'
4-
id 'idea'
5-
id 'net.neoforged.moddev' version '2.0.140'
5+
id 'net.neoforged.moddev.legacyforge' version '2.0.91'
6+
}
7+
8+
tasks.named('wrapper', Wrapper).configure {
9+
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
10+
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
11+
// documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
12+
// file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
13+
// (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
14+
distributionType = Wrapper.DistributionType.BIN
615
}
716

817
version = mod_version
@@ -11,52 +20,57 @@ group = mod_group_id
1120
repositories {
1221
mavenLocal()
1322
mavenCentral()
23+
gradlePluginPortal()
1424
maven {
1525
name = "TerraformersMC"
1626
url = "https://maven.terraformersmc.com/"
1727
}
28+
maven {
29+
name = "Modmaven"
30+
url = "https://modmaven.dev/"
31+
}
1832
}
1933

2034
base {
2135
archivesName = mod_id
2236
}
2337

24-
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
38+
// Mojang ships Java 17 to end users in 1.20.1, so mods should target Java 17.
39+
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
2540

26-
neoForge {
27-
// Specify the version of NeoForge to use.
28-
version = project.neo_version
41+
legacyForge {
42+
// Specify the version of MinecraftForge to use.
43+
version = project.minecraft_version + '-' + project.forge_version
2944

3045
parchment {
3146
mappingsVersion = project.parchment_mappings_version
3247
minecraftVersion = project.parchment_minecraft_version
3348
}
3449

3550
// This line is optional. Access Transformers are automatically detected
36-
// accessTransformers.add('src/main/resources/META-INF/accesstransformer.cfg')
51+
// accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
3752

3853
// Default run configurations.
3954
// These can be tweaked, removed, or duplicated as needed.
4055
runs {
4156
client {
4257
client()
43-
4458
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
45-
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
59+
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
4660
}
4761

4862
server {
4963
server()
5064
programArgument '--nogui'
51-
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
65+
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
5266
}
5367

5468
// This run config launches GameTestServer and runs all registered gametests, then exits.
5569
// By default, the server will crash when no gametests are provided.
5670
// The gametest system is also enabled by default for other run configs under the /test command.
5771
gameTestServer {
5872
type = "gameTestServer"
59-
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
73+
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
6074
}
6175

6276
data {
@@ -99,40 +113,71 @@ neoForge {
99113
// Include resources generated by data generators.
100114
sourceSets.main.resources { srcDir 'src/generated/resources' }
101115

116+
// Sets up a dependency configuration called 'localRuntime' and a deobfuscating one called 'modLocalRuntime'
117+
// These configurations should be used instead of 'runtimeOnly' to declare
118+
// a dependency that will be present for runtime testing but that is
119+
// "optional", meaning it will not be pulled by dependents of this mod.
120+
configurations {
121+
runtimeClasspath.extendsFrom localRuntime
122+
}
123+
obfuscation {
124+
createRemappingConfiguration(configurations.localRuntime)
125+
}
102126

103127
dependencies {
104-
implementation "org.appliedenergistics:appliedenergistics2:${ae2_version}"
105-
implementation "dev.emi:emi-neoforge:${emi_version}"
128+
modCompileOnly "appeng:appliedenergistics2-forge:15.4.10"
129+
// modImplementation "org.appliedenergistics:guideme:20.1.14"
130+
modCompileOnly "dev.emi:emi-forge:1.1.22+1.20.1"
131+
// compileOnly "io.github.llamalad7:mixinextras-common:0.3.5"
132+
//
133+
// implementation "io.github.llamalad7:mixinextras-forge:0.3.5"
106134
}
107135

136+
// Uncomment the lines below if you wish to configure mixin. The mixin file should be named modid.mixins.json.
137+
138+
mixin {
139+
add sourceSets.main, "${mod_id}.refmap.json"
140+
config "${mod_id}.mixins.json"
141+
}
142+
143+
dependencies {
144+
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
145+
// annotationProcessor "io.github.llamalad7:mixinextras-common:0.3.5"
146+
}
147+
148+
jar {
149+
manifest.attributes([
150+
"MixinConfigs": "${mod_id}.mixins.json"
151+
])
152+
}
153+
154+
108155
// This block of code expands all declared replace properties in the specified resource targets.
109156
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
110157
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
111-
var replaceProperties = [minecraft_version : minecraft_version,
112-
minecraft_version_range: minecraft_version_range,
113-
neo_version : neo_version,
114-
neo_version_range : neo_version_range,
115-
loader_version_range : loader_version_range,
116-
mod_id : mod_id,
117-
mod_name : mod_name,
118-
mod_license : mod_license,
119-
mod_version : mod_version,
120-
mod_authors : mod_authors,
121-
mod_description : mod_description,
122-
ae2_version : ae2_version,
123-
emi_version : emi_version,
158+
var replaceProperties = [
159+
minecraft_version : minecraft_version,
160+
minecraft_version_range : minecraft_version_range,
161+
forge_version : forge_version,
162+
forge_version_range : forge_version_range,
163+
loader_version_range : loader_version_range,
164+
mod_id : mod_id,
165+
mod_name : mod_name,
166+
mod_license : mod_license,
167+
mod_version : mod_version,
168+
mod_authors : mod_authors,
169+
mod_description : mod_description
124170
]
125171
inputs.properties replaceProperties
126172
expand replaceProperties
127173
from "src/main/templates"
128174
into "build/generated/sources/modMetadata"
129175
}
130-
131176
// Include the output of "generateModMetadata" as an input directory for the build
132177
// this works with both building through Gradle and the IDE.
133178
sourceSets.main.resources.srcDir generateModMetadata
134179
// To avoid having to run "generateModMetadata" manually, make it run on every project reload
135-
neoForge.ideSyncTask generateModMetadata
180+
legacyForge.ideSyncTask generateModMetadata
136181

137182
// Example configuration to allow publishing using the maven-publish plugin
138183
publishing {
@@ -148,6 +193,10 @@ publishing {
148193
}
149194
}
150195

196+
tasks.withType(JavaCompile).configureEach {
197+
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
198+
}
199+
151200
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
152201
idea {
153202
module {

gradle.properties

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,26 @@ org.gradle.daemon=true
44
org.gradle.parallel=true
55
org.gradle.caching=true
66
org.gradle.configuration-cache=true
7-
## Environment Properties
8-
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
9-
# The Minecraft version must agree with the Neo version to get a valid artifact
10-
minecraft_version=1.21.1
7+
8+
#read more on this at https://github.com/neoforged/ModDevGradle?tab=readme-ov-file#better-minecraft-parameter-names--javadoc-parchment
9+
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
10+
parchment_minecraft_version=1.20.1
11+
parchment_mappings_version=2023.09.03
12+
# Environment Properties
13+
# You can find the latest versions here: https://files.minecraftforge.net/net/minecraftforge/forge/index_1.20.1.html
14+
# The Minecraft version must agree with the Forge version to get a valid artifact
15+
minecraft_version=1.20.1
1116
# The Minecraft version range can use any release version of Minecraft as bounds.
1217
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
1318
# as they do not follow standard versioning conventions.
14-
minecraft_version_range=[1.21.1,1.22)
15-
# The Neo version must agree with the Minecraft version to get a valid artifact
16-
neo_version=21.1.219
17-
# The Neo version range can use any version of Neo as bounds
18-
neo_version_range=[21,)
19+
minecraft_version_range=[1.20.1]
20+
# The Forge version must agree with the Minecraft version to get a valid artifact
21+
forge_version=47.1.47
22+
# The Forge version range can use any version of Forge as bounds
23+
forge_version_range=[47,)
1924
# The loader version range can only use the major version of FML as bounds
20-
loader_version_range=[4,)
21-
parchment_minecraft_version=1.21.11
22-
parchment_mappings_version=2025.12.20
25+
loader_version_range=[47,)
26+
2327
## Mod Properties
2428
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
2529
# Must match the String constant located in the main mod class annotated with @Mod.
@@ -30,5 +34,3 @@ mod_version=1.0.1
3034
mod_group_id=io.github.linkfgfgui
3135
mod_authors=link-fgfgui
3236
mod_description=Automatically Encoding Patterns from the EMI Recipe Tree.
33-
ae2_version=19.2.17
34-
emi_version=1.1.22+1.21.1

gradle/wrapper/gradle-wrapper.jar

311 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings.gradle

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
pluginManagement {
2-
repositories {
3-
mavenLocal()
4-
gradlePluginPortal()
5-
maven { url = 'https://maven.neoforged.net/releases' }
6-
}
7-
}
8-
91
plugins {
10-
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
2+
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
113
}

0 commit comments

Comments
 (0)