update to OptiFine H6
This commit is contained in:
@@ -23,8 +23,13 @@ import org.apache.logging.log4j.Level.INFO
|
||||
@SideOnly(Side.CLIENT)
|
||||
object OptifineCTM {
|
||||
|
||||
val isAvailable = allAvailable(Refs.ConnectedTextures, Refs.ConnectedProperties, Refs.getConnectedTexture,
|
||||
Refs.CTblockProperties, Refs.CTtileProperties, Refs.CPtileIcons, Refs.CPmatchesBlock, Refs.CPmatchesIcon)
|
||||
val isAvailable = allAvailable(
|
||||
Refs.ConnectedTextures, Refs.ConnectedProperties,
|
||||
Refs.getConnectedTexture,
|
||||
Refs.CTblockProperties, Refs.CTtileProperties,
|
||||
Refs.CPMatchBlocks, Refs.CPtileIcons,
|
||||
Refs.matchesBlock, Refs.CPmatchesIcon
|
||||
)
|
||||
|
||||
init {
|
||||
Client.log(INFO, "Optifine CTM support is ${if (isAvailable) "enabled" else "disabled" }")
|
||||
@@ -46,11 +51,15 @@ object OptifineCTM {
|
||||
/** Get all the CTM [TextureAtlasSprite]s that could possibly be used for this block. */
|
||||
fun getAllCTM(state: IBlockState, icon: TextureAtlasSprite): Collection<TextureAtlasSprite> {
|
||||
val result = hashSetOf<TextureAtlasSprite>()
|
||||
if (state !is BlockStateBase) return result
|
||||
if (state !is BlockStateBase || !isAvailable) return result
|
||||
|
||||
connectedProperties.forEach { cp ->
|
||||
if (Refs.CPmatchesBlock.invoke(cp, state) as Boolean &&
|
||||
Refs.CPmatchesIcon.invoke(cp, icon) as Boolean) {
|
||||
val matchesIcon = Refs.CPmatchesIcon.invoke(cp, icon) as Boolean
|
||||
val matchesBlock = Refs.CPMatchBlocks.get(cp)?.let { matchBlocks ->
|
||||
Refs.matchesBlock.invokeStatic(state, matchBlocks) as Boolean
|
||||
} ?: false
|
||||
|
||||
if (matchesBlock && matchesIcon) {
|
||||
Client.log(INFO, "Match for block: ${state.toString()}, icon: ${icon.iconName} -> CP: ${cp.toString()}")
|
||||
result.addAll(Refs.CPtileIcons.get(cp) as Array<TextureAtlasSprite>)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user