Skip to content

Commit

Permalink
Port to 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
gigabit101 committed Feb 24, 2024
1 parent 7599125 commit fea5e6a
Show file tree
Hide file tree
Showing 41 changed files with 566 additions and 454 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: Java CI with Gradle

on:
push:
branches: [ 1.20.1 ]
branches: [ 1.20.4 ]
jobs:
build:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ out/
dep/
RebornStorage_Client.launch
RebornStorage_Server.launch
runs/
232 changes: 100 additions & 132 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,184 +1,152 @@
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
// jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1+', changing: true
}
}
plugins {
id 'java-library'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.57'
}
apply plugin: 'net.minecraftforge.gradle'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.

version = "${project.mc_version}-${project.mod_version}"
group = "${project.maven_group}"
archivesBaseName = "${project.mod_id}"

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))

minecraft {
mappings channel: 'official', version: "${project.mc_version}"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES'
property 'forge.logging.console.level', 'debug'

property 'forge.enabledGameTestNamespaces', 'rebornstorage'

//Patchouli
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"

mods {
rebornstorage {
source sourceSets.main
}
}
}

server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES'
property 'forge.logging.console.level', 'debug'

property 'forge.enabledGameTestNamespaces', 'rebornstorage'

//Patchouli
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"

mods {
rebornstorage {
source sourceSets.main
}
}
}
def ENV = System.getenv()

gameTestServer {
workingDirectory project.file('run')
version = minecraft_version + "-" + mod_version + "-neoforge"
group = mod_group_id

// 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.
property 'forge.logging.markers', 'REGISTRIES'
repositories {
mavenLocal()
}

// 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
property 'forge.logging.console.level', 'debug'
base {
archivesName = mod_id
}

// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', 'rebornstorage'
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

mods {
rebornstorage {
source sourceSets.main
}
}
}
//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
minecraft {
accessTransformers {
file('src/main/resources/META-INF/accesstransformer.cfg')
}
}

data {
workingDirectory project.file('run')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
// applies to all the run configs below
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'

// 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'

modSource project.sourceSets.main
}

property 'forge.logging.markers', 'REGISTRIES'
client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}

property 'forge.logging.console.level', 'debug'
server {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
programArgument '--nogui'
}

// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', 'rebornstorage', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}

//Patchouli
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
data {
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
// workingDirectory project.file('run-data')

mods {
rebornstorage {
source sourceSets.main
}
}
}
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
}

// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }

repositories {
maven {
url = "https://maven.creeperhost.net"
name "CreeperHost"
url 'https://maven.creeperhost.net'
}
maven {
// location of the maven that hosts JEI files since January 2023
name = "Jared's maven"
url = "https://maven.blamejared.com/"
}
maven {
url "https://www.cursemaven.com"
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
url = "https://maven.theillusivec4.top/"
}

// flatDir {
// dirs '/libs'
// }
}

dependencies {
minecraft "net.minecraftforge:forge:${project.mc_version}-${project.forge_version}"

implementation fg.deobf("com.refinedmods:refinedstorage:${project.rs_version}") {
// Specify the version of Minecraft to use.
// Depending on the plugin applied there are several options. We will assume you applied the userdev plugin as shown above.
// The group for userdev is net.neoforged, the module name is neoforge, and the version is the same as the neoforge version.
// You can however also use the vanilla plugin (net.neoforged.gradle.vanilla) to use a version of Minecraft without the neoforge loader.
// And its provides the option to then use net.minecraft as the group, and one of; client, server or joined as the module name, plus the game version as version.
// For all intends and purposes: You can treat this dependency as if it is a normal library you would use.
implementation "net.neoforged:neoforge:${neo_version}"
implementation "net.creeperhost:polylib-neoforge:${polylib_version}"
implementation ("com.refinedmods:refinedstorage:${project.rs_version}") {
transitive false
}
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}")

runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${project.curios_version}")
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${project.curios_version}:api")

// compileOnly fg.deobf("vazkii.patchouli:Patchouli:${project.patchouli_version}:api")
// runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${project.patchouli_version}")

// compileOnly fg.deobf("team.chisel.ctm:CTM:${project.ctm_version}")
// runtimeOnly fg.deobf("team.chisel.ctm:CTM:${project.ctm_version}")
}

jar {
manifest {
attributes(["Specification-Title": archivesBaseName,
"Specification-Vendor": "gigabit101",
"Specification-Version": "${project.mod_version}",
"Implementation-Title": archivesBaseName,
"Implementation-Version": "${project.mod_version}",
"Implementation-Vendor" :"gigabit101",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],)
// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
tasks.withType(ProcessResources).configureEach {
var replaceProperties = [
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
neo_version : neo_version, neo_version_range: neo_version_range,
loader_version_range: loader_version_range,
mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors : mod_authors, mod_description: mod_description,
]
inputs.properties replaceProperties

filesMatching(['META-INF/mods.toml']) {
expand replaceProperties + [project: project]
}
}

def ENV = System.getenv()

// Example configuration to allow publishing using the maven-publish plugin
publishing {
publications {
register('mavenJava', MavenPublication) {
groupId "net.gigabit101"
artifactId = rootProject.archivesBaseName
groupId "net.creeperhost"
artifactId rootProject.archivesBaseName
version version
from components.java
}
}
repositories {
if (ENV.MAVEN_TOKEN) {
if (ENV.CREEPERHOST_MAVEN_TOKEN) {
maven {
url "https://maven.creeperhost.net/release"
allowInsecureProtocol = true
credentials {
username = "Gigabit101"
password = "${ENV.MAVEN_TOKEN}"
username = "githubci"
password = "${ENV.CREEPERHOST_MAVEN_TOKEN}"
}
}
}
Expand Down
55 changes: 43 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,45 @@
org.gradle.jvmargs=-Xmx3G
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.daemon=false
org.gradle.debug=false

mod_version = 5.0.7
mod_id = rebornstorage
maven_group = gigabit101

mc_version = 1.20.1
forge_version = 47.0.19
jei_version=15.1.0.19
rs_version=1.12.4
curios_version=5.2.0-beta.3+1.20.1
patchouli_version=1.19-75
ctm_version=1.18.2-1.1.4+4

## 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
# 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.4,1.21)
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=20.4.173
# The Neo version range can use any version of Neo as bounds
neo_version_range=[20.4,)
# The loader version range can only use the major version of FML as bounds
loader_version_range=[2,)

## Mod Properties

# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.
mod_id=rebornstorage
# The human-readable display name for the mod.
mod_name=Reborn Storage
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=MIT
# The mod version. See https://semver.org/
mod_version=5.1.0
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=net.gigabit101
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=Modmuss50, Gigabit101
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=I like trains.

polylib_version=2004.0.3-build.117

#jei_version=15.1.0.19
rs_version=1.13.0-beta.2
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit fea5e6a

Please sign in to comment.