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;
}
Aggregations