Fixup the buildscript for loading in background ponies.

Removed the pack zipper. It's in a separate repo.
 Just download the zip from github.
This commit is contained in:
Matthew Messinger 2018-11-05 19:32:30 -05:00
parent 4afbf7abb3
commit 7dd5081841
2 changed files with 35 additions and 33 deletions

View file

@ -111,31 +111,40 @@ jar {
archivesBaseName = "mod-${project.name.toLowerCase()}"
task copyBGPones(type: Copy) {
delete "${buildDir}/skins/assets/minelittlepony/textures/entity/pony"
// use the same rejex for both filenames and the bgponies.json
// Otherwise there could be errors because of the names in the json not matching the ones on disk
def permittedChars = /[^0-9a-z_-\",\t\{\}\[\]\(\):\'\.\/ ]/
def illegals = /[^a-z0-9_\/.-]/
from("skins/Background Ponies") {
exclude "bgponies.json"
from "skins/background_ponies"
into temporaryDir
rename { filename ->
filename.toLowerCase()
.replaceAll(permittedChars, '')
include '**/*.png'
eachFile {
if (it.name =~ illegals){
logger.warn("Sanitizing file with illegal characters: ${it.path}")
it.name = it.name.replaceAll(/\s/, '_').replaceAll(illegals, '')
}
}
}
from("skins/Background Ponies") {
include "bgponies.json"
import groovy.json.JsonBuilder
filter { line ->
line.toLowerCase()
.replaceAll(permittedChars, '')
}
}
task genPoniesJson(dependsOn: copyBGPones) {
// loop through the background ponies to create the bgponies.json
into "${buildDir}/skins/assets/minelittlepony/textures/entity/pony"
def bgponies = 'bgponies.json'
def json = file("$temporaryDir/$bgponies")
inputs.dir copyBGPones.outputs
outputs.file json
doFirst {
json.text = new JsonBuilder(
override: false,
ponies: fileTree(copyBGPones.outputs.files.singleFile).filter { it.file }.collect { it.name.replace(".png", "") }
).toPrettyString()
}
}
shadowJar {
@ -149,6 +158,9 @@ shadowJar {
from(copyBGPones) {
into "/assets/minelittlepony/textures/entity/pony"
}
from (genPoniesJson){
into "/assets/minelittlepony/textures/entity/pony"
}
dependencies {
exclude dependency('deobf.com.mumfrey:liteloader:')
@ -174,16 +186,6 @@ task srgJar(type: Jar) {
classifier "mc$minecraft.version-srg"
}
task zipCommunityPack(type: Zip) {
baseName = "Pony Skin Pack"
destinationDir = new File(buildDir, "libs")
from("skins") {
// TODO: Later packs will have their folders excluded.
// For now we just zip everything.
exclude "README.md"
}
}
reobf {
srgJar {
mappingType = 'SEARGE'

2
skins

@ -1 +1 @@
Subproject commit 3f99def1cd53359a11ffb5dc7b0069402a3bc0e3
Subproject commit e5250bdc971f7256d77ca9be1570e0899d3a5dc3