Skip to content

Commit

Permalink
Port to 1.20.2 [build] [publish]
Browse files Browse the repository at this point in the history
Add back datagen code that was accidentally removed
  • Loading branch information
Mrbysco committed Dec 9, 2023
1 parent 3d7db74 commit 2819204
Show file tree
Hide file tree
Showing 37 changed files with 442 additions and 398 deletions.
177 changes: 79 additions & 98 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,95 +1,57 @@
plugins {
id 'java-library'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'net.neoforged.gradle.userdev' version '7.0.61'
id 'net.darkhax.curseforgegradle' version '1.1.17'
id 'com.modrinth.minotaur' version "2.+"
}

version = "${version}"
group = "${mod_group}"

base {
archivesName = "${mod_archive_name}-${mc_version}"
}

// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
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: mapping_channel, version: mapping_version

copyIdeResources = true

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

runs {
client {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"

// Recommended logging data for a userdev environment
// property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.markers', 'REGISTRIES'
//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager

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

// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', "${mod_id}"

mods {
"${mod_id}" {
source sourceSets.main
}
}
}
runs {
// applies to all the run configs below
configureEach {
// Recommended logging data for a userdev environment
systemProperty 'forge.logging.markers', 'REGISTRIES'

server {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
// Recommended logging level for the console
systemProperty 'forge.logging.console.level', 'debug'

// Recommended logging data for a userdev environment
// property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.markers', 'REGISTRIES'
//Limit ram usage for the dev environment to 4GB
jvmArgument '-Xmx4G'

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

// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', "${mod_id}"

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

data {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
modSource project.sourceSets.main
}

// Recommended logging data for a userdev environment
// property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.markers', 'REGISTRIES'
client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
systemProperty 'neoforge.enabledGameTestNamespaces', "${mod_id}"
}

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
server {
systemProperty 'neoforge.enabledGameTestNamespaces', "${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', "${mod_id}", '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
data {
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
// workingDirectory project.file('run-data')

mods {
"${mod_id}" {
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', "${mod_id}", '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
}

Expand All @@ -115,20 +77,19 @@ repositories {
}

dependencies {
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
implementation "net.neoforged:neoforge:${neo_version}"

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

runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
implementation "curse.maven:jade-324717:4845321" //Jade (WAILA)
// implementation "curse.maven:TheOneProbe-245211:4579432" //The One Probe (TOP)

implementation fg.deobf("curse.maven:jade-324717:4573193") //Jade (WAILA)
implementation fg.deobf("curse.maven:TheOneProbe-245211:4579432") //The One Probe (TOP)

runtimeOnly fg.deobf("teamtwilight:twilightforest:${twilight_forest_version}:universal")
runtimeOnly "teamtwilight:twilightforest:${twilight_forest_version}:universal"
}

// Example for how to get properties into the manifest for reading at runtime.
jar {
manifest {
attributes([
Expand All @@ -143,25 +104,13 @@ jar {
}
}

// Example configuration to allow publishing using the maven-publish plugin
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
// publish.dependsOn('reobfJar')

def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) {
type 'jar'
builtBy 'reobfJar'
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact(reobfArtifact) {
builtBy reobfArtifact
artifactId = base.archivesName.get()
classifier null
}
register('mavenJava', MavenPublication) {
groupId project.group
artifactId base.archivesName.get()
version project.version
from components.java
}
}
repositories {
Expand All @@ -177,9 +126,41 @@ publishing {
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
if (System.getenv().CURSEFORGE_KEY) {
task curseforge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {
apiToken = System.getenv().CURSEFORGE_KEY

def mainFile = upload(project.curseforge_id, jar)
mainFile.releaseType = 'beta'
mainFile.addGameVersion "NeoForge"
mainFile.addGameVersion "${mc_version}"
mainFile.addGameVersion "Java 17"

mainFile.changelog = file("$project.rootDir/changelog.md")
mainFile.changelogType = 'markdown'

mainFile.addOptional("jade")
}
}

apply from: 'gradle/curseforge.gradle'
apply from: 'gradle/modrinth.gradle'
if (System.getenv().MODRINTH_KEY) {
modrinth {
token = System.getenv().MODRINTH_KEY
projectId = project.modrinth_id
versionType = "beta"
versionName = "${mod_name} ${mc_version}"
versionNumber = project.version
uploadFile = jar
changelog = file("$project.rootDir/changelog.md").text
gameVersions = ["${mc_version}"]
loaders = ["neoforge"]

dependencies {
optional.project "jade"
}
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* Rework Teleportation logic (Thanks to [ChampionAsh5357](https://github.com/Mrbysco/TelePastries/pull/16))
* Initial update to 1.20.2
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

# Base info
mc_version=1.20.1
forge_version=47.1.3
mc_version=1.20.2
neo_version=20.2.86
mapping_channel=official
mapping_version=1.20.1
mapping_version=1.20.2
mod_group=com.mrbysco.telepastries
mod_id=telepastries
mod_archive_name=TelePastries
Expand All @@ -18,8 +18,8 @@ curseforge_id=319466
modrinth_id=FqHeaVGC

# Version
version=0.8.2
version=0.9.0

# Dependencies
jei_version=15.2.0.23
twilight_forest_version=4.3.1850
twilight_forest_version=4.4.1977
18 changes: 0 additions & 18 deletions gradle/curseforge.gradle

This file was deleted.

16 changes: 0 additions & 16 deletions gradle/modrinth.gradle

This file was deleted.

7 changes: 2 additions & 5 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
maven { url = 'https://maven.neoforged.net/releases' }
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2023-06-24T19:47:49.4959762 Loot Tables
// 1.20.2 2023-12-09T19:08:07.7635854 Loot Tables
45c77a6d516d0d226b0e40eeb49a3613ecd9ce5a data/telepastries/loot_tables/blocks/custom_cake.json
466c7c84761ac5fbd61c289e0e469391364a001d data/telepastries/loot_tables/blocks/custom_cake2.json
e908d55d357142ade4575859318c07b045edcc61 data/telepastries/loot_tables/blocks/custom_cake3.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2023-06-24T19:47:49.4949752 Block States: telepastries
// 1.20.2 2023-12-09T19:10:36.5089363 Block States: telepastries
e4ae4e78c657e28e3bf3f0af5ffa9395d0bd6582 assets/telepastries/blockstates/custom_cake.json
24c6c3c07ac7f6c8875f3b29a3a4642a2241f0c2 assets/telepastries/blockstates/custom_cake2.json
f4fa9a8dd20cb9901e76454597006d79cf526f0a assets/telepastries/blockstates/custom_cake3.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// 1.20.1 2023-06-24T19:56:35.554421 Recipes
ecdcaff47a349e634adfcca9c2e9a238c94fbbe0 data/telepastries/advancements/recipes/transportation/end_cake.json
7b414e1f3a27a62f76bb2bd69e3a1782408c565f data/telepastries/advancements/recipes/transportation/nether_cake.json
0ac851eca74e444b19e47b3c7515706ba9958108 data/telepastries/advancements/recipes/transportation/overworld_cake.json
// 1.20.2 2023-12-09T19:08:07.7640856 Recipes
aaf2244a00fb3ddb9c203f2105d14c90f5df76ff data/telepastries/advancements/recipes/transportation/end_cake.json
b89c3aaa93a3094803e5e0746cdfd3dd0c7ff1ec data/telepastries/advancements/recipes/transportation/nether_cake.json
3ff1ccd05a75e89ddb35d46811408f295b093ee5 data/telepastries/advancements/recipes/transportation/overworld_cake.json
050d99c5bbd8ed34d0df9b9b4e51c41f420e3260 data/telepastries/advancements/recipes/transportation/twilight_cake.json
2e702249bfe1fac1758a20be86c7fb701ad71076 data/telepastries/recipes/end_cake.json
10dd9c5fa1a806683b5f3211ab3b3d397b0cb09c data/telepastries/recipes/nether_cake.json
79d0a776239f443fa259c13d96ee0440f12de07e data/telepastries/recipes/overworld_cake.json
5152a4bf5df8789b8c2fdb93ef2ee85ff447b4cc data/telepastries/recipes/twilight_cake.json
d0c44624cdbca29fc5e0adaba01b84907c519e1f data/telepastries/recipes/twilight_cake.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2023-06-24T19:47:49.4929774 Item Models: telepastries
// 1.20.2 2023-12-09T19:08:07.7595865 Item Models: telepastries
b6e497293761ab59f31c5c34d83ddacec295bb00 assets/telepastries/models/item/custom_cake.json
02a46cd1791553fa53d8d6f6a07dd5aac596211b assets/telepastries/models/item/custom_cake2.json
4ce73c18f2afd1f36f0f31bc07df8a36ea74e10c assets/telepastries/models/item/custom_cake3.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
},
"requirements": [
[
"has_the_recipe",
"has_cake",
"has_ender_eye",
"has_the_recipe"
"has_ender_eye"
]
],
"rewards": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
},
"requirements": [
[
"has_the_recipe",
"has_cake",
"has_obsidian",
"has_the_recipe"
"has_obsidian"
]
],
"rewards": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
},
"requirements": [
[
"has_the_recipe",
"has_cake",
"has_sapling",
"has_the_recipe"
"has_sapling"
]
],
"rewards": {
Expand Down
Loading

0 comments on commit 2819204

Please sign in to comment.