mirror of
https://gitlab.bixilon.de/bixilon/pixlyzer.git
synced 2025-09-29 07:01:01 -04:00
don't write all file if not requested
This commit is contained in:
parent
2c43a2ab59
commit
7d7d468b58
@ -40,7 +40,7 @@ object PixLyzer {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Class.forName("net.minecraft.DetectedVersion")
|
Class.forName("net.minecraft.DetectedVersion")
|
||||||
throw IllegalStateException("This branch only works with yarn mappings, not with mojangs!")
|
throw IllegalStateException("This branch only works with yarn mappings, not with mojangs!")
|
||||||
} catch (exception: ClassNotFoundException) {
|
} catch (exception: ClassNotFoundException) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,21 +95,16 @@ object PixLyzer {
|
|||||||
|
|
||||||
println("Done generating ${generator.name} in ${System.currentTimeMillis() - startTime}ms, generated ${generator.entries} entries.")
|
println("Done generating ${generator.name} in ${System.currentTimeMillis() - startTime}ms, generated ${generator.entries} entries.")
|
||||||
}
|
}
|
||||||
|
println("Eventually writing all to file...")
|
||||||
println("Writing all to file...")
|
|
||||||
|
|
||||||
writData("${outputDirectory.absolutePath}/all", all)
|
|
||||||
|
|
||||||
val tempFileOutputPath = System.getProperty("java.io.tmpdir") + "/" + UUID.randomUUID().toString()
|
val tempFileOutputPath = System.getProperty("java.io.tmpdir") + "/" + UUID.randomUUID().toString()
|
||||||
|
|
||||||
val jsonHash = Util.saveHashFile(all.toJsonString().byteInputStream(), tempFileOutputPath, GZIPOutputStream(FileOutputStream(tempFileOutputPath)), hashDirectory.absolutePath + "/\${shortHash}/\${hash}.gz")
|
|
||||||
|
|
||||||
val mbfStream = ByteArrayOutputStream()
|
|
||||||
MBFBinaryWriter(mbfStream).writeMBF(MBFData(dataInfo = MBFDataInfo(compression = MBFCompressionTypes.ZSDT, preferVariableTypes = true, variableLengthPrefix = true, compressionLevel = 22), data = all))
|
|
||||||
|
|
||||||
val mbfHash = Util.saveHashFile(ByteArrayInputStream(mbfStream.toByteArray()), tempFileOutputPath, FileOutputStream(tempFileOutputPath), hashDirectory.absolutePath + "/\${shortHash}/\${hash}.mbf")
|
|
||||||
if (File(jsonAssetsIndex.absolutePath + ".json").exists()) {
|
if (File(jsonAssetsIndex.absolutePath + ".json").exists()) {
|
||||||
|
|
||||||
|
writData("${outputDirectory.absolutePath}/all", all)
|
||||||
|
|
||||||
|
val jsonHash = Util.saveHashFile(all.toJsonString().byteInputStream(), tempFileOutputPath, GZIPOutputStream(FileOutputStream(tempFileOutputPath)), hashDirectory.absolutePath + "/\${shortHash}/\${hash}.gz")
|
||||||
|
|
||||||
val assetsIndexJson = Util.readJsonFile(jsonAssetsIndex.absolutePath + ".json")
|
val assetsIndexJson = Util.readJsonFile(jsonAssetsIndex.absolutePath + ".json")
|
||||||
|
|
||||||
assetsIndexJson[versionId] = jsonHash
|
assetsIndexJson[versionId] = jsonHash
|
||||||
@ -120,6 +115,11 @@ object PixLyzer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (File(mbfAssetsIndex.absolutePath + ".json").exists()) {
|
if (File(mbfAssetsIndex.absolutePath + ".json").exists()) {
|
||||||
|
val mbfStream = ByteArrayOutputStream()
|
||||||
|
MBFBinaryWriter(mbfStream).writeMBF(MBFData(dataInfo = MBFDataInfo(compression = MBFCompressionTypes.ZSDT, preferVariableTypes = true, variableLengthPrefix = true, compressionLevel = 22), data = all))
|
||||||
|
|
||||||
|
val mbfHash = Util.saveHashFile(ByteArrayInputStream(mbfStream.toByteArray()), tempFileOutputPath, FileOutputStream(tempFileOutputPath), hashDirectory.absolutePath + "/\${shortHash}/\${hash}.mbf")
|
||||||
|
|
||||||
|
|
||||||
val assetsIndexData = Util.readJsonFile(mbfAssetsIndex.absolutePath + ".json")
|
val assetsIndexData = Util.readJsonFile(mbfAssetsIndex.absolutePath + ".json")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user