Search in sources :

Example 1 with ControllerInputType

use of org.valkyrienskies.mod.common.piloting.ControllerInputType in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class MixinMovementInputFromOptions method preUpdatePlayerMoveState.

@Inject(method = "updatePlayerMoveState", at = @At("HEAD"), cancellable = true)
public void preUpdatePlayerMoveState(CallbackInfo callbackInfo) {
    IShipPilot pilot = (IShipPilot) Minecraft.getMinecraft().player;
    if (pilot != null) {
        ControllerInputType inputTypeEnum = pilot.getControllerInputEnum();
        if (inputTypeEnum != null) {
            if (inputTypeEnum.shouldLockPlayerMovement()) {
                // Then don't let the player move anymore while it's piloting this bastard
                zeroAllPlayerMovements();
                callbackInfo.cancel();
            }
        }
    }
}
Also used : IShipPilot(org.valkyrienskies.mod.common.piloting.IShipPilot) ControllerInputType(org.valkyrienskies.mod.common.piloting.ControllerInputType) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

Inject (org.spongepowered.asm.mixin.injection.Inject)1 ControllerInputType (org.valkyrienskies.mod.common.piloting.ControllerInputType)1 IShipPilot (org.valkyrienskies.mod.common.piloting.IShipPilot)1