Search in sources :

Example 1 with BlockBoatChair

use of org.valkyrienskies.mod.common.block.BlockBoatChair in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class TileEntityBoatChair method processControlMessage.

@Override
public void processControlMessage(PilotControlsMessage message, EntityPlayerMP sender) {
    final IBlockState state = getWorld().getBlockState(getPos());
    final double pilotYaw = ((BlockBoatChair) state.getBlock()).getChairYaw(state);
    // Linear velocity
    final Vector3d newTargetLinearVelocity = new Vector3d();
    if (message.airshipForward_KeyDown) {
        newTargetLinearVelocity.x += MAX_LINEAR_VELOCITY;
    }
    if (message.airshipBackward_KeyDown) {
        newTargetLinearVelocity.x -= MAX_LINEAR_VELOCITY;
    }
    if (message.airshipSprinting) {
        newTargetLinearVelocity.mul(2);
    }
    newTargetLinearVelocity.rotateAxis(Math.toRadians(pilotYaw), 0, 1, 0);
    // Angular velocity
    final Vector3d newTargetAngularVelocity = new Vector3d();
    if (message.airshipLeft_KeyDown) {
        newTargetAngularVelocity.y += MAX_ANGULAR_VELOCITY;
    }
    if (message.airshipRight_KeyDown) {
        newTargetAngularVelocity.y -= MAX_ANGULAR_VELOCITY;
    }
    // Update the target velocities
    targetLinearVelocity = newTargetLinearVelocity;
    targetAngularVelocity = newTargetAngularVelocity;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) Vector3d(org.joml.Vector3d) BlockBoatChair(org.valkyrienskies.mod.common.block.BlockBoatChair)

Aggregations

IBlockState (net.minecraft.block.state.IBlockState)1 Vector3d (org.joml.Vector3d)1 BlockBoatChair (org.valkyrienskies.mod.common.block.BlockBoatChair)1