diff --git a/OptiGUI/src/main/kotlin/opekope2/optigui/resource/OptiFineFilterLoader.kt b/OptiGUI/src/main/kotlin/opekope2/optigui/resource/OptiFineFilterLoader.kt index 0e14934d..56be56f3 100644 --- a/OptiGUI/src/main/kotlin/opekope2/optigui/resource/OptiFineFilterLoader.kt +++ b/OptiGUI/src/main/kotlin/opekope2/optigui/resource/OptiFineFilterLoader.kt @@ -66,12 +66,7 @@ private fun createFilterData( ) continue } - yield( - OptiFineFilterData(resourcePath, null, resolvedReplacement, properties, false).apply { - originalTexture = original - replaceableTextures = setOf(original) - } - ) + yield(TexturePathFilterData(resourcePath, original, resolvedReplacement, properties)) } } @@ -193,7 +188,7 @@ private open class OptiFineFilterData( filterName: Boolean ) : this(resource, Identifier.ofVanilla(container), replacementTexture, properties, filterName) - var originalTexture: Identifier? = container?.let(ContainerDefaultGuiTextureRegistry::get) + open val originalTexture: Identifier? = container?.let(ContainerDefaultGuiTextureRegistry::get) override val rawSelectorData get() = sequence { @@ -292,6 +287,24 @@ private class PlayerFilterData( }.asIterable() } +private class TexturePathFilterData( + resource: Identifier, + override val originalTexture: Identifier, + replacementTexture: Identifier, + properties: Options +) : OptiFineFilterData(resource, null, replacementTexture, properties, false) { + init { + replaceableTextures = setOf(originalTexture) + } + + override val rawSelectorData: Iterable> + get() = sequence { + yield("interaction.texture" to originalTexture.toString()) + properties["biomes"]?.let { biomes -> yield("player.biomes" to biomes) } + properties["heights"]?.let { heights -> yield("player.heights" to heights) } + }.asIterable() +} + private fun getNameSelectorData(name: String) = when { name.startsWith("pattern:") -> "name.wildcard" to name.substring("pattern:".length) name.startsWith("ipattern:") -> "name.wildcard.ignore_case" to name.substring("ipattern:".length) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2aa550b6..1eacc968 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] java = "21" # Don't forget to update *.mixins.json kotlin = "2.0.0" -optigui = "2.3.0-beta.5+1.21" +optigui = "2.3.0-beta.6+1.21" minecraft = "1.21" yarn = "1.21+build.2" fabric-loom = "1.6-SNAPSHOT"