Skip to content

Commit

Permalink
fabric port
Browse files Browse the repository at this point in the history
  • Loading branch information
JieningYu committed Dec 2, 2022
1 parent 4b2bb65 commit e52702e
Show file tree
Hide file tree
Showing 23 changed files with 406 additions and 554 deletions.
41 changes: 24 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
# gradle

.gradle/
build/
out/
classes/

# eclipse
bin

*.launch
.settings
.metadata
.classpath
.project

# idea
out

.idea/
*.iml
*.ipr
*.iws
*.iml
.idea

# gradle
build
.gradle
# vscode

.settings/
.vscode/
bin/
.classpath
.project

# macos

*.DS_Store

# other
eclipse
run
# fabric

# Files from Forge MDK
forge*changelog.txt
/local.properties
run/
274 changes: 70 additions & 204 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,236 +1,102 @@
buildscript {
repositories {
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
maven { url = 'https://maven.parchmentmc.org' }
maven { url = 'https://repo.spongepowered.org/repository/maven-public' }
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: "${forgegradle_version}", changing: true
classpath "org.parchmentmc:librarian:${librarian_version}"
classpath "org.spongepowered:mixingradle:${mixingradle_version}"
}
}
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'org.spongepowered.mixin'

version = mod_version
group = 'plus.dragons.createdragonlib' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "create_dragon_lib-${artifact_minecraft_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 {
// The mappings can be changed at any time and must be in the following format.
// Channel: Version:
// official MCVersion Official field/method names from Mojang mapping files
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
//
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
//
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
// Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started
//
// Use non-default mappings at your own risk. They may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"

// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.

// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')

arg '-mixin.config=create_dragon_lib.mixins.json'

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

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

// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', 'examplemod'

mods {
create_dragon_lib {
source sourceSets.main
}
}
}

server {
workingDirectory project.file('run')

arg '-mixin.config=create_dragon_lib.mixins.json'

property 'forge.logging.markers', 'REGISTRIES'

property 'forge.logging.console.level', 'debug'

// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', 'examplemod'

mods {
create_dragon_lib {
source sourceSets.main
}
}
}

data {
workingDirectory project.file('run')

property 'forge.logging.markers', 'REGISTRIES'

property 'forge.logging.console.level', 'debug'

// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', 'create_dragon_lib', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

mods {
create_dragon_lib {
source sourceSets.main
}
}
}
}
plugins {
id 'fabric-loom' version '1.0.9'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

repositories {
// Put repositories for dependencies here
// ForgeGradle automatically adds the Forge maven and Maven Central for you
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
// flatDir {
// dir 'libs'
// }
maven {
name = 'tterrag maven'
url = 'https://maven.tterrag.com/'
}
maven {
// Location of the maven that hosts JEI files (and TiC)
name 'Progwml6 maven'
url 'https://dvs1.progwml6.com/files/maven'
}
maven {
// Location of the maven for vazkii's mods
name 'blamejared'
url 'https://maven.blamejared.com'
}
repositories {
maven { url = "https://hephaestus.dev/release" }
maven { url = "https://api.modrinth.com/maven" }
maven { url = "https://cursemaven.com" }
maven { url = "https://maven.parchmentmc.org" }
maven { url = "https://maven.fabricmc.net/" }
maven { url = "https://maven.tterrag.com/" }
maven { url = "https://storage.googleapis.com/devan-maven/" }
maven { url = "https://maven.shedaniel.me/" }
maven { url = "https://aperlambda.github.io/maven" }
maven { url = "https://ladysnake.jfrog.io/artifactory/mods" }
maven { url = "https://maven.kotlindiscord.com/repository/terraformers/" }
maven { url = "https://mvn.devos.one/releases/" }
maven { url = "https://mvn.devos.one/snapshots/" }
maven { url = "https://maven.terraformersmc.com/" }
maven { url = "https://maven.cafeteria.dev/releases/" }
maven { url = "https://jitpack.io/" }
maven { url = "https://maven.gegy.dev" }
maven { url = "https://dvs1.progwml6.com/files/maven/" }
maven { url = "https://modmaven.dev" }
maven {
//location of the maven for curios api
url = "https://maven.theillusivec4.top/"
url = "https://maven.jamieswhiteshirt.com/libs-release"
content {
includeGroup("com.jamieswhiteshirt")
}
}
}

dependencies {
// Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed
// that the dep is a ForgeGradle 'patcher' dependency, and its 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:${minecraft_version}-${forge_version}"

// Real mod deobf dependency examples - these get remapped to your current mappings
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
// implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings (loom.officialMojangMappings())
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Examples using mod jars from ./libs
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
implementation fg.deobf("com.simibubi.create:create-${create_minecraft_version}:${create_version}:slim") { transitive = false }
implementation fg.deobf("com.jozufozu.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}")
implementation fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}")

compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-common-api:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-forge-api:${jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-forge:${jei_version}")
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "com.simibubi.create:create-fabric-1.19.2:${project.create_version}+${project.minecraft_version}"
}

compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_minecraft_version}-${curios_version}:api")
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_minecraft_version}-${curios_version}")
processResources {
inputs.property "version", project.version

// For more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}

// Include resources generated by data generators.
sourceSets.main.resources {
srcDir'src/generated/resources'
exclude '.cache/'
tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}

mixin {
add sourceSets.main, 'create_dragon_lib.refmap.json'
config 'create_dragon_lib.mixins.json'

debug.verbose = true
debug.export = true
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}


// Example for how to get properties into the manifest for reading at runtime.
jar {
manifest {
attributes([
"Specification-Title" : "create_dragon_lib",
"Specification-Vendor" : "dragons.plus",
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : "dragons.plus",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'MixinConfigs': 'create_dragon_lib.mixins.json'
])
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}

// 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')
sourceSets {
main {
resources {
srcDirs += [
'src/generated/resources'
]
}
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = archivesBaseName

from components.java
fg.component(it)
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
maven {
name = "repository"
url = "https://maven.dragons.plus/Releases"
credentials(PasswordCredentials)
authentication {
basic(BasicAuthentication)
}
}
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
}
Loading

0 comments on commit e52702e

Please sign in to comment.