Skip to content

Commit

Permalink
fix: defaultVanillaResourcePack read failing due to missing CubeFace …
Browse files Browse the repository at this point in the history
…enum
  • Loading branch information
Boy0000 committed Aug 9, 2024
1 parent acc7d58 commit a0684f3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ subprojects {
repositories {
mavenCentral()
maven("https://repo.mineinabyss.com/releases")
maven("https://repo.mineinabyss.com/snapshots")
maven("https://erethon.de/repo/")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.spaceio.xyz/repository/maven-snapshots/")
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ customblockdata="2.2.2"
morepersistentdatatypes="2.4.0"

[libraries]
creative-api = { module = "team.unnamed:creative-api", version.ref = "creative" }
creative-api = { module = "team.unnamed:creative-api", version = "1.7.4-SNAPSHOT" }
creative-serializer-minecraft = { module = "team.unnamed:creative-serializer-minecraft", version.ref = "creative" }
creative-server = { module = "team.unnamed:creative-server", version.ref = "creative" }
exposed-core = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposed" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Config<T>(

fun getOrLoad(): T {
loaded?.let { return it }
return runCatching(::load).onFailure { it.printStackTrace() }.getOrDefault(default).also(onFirstLoad).also(onLoad)
return runCatching(::load).onFailure { it.printStackTrace() }.getOrDefault(loaded ?: default).also(onFirstLoad).also(onLoad)
}

fun reload(): T {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ object MinecraftAssetExtractor {
val assetPath = Bukkit.getPluginsFolder().resolve("Idofront/assetCache/${Bukkit.getMinecraftVersion()}")

fun extractLatest() {
if (assetPath.exists() && !assetPath.listFiles().isNullOrEmpty()) return
idofrontLogger.i("Extracting latest vanilla-assets...")
val versionInfo = runCatching {
downloadJson(findVersionInfoUrl() ?: return)?.asJsonObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object ResourcePacks {
* The ResourcePack instance does not contain any of the vanilla OGG files due to filesize optimizations
*/
val defaultVanillaResourcePack by lazy {
MinecraftAssetExtractor.assetPath.apply { if (!exists()) MinecraftAssetExtractor.extractLatest() }.let(::readToResourcePack)
MinecraftAssetExtractor.assetPath.apply { MinecraftAssetExtractor.extractLatest() }.let(::readToResourcePack)
}

/**
Expand Down Expand Up @@ -50,7 +50,7 @@ object ResourcePacks {
file.extension == "zip" -> resourcePackReader.readFromZipFile(file)
else -> null
}
}.onFailure { idofrontLogger.w(file.name + ": " + it.message) }.getOrNull()
}.onFailure { it.printStackTrace()/*idofrontLogger.w(file.name + ": " + it.message)*/ }.getOrNull()
}

fun writeToFile(file: File, resourcePack: ResourcePack) {
Expand Down

0 comments on commit a0684f3

Please sign in to comment.