Use a mixin for the gamma boost feature
Fixes it being reset by the graphics settings screen, and doesn't need to modify the option Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
6b113b7750
commit
a30fda1262
@ -0,0 +1,23 @@
|
|||||||
|
package fr.username404.snowygui.mixins;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
|
import fr.username404.snowygui.gui.feature.GammaBoost;
|
||||||
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
@Mixin(LightTexture.class)
|
||||||
|
abstract class GammaMixin {
|
||||||
|
@ModifyExpressionValue(
|
||||||
|
method = "updateLightTexture(F)V", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Ljava/lang/Double;floatValue()F",
|
||||||
|
ordinal = 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
public float highGamma(float original) {
|
||||||
|
if (GammaBoost.INSTANCE.getToggled())
|
||||||
|
return GammaBoost.BOOST;
|
||||||
|
return original;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,19 +1,6 @@
|
|||||||
package fr.username404.snowygui.gui.feature
|
package fr.username404.snowygui.gui.feature
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft
|
|
||||||
|
|
||||||
@ButtonInfo(Category.MISC)
|
@ButtonInfo(Category.MISC)
|
||||||
object GammaBoost: ButtonImpl() {
|
object GammaBoost: ButtonImpl() {
|
||||||
private const val boost = 1400.0
|
const val BOOST = 1400.0F
|
||||||
private var oldGamma = 0.0
|
|
||||||
override fun execAction() {
|
|
||||||
with(Minecraft.getInstance().options) {
|
|
||||||
val gamma = gamma().get()
|
|
||||||
gamma().value =
|
|
||||||
if (toggled) {
|
|
||||||
if (gamma < boost) oldGamma = gamma
|
|
||||||
boost
|
|
||||||
} else oldGamma
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -2,7 +2,9 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"package": "fr.username404.snowygui.mixins",
|
"package": "fr.username404.snowygui.mixins",
|
||||||
"compatibilityLevel": "JAVA_18",
|
"compatibilityLevel": "JAVA_18",
|
||||||
"client": [],
|
"client": [
|
||||||
|
"GammaMixin"
|
||||||
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user