Merge pull request #3290 from Zergatul/camera-mixin-compat

CameraMixin change for compatibility
This commit is contained in:
simibubi 2022-08-01 15:55:03 +02:00 committed by GitHub
commit bad16edaec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.simibubi.create.content.logistics.trains.CameraDistanceModifier; import com.simibubi.create.content.logistics.trains.CameraDistanceModifier;
@ -26,15 +27,13 @@ public abstract class CameraMixin {
throw new AssertionError(); throw new AssertionError();
} }
@Inject( @ModifyArg(
method = "Lnet/minecraft/client/Camera;setup(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/world/entity/Entity;ZZF)V", method = "Lnet/minecraft/client/Camera;setup(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/world/entity/Entity;ZZF)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Camera;move(DDD)V", ordinal = 0), at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Camera;move(DDD)V", ordinal = 0),
cancellable = true index = 0
) )
public void modifySetup(BlockGetter pLevel, Entity pEntity, boolean pDetached, boolean pThirdPersonReverse, float pPartialTick, CallbackInfo ci) { public double modifyCameraOffset(double originalValue) {
move(-this.getMaxZoom(4.0D * CameraDistanceModifier.getMultiplier(AnimationTickHolder.getPartialTicks())), 0, 0); return -this.getMaxZoom(4.0D * CameraDistanceModifier.getMultiplier(AnimationTickHolder.getPartialTicks()));
ci.cancel();
} }
} }