Skip to content

Commit

Permalink
Fabric 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
gudenau committed Dec 2, 2021
1 parent 9b9bc4c commit 21278d3
Show file tree
Hide file tree
Showing 183 changed files with 12,622 additions and 16,324 deletions.
207 changes: 17 additions & 190 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,210 +1,37 @@
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
}

repositories {
maven {
name = "chickenbones"
url = "http://chickenbones.net/maven/"
url = "https://chickenbones.net/maven/"
}
}

apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven'
apply plugin: 'eclipse'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

ext.configFile = file('build.properties')

ext.config = parseConfig(configFile)
//ext.priv = parseConfig(file('private.properties'))

version = "${config.version}-${config.build_number}"
group = "vazkii.ambience" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = config.mod_name

minecraft {
version = "${config.mc_version}-${config.forge_version}"
runDir = "eclipse/assets"
mappings = config.mc_mappings

//This, does the token replacement.
//Though, I reccomend this to be replaced with a token such as @VERSION@
replace 'GRADLE:BUILD', config.build_number
replace 'GRADLE:VERSION', config.version

replaceIn 'LibMisc.java' //I may have missed another file, though I can only find it in here.
}

repositories {
mavenCentral()
}

dependencies {
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.minecraft_version}+build.${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
}

processResources {
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
expand 'version': project.version, 'mcversion': project.minecraft.version
}

// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info', '**/psd/**'
}
}

/**
* These, go outside of the processResources {}* Though, this was added with the NEI intergation commit (8bf4680)
*/
task deobfJar(type: Jar) {
from(sourceSets.main.output)
archiveName = "${baseName} ${version}-deobf.${extension}"
}

artifacts {
archives deobfJar
}
/**
* Increments the buildnumber in your config file, and saves it
*/
task incrementBuildNumber {
config.build_number = (config.build_number.toString().toInteger()) + 1
configFile.withWriter {
config.toProperties().store(it, "")
}
inputs.property "version", project.version

//file('web/versions.ini').append("\n${version}=${minecraft.version}")
//file("${config.dir_repo}/version/${minecraft.version}.txt").write("${version}")
}

// I have no idea what I'm doing
task wtfGradle2(type: Copy) {
from(jar.destinationDir)
into file("${config.dir_output}/wtf")
}

// Seriously, I'm desperate to make this work
task wtfGradle1(type: Delete) {
dependsOn "wtfGradle2"
delete "${config.dir_output}/wtf/${deobfJar.archiveName}"
}

task output(type: Copy) {
dependsOn "wtfGradle1"
from(jar.destinationDir)
into file(config.dir_output)
}

task outputDeobf(type: Copy) {
dependsOn "output"
from(config.dir_output) {
include deobfJar.archiveName
filesMatching("fabric.mod.json") {
expand "version": project.version
}
into file("${config.dir_output}/deobf")
}

/*task forgecraft(type: Copy) {
dependsOn "outputDeobf"
from "${config.dir_output}/wtf"
into file(config.dir_forgecraft)
}*/

task sort(type: Delete) {
dependsOn /*"forgecraft"*/ "outputDeobf"
delete "${config.dir_output}/${deobfJar.archiveName}", "${config.dir_output}/wtf"
}

/**
* This is the upload task from the build.xml
*/
/*task upload(dependsOn: 'reobf') << {
ftp(action: 'mkdir', remotedir: '/files')
ftp(action: 'send', remotedir: '/files') {
fileset(file: jar.archivePath)
}
ftp(action: 'send', remotedir: '/files/deobf') {
fileset(file: deobfJar.archivePath)
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
ftp(action: 'send', remotedir: '.') {
fileset(file: 'web/changelog.txt')
fileset(file: 'web/versions.ini')
}
}*/

/**
* This is deply_web task
*/
task deployWeb << {
ftp(action: 'send', remotedir: '.') {
fileset(dir: 'web') //everything from the web directory
}
}

//simple function that we can use
//Got this from: http://svn.codehaus.org/gradle/website/build.gradle
/*void ftp(Map args, Closure antFileset = {}) {
ant {
taskdef(name: 'ftp',
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: configurations.ftpAntTask.asPath)
Map ftpArgs = args + [ //some default options
verbose : 'yes',
server : priv.host,
userid : priv.user,
password: priv.pass
]
delegate.ftp(ftpArgs) {
antFileset.delegate = delegate
antFileset()
}
}
}*/

def parseConfig(File config) {
config.withReader {
def prop = new Properties()
prop.load(it)
return (new ConfigSlurper().parse(prop))
}
}

jar {
//rename the default output, for some better... sanity with scipts
archiveName = "${baseName} ${version}.${extension}"
}

/*curse {
apiKey = priv.cfkey
projectId = "225643"
changelog = """
See http://vazkii.us/mod/Botania/changelog.php#${version}
"""
releaseType = "release"
}*/

//change this so it only increments on upload
//upload.dependsOn tasks.incrementBuildNumber
defaultTasks 'clean', 'build', 'sort', 'incrementBuildNumber'/*, 'forgecraft', 'curse', 'upload'*/ //remove clean if you want faster builds, this will stop rare inconsistancies.
11 changes: 0 additions & 11 deletions build.properties

This file was deleted.

32 changes: 0 additions & 32 deletions eclipse/assets/ambience_music/ambience.properties

This file was deleted.

84 changes: 0 additions & 84 deletions eclipse/assets/config/forge.cfg

This file was deleted.

Loading

0 comments on commit 21278d3

Please sign in to comment.