update to OptiFine H6
This commit is contained in:
@@ -2,7 +2,7 @@ apply plugin: "net.minecraftforge.gradle.forge"
|
|||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
group = 'com.github.octarine-noise'
|
group = 'com.github.octarine-noise'
|
||||||
version = "2.0.11"
|
version = "2.0.12"
|
||||||
archivesBaseName = rootProject.name + '-MC1.8'
|
archivesBaseName = rootProject.name + '-MC1.8'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
|
|||||||
@@ -23,8 +23,13 @@ import org.apache.logging.log4j.Level.INFO
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
object OptifineCTM {
|
object OptifineCTM {
|
||||||
|
|
||||||
val isAvailable = allAvailable(Refs.ConnectedTextures, Refs.ConnectedProperties, Refs.getConnectedTexture,
|
val isAvailable = allAvailable(
|
||||||
Refs.CTblockProperties, Refs.CTtileProperties, Refs.CPtileIcons, Refs.CPmatchesBlock, Refs.CPmatchesIcon)
|
Refs.ConnectedTextures, Refs.ConnectedProperties,
|
||||||
|
Refs.getConnectedTexture,
|
||||||
|
Refs.CTblockProperties, Refs.CTtileProperties,
|
||||||
|
Refs.CPMatchBlocks, Refs.CPtileIcons,
|
||||||
|
Refs.matchesBlock, Refs.CPmatchesIcon
|
||||||
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
Client.log(INFO, "Optifine CTM support is ${if (isAvailable) "enabled" else "disabled" }")
|
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. */
|
/** Get all the CTM [TextureAtlasSprite]s that could possibly be used for this block. */
|
||||||
fun getAllCTM(state: IBlockState, icon: TextureAtlasSprite): Collection<TextureAtlasSprite> {
|
fun getAllCTM(state: IBlockState, icon: TextureAtlasSprite): Collection<TextureAtlasSprite> {
|
||||||
val result = hashSetOf<TextureAtlasSprite>()
|
val result = hashSetOf<TextureAtlasSprite>()
|
||||||
if (state !is BlockStateBase) return result
|
if (state !is BlockStateBase || !isAvailable) return result
|
||||||
|
|
||||||
connectedProperties.forEach { cp ->
|
connectedProperties.forEach { cp ->
|
||||||
if (Refs.CPmatchesBlock.invoke(cp, state) as Boolean &&
|
val matchesIcon = Refs.CPmatchesIcon.invoke(cp, icon) as Boolean
|
||||||
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()}")
|
Client.log(INFO, "Match for block: ${state.toString()}, icon: ${icon.iconName} -> CP: ${cp.toString()}")
|
||||||
result.addAll(Refs.CPtileIcons.get(cp) as Array<TextureAtlasSprite>)
|
result.addAll(Refs.CPtileIcons.get(cp) as Array<TextureAtlasSprite>)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,15 +93,15 @@ class BetterFoliageTransformer : Transformer() {
|
|||||||
transformMethod(Refs.rebuildChunk) {
|
transformMethod(Refs.rebuildChunk) {
|
||||||
find(invokeRef(Refs.renderBlock))?.replace {
|
find(invokeRef(Refs.renderBlock))?.replace {
|
||||||
log.info("Applying RenderChunk block render override")
|
log.info("Applying RenderChunk block render override")
|
||||||
varinsn(ALOAD, if (isOptifinePresent) 21 else 18)
|
varinsn(ALOAD, if (isOptifinePresent) 20 else 18)
|
||||||
invokeStatic(Refs.renderWorldBlock)
|
invokeStatic(Refs.renderWorldBlock)
|
||||||
}
|
}
|
||||||
if (isOptifinePresent) {
|
if (isOptifinePresent) {
|
||||||
find(varinsn(ISTORE, 22))?.insertBefore {
|
find(varinsn(ISTORE, 21))?.insertBefore {
|
||||||
log.info("Applying RenderChunk block layer override")
|
log.info("Applying RenderChunk block layer override")
|
||||||
insn(POP)
|
insn(POP)
|
||||||
varinsn(ALOAD, 17)
|
varinsn(ALOAD, 17)
|
||||||
varinsn(ALOAD, 21)
|
varinsn(ALOAD, 20)
|
||||||
invokeStatic(Refs.canRenderBlockInLayer)
|
invokeStatic(Refs.canRenderBlockInLayer)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package mods.betterfoliage.loader
|
|||||||
import mods.octarinecore.metaprog.ClassRef
|
import mods.octarinecore.metaprog.ClassRef
|
||||||
import mods.octarinecore.metaprog.FieldRef
|
import mods.octarinecore.metaprog.FieldRef
|
||||||
import mods.octarinecore.metaprog.MethodRef
|
import mods.octarinecore.metaprog.MethodRef
|
||||||
|
import mods.octarinecore.metaprog.array
|
||||||
import net.minecraftforge.fml.relauncher.FMLInjectionData
|
import net.minecraftforge.fml.relauncher.FMLInjectionData
|
||||||
|
|
||||||
/** Singleton object holding references to foreign code elements. */
|
/** Singleton object holding references to foreign code elements. */
|
||||||
@@ -88,8 +89,11 @@ object Refs {
|
|||||||
val CTtileProperties = FieldRef(ConnectedTextures, "tileProperties", null)
|
val CTtileProperties = FieldRef(ConnectedTextures, "tileProperties", null)
|
||||||
|
|
||||||
val ConnectedProperties = ClassRef("ConnectedProperties")
|
val ConnectedProperties = ClassRef("ConnectedProperties")
|
||||||
|
val MatchBlock = ClassRef("MatchBlock")
|
||||||
val CPtileIcons = FieldRef(ConnectedProperties, "tileIcons", null)
|
val CPtileIcons = FieldRef(ConnectedProperties, "tileIcons", null)
|
||||||
val CPmatchesBlock = MethodRef(ConnectedProperties, "matchesBlock", ClassRef.boolean, BlockStateBase)
|
val CPMatchBlocks = FieldRef(ConnectedProperties, "matchBlocks", MatchBlock.array())
|
||||||
|
val Matches = ClassRef("Matches")
|
||||||
|
val matchesBlock = MethodRef(Matches, "block", ClassRef.boolean, BlockStateBase, MatchBlock.array())
|
||||||
val CPmatchesIcon = MethodRef(ConnectedProperties, "matchesIcon", ClassRef.boolean, TextureAtlasSprite)
|
val CPmatchesIcon = MethodRef(ConnectedProperties, "matchesIcon", ClassRef.boolean, TextureAtlasSprite)
|
||||||
|
|
||||||
// ShadersMod
|
// ShadersMod
|
||||||
|
|||||||
@@ -89,6 +89,14 @@ class ClassRefPrimitive(name: String, val clazz: Class<*>?) : ClassRef(name) {
|
|||||||
override fun resolve() = clazz
|
override fun resolve() = clazz
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ClassRefArray(mcpName: String, obfName: String) : ClassRef(mcpName, obfName) {
|
||||||
|
constructor(mcpName: String) : this(mcpName, mcpName)
|
||||||
|
override fun asmDescriptor(namespace: Namespace) = "[" + super.asmDescriptor(namespace)
|
||||||
|
override fun resolve() = listOf(mcpName, obfName).map { getJavaClass("[L$it;") }.filterNotNull().firstOrNull()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ClassRef.array() = ClassRefArray(mcpName, obfName)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference to a method.
|
* Reference to a method.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user