Skip to content

Commit

Permalink
Merge pull request #1963 from mystchonky/1.20.x
Browse files Browse the repository at this point in the history
Initial port to 1.20.x, courtesy of chonky.
  • Loading branch information
WayofTime authored Aug 17, 2023
2 parents b6312e7 + 63c4522 commit 3bd53c4
Show file tree
Hide file tree
Showing 1,203 changed files with 17,261 additions and 19,675 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build jar

on: push

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Store committed data
run: cp -r src/generated generatedBak
- name: Build # Build to catch Java errors first
uses: gradle/gradle-build-action@v2
with:
arguments: build
- name: Run data generator
uses: gradle/gradle-build-action@v2
continue-on-error: true # We have to do this because runDataProd always exits funny
with:
arguments: runDataProd
- name: Check data generated successfully # So we do this to ensure something was done, .cache will always be written
continue-on-error: false # reset
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "src/generated/resources/.cache/"
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
path: ./build/libs/
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ run

# Files from Forge MDK
forge*changelog.txt
/src/generated/resources/.cache/
/run-data/
153 changes: 65 additions & 88 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,107 +1,78 @@
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
}
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.spongepowered.mixin' version '0.7.+'
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = minecraft_version + '-' + mod_version
group = 'wayoftime.bloodmagic' // http://maven.apache.org/guides/mini/guide-naming-conventions.html

version = '1.18.2-3.2.6-41'
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'BloodMagic'
base {
archivesName = 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: '1.18.2'
mappings channel: mapping_channel, version: mapping_version

accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
copyIdeResources = true

runs {
client {

configureEach {
workingDirectory project.file('run')

// properties 'mixin.env.disableRefMap': 'true'

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

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

mods {
bloodmagic {
"${mod_id}" {
source sourceSets.main
}
}

}
client {
property 'forge.enabledGameTestNamespaces', mod_id
}

server {
workingDirectory project.file('run')

// properties 'mixin.env.disableRefMap': 'true'

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
property 'forge.enabledGameTestNamespaces', mod_id
args '--nogui'
}

mods {
bloodmagic {
source sourceSets.main
}
}
gameTestServer {
property 'forge.enabledGameTestNamespaces', mod_id
}

data {
workingDirectory project.file('run')

// properties 'mixin.env.disableRefMap': 'true'

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

args '--mod', 'bloodmagic', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

mods {
bloodmagic {
source sourceSets.main
}
}
workingDirectory project.file('run-data')
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
}
}
}

// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
mixin {
add sourceSets.main, "bloodmagic.refmap.json"

config "bloodmagic.mixins.json"
}

repositories {
maven {
url "https://dvs1.progwml6.com/files/maven/"
}
maven {
name = "The Loader"
url = "https://maven.blamejared.com"
Expand All @@ -113,19 +84,12 @@ repositories {
}

dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.18.2-40.1.51'

// compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api")
// runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")



compileOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.5.174:api")
runtimeOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.5.174")
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"

compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")

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

Expand All @@ -135,39 +99,49 @@ dependencies {
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api")
}

jar {
tasks.named('processResources', ProcessResources).configure {
var replaceProperties = [
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version: forge_version, forge_version_range: forge_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', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}
}

tasks.named('jar', Jar).configure {
manifest {
attributes([
"Specification-Title": "bloodmagic",
"Specification-Vendor": "bloodmagicsareus",
"Specification-Title": mod_id,
"Specification-Vendor": mod_authors,
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"bloodmagicsareus",
"Implementation-Version": project.jar.archiveVersion,
"Implementation-Vendor" : mod_authors,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
finalizedBy 'reobfJar'
}


jar.finalizedBy('reobfJar')


sourceSets.main.resources {
srcDir 'src/generated/resources'
}

task srcJar(type: Jar) {
from(sourceSets.main.java)
classifier = 'sources'
archiveClassifier = 'sources'
}

task apiJar(type: Jar) {
from(sourceSets.main.allJava)
from(sourceSets.main.output)
include 'wayoftime/bloodmagic/api/**'

classifier = 'api'
archiveClassifier = 'api'
}

artifacts {
Expand All @@ -176,7 +150,7 @@ artifacts {

publishing {
publications {
mavenJava(MavenPublication) {
register('mavenJava', MavenPublication) {
artifact jar
artifact srcJar
artifact apiJar
Expand All @@ -187,4 +161,7 @@ publishing {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
31 changes: 27 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,32 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

minecraft_version=1.16.5
minecraft_version=1.20.1
minecraft_version_range=[1.20.1,1.21)
# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=47.1.0
# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[47,)
# The loader version range can only use the major version of Forge/FML as bounds
loader_version_range=[47,)
mapping_channel=official
mapping_version=1.20.1

mod_id=bloodmagic
mod_version=3.3.0-42
mod_name=Blood Magic
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
# 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=com.example.examplemod
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=WayofTime
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.

#Mod dependencies
jei_version=7.6.0.49
curios_version=1.18.2-5.0.7.1
patchouli_version=1.18.2-71.1
jei_version=15.2.0.23
curios_version=5.2.0-beta.3+1.20.1
patchouli_version=1.20.1-80-FORGE
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.3.3-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 3bd53c4

Please sign in to comment.