优化飞行器鼠标反转

This commit is contained in:
Atsuishio 2025-05-14 12:41:39 +08:00 committed by Light_Quanta
parent e8950a1680
commit 96d59f1288
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -2,8 +2,7 @@ package com.atsuishio.superbwarfare.event;
import com.atsuishio.superbwarfare.client.MouseMovementHandler; import com.atsuishio.superbwarfare.client.MouseMovementHandler;
import com.atsuishio.superbwarfare.config.client.VehicleControlConfig; import com.atsuishio.superbwarfare.config.client.VehicleControlConfig;
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity; import com.atsuishio.superbwarfare.entity.vehicle.base.AirEntity;
import com.atsuishio.superbwarfare.entity.vehicle.Tom6Entity;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModMobEffects; import com.atsuishio.superbwarfare.init.ModMobEffects;
@ -99,13 +98,11 @@ public class ClientMouseHandler {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
Player player = mc.player; Player player = mc.player;
// 反转鼠标
if (player == null) return 1; if (player == null) return 1;
if (player.getVehicle() instanceof Ah6Entity ah6Entity && ah6Entity.getFirstPassenger() == player) { if (player.getVehicle() instanceof VehicleEntity vehicle && vehicle instanceof AirEntity && vehicle.getFirstPassenger() == player) {
return VehicleControlConfig.INVERT_AIRCRAFT_CONTROL.get() ? -1 : 1;
}
if (player.getVehicle() instanceof Tom6Entity tom6 && tom6.getFirstPassenger() == player) {
return VehicleControlConfig.INVERT_AIRCRAFT_CONTROL.get() ? -1 : 1; return VehicleControlConfig.INVERT_AIRCRAFT_CONTROL.get() ? -1 : 1;
} }
return 1; return 1;