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()}" archivesBaseName = "mod-${project.name.toLowerCase()}"
task copyBGPones(type: Copy) { task copyBGPones(type: Copy) {
delete "${buildDir}/skins/assets/minelittlepony/textures/entity/pony"
// use the same rejex for both filenames and the bgponies.json def illegals = /[^a-z0-9_\/.-]/
// Otherwise there could be errors because of the names in the json not matching the ones on disk
def permittedChars = /[^0-9a-z_-\",\t\{\}\[\]\(\):\'\.\/ ]/
from("skins/Background Ponies") { from "skins/background_ponies"
exclude "bgponies.json" into temporaryDir
rename { filename -> include '**/*.png'
filename.toLowerCase()
.replaceAll(permittedChars, '') 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") { import groovy.json.JsonBuilder
include "bgponies.json"
filter { line -> task genPoniesJson(dependsOn: copyBGPones) {
line.toLowerCase() // loop through the background ponies to create the bgponies.json
.replaceAll(permittedChars, '')
} 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()
} }
into "${buildDir}/skins/assets/minelittlepony/textures/entity/pony"
} }
shadowJar { shadowJar {
@ -149,6 +158,9 @@ shadowJar {
from(copyBGPones) { from(copyBGPones) {
into "/assets/minelittlepony/textures/entity/pony" into "/assets/minelittlepony/textures/entity/pony"
} }
from (genPoniesJson){
into "/assets/minelittlepony/textures/entity/pony"
}
dependencies { dependencies {
exclude dependency('deobf.com.mumfrey:liteloader:') exclude dependency('deobf.com.mumfrey:liteloader:')
@ -174,16 +186,6 @@ task srgJar(type: Jar) {
classifier "mc$minecraft.version-srg" 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 { reobf {
srgJar { srgJar {
mappingType = 'SEARGE' mappingType = 'SEARGE'

2
skins

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