Update the fabric zoom mixin to avoid compatibility issues
This commit is contained in:
parent
f495ff1f4e
commit
56255825e2
|
@ -1,20 +1,19 @@
|
||||||
package fr.username404.snowygui.mixins;
|
package fr.username404.snowygui.mixins;
|
||||||
|
|
||||||
import fr.username404.snowygui.gui.feature.Zoom;
|
import fr.username404.snowygui.gui.feature.Zoom;
|
||||||
import net.minecraft.client.Options;
|
import net.minecraft.client.Camera;
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
import org.objectweb.asm.Opcodes;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@Mixin(GameRenderer.class)
|
@Mixin(GameRenderer.class)
|
||||||
abstract class ZoomMixin {
|
abstract class ZoomMixin {
|
||||||
@Redirect(
|
@Inject(at = @At(value = "RETURN"), method = "getFov(Lnet/minecraft/client/Camera;FZ)D", cancellable = true)
|
||||||
at = @At(value = "FIELD", target = "Lnet/minecraft/client/Options;fov:D", opcode = Opcodes.GETFIELD, ordinal = 0),
|
private void getFov(Camera camera, float f, boolean bl, CallbackInfoReturnable<Double> cir) {
|
||||||
method = "getFov(Lnet/minecraft/client/Camera;FZ)D"
|
if (Zoom.INSTANCE.getToggled()) {
|
||||||
)
|
cir.setReturnValue(Zoom.getNewZoom(cir.getReturnValue()));
|
||||||
private double getFov(Options options) {
|
}
|
||||||
return Zoom.INSTANCE.getToggled() ? Zoom.getNewZoom(options.fov) : options.fov;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue