Skip to content

Commit

Permalink
Merge pull request #96 from unilock/neoforge/1.21
Browse files Browse the repository at this point in the history
Port to Neoforge 1.21
  • Loading branch information
Lance5057 authored Aug 14, 2024
2 parents a4fb497 + ca075a9 commit d50c7f5
Show file tree
Hide file tree
Showing 1,712 changed files with 20,248 additions and 20,543 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
fetch-depth: 0
fetch-tags: true

- name: Setup JDK 17
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'

- name: Build with Gradle
Expand Down
79 changes: 47 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.151'
id 'net.neoforged.moddev' version '1.0.14'
}

tasks.named('wrapper', Wrapper).configure {
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
// documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
// file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
// (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
distributionType = Wrapper.DistributionType.BIN
}

version = mod_version
Expand All @@ -20,43 +29,51 @@ base {
archivesName = mod_id
}

// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
// Mojang ships Java 21 to end users starting in 1.20.5, so mods should target Java 21.
java.toolchain.languageVersion = JavaLanguageVersion.of(21)

minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
neoForge {
version = project.neo_version

runs {
configureEach {
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
systemProperty 'forge.logging.markers', 'REGISTRIES'
parchment {
mappingsVersion = project.parchment_mappings_version
minecraftVersion = project.parchment_minecraft_version
}

// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
systemProperty 'forge.logging.console.level', 'debug'
accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')

modSource project.sourceSets.main
}
runs {
client {
client()
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}

client {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}
server {
server()
programArgument '--nogui'
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}

server {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
programArgument '--nogui'
}
gameTestServer {
type = "gameTestServer"
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}

data {
data()
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}

gameTestServer {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
configureEach {
systemProperty 'forge.logging.markers', 'REGISTRIES'
logLevel = org.slf4j.event.Level.DEBUG
}
}

data {
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
mods {
"${mod_id}" {
sourceSet(sourceSets.main)
}
}
}

Expand All @@ -67,8 +84,6 @@ configurations {
}

dependencies {
implementation "net.neoforged:neoforge:${neo_version}"

compileOnly "mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"
compileOnly "mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}"
localRuntime "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}"
Expand All @@ -91,7 +106,7 @@ tasks.withType(ProcessResources).configureEach {
]
inputs.properties replaceProperties

filesMatching(['META-INF/mods.toml']) {
filesMatching(['META-INF/neoforge.mods.toml']) {
expand replaceProperties
}
}
Expand Down
26 changes: 14 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
#org.gradle.jvmargs=
org.gradle.daemon=false
org.gradle.debug=false
org.gradle.jvmargs=-Xmx1G
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true

#read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings
#read more on this at https://github.com/neoforged/ModDevGradle?tab=readme-ov-file#better-minecraft-parameter-names--javadoc-parchment
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
neogradle.subsystems.parchment.minecraftVersion=1.20.4
neogradle.subsystems.parchment.mappingsVersion=2024.04.14
parchment_minecraft_version=1.21
parchment_mappings_version=2024.07.07
# Environment Properties
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
# The Minecraft version must agree with the Neo version to get a valid artifact
minecraft_version=1.20.4
minecraft_version=1.21
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.20.3,)
minecraft_version_range=[1.21,)
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=20.4.237
neo_version=21.0.114-beta
# The Neo version range can use any version of Neo as bounds
neo_version_range=[20.3,)
neo_version_range=[21.0.0-beta,)
# The loader version range can only use the major version of FML as bounds
loader_version_range=[2,)
loader_version_range=[4,)

## Mod Properties

Expand All @@ -46,4 +48,4 @@ mod_description=Killing an animal nets barely a few bits, maybe some meat and a

## Mod Dependencies

jei_version=17.3.0.56
jei_version=19.5.0.47
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.4 2024-07-04T06:09:30.465862306 Languages: en_us for mod: butchercraft
// 1.21 2024-07-22T20:34:07.367101084 Languages: en_us for mod: butchercraft
e042620c36bfc641a71caa608e56dba500ea1318 assets/butchercraft/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.4 2024-07-04T06:09:30.471928963 Block States: butchercraft
// 1.21 2024-07-22T20:34:07.374992238 Block States: butchercraft
90ac39911e6fcdc8a3e257d68c296bf15ca898a8 assets/butchercraft/blockstates/barn_wood_block.json
0dd6f470c09dcaa441fda03d7966ade38d1b5dc3 assets/butchercraft/blockstates/barn_wood_door.json
54cc4bb416fcf43d01815da926c642ca296e4029 assets/butchercraft/blockstates/barn_wood_fence.json
Expand Down
Loading

0 comments on commit d50c7f5

Please sign in to comment.