Update to work with OptiFine_1.12.2_HD_U_F6_pre1

This commit is contained in:
octarine-noise
2020-01-01 15:15:44 +01:00
parent 1b0e93b050
commit 8319d721c7
10 changed files with 68 additions and 30 deletions

View File

@@ -47,11 +47,10 @@ class AoData() {
}
class AoFaceData(val face: EnumFacing) {
val ao = Refs.AmbientOcclusionFace.element!!.let {
if (allAvailable(Refs.OptifineClassTransformer)) it.getDeclaredConstructor().newInstance()
else it.getDeclaredConstructor(Refs.BlockModelRenderer.element!!)
.newInstance(BlockModelRenderer(Minecraft.getMinecraft().blockColors))
} as BlockModelRenderer.AmbientOcclusionFace
val ao = Refs.AmbientOcclusionFace.element!!.getDeclaredConstructor(Refs.BlockModelRenderer.element!!)
.newInstance(BlockModelRenderer(Minecraft.getMinecraft().blockColors))
as BlockModelRenderer.AmbientOcclusionFace
val top = faceCorners[face.ordinal].topLeft.first
val left = faceCorners[face.ordinal].topLeft.second

View File

@@ -228,6 +228,15 @@ class ConfigPropertyInt(val min: Int, val max: Int, val default: Int) :
override fun Property.write(value: Int) = property!!.set(value)
}
/** [Long]-typed property delegate. Still uses [Int] internally */
class ConfigPropertyLong(val min: Int, val max: Int, val default: Int) :
ConfigPropertyDelegate<Long>() {
override fun resolve(target: Configuration, category: String, name: String) =
target.get(category, name, default, null).apply { setMinValue(min); setMaxValue(max) }
override fun Property.read() = property!!.long
override fun Property.write(value: Long) = property!!.set(value)
}
/** [Boolean]-typed property delegate. */
class ConfigPropertyBoolean(val default: Boolean) :
ConfigPropertyDelegate<Boolean>() {
@@ -252,5 +261,6 @@ class ConfigPropertyIntList(val defaults: ()->Array<Int>) :
fun double(min: Double = 0.0, max: Double = 1.0, default: Double) = ConfigPropertyDouble(min, max, default)
fun float(min: Double = 0.0, max: Double = 1.0, default: Double) = ConfigPropertyFloat(min, max, default)
fun int(min: Int = 0, max: Int, default: Int) = ConfigPropertyInt(min, max, default)
fun long(min: Int = 0, max: Int, default: Int) = ConfigPropertyLong(min, max, default)
fun intList(defaults: ()->Array<Int>) = ConfigPropertyIntList(defaults)
fun boolean(default: Boolean) = ConfigPropertyBoolean(default)