From 7e99a4f8cc3530f9bc1763a48eaead8b88d909aa Mon Sep 17 00:00:00 2001 From: Boy Date: Fri, 9 Aug 2024 23:19:54 +0200 Subject: [PATCH] fix: vanilla textures not tied to a model being obfuscated --- src/main/kotlin/com/mineinabyss/packy/PackObfuscator.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/mineinabyss/packy/PackObfuscator.kt b/src/main/kotlin/com/mineinabyss/packy/PackObfuscator.kt index c260c61..cf046e2 100644 --- a/src/main/kotlin/com/mineinabyss/packy/PackObfuscator.kt +++ b/src/main/kotlin/com/mineinabyss/packy/PackObfuscator.kt @@ -153,6 +153,7 @@ class PackObfuscator(private val resourcePack: ResourcePack) { private fun Model.obfuscateModelTextures(): Model { obfuscatedModels.findObf(this.key())?.let { return it } + if (ResourcePacks.defaultVanillaResourcePack?.model(key()) != null) return this val layers = textures().layers().filter { it.key() != null }.map { modelTexture -> obfuscateModelTexture(modelTexture)?.key()?.let(ModelTexture::ofKey) ?: modelTexture @@ -207,12 +208,12 @@ class PackObfuscator(private val resourcePack: ResourcePack) { private fun obfuscateModelTexture(modelTexture: ModelTexture): Texture? { val keyPng = modelTexture.key()?.removeSuffix(".png") ?: return null - return obfuscatedTextures.findObf(keyPng) ?: resourcePack.texture(keyPng)?.obfuscate() + return obfuscatedTextures.findObf(keyPng) ?: ResourcePacks.defaultVanillaResourcePack?.texture(keyPng) ?: resourcePack.texture(keyPng)?.obfuscate() } private fun obfuscateFontTexture(provider: BitMapFontProvider): Texture? { val keyPng = provider.file().appendSuffix(".png") - return obfuscatedTextures.findObf(keyPng) ?: resourcePack.texture(keyPng)?.obfuscate() + return obfuscatedTextures.findObf(keyPng) ?: ResourcePacks.defaultVanillaResourcePack?.texture(keyPng) ?: resourcePack.texture(keyPng)?.obfuscate() } private fun Key.obfuscateKey() = when (packy.config.obfuscation) {