mirror of
https://codeberg.org/moonleay/Gimbal.git
synced 2025-04-04 11:44:13 +02:00
21 lines
825 B
Java
21 lines
825 B
Java
package net.moonleay.gimble.mixin;
|
|
|
|
import net.minecraft.client.render.Camera;
|
|
import net.moonleay.gimble.client.editor.ClientEditor;
|
|
import net.moonleay.gimble.editor.state.mode.ModeModifier;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
import org.spongepowered.asm.mixin.injection.Inject;
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
|
|
@Mixin(Camera.class)
|
|
public class NoClipCameraFixMixin {
|
|
|
|
@Inject(method = "clipToSpace", at = @At("HEAD"), cancellable = true)
|
|
private void fixCameraInNoClip(double desiredCameraDistance, CallbackInfoReturnable<Double> cir) {
|
|
if (ClientEditor.INSTANCE.containsModifier(ModeModifier.NO_CLIP)){
|
|
cir.setReturnValue(desiredCameraDistance);
|
|
cir.cancel();
|
|
}
|
|
}
|
|
}
|