Skip to content

Commit

Permalink
Merge branch 'dev' into release/1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
opekope2 committed Oct 8, 2024
2 parents 1353769 + 0716b22 commit aec8e7b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

Expand Down Expand Up @@ -193,7 +188,7 @@ private open class OptiFineFilterData(
filterName: Boolean
) : this(resource, Identifier(container), replacementTexture, properties, filterName)

var originalTexture: Identifier? = container?.let(ContainerDefaultGuiTextureRegistry::get)
open val originalTexture: Identifier? = container?.let(ContainerDefaultGuiTextureRegistry::get)

override val rawSelectorData
get() = sequence {
Expand Down Expand Up @@ -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<Pair<String, String>>
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)
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
java = "17" # Don't forget to update *.mixins.json
kotlin = "1.9.22"
optigui = "2.3.0-beta.5+1.20.2"
optigui = "2.3.0-beta.6+1.20.2"
minecraft = "1.20.2"
yarn = "1.20.2+build.4"
fabric-loom = "1.5-SNAPSHOT"
Expand Down

0 comments on commit aec8e7b

Please sign in to comment.