Search in sources :

Example 1 with MessagePlayerStoppedPiloting

use of org.valkyrienskies.mod.common.network.MessagePlayerStoppedPiloting in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class VSKeyHandler method playerTick.

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void playerTick(PlayerTickEvent event) {
    if (event.side == Side.SERVER) {
        return;
    }
    if (event.phase == Phase.START) {
        IShipPilotClient clientPilot = (IShipPilotClient) event.player;
        clientPilot.onClientTick();
        if (dismountKey.isKeyDown() && clientPilot.isPilotingATile()) {
            BlockPos pilotedPos = clientPilot.getPosBeingControlled();
            MessagePlayerStoppedPiloting stopPilotingMessage = new MessagePlayerStoppedPiloting(pilotedPos);
            ValkyrienSkiesMod.controlNetwork.sendToServer(stopPilotingMessage);
            clientPilot.stopPilotingEverything();
        }
        if (dismountKey.isKeyDown() && clientPilot.getShipIDBeingControlled() != null) {
            MessagePlayerStoppedPiloting stopPilotingMessage = new MessagePlayerStoppedPiloting(clientPilot.getShipIDBeingControlled());
            ValkyrienSkiesMod.controlNetwork.sendToServer(stopPilotingMessage);
            clientPilot.stopPilotingEverything();
        }
    }
}
Also used : IShipPilotClient(org.valkyrienskies.mod.common.piloting.IShipPilotClient) BlockPos(net.minecraft.util.math.BlockPos) MessagePlayerStoppedPiloting(org.valkyrienskies.mod.common.network.MessagePlayerStoppedPiloting) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

BlockPos (net.minecraft.util.math.BlockPos)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1 MessagePlayerStoppedPiloting (org.valkyrienskies.mod.common.network.MessagePlayerStoppedPiloting)1 IShipPilotClient (org.valkyrienskies.mod.common.piloting.IShipPilotClient)1