55import com .xtracr .realcamera .config .ConfigFile ;
66import com .xtracr .realcamera .mixin .accessor .CameraAccessor ;
77import net .minecraft .client .Camera ;
8+ import net .minecraft .world .entity .player .Player ;
89
910import java .lang .reflect .Field ;
1011import java .lang .reflect .Method ;
@@ -16,6 +17,7 @@ public class CompatibilityHelper {
1617 private static Field NEA_NEAnimationsLoader_playerTransformer ;
1718 private static Class <?> SW_ClientEventHandler ;
1819 private static Field SW_ClientEventHandler_zoomTime ;
20+ private static Class <?> SBW_VehicleEntity ;
1921
2022 public static void initialize (PlatformHelper platformHelper ) {
2123 CompatibilityHelper .platformHelper = platformHelper ;
@@ -46,7 +48,9 @@ public static void initialize(PlatformHelper platformHelper) {
4648 if (isModLoaded ("superbwarfare" )) try {
4749 SW_ClientEventHandler = Class .forName ("com.atsuishio.superbwarfare.event.ClientEventHandler" );
4850 SW_ClientEventHandler_zoomTime = SW_ClientEventHandler .getDeclaredField ("zoomTime" );
51+ SBW_VehicleEntity = Class .forName ("com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity" );
4952 DisableHelper .MAIN_FEATURE .registerOrInBinding (player -> CompatibilityHelper .SW_gunsIsZooming ());
53+ DisableHelper .MAIN_FEATURE .registerOrInBinding (CompatibilityHelper ::SBW_isDrivingVehicle );
5054 } catch (Exception e ) {
5155 RealCamera .LOGGER .warn ("SuperbWarfare is not loaded correctly: [{}] {}" , e .getClass ().getName (), e .getMessage ());
5256 }
@@ -62,6 +66,16 @@ private static boolean SW_gunsIsZooming(){
6266 }
6367 }
6468
69+ private static boolean SBW_isDrivingVehicle (Player player ) {
70+ try {
71+ if (SBW_VehicleEntity .isAssignableFrom (player .getVehicle ().getClass ())) return true ;
72+ return false ;
73+ } catch (Exception e ) {
74+ RealCamera .LOGGER .error ("Failed to access SuperbWarfare's isAssignableFrom method" , e );
75+ return false ;
76+ }
77+ }
78+
6579 public static void NEA_setDeltaTick (float deltaTick ) {
6680 if (NEA_playerTransformer_setDeltaTick != null ) try {
6781 Object INSTANCE = NEA_NEAnimationsLoader_INSTANCE .get (null );
0 commit comments